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, 12 May 2022 15:08:51
Message-Id: 1652368093.6d94c4ca979ae245583bb19c48ae7cbcd76f7670.williamh@gentoo
1 commit: 6d94c4ca979ae245583bb19c48ae7cbcd76f7670
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Thu May 12 14:46:27 2022 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Thu May 12 15:08:13 2022 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d94c4ca
7
8 dev-lang/go: add 1.17.10, 1.18.2
9
10 Bug: https://bugs.gentoo.org/843644
11 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
12
13 dev-lang/go/Manifest | 2 +
14 dev-lang/go/go-1.17.10.ebuild | 196 ++++++++++++++++++++++++++++++++++++++++++
15 dev-lang/go/go-1.18.2.ebuild | 196 ++++++++++++++++++++++++++++++++++++++++++
16 3 files changed, 394 insertions(+)
17
18 diff --git a/dev-lang/go/Manifest b/dev-lang/go/Manifest
19 index 0aee55ec2931..be368e2a2c8e 100644
20 --- a/dev-lang/go/Manifest
21 +++ b/dev-lang/go/Manifest
22 @@ -1,3 +1,5 @@
23 +DIST go1.17.10.src.tar.gz 22196380 BLAKE2B 548d54aa27aca78b6a5b6338a4496c7072c37a9bbcea78456d0851f562278a872fe63d102a3d68bc3c91266bf07f9f4fc0b903ba047bbf8a0e51d973b6ae2a49 SHA512 92aa95927ce244cab339dd7f2fb7e416605515d496e96618e6e45ecfa7b022ae3a178bf88338a7a9e9e1afea4c9ab5f9c35f5716409cddbab3542daefb6ba425
24 DIST go1.17.8.src.tar.gz 22199282 BLAKE2B 359089402c4f67b8102689a5772f6a168938c57fc3c809681f65f95725ce0a3b528d6cdfeff0da50844f5cfdb941d427658907c30597872315b1fd68a3a61be8 SHA512 21d5c51ce62bc3b987dd5bf7c6b7e1a934fe40582bfbbe99ca80c26d41253e796a4b9d02c571f1e5ab3fd7c3950175e23b9929b0d934f421c96a6d6128c44668
25 DIST go1.17.9.src.tar.gz 22200358 BLAKE2B 50c3870bf8bbce805b402b34afadd741e061fc29880a52a1d62d9f7c147a64500729412de4afd05ad7154b12c24c1ae801e734420d74e9f77fad0645cdd9963e SHA512 70c7a6b43531c445cce13963644cc766e5d167597452a1324eacb2ee95bdd9c860ef62f13261bfc4c6baae5773f8953ce6cda9fae21eb7ac0e90bae1ca044a02
26 DIST go1.18.1.src.tar.gz 22834149 BLAKE2B 0856d58b0ee83d09884d25861aeb3af89eac62306937744685ff8df8671a2c46eb75785bc88e32b93af41fe62488916ed2a4dda412bc26ac923196680acb2d3c SHA512 baa053e2d713b235b9285c946b4f0842085a5224d1f4cbe92a446fbf97ed9f7289c8d4ba212fb31dd2e4eac39bb4c015f478543a1856594c2d1fc331c946f571
27 +DIST go1.18.2.src.tar.gz 22837686 BLAKE2B 73bdbdcd7b78baacc123fbc9bb0ae603a5eb2b983192fafe7ccd35c79b526bd8f28979ba48a9fffce0a26dd1ba4d010968c01298671703b272bb0b009819b7e2 SHA512 9214cbc051cf26b49ab1bd4d8d30b060865944b831578a9ea7fcfe33f84009f77932a39f2948efbfc412b151e4734a3bc1f8332f3bea11b35a912b0e23a4118f
28
29 diff --git a/dev-lang/go/go-1.17.10.ebuild b/dev-lang/go/go-1.17.10.ebuild
30 new file mode 100644
31 index 000000000000..217891046702
32 --- /dev/null
33 +++ b/dev-lang/go/go-1.17.10.ebuild
34 @@ -0,0 +1,196 @@
35 +# Copyright 1999-2022 Gentoo Authors
36 +# Distributed under the terms of the GNU General Public License v2
37 +
38 +EAPI=7
39 +
40 +export CBUILD=${CBUILD:-${CHOST}}
41 +export CTARGET=${CTARGET:-${CHOST}}
42 +
43 +MY_PV=${PV/_/}
44 +
45 +inherit toolchain-funcs
46 +
47 +case ${PV} in
48 +*9999*)
49 + EGIT_REPO_URI="https://github.com/golang/go.git"
50 + inherit git-r3
51 + ;;
52 +*)
53 + SRC_URI="https://storage.googleapis.com/golang/go${MY_PV}.src.tar.gz "
54 + S="${WORKDIR}"/go
55 + case ${PV} in
56 + *_beta*|*_rc*) ;;
57 + *)
58 + KEYWORDS="-* ~amd64 ~arm ~arm64 ~ppc64 ~riscv ~s390 ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
59 + ;;
60 + esac
61 +esac
62 +
63 +DESCRIPTION="A concurrent garbage collected and typesafe programming language"
64 +HOMEPAGE="https://go.dev"
65 +
66 +LICENSE="BSD"
67 +SLOT="0/${PV}"
68 +IUSE="cpu_flags_x86_sse2"
69 +
70 +BDEPEND="|| (
71 + dev-lang/go
72 + dev-lang/go-bootstrap )"
73 +
74 +# the *.syso files have writable/executable stacks
75 +QA_EXECSTACK='*.syso'
76 +
77 +# Do not complain about CFLAGS, etc, since Go doesn't use them.
78 +QA_FLAGS_IGNORED='.*'
79 +
80 +# The tools in /usr/lib/go should not cause the multilib-strict check to fail.
81 +QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*"
82 +
83 +# This package triggers "unrecognized elf file(s)" notices on riscv.
84 +# https://bugs.gentoo.org/794046
85 +QA_PREBUILT='.*'
86 +
87 +# Do not strip this package. Stripping is unsupported upstream and may
88 +# fail.
89 +RESTRICT+=" strip"
90 +
91 +DOCS=(
92 +AUTHORS
93 +CONTRIBUTING.md
94 +CONTRIBUTORS
95 +PATENTS
96 +README.md
97 +)
98 +
99 +go_arch() {
100 + # By chance most portage arch names match Go
101 + local portage_arch=$(tc-arch $@)
102 + case "${portage_arch}" in
103 + x86) echo 386;;
104 + x64-*) echo amd64;;
105 + ppc64) [[ $(tc-endian $@) = big ]] && echo ppc64 || echo ppc64le ;;
106 + riscv) echo riscv64 ;;
107 + s390) echo s390x ;;
108 + *) echo "${portage_arch}";;
109 + esac
110 +}
111 +
112 +go_arm() {
113 + case "${1:-${CHOST}}" in
114 + armv5*) echo 5;;
115 + armv6*) echo 6;;
116 + armv7*) echo 7;;
117 + *)
118 + die "unknown GOARM for ${1:-${CHOST}}"
119 + ;;
120 + esac
121 +}
122 +
123 +go_os() {
124 + case "${1:-${CHOST}}" in
125 + *-linux*) echo linux;;
126 + *-darwin*) echo darwin;;
127 + *-freebsd*) echo freebsd;;
128 + *-netbsd*) echo netbsd;;
129 + *-openbsd*) echo openbsd;;
130 + *-solaris*) echo solaris;;
131 + *-cygwin*|*-interix*|*-winnt*)
132 + echo windows
133 + ;;
134 + *)
135 + die "unknown GOOS for ${1:-${CHOST}}"
136 + ;;
137 + esac
138 +}
139 +
140 +go_tuple() {
141 + echo "$(go_os $@)_$(go_arch $@)"
142 +}
143 +
144 +go_cross_compile() {
145 + [[ $(go_tuple ${CBUILD}) != $(go_tuple) ]]
146 +}
147 +
148 +src_compile() {
149 + if has_version -b dev-lang/go; then
150 + export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go"
151 + elif has_version -b dev-lang/go-bootstrap; then
152 + export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go-bootstrap"
153 + else
154 + eerror "Go cannot be built without go or go-bootstrap installed"
155 + die "Should not be here, please report a bug"
156 + fi
157 +
158 + export GOROOT_FINAL="${EPREFIX}"/usr/lib/go
159 + export GOROOT="${PWD}"
160 + export GOBIN="${GOROOT}/bin"
161 +
162 + # Go's build script does not use BUILD/HOST/TARGET consistently. :(
163 + export GOHOSTARCH=$(go_arch ${CBUILD})
164 + export GOHOSTOS=$(go_os ${CBUILD})
165 + export CC=$(tc-getBUILD_CC)
166 +
167 + export GOARCH=$(go_arch)
168 + export GOOS=$(go_os)
169 + export CC_FOR_TARGET=$(tc-getCC)
170 + export CXX_FOR_TARGET=$(tc-getCXX)
171 + use arm && export GOARM=$(go_arm)
172 + use x86 && export GO386=$(usex cpu_flags_x86_sse2 '' 'softfloat')
173 +
174 + cd src
175 + bash -x ./make.bash || die "build failed"
176 +}
177 +
178 +src_test() {
179 + go_cross_compile && return 0
180 +
181 + cd src
182 + PATH="${GOBIN}:${PATH}" \
183 + ./run.bash -no-rebuild || die "tests failed"
184 + cd ..
185 + rm -fr pkg/*_race || die
186 + rm -fr pkg/obj/go-build || die
187 +}
188 +
189 +src_install() {
190 + # There is a known issue which requires the source tree to be installed [1].
191 + # Once this is fixed, we can consider using the doc use flag to control
192 + # installing the doc and src directories.
193 + # The use of cp is deliberate in order to retain permissions
194 + # [1] https://golang.org/issue/2775
195 + dodir /usr/lib/go
196 + cp -R api bin doc lib pkg misc src test "${ED}"/usr/lib/go
197 + einstalldocs
198 +
199 + # testdata directories are not needed on the installed system
200 + rm -fr $(find "${ED}"/usr/lib/go -iname testdata -type d -print)
201 +
202 + local bin_path
203 + if go_cross_compile; then
204 + bin_path="bin/$(go_tuple)"
205 + else
206 + bin_path=bin
207 + fi
208 + local f x
209 + for x in ${bin_path}/*; do
210 + f=${x##*/}
211 + dosym ../lib/go/${bin_path}/${f} /usr/bin/${f}
212 + done
213 +
214 + # install the @golang-rebuild set for Portage
215 + insinto /usr/share/portage/config/sets
216 + newins "${FILESDIR}"/go-sets.conf go.conf
217 +}
218 +
219 +pkg_postinst() {
220 + [[ -z ${REPLACING_VERSIONS} ]] && return
221 + elog "After ${CATEGORY}/${PN} is updated it is recommended to rebuild"
222 + elog "all packages compiled with previous versions of ${CATEGORY}/${PN}"
223 + elog "due to the static linking nature of go."
224 + elog "If this is not done, the packages compiled with the older"
225 + elog "version of the compiler will not be updated until they are"
226 + elog "updated individually, which could mean they will have"
227 + elog "vulnerabilities."
228 + elog "Run 'emerge @golang-rebuild' to rebuild all 'go' packages"
229 + elog "See https://bugs.gentoo.org/752153 for more info"
230 +}
231
232 diff --git a/dev-lang/go/go-1.18.2.ebuild b/dev-lang/go/go-1.18.2.ebuild
233 new file mode 100644
234 index 000000000000..217891046702
235 --- /dev/null
236 +++ b/dev-lang/go/go-1.18.2.ebuild
237 @@ -0,0 +1,196 @@
238 +# Copyright 1999-2022 Gentoo Authors
239 +# Distributed under the terms of the GNU General Public License v2
240 +
241 +EAPI=7
242 +
243 +export CBUILD=${CBUILD:-${CHOST}}
244 +export CTARGET=${CTARGET:-${CHOST}}
245 +
246 +MY_PV=${PV/_/}
247 +
248 +inherit toolchain-funcs
249 +
250 +case ${PV} in
251 +*9999*)
252 + EGIT_REPO_URI="https://github.com/golang/go.git"
253 + inherit git-r3
254 + ;;
255 +*)
256 + SRC_URI="https://storage.googleapis.com/golang/go${MY_PV}.src.tar.gz "
257 + S="${WORKDIR}"/go
258 + case ${PV} in
259 + *_beta*|*_rc*) ;;
260 + *)
261 + KEYWORDS="-* ~amd64 ~arm ~arm64 ~ppc64 ~riscv ~s390 ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
262 + ;;
263 + esac
264 +esac
265 +
266 +DESCRIPTION="A concurrent garbage collected and typesafe programming language"
267 +HOMEPAGE="https://go.dev"
268 +
269 +LICENSE="BSD"
270 +SLOT="0/${PV}"
271 +IUSE="cpu_flags_x86_sse2"
272 +
273 +BDEPEND="|| (
274 + dev-lang/go
275 + dev-lang/go-bootstrap )"
276 +
277 +# the *.syso files have writable/executable stacks
278 +QA_EXECSTACK='*.syso'
279 +
280 +# Do not complain about CFLAGS, etc, since Go doesn't use them.
281 +QA_FLAGS_IGNORED='.*'
282 +
283 +# The tools in /usr/lib/go should not cause the multilib-strict check to fail.
284 +QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*"
285 +
286 +# This package triggers "unrecognized elf file(s)" notices on riscv.
287 +# https://bugs.gentoo.org/794046
288 +QA_PREBUILT='.*'
289 +
290 +# Do not strip this package. Stripping is unsupported upstream and may
291 +# fail.
292 +RESTRICT+=" strip"
293 +
294 +DOCS=(
295 +AUTHORS
296 +CONTRIBUTING.md
297 +CONTRIBUTORS
298 +PATENTS
299 +README.md
300 +)
301 +
302 +go_arch() {
303 + # By chance most portage arch names match Go
304 + local portage_arch=$(tc-arch $@)
305 + case "${portage_arch}" in
306 + x86) echo 386;;
307 + x64-*) echo amd64;;
308 + ppc64) [[ $(tc-endian $@) = big ]] && echo ppc64 || echo ppc64le ;;
309 + riscv) echo riscv64 ;;
310 + s390) echo s390x ;;
311 + *) echo "${portage_arch}";;
312 + esac
313 +}
314 +
315 +go_arm() {
316 + case "${1:-${CHOST}}" in
317 + armv5*) echo 5;;
318 + armv6*) echo 6;;
319 + armv7*) echo 7;;
320 + *)
321 + die "unknown GOARM for ${1:-${CHOST}}"
322 + ;;
323 + esac
324 +}
325 +
326 +go_os() {
327 + case "${1:-${CHOST}}" in
328 + *-linux*) echo linux;;
329 + *-darwin*) echo darwin;;
330 + *-freebsd*) echo freebsd;;
331 + *-netbsd*) echo netbsd;;
332 + *-openbsd*) echo openbsd;;
333 + *-solaris*) echo solaris;;
334 + *-cygwin*|*-interix*|*-winnt*)
335 + echo windows
336 + ;;
337 + *)
338 + die "unknown GOOS for ${1:-${CHOST}}"
339 + ;;
340 + esac
341 +}
342 +
343 +go_tuple() {
344 + echo "$(go_os $@)_$(go_arch $@)"
345 +}
346 +
347 +go_cross_compile() {
348 + [[ $(go_tuple ${CBUILD}) != $(go_tuple) ]]
349 +}
350 +
351 +src_compile() {
352 + if has_version -b dev-lang/go; then
353 + export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go"
354 + elif has_version -b dev-lang/go-bootstrap; then
355 + export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go-bootstrap"
356 + else
357 + eerror "Go cannot be built without go or go-bootstrap installed"
358 + die "Should not be here, please report a bug"
359 + fi
360 +
361 + export GOROOT_FINAL="${EPREFIX}"/usr/lib/go
362 + export GOROOT="${PWD}"
363 + export GOBIN="${GOROOT}/bin"
364 +
365 + # Go's build script does not use BUILD/HOST/TARGET consistently. :(
366 + export GOHOSTARCH=$(go_arch ${CBUILD})
367 + export GOHOSTOS=$(go_os ${CBUILD})
368 + export CC=$(tc-getBUILD_CC)
369 +
370 + export GOARCH=$(go_arch)
371 + export GOOS=$(go_os)
372 + export CC_FOR_TARGET=$(tc-getCC)
373 + export CXX_FOR_TARGET=$(tc-getCXX)
374 + use arm && export GOARM=$(go_arm)
375 + use x86 && export GO386=$(usex cpu_flags_x86_sse2 '' 'softfloat')
376 +
377 + cd src
378 + bash -x ./make.bash || die "build failed"
379 +}
380 +
381 +src_test() {
382 + go_cross_compile && return 0
383 +
384 + cd src
385 + PATH="${GOBIN}:${PATH}" \
386 + ./run.bash -no-rebuild || die "tests failed"
387 + cd ..
388 + rm -fr pkg/*_race || die
389 + rm -fr pkg/obj/go-build || die
390 +}
391 +
392 +src_install() {
393 + # There is a known issue which requires the source tree to be installed [1].
394 + # Once this is fixed, we can consider using the doc use flag to control
395 + # installing the doc and src directories.
396 + # The use of cp is deliberate in order to retain permissions
397 + # [1] https://golang.org/issue/2775
398 + dodir /usr/lib/go
399 + cp -R api bin doc lib pkg misc src test "${ED}"/usr/lib/go
400 + einstalldocs
401 +
402 + # testdata directories are not needed on the installed system
403 + rm -fr $(find "${ED}"/usr/lib/go -iname testdata -type d -print)
404 +
405 + local bin_path
406 + if go_cross_compile; then
407 + bin_path="bin/$(go_tuple)"
408 + else
409 + bin_path=bin
410 + fi
411 + local f x
412 + for x in ${bin_path}/*; do
413 + f=${x##*/}
414 + dosym ../lib/go/${bin_path}/${f} /usr/bin/${f}
415 + done
416 +
417 + # install the @golang-rebuild set for Portage
418 + insinto /usr/share/portage/config/sets
419 + newins "${FILESDIR}"/go-sets.conf go.conf
420 +}
421 +
422 +pkg_postinst() {
423 + [[ -z ${REPLACING_VERSIONS} ]] && return
424 + elog "After ${CATEGORY}/${PN} is updated it is recommended to rebuild"
425 + elog "all packages compiled with previous versions of ${CATEGORY}/${PN}"
426 + elog "due to the static linking nature of go."
427 + elog "If this is not done, the packages compiled with the older"
428 + elog "version of the compiler will not be updated until they are"
429 + elog "updated individually, which could mean they will have"
430 + elog "vulnerabilities."
431 + elog "Run 'emerge @golang-rebuild' to rebuild all 'go' packages"
432 + elog "See https://bugs.gentoo.org/752153 for more info"
433 +}