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