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, 29 Nov 2021 18:50:15
Message-Id: 1638211796.b45593a7ff5827c7382d4132be1b981241ef80e2.williamh@gentoo
1 commit: b45593a7ff5827c7382d4132be1b981241ef80e2
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Mon Nov 29 18:33:02 2021 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Mon Nov 29 18:49:56 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=b45593a7
7
8 dev-lang/go: 1.17.3 bump
9
10 Bug: https://bugs.gentoo.org/821859
11 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
12
13 dev-lang/go/Manifest | 1 +
14 dev-lang/go/go-1.17.3.ebuild | 197 +++++++++++++++++++++++++++++++++++++++++++
15 2 files changed, 198 insertions(+)
16
17 diff --git a/dev-lang/go/Manifest b/dev-lang/go/Manifest
18 index 30acb6fee22e..e4a9ef492f41 100644
19 --- a/dev-lang/go/Manifest
20 +++ b/dev-lang/go/Manifest
21 @@ -1 +1,2 @@
22 DIST go1.17.2.src.tar.gz 22182111 BLAKE2B 83b665af212f3e20dc9c9f4bd80ac0e1e4acb8ba6653835f6a8b990a5d6074a25ba78b783f7a4f9402b3f1916a65ddba4ad9780e4eae871719cff13f7bb9c980 SHA512 167220293e02d6994b5cdee5909cbdbe66f692619baeb6ff9ee0d56660eb39cfd9eac2ac510f113d5222dadd5858fd6276bd961365ca42b42c07af5d24d48107
23 +DIST go1.17.3.src.tar.gz 22183309 BLAKE2B 1cb2960f67335f0022900cdab5dd70bcb52f15c2d311ea2dd99a0205af518741d9642741ea1bb5fea870239d6c971e6c69053a195e6a72e7440c8bdd3a0c085c SHA512 a2793efefe3f7e89054453cada03c25a900a4a6b71b2dfa0f5f33c1d8946711c983067dd54021faa5605074708db8e4225d104be703d307f3dbcc6035410acbd
24
25 diff --git a/dev-lang/go/go-1.17.3.ebuild b/dev-lang/go/go-1.17.3.ebuild
26 new file mode 100644
27 index 000000000000..12a85433a096
28 --- /dev/null
29 +++ b/dev-lang/go/go-1.17.3.ebuild
30 @@ -0,0 +1,197 @@
31 +# Copyright 1999-2021 Gentoo Authors
32 +# Distributed under the terms of the GNU General Public License v2
33 +
34 +EAPI=7
35 +
36 +export CBUILD=${CBUILD:-${CHOST}}
37 +export CTARGET=${CTARGET:-${CHOST}}
38 +
39 +MY_PV=${PV/_/}
40 +
41 +inherit toolchain-funcs
42 +
43 +case ${PV} in
44 +*9999*)
45 + EGIT_REPO_URI="https://github.com/golang/go.git"
46 + inherit git-r3
47 + ;;
48 +*)
49 + SRC_URI="https://storage.googleapis.com/golang/go${MY_PV}.src.tar.gz "
50 + S="${WORKDIR}"/go
51 + case ${PV} in
52 + *_beta*|*_rc*) ;;
53 + *)
54 + KEYWORDS="-* amd64 ~arm ~arm64 ~ppc64 ~riscv ~s390 ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
55 + ;;
56 + esac
57 +esac
58 +
59 +DESCRIPTION="A concurrent garbage collected and typesafe programming language"
60 +HOMEPAGE="https://golang.org"
61 +
62 +LICENSE="BSD"
63 +SLOT="0/${PV}"
64 +IUSE="cpu_flags_x86_sse2"
65 +
66 +BDEPEND="|| (
67 + dev-lang/go
68 + dev-lang/go-bootstrap )"
69 +RDEPEND="!<dev-go/go-tools-0_pre20150902"
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 +}