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