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 Apr 2019 16:54:11
Message-Id: 1554223939.21878442c2faa0d12e9ea967fb33a816e02974cf.williamh@gentoo
1 commit: 21878442c2faa0d12e9ea967fb33a816e02974cf
2 Author: William Hubbs <william.hubbs <AT> sony <DOT> com>
3 AuthorDate: Tue Apr 2 16:50:22 2019 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Tue Apr 2 16:52:19 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=21878442
7
8 dev-lang/go: add non-vulnerable version of go 1.11
9
10 This would have gone stable with 1.12.1 if I had known of its existance
11 so I think we can go straight to stable.
12
13 Copyright: Sony Interactive Entertainment Inc.
14 Package-Manager: Portage-2.3.62, Repoman-2.3.12
15 RepoMan-Options: --force
16 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
17
18 dev-lang/go/Manifest | 1 +
19 dev-lang/go/go-1.11.6.ebuild | 238 +++++++++++++++++++++++++++++++++++++++++++
20 2 files changed, 239 insertions(+)
21
22 diff --git a/dev-lang/go/Manifest b/dev-lang/go/Manifest
23 index 840c6b2a0f4..51592379e5d 100644
24 --- a/dev-lang/go/Manifest
25 +++ b/dev-lang/go/Manifest
26 @@ -9,4 +9,5 @@ DIST go-linux-ppc64-bootstrap-1.8.tbz 52315782 BLAKE2B 6be0a48e8bc4e5fed4d34f8aa
27 DIST go-linux-ppc64le-bootstrap-1.8.tbz 52211575 BLAKE2B 7a28ec5a381369c4e9415c8360e904c2545380513afd328077c584e8af0bf6bd818aa03e5a58c350cbb98facc1c9dccb02b06adcb27233875497cf5d33265912 SHA512 6931d999dd0ee1ff44c4cec48acb27af061f57f87aa74802dcebab78553b46bc8ac732f07fe91e5074dbdd32c55b707994875934bfb12bb4276d71eb1d06c4ba
28 DIST go-linux-s390x-bootstrap-1.8.tbz 57124869 BLAKE2B 920a176b8f4fc3a816e724324bbb30a383d599e31a0d2093d24797dbcd0e799a662a3589dbb87d2f5dd16df07c4cf8f1e444e87b540ec732746bb025dc9271f8 SHA512 d429cae870d66217ab2e07c74209d3031d97baa4f899b4d70ae6283a1a5b1434b037904c4cfca0b2bc798d5ba0b358c3739e000eccbc74809baf564c5686df5a
29 DIST go-solaris-amd64-bootstrap-1.8.tbz 54926326 BLAKE2B 0a45312f090d81ebf46fe5950cb65c059e2801394231e715e94145d1f918eb59b10472b2385e57ebd5cfb9eca0ad7290fb118436486b665520bb540970f971ab SHA512 52b849e5b9a940e10de7ba3df0ebdf6e1c5d631de9581d936c9edf8f38e6bb3314acbc2b2d5202b0528fde2a359d52bc0c6f39acf9b1b614725e4b4a947ed10d
30 +DIST go1.11.6.src.tar.gz 21113406 BLAKE2B e7372e9bf6190295176c66a328b3e31f9201776f16f1165136e24bdaf5c514d7895dd5880514fa054ee958ed5ff96814de9a555e47b3f6dddd388d1e57c0d05f SHA512 bc29df69a08a4e9e703de72b5eda5f2d63b78f18f3e7a1173eae5c6dd767f29f1b865a2fc3f692e15277df2d45e74ee17875b275eb3fc50aac2b88082e618bf5
31 DIST go1.12.1.src.tar.gz 21963082 BLAKE2B fd9c0ca19e6bd285c52034a88df1a58f96b957483362fac2e0c0f2a9dddde0543e7569d76fb93eff473774d152db361bfe9bdd354d80412c71ee5c4162010346 SHA512 b3fdfb874e6e0e0b50458085724fbd8e8b9be212df3f777b97db340aa3b80f32ee08d646a57a8a7d52ff6f19657d884dd25018c866c6173473aafa20a58f1975
32
33 diff --git a/dev-lang/go/go-1.11.6.ebuild b/dev-lang/go/go-1.11.6.ebuild
34 new file mode 100644
35 index 00000000000..292a2af5619
36 --- /dev/null
37 +++ b/dev-lang/go/go-1.11.6.ebuild
38 @@ -0,0 +1,238 @@
39 +# Copyright 1999-2019 Gentoo Authors
40 +# Distributed under the terms of the GNU General Public License v2
41 +
42 +EAPI=7
43 +
44 +export CBUILD=${CBUILD:-${CHOST}}
45 +export CTARGET=${CTARGET:-${CHOST}}
46 +
47 +MY_PV=${PV/_/}
48 +
49 +inherit toolchain-funcs
50 +
51 +BOOTSTRAP_VERSION="bootstrap-1.8"
52 +BOOTSTRAP_DIST="https://dev.gentoo.org/~williamh/dist"
53 +BOOTSTRAP_URI="
54 + ${BOOTSTRAP_DIST}/go-linux-amd64-${BOOTSTRAP_VERSION}.tbz
55 + ${BOOTSTRAP_DIST}/go-linux-arm-${BOOTSTRAP_VERSION}.tbz
56 + ${BOOTSTRAP_DIST}/go-linux-arm64-${BOOTSTRAP_VERSION}.tbz
57 + ${BOOTSTRAP_DIST}/go-linux-ppc64-${BOOTSTRAP_VERSION}.tbz
58 + ${BOOTSTRAP_DIST}/go-linux-ppc64le-${BOOTSTRAP_VERSION}.tbz
59 + ${BOOTSTRAP_DIST}/go-linux-s390x-${BOOTSTRAP_VERSION}.tbz
60 + ${BOOTSTRAP_DIST}/go-linux-386-${BOOTSTRAP_VERSION}.tbz
61 + ${BOOTSTRAP_DIST}/go-freebsd-amd64-${BOOTSTRAP_VERSION}.tbz
62 + ${BOOTSTRAP_DIST}/go-freebsd-386-${BOOTSTRAP_VERSION}.tbz
63 + ${BOOTSTRAP_DIST}/go-darwin-amd64-${BOOTSTRAP_VERSION}.tbz
64 + ${BOOTSTRAP_DIST}/go-solaris-amd64-${BOOTSTRAP_VERSION}.tbz
65 +"
66 +
67 +case ${PV} in
68 +*9999*)
69 + EGIT_REPO_URI="https://github.com/golang/go.git"
70 + inherit git-r3
71 + ;;
72 +*)
73 + SRC_URI="https://storage.googleapis.com/golang/go${MY_PV}.src.tar.gz "
74 + S="${WORKDIR}"/go
75 + case ${PV} in
76 + *_beta*|*_rc*) ;;
77 + *)
78 + KEYWORDS="-* amd64 arm ~arm64 ~ppc64 ~s390 x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x64-macos ~x64-solaris"
79 + # The upstream tests fail under portage but pass if the build is
80 + # run according to their documentation [1].
81 + # I am restricting the tests on released versions until this is
82 + # solved.
83 + # [1] https://golang.org/issues/18442
84 + RESTRICT="test"
85 + ;;
86 + esac
87 +esac
88 +
89 +# If gccgo is not being used to build Go, there is no way to know the
90 +# architecture or operating system of the build machine, so we need to
91 +# download all of our bootstrap archives to allow this ebuild to work
92 +# under crossdev.
93 +#
94 +# https://bugs.gentoo.org/671394
95 +SRC_URI+="!gccgo? ( ${BOOTSTRAP_URI} )"
96 +
97 +DESCRIPTION="A concurrent garbage collected and typesafe programming language"
98 +HOMEPAGE="https://golang.org"
99 +
100 +LICENSE="BSD"
101 +SLOT="0/${PV}"
102 +IUSE="gccgo"
103 +
104 +BDEPEND="gccgo? ( >=sys-devel/gcc-5[go] )"
105 +RDEPEND="!<dev-go/go-tools-0_pre20150902"
106 +
107 +# These test data objects have writable/executable stacks.
108 +QA_EXECSTACK="
109 + usr/lib/go/src/debug/elf/testdata/*.obj
110 + usr/lib/go/src/*.gox
111 + "
112 +
113 +# Do not complain about CFLAGS, etc, since Go doesn't use them.
114 +QA_FLAGS_IGNORED='.*'
115 +
116 +REQUIRES_EXCLUDE="/usr/lib/go/src/debug/elf/testdata/*"
117 +
118 +# The tools in /usr/lib/go should not cause the multilib-strict check to fail.
119 +QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*"
120 +
121 +# Do not strip this package. Stripping is unsupported upstream and may
122 +# fail.
123 +RESTRICT+=" strip"
124 +
125 +DOCS=(
126 +AUTHORS
127 +CONTRIBUTING.md
128 +CONTRIBUTORS
129 +PATENTS
130 +README.md
131 +)
132 +
133 +go_arch()
134 +{
135 + # By chance most portage arch names match Go
136 + local portage_arch=$(tc-arch $@)
137 + case "${portage_arch}" in
138 + x86) echo 386;;
139 + x64-*) echo amd64;;
140 + ppc64) [[ $(tc-endian $@) = big ]] && echo ppc64 || echo ppc64le ;;
141 + s390) echo s390x ;;
142 + *) echo "${portage_arch}";;
143 + esac
144 +}
145 +
146 +go_arm()
147 +{
148 + case "${1:-${CHOST}}" in
149 + armv5*) echo 5;;
150 + armv6*) echo 6;;
151 + armv7*) echo 7;;
152 + *)
153 + die "unknown GOARM for ${1:-${CHOST}}"
154 + ;;
155 + esac
156 +}
157 +
158 +go_os()
159 +{
160 + case "${1:-${CHOST}}" in
161 + *-linux*) echo linux;;
162 + *-darwin*) echo darwin;;
163 + *-freebsd*) echo freebsd;;
164 + *-netbsd*) echo netbsd;;
165 + *-openbsd*) echo openbsd;;
166 + *-solaris*) echo solaris;;
167 + *-cygwin*|*-interix*|*-winnt*)
168 + echo windows
169 + ;;
170 + *)
171 + die "unknown GOOS for ${1:-${CHOST}}"
172 + ;;
173 + esac
174 +}
175 +
176 +go_tuple()
177 +{
178 + echo "$(go_os $@)_$(go_arch $@)"
179 +}
180 +
181 +go_cross_compile()
182 +{
183 + [[ $(go_tuple ${CBUILD}) != $(go_tuple) ]]
184 +}
185 +
186 +pkg_pretend()
187 +{
188 + # make.bash does not understand cross-compiling a cross-compiler
189 + if [[ $(go_tuple) != $(go_tuple ${CTARGET}) ]]; then
190 + die "CHOST CTARGET pair unsupported: CHOST=${CHOST} CTARGET=${CTARGET}"
191 + fi
192 +}
193 +
194 +src_unpack()
195 +{
196 + if [[ ${PV} = 9999 ]]; then
197 + git-r3_src_unpack
198 + fi
199 + default
200 +}
201 +
202 +src_compile()
203 +{
204 + export GOROOT_BOOTSTRAP="${WORKDIR}"/go-$(go_os ${CBUILD})-$(go_arch ${CBUILD})-bootstrap
205 + if use gccgo; then
206 + mkdir -p "${GOROOT_BOOTSTRAP}/bin" || die
207 + local go_binary=$(gcc-config --get-bin-path)/go-$(gcc-major-version)
208 + [[ -x ${go_binary} ]] || go_binary=$(
209 + find "${EPREFIX}"/usr/${CHOST}/gcc-bin/*/go-$(gcc-major-version) |
210 + sort -V | tail -n1)
211 + [[ -x ${go_binary} ]] ||
212 + die "go-$(gcc-major-version): command not found"
213 + ln -s "${go_binary}" "${GOROOT_BOOTSTRAP}/bin/go" || die
214 + fi
215 + export GOROOT_FINAL="${EPREFIX}"/usr/lib/go
216 + export GOROOT="$(pwd)"
217 + export GOBIN="${GOROOT}/bin"
218 +
219 + # Go's build script does not use BUILD/HOST/TARGET consistently. :(
220 + export GOHOSTARCH=$(go_arch ${CBUILD})
221 + export GOHOSTOS=$(go_os ${CBUILD})
222 + export CC=$(tc-getBUILD_CC)
223 +
224 + export GOARCH=$(go_arch)
225 + export GOOS=$(go_os)
226 + export CC_FOR_TARGET=$(tc-getCC)
227 + export CXX_FOR_TARGET=$(tc-getCXX)
228 + if [[ ${ARCH} == arm ]]; then
229 + export GOARM=$(go_arm)
230 + fi
231 +
232 + cd src
233 + ./make.bash || die "build failed"
234 +}
235 +
236 +src_test()
237 +{
238 + go_cross_compile && return 0
239 +
240 + cd src
241 + PATH="${GOBIN}:${PATH}" \
242 + ./run.bash -no-rebuild || die "tests failed"
243 +}
244 +
245 +src_install()
246 +{
247 + local bin_path f x
248 +
249 + dodir /usr/lib/go
250 +
251 + # There is a known issue which requires the source tree to be installed [1].
252 + # Once this is fixed, we can consider using the doc use flag to control
253 + # installing the doc and src directories.
254 + # [1] https://golang.org/issue/2775
255 + #
256 + # deliberately use cp to retain permissions
257 + cp -R api bin doc lib pkg misc src test "${ED}"/usr/lib/go
258 + if go_cross_compile; then
259 + bin_path="bin/$(go_tuple)"
260 + else
261 + bin_path=bin
262 + fi
263 + for x in ${bin_path}/*; do
264 + f=${x##*/}
265 + dosym ../lib/go/${bin_path}/${f} /usr/bin/${f}
266 + done
267 + einstalldocs
268 +
269 + if [[ ${CHOST} == *-darwin* ]] ; then
270 + # fix install_name for test object (binutils_test) on Darwin, it
271 + # is never used in real circumstances
272 + local libmac64="${EPREFIX}"/usr/lib/go/src/cmd/vendor/github.com/
273 + libmac64+=google/pprof/internal/binutils/testdata/lib_mac_64
274 + install_name_tool -id "${libmac64}" "${D}${libmac64}"
275 + fi
276 +}