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