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