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, 12 Oct 2021 21:40:29
Message-Id: 1634074816.19335011ed7ba62e12ca1fa94fb0da3a28e1160e.williamh@gentoo
1 commit: 19335011ed7ba62e12ca1fa94fb0da3a28e1160e
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Tue Oct 12 21:39:36 2021 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Tue Oct 12 21:40:16 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=19335011
7
8 dev-lang/go: 1.17.2 bump
9
10 Bug: https://bugs.gentoo.org/816912
11 Package-Manager: Portage-3.0.20, Repoman-3.0.3
12 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
13
14 dev-lang/go/Manifest | 1 +
15 dev-lang/go/go-1.17.2.ebuild | 197 +++++++++++++++++++++++++++++++++++++++++++
16 2 files changed, 198 insertions(+)
17
18 diff --git a/dev-lang/go/Manifest b/dev-lang/go/Manifest
19 index cb5cbd90fb2..53ffb334ccf 100644
20 --- a/dev-lang/go/Manifest
21 +++ b/dev-lang/go/Manifest
22 @@ -1,2 +1,3 @@
23 DIST go1.17.1.src.tar.gz 22181735 BLAKE2B 77ce952e14c101776935c625aa39596a6b8923ca5ac264c72ed08a578f08fbbbc1825315a5dd84f9fa1412aaa7400b31e73117d5919aeb527c084173d8e11504 SHA512 23d4e003651204c5bcc5cf41437134e07a3fe3c188eb129f2d6366a7445a7919d6a7319c57483e91b3415fd28aa55df8d58eec398434f20ce6accd587925a14b
24 +DIST go1.17.2.src.tar.gz 22182111 BLAKE2B 83b665af212f3e20dc9c9f4bd80ac0e1e4acb8ba6653835f6a8b990a5d6074a25ba78b783f7a4f9402b3f1916a65ddba4ad9780e4eae871719cff13f7bb9c980 SHA512 167220293e02d6994b5cdee5909cbdbe66f692619baeb6ff9ee0d56660eb39cfd9eac2ac510f113d5222dadd5858fd6276bd961365ca42b42c07af5d24d48107
25 DIST go1.17.src.tar.gz 22178549 BLAKE2B 86cb84ff782eaee3fc0411b1f31cd985f3fdcda7b2709f3a94cba0fbe827ac13632d0476e1f67deaf06d2352c2ea3ac9217db7d170702dffff6a64beabdb0814 SHA512 bb94d69555faa103bc092ce85b73168954a553a5c72e4b38c39bd99a3eb4db679f352685e66507b0945ed12676eb2a0c51674e456f68a9a5b98c3ec6a948d35b
26
27 diff --git a/dev-lang/go/go-1.17.2.ebuild b/dev-lang/go/go-1.17.2.ebuild
28 new file mode 100644
29 index 00000000000..65ea8818bf9
30 --- /dev/null
31 +++ b/dev-lang/go/go-1.17.2.ebuild
32 @@ -0,0 +1,197 @@
33 +# Copyright 1999-2021 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://golang.org"
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 +RDEPEND="!<dev-go/go-tools-0_pre20150902"
72 +
73 +# the *.syso files have writable/executable stacks
74 +QA_EXECSTACK='*.syso'
75 +
76 +# Do not complain about CFLAGS, etc, since Go doesn't use them.
77 +QA_FLAGS_IGNORED='.*'
78 +
79 +# The tools in /usr/lib/go should not cause the multilib-strict check to fail.
80 +QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*"
81 +
82 +# This package triggers "unrecognized elf file(s)" notices on riscv.
83 +# https://bugs.gentoo.org/794046
84 +QA_PREBUILT='.*'
85 +
86 +# Do not strip this package. Stripping is unsupported upstream and may
87 +# fail.
88 +RESTRICT+=" strip"
89 +
90 +DOCS=(
91 +AUTHORS
92 +CONTRIBUTING.md
93 +CONTRIBUTORS
94 +PATENTS
95 +README.md
96 +)
97 +
98 +go_arch() {
99 + # By chance most portage arch names match Go
100 + local portage_arch=$(tc-arch $@)
101 + case "${portage_arch}" in
102 + x86) echo 386;;
103 + x64-*) echo amd64;;
104 + ppc64) [[ $(tc-endian $@) = big ]] && echo ppc64 || echo ppc64le ;;
105 + riscv) echo riscv64 ;;
106 + s390) echo s390x ;;
107 + *) echo "${portage_arch}";;
108 + esac
109 +}
110 +
111 +go_arm() {
112 + case "${1:-${CHOST}}" in
113 + armv5*) echo 5;;
114 + armv6*) echo 6;;
115 + armv7*) echo 7;;
116 + *)
117 + die "unknown GOARM for ${1:-${CHOST}}"
118 + ;;
119 + esac
120 +}
121 +
122 +go_os() {
123 + case "${1:-${CHOST}}" in
124 + *-linux*) echo linux;;
125 + *-darwin*) echo darwin;;
126 + *-freebsd*) echo freebsd;;
127 + *-netbsd*) echo netbsd;;
128 + *-openbsd*) echo openbsd;;
129 + *-solaris*) echo solaris;;
130 + *-cygwin*|*-interix*|*-winnt*)
131 + echo windows
132 + ;;
133 + *)
134 + die "unknown GOOS for ${1:-${CHOST}}"
135 + ;;
136 + esac
137 +}
138 +
139 +go_tuple() {
140 + echo "$(go_os $@)_$(go_arch $@)"
141 +}
142 +
143 +go_cross_compile() {
144 + [[ $(go_tuple ${CBUILD}) != $(go_tuple) ]]
145 +}
146 +
147 +src_compile() {
148 + if has_version -b dev-lang/go; then
149 + export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go"
150 + elif has_version -b dev-lang/go-bootstrap; then
151 + export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go-bootstrap"
152 + else
153 + eerror "Go cannot be built without go or go-bootstrap installed"
154 + die "Should not be here, please report a bug"
155 + fi
156 +
157 + export GOROOT_FINAL="${EPREFIX}"/usr/lib/go
158 + export GOROOT="${PWD}"
159 + export GOBIN="${GOROOT}/bin"
160 +
161 + # Go's build script does not use BUILD/HOST/TARGET consistently. :(
162 + export GOHOSTARCH=$(go_arch ${CBUILD})
163 + export GOHOSTOS=$(go_os ${CBUILD})
164 + export CC=$(tc-getBUILD_CC)
165 +
166 + export GOARCH=$(go_arch)
167 + export GOOS=$(go_os)
168 + export CC_FOR_TARGET=$(tc-getCC)
169 + export CXX_FOR_TARGET=$(tc-getCXX)
170 + use arm && export GOARM=$(go_arm)
171 + use x86 && export GO386=$(usex cpu_flags_x86_sse2 '' 'softfloat')
172 +
173 + cd src
174 + bash -x ./make.bash || die "build failed"
175 +}
176 +
177 +src_test() {
178 + go_cross_compile && return 0
179 +
180 + cd src
181 + PATH="${GOBIN}:${PATH}" \
182 + ./run.bash -no-rebuild || die "tests failed"
183 + cd ..
184 + rm -fr pkg/*_race || die
185 + rm -fr pkg/obj/go-build || die
186 +}
187 +
188 +src_install() {
189 + # There is a known issue which requires the source tree to be installed [1].
190 + # Once this is fixed, we can consider using the doc use flag to control
191 + # installing the doc and src directories.
192 + # The use of cp is deliberate in order to retain permissions
193 + # [1] https://golang.org/issue/2775
194 + dodir /usr/lib/go
195 + cp -R api bin doc lib pkg misc src test "${ED}"/usr/lib/go
196 + einstalldocs
197 +
198 + # testdata directories are not needed on the installed system
199 + rm -fr $(find "${ED}"/usr/lib/go -iname testdata -type d -print)
200 +
201 + local bin_path
202 + if go_cross_compile; then
203 + bin_path="bin/$(go_tuple)"
204 + else
205 + bin_path=bin
206 + fi
207 + local f x
208 + for x in ${bin_path}/*; do
209 + f=${x##*/}
210 + dosym ../lib/go/${bin_path}/${f} /usr/bin/${f}
211 + done
212 +
213 + # install the @golang-rebuild set for Portage
214 + insinto /usr/share/portage/config/sets
215 + newins "${FILESDIR}"/go-sets.conf go.conf
216 +}
217 +
218 +pkg_postinst() {
219 + [[ -z ${REPLACING_VERSIONS} ]] && return
220 + elog "After ${CATEGORY}/${PN} is updated it is recommended to rebuild"
221 + elog "all packages compiled with previous versions of ${CATEGORY}/${PN}"
222 + elog "due to the static linking nature of go."
223 + elog "If this is not done, the packages compiled with the older"
224 + elog "version of the compiler will not be updated until they are"
225 + elog "updated individually, which could mean they will have"
226 + elog "vulnerabilities."
227 + elog "Run 'emerge @golang-rebuild' to rebuild all 'go' packages"
228 + elog "See https://bugs.gentoo.org/752153 for more info"
229 +}