Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/go/
Date: Thu, 09 Sep 2021 18:35:54
Message-Id: 1631212543.293765445d24c6dc94c618b207a401369cb12047.williamh@gentoo
1 commit: 293765445d24c6dc94c618b207a401369cb12047
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Thu Sep 9 18:35:25 2021 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Thu Sep 9 18:35:43 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=29376544
7
8 dev-lang/go: 1.17.1 bump
9
10 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
11
12 dev-lang/go/Manifest | 1 +
13 dev-lang/go/go-1.17.1.ebuild | 197 +++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 198 insertions(+)
15
16 diff --git a/dev-lang/go/Manifest b/dev-lang/go/Manifest
17 index d05cdde1523..cb5cbd90fb2 100644
18 --- a/dev-lang/go/Manifest
19 +++ b/dev-lang/go/Manifest
20 @@ -1 +1,2 @@
21 +DIST go1.17.1.src.tar.gz 22181735 BLAKE2B 77ce952e14c101776935c625aa39596a6b8923ca5ac264c72ed08a578f08fbbbc1825315a5dd84f9fa1412aaa7400b31e73117d5919aeb527c084173d8e11504 SHA512 23d4e003651204c5bcc5cf41437134e07a3fe3c188eb129f2d6366a7445a7919d6a7319c57483e91b3415fd28aa55df8d58eec398434f20ce6accd587925a14b
22 DIST go1.17.src.tar.gz 22178549 BLAKE2B 86cb84ff782eaee3fc0411b1f31cd985f3fdcda7b2709f3a94cba0fbe827ac13632d0476e1f67deaf06d2352c2ea3ac9217db7d170702dffff6a64beabdb0814 SHA512 bb94d69555faa103bc092ce85b73168954a553a5c72e4b38c39bd99a3eb4db679f352685e66507b0945ed12676eb2a0c51674e456f68a9a5b98c3ec6a948d35b
23
24 diff --git a/dev-lang/go/go-1.17.1.ebuild b/dev-lang/go/go-1.17.1.ebuild
25 new file mode 100644
26 index 00000000000..9fe46e9a804
27 --- /dev/null
28 +++ b/dev-lang/go/go-1.17.1.ebuild
29 @@ -0,0 +1,197 @@
30 +# Copyright 1999-2021 Gentoo Authors
31 +# Distributed under the terms of the GNU General Public License v2
32 +
33 +EAPI=7
34 +
35 +export CBUILD=${CBUILD:-${CHOST}}
36 +export CTARGET=${CTARGET:-${CHOST}}
37 +
38 +MY_PV=${PV/_/}
39 +
40 +inherit toolchain-funcs
41 +
42 +case ${PV} in
43 +*9999*)
44 + EGIT_REPO_URI="https://github.com/golang/go.git"
45 + inherit git-r3
46 + ;;
47 +*)
48 + SRC_URI="https://storage.googleapis.com/golang/go${MY_PV}.src.tar.gz "
49 + S="${WORKDIR}"/go
50 + case ${PV} in
51 + *_beta*|*_rc*) ;;
52 + *)
53 + KEYWORDS="-* ~amd64 ~arm ~arm64 ~ppc64 ~riscv ~s390 ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
54 + ;;
55 + esac
56 +esac
57 +
58 +DESCRIPTION="A concurrent garbage collected and typesafe programming language"
59 +HOMEPAGE="https://golang.org"
60 +
61 +LICENSE="BSD"
62 +SLOT="0/${PV}"
63 +IUSE="cpu_flags_x86_sse2"
64 +
65 +BDEPEND="|| (
66 + dev-lang/go
67 + dev-lang/go-bootstrap )"
68 +RDEPEND="!<dev-go/go-tools-0_pre20150902"
69 +
70 +# the *.syso files have writable/executable stacks
71 +QA_EXECSTACK='*.syso'
72 +
73 +# Do not complain about CFLAGS, etc, since Go doesn't use them.
74 +QA_FLAGS_IGNORED='.*'
75 +
76 +# The tools in /usr/lib/go should not cause the multilib-strict check to fail.
77 +QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*"
78 +
79 +# This package triggers "unrecognized elf file(s)" notices on riscv.
80 +# https://bugs.gentoo.org/794046
81 +QA_PREBUILT='.*'
82 +
83 +# Do not strip this package. Stripping is unsupported upstream and may
84 +# fail.
85 +RESTRICT+=" strip"
86 +
87 +DOCS=(
88 +AUTHORS
89 +CONTRIBUTING.md
90 +CONTRIBUTORS
91 +PATENTS
92 +README.md
93 +)
94 +
95 +go_arch() {
96 + # By chance most portage arch names match Go
97 + local portage_arch=$(tc-arch $@)
98 + case "${portage_arch}" in
99 + x86) echo 386;;
100 + x64-*) echo amd64;;
101 + ppc64) [[ $(tc-endian $@) = big ]] && echo ppc64 || echo ppc64le ;;
102 + riscv) echo riscv64 ;;
103 + s390) echo s390x ;;
104 + *) echo "${portage_arch}";;
105 + esac
106 +}
107 +
108 +go_arm() {
109 + case "${1:-${CHOST}}" in
110 + armv5*) echo 5;;
111 + armv6*) echo 6;;
112 + armv7*) echo 7;;
113 + *)
114 + die "unknown GOARM for ${1:-${CHOST}}"
115 + ;;
116 + esac
117 +}
118 +
119 +go_os() {
120 + case "${1:-${CHOST}}" in
121 + *-linux*) echo linux;;
122 + *-darwin*) echo darwin;;
123 + *-freebsd*) echo freebsd;;
124 + *-netbsd*) echo netbsd;;
125 + *-openbsd*) echo openbsd;;
126 + *-solaris*) echo solaris;;
127 + *-cygwin*|*-interix*|*-winnt*)
128 + echo windows
129 + ;;
130 + *)
131 + die "unknown GOOS for ${1:-${CHOST}}"
132 + ;;
133 + esac
134 +}
135 +
136 +go_tuple() {
137 + echo "$(go_os $@)_$(go_arch $@)"
138 +}
139 +
140 +go_cross_compile() {
141 + [[ $(go_tuple ${CBUILD}) != $(go_tuple) ]]
142 +}
143 +
144 +src_compile() {
145 + if has_version -b dev-lang/go; then
146 + export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go"
147 + elif has_version -b dev-lang/go-bootstrap; then
148 + export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go-bootstrap"
149 + else
150 + eerror "Go cannot be built without go or go-bootstrap installed"
151 + die "Should not be here, please report a bug"
152 + fi
153 +
154 + export GOROOT_FINAL="${EPREFIX}"/usr/lib/go
155 + export GOROOT="${PWD}"
156 + export GOBIN="${GOROOT}/bin"
157 +
158 + # Go's build script does not use BUILD/HOST/TARGET consistently. :(
159 + export GOHOSTARCH=$(go_arch ${CBUILD})
160 + export GOHOSTOS=$(go_os ${CBUILD})
161 + export CC=$(tc-getBUILD_CC)
162 +
163 + export GOARCH=$(go_arch)
164 + export GOOS=$(go_os)
165 + export CC_FOR_TARGET=$(tc-getCC)
166 + export CXX_FOR_TARGET=$(tc-getCXX)
167 + use arm && export GOARM=$(go_arm)
168 + use x86 && export GO386=$(usex cpu_flags_x86_sse2 '' 'softfloat')
169 +
170 + cd src
171 + bash -x ./make.bash || die "build failed"
172 +}
173 +
174 +src_test() {
175 + go_cross_compile && return 0
176 +
177 + cd src
178 + PATH="${GOBIN}:${PATH}" \
179 + ./run.bash -no-rebuild || die "tests failed"
180 + cd ..
181 + rm -fr pkg/*_race || die
182 + rm -fr pkg/obj/go-build || die
183 +}
184 +
185 +src_install() {
186 + # There is a known issue which requires the source tree to be installed [1].
187 + # Once this is fixed, we can consider using the doc use flag to control
188 + # installing the doc and src directories.
189 + # The use of cp is deliberate in order to retain permissions
190 + # [1] https://golang.org/issue/2775
191 + dodir /usr/lib/go
192 + cp -R api bin doc lib pkg misc src test "${ED}"/usr/lib/go
193 + einstalldocs
194 +
195 + # testdata directories are not needed on the installed system
196 + rm -fr $(find "${ED}"/usr/lib/go -iname testdata -type d -print)
197 +
198 + local bin_path
199 + if go_cross_compile; then
200 + bin_path="bin/$(go_tuple)"
201 + else
202 + bin_path=bin
203 + fi
204 + local f x
205 + for x in ${bin_path}/*; do
206 + f=${x##*/}
207 + dosym ../lib/go/${bin_path}/${f} /usr/bin/${f}
208 + done
209 +
210 + # install the @golang-rebuild set for Portage
211 + insinto /usr/share/portage/config/sets
212 + newins "${FILESDIR}"/go-sets.conf go.conf
213 +}
214 +
215 +pkg_postinst() {
216 + [[ -z ${REPLACING_VERSIONS} ]] && return
217 + einfo "After ${CATEGORY}/${PN} is updated it is recommended to rebuild"
218 + einfo "all packages compiled with previous versions of ${CATEGORY}/${PN}"
219 + einfo "due to the static linking nature of go."
220 + einfo "If this is not done, the packages compiled with the older"
221 + einfo "version of the compiler will not be updated until they are"
222 + einfo "updated individually, which could mean they will have"
223 + einfo "vulnerabilities."
224 + einfo "Run 'emerge @golang-rebuild' to rebuild all 'go' packages"
225 + einfo "See https://bugs.gentoo.org/752153 for more info"
226 +}