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, 07 May 2019 18:04:16
Message-Id: 1557252247.6d2efa477ffd38849b626783735905db56040736.williamh@gentoo
1 commit: 6d2efa477ffd38849b626783735905db56040736
2 Author: William Hubbs <william.hubbs <AT> sony <DOT> com>
3 AuthorDate: Tue May 7 17:59:05 2019 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Tue May 7 18:04:07 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=6d2efa47
7
8 dev-lang/go: 1.12.5 and 1.11.10 bump
9
10 Copyright: Sony Interactive Entertainment Inc.
11 Package-Manager: Portage-2.3.62, Repoman-2.3.12
12 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
13
14 dev-lang/go/Manifest | 2 +
15 dev-lang/go/go-1.11.10.ebuild | 246 ++++++++++++++++++++++++++++++++++++++++++
16 dev-lang/go/go-1.12.5.ebuild | 246 ++++++++++++++++++++++++++++++++++++++++++
17 3 files changed, 494 insertions(+)
18
19 diff --git a/dev-lang/go/Manifest b/dev-lang/go/Manifest
20 index 7e43b0400b2..358cc720094 100644
21 --- a/dev-lang/go/Manifest
22 +++ b/dev-lang/go/Manifest
23 @@ -9,6 +9,7 @@ DIST go-linux-ppc64-bootstrap-1.8.tbz 52315782 BLAKE2B 6be0a48e8bc4e5fed4d34f8aa
24 DIST go-linux-ppc64le-bootstrap-1.8.tbz 52211575 BLAKE2B 7a28ec5a381369c4e9415c8360e904c2545380513afd328077c584e8af0bf6bd818aa03e5a58c350cbb98facc1c9dccb02b06adcb27233875497cf5d33265912 SHA512 6931d999dd0ee1ff44c4cec48acb27af061f57f87aa74802dcebab78553b46bc8ac732f07fe91e5074dbdd32c55b707994875934bfb12bb4276d71eb1d06c4ba
25 DIST go-linux-s390x-bootstrap-1.8.tbz 57124869 BLAKE2B 920a176b8f4fc3a816e724324bbb30a383d599e31a0d2093d24797dbcd0e799a662a3589dbb87d2f5dd16df07c4cf8f1e444e87b540ec732746bb025dc9271f8 SHA512 d429cae870d66217ab2e07c74209d3031d97baa4f899b4d70ae6283a1a5b1434b037904c4cfca0b2bc798d5ba0b358c3739e000eccbc74809baf564c5686df5a
26 DIST go-solaris-amd64-bootstrap-1.8.tbz 54926326 BLAKE2B 0a45312f090d81ebf46fe5950cb65c059e2801394231e715e94145d1f918eb59b10472b2385e57ebd5cfb9eca0ad7290fb118436486b665520bb540970f971ab SHA512 52b849e5b9a940e10de7ba3df0ebdf6e1c5d631de9581d936c9edf8f38e6bb3314acbc2b2d5202b0528fde2a359d52bc0c6f39acf9b1b614725e4b4a947ed10d
27 +DIST go1.11.10.src.tar.gz 21113259 BLAKE2B 2dc704ea092fb4f4bb6c379ecb5104eb9dc5657750fb046810f210f38191d494c926e7a3661f67ea09c3d4090676485ba346daaa6dfe9eebbf3d69acbacea3b8 SHA512 8fab3b96d1c47b8f75b135da9d1a104c485098f6f42041b69336216a57cfd49c0785c8cfa7b016020ded5f0aadd279d7a76feeca33038321a4930139aee28cc8
28 DIST go1.11.6.src.tar.gz 21113406 BLAKE2B e7372e9bf6190295176c66a328b3e31f9201776f16f1165136e24bdaf5c514d7895dd5880514fa054ee958ed5ff96814de9a555e47b3f6dddd388d1e57c0d05f SHA512 bc29df69a08a4e9e703de72b5eda5f2d63b78f18f3e7a1173eae5c6dd767f29f1b865a2fc3f692e15277df2d45e74ee17875b275eb3fc50aac2b88082e618bf5
29 DIST go1.11.7.src.tar.gz 21113223 BLAKE2B e58a947a43e8dbabbe6d4dc1384239b01160e4d9cc88ed866c8d6e5a0ef66dd89203b9fb95c14c5fcc50ad47f75b17440cf1df34cb793a435d7744e630845307 SHA512 26bc2a3ab51ebe1179cd83897dae6ca17f30126189bf2c0b60060a25f3f22e72bcda383055825a9151948f074a103a177ab5550f5c2d088448bdf5455448061e
30 DIST go1.11.8.src.tar.gz 21113433 BLAKE2B 272ef36664a180640f14afba18d2f715d5a335134b33cea449d14fd3b568c2322bbbac7aab254987fbd7dcf3d486dc8b1f62f14577ae2e57b21de1720d0f29a7 SHA512 00b57b0ebbbf53f4de718bf40e5dfdaf57cafa9932917d22e9723b5a33a62d335013ab49753d98f8fe30c71daca95c7addd921825fe0c3885942b342773050cc
31 @@ -17,3 +18,4 @@ DIST go1.12.1.src.tar.gz 21963082 BLAKE2B fd9c0ca19e6bd285c52034a88df1a58f96b957
32 DIST go1.12.2.src.tar.gz 21965624 BLAKE2B 9f4fbe62b37ccaf62517b2e5df3e1ada0155b7cb79067c2a74100df6d96ba89b0e372b5f1b1037b0cf98ea9f52623de00055793d011e5e39e92773a0cd87e41d SHA512 f7b8ffe8d3de7b456ba595deece5b092db8645e95d901826c33428af0151731921437222dcb5d52c9d937da4ebeb3192c30aa17052aa88c9e425e96cac2d79bb
33 DIST go1.12.3.src.tar.gz 21965718 BLAKE2B 226b1028eb47cee8ccc0b72130a098a65211cf0e54030fe626b6b9cf1c16993e0a9677a443c07abd997e0f2bfbc1711c703a40869ae1ecbb8b8dfa0fbf31c0b2 SHA512 bd33e958f2e8550da14afc0576928d00d2b8ecac569ddcf3551e44a342ce78ad3934e36109cbe6c15d31c55448ccc092f6e1fbf82685d6702402ab67106a1424
34 DIST go1.12.4.src.tar.gz 21965966 BLAKE2B 6a6d2712769d9195795ca14a7c33a4e025c572317c0a9118f4f610c56f907e0eec99d2ecca37cc6e2005a42b842080d93895d4dfed206f23db32f3b848c9c57f SHA512 45ced5fc23a2786a652dbe66de7bbc039efaba29d884d797d6d0a6eaffb61dfb897905f0733ce74704f8760b1fdedb9963e26c1d9d8dee4a4676e74da5df8792
35 +DIST go1.12.5.src.tar.gz 21971348 BLAKE2B 7de8db4a6c4cd9e1883fbf28357fe99ad9f43f3e015b2063347b1961df128760b720c0dd5549997c7080e6cf0036406430419d4bf033323f26017d3629ad6067 SHA512 ce64105ff71615f9d235cc7c8656b6409fc40cc90d15a28d355fadd9072d2eab842af379dd8bba0f1181715753143e4a07491e0f9e5f8df806327d7c95a34fae
36
37 diff --git a/dev-lang/go/go-1.11.10.ebuild b/dev-lang/go/go-1.11.10.ebuild
38 new file mode 100644
39 index 00000000000..3797d6e013d
40 --- /dev/null
41 +++ b/dev-lang/go/go-1.11.10.ebuild
42 @@ -0,0 +1,246 @@
43 +# Copyright 1999-2019 Gentoo Authors
44 +# Distributed under the terms of the GNU General Public License v2
45 +
46 +EAPI=7
47 +
48 +export CBUILD=${CBUILD:-${CHOST}}
49 +export CTARGET=${CTARGET:-${CHOST}}
50 +
51 +MY_PV=${PV/_/}
52 +
53 +inherit toolchain-funcs
54 +
55 +BOOTSTRAP_VERSION="bootstrap-1.8"
56 +BOOTSTRAP_DIST="https://dev.gentoo.org/~williamh/dist"
57 +BOOTSTRAP_URI="
58 + ${BOOTSTRAP_DIST}/go-linux-amd64-${BOOTSTRAP_VERSION}.tbz
59 + ${BOOTSTRAP_DIST}/go-linux-arm-${BOOTSTRAP_VERSION}.tbz
60 + ${BOOTSTRAP_DIST}/go-linux-arm64-${BOOTSTRAP_VERSION}.tbz
61 + ${BOOTSTRAP_DIST}/go-linux-ppc64-${BOOTSTRAP_VERSION}.tbz
62 + ${BOOTSTRAP_DIST}/go-linux-ppc64le-${BOOTSTRAP_VERSION}.tbz
63 + ${BOOTSTRAP_DIST}/go-linux-s390x-${BOOTSTRAP_VERSION}.tbz
64 + ${BOOTSTRAP_DIST}/go-linux-386-${BOOTSTRAP_VERSION}.tbz
65 + ${BOOTSTRAP_DIST}/go-freebsd-amd64-${BOOTSTRAP_VERSION}.tbz
66 + ${BOOTSTRAP_DIST}/go-freebsd-386-${BOOTSTRAP_VERSION}.tbz
67 + ${BOOTSTRAP_DIST}/go-darwin-amd64-${BOOTSTRAP_VERSION}.tbz
68 + ${BOOTSTRAP_DIST}/go-solaris-amd64-${BOOTSTRAP_VERSION}.tbz
69 +"
70 +
71 +case ${PV} in
72 +*9999*)
73 + EGIT_REPO_URI="https://github.com/golang/go.git"
74 + inherit git-r3
75 + ;;
76 +*)
77 + SRC_URI="https://storage.googleapis.com/golang/go${MY_PV}.src.tar.gz "
78 + S="${WORKDIR}"/go
79 + case ${PV} in
80 + *_beta*|*_rc*) ;;
81 + *)
82 + KEYWORDS="-* ~amd64 ~arm ~arm64 ~ppc64 ~s390 ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x64-macos ~x64-solaris"
83 + # The upstream tests fail under portage but pass if the build is
84 + # run according to their documentation [1].
85 + # I am restricting the tests on released versions until this is
86 + # solved.
87 + # [1] https://golang.org/issues/18442
88 + RESTRICT="test"
89 + ;;
90 + esac
91 +esac
92 +
93 +# If gccgo or a previously installed version of dev-lang/go is not being
94 +# used to build Go, there is no way to know the architecture or operating system
95 +# of the build machine, so we need to download all of our bootstrap
96 +# archives to allow this ebuild to work under crossdev.
97 +#
98 +# https://bugs.gentoo.org/671394
99 +SRC_URI+="!gccgo? ( !system-bootstrap? ( ${BOOTSTRAP_URI} ) )"
100 +
101 +DESCRIPTION="A concurrent garbage collected and typesafe programming language"
102 +HOMEPAGE="https://golang.org"
103 +
104 +LICENSE="BSD"
105 +SLOT="0/${PV}"
106 +IUSE="gccgo system-bootstrap"
107 +
108 +BDEPEND="gccgo? ( >=sys-devel/gcc-5[go] )"
109 +RDEPEND="!<dev-go/go-tools-0_pre20150902"
110 +
111 +# These test data objects have writable/executable stacks.
112 +QA_EXECSTACK="
113 + usr/lib/go/src/debug/elf/testdata/*.obj
114 + usr/lib/go/src/*.gox
115 + "
116 +
117 +# Do not complain about CFLAGS, etc, since Go doesn't use them.
118 +QA_FLAGS_IGNORED='.*'
119 +
120 +REQUIRES_EXCLUDE="/usr/lib/go/src/debug/elf/testdata/*"
121 +
122 +# The tools in /usr/lib/go should not cause the multilib-strict check to fail.
123 +QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*"
124 +
125 +# Do not strip this package. Stripping is unsupported upstream and may
126 +# fail.
127 +RESTRICT+=" strip"
128 +
129 +DOCS=(
130 +AUTHORS
131 +CONTRIBUTING.md
132 +CONTRIBUTORS
133 +PATENTS
134 +README.md
135 +)
136 +
137 +go_arch()
138 +{
139 + # By chance most portage arch names match Go
140 + local portage_arch=$(tc-arch $@)
141 + case "${portage_arch}" in
142 + x86) echo 386;;
143 + x64-*) echo amd64;;
144 + ppc64) [[ $(tc-endian $@) = big ]] && echo ppc64 || echo ppc64le ;;
145 + s390) echo s390x ;;
146 + *) echo "${portage_arch}";;
147 + esac
148 +}
149 +
150 +go_arm()
151 +{
152 + case "${1:-${CHOST}}" in
153 + armv5*) echo 5;;
154 + armv6*) echo 6;;
155 + armv7*) echo 7;;
156 + *)
157 + die "unknown GOARM for ${1:-${CHOST}}"
158 + ;;
159 + esac
160 +}
161 +
162 +go_os()
163 +{
164 + case "${1:-${CHOST}}" in
165 + *-linux*) echo linux;;
166 + *-darwin*) echo darwin;;
167 + *-freebsd*) echo freebsd;;
168 + *-netbsd*) echo netbsd;;
169 + *-openbsd*) echo openbsd;;
170 + *-solaris*) echo solaris;;
171 + *-cygwin*|*-interix*|*-winnt*)
172 + echo windows
173 + ;;
174 + *)
175 + die "unknown GOOS for ${1:-${CHOST}}"
176 + ;;
177 + esac
178 +}
179 +
180 +go_tuple()
181 +{
182 + echo "$(go_os $@)_$(go_arch $@)"
183 +}
184 +
185 +go_cross_compile()
186 +{
187 + [[ $(go_tuple ${CBUILD}) != $(go_tuple) ]]
188 +}
189 +
190 +pkg_pretend()
191 +{
192 + # make.bash does not understand cross-compiling a cross-compiler
193 + if [[ $(go_tuple) != $(go_tuple ${CTARGET}) ]]; then
194 + die "CHOST CTARGET pair unsupported: CHOST=${CHOST} CTARGET=${CTARGET}"
195 + fi
196 + [[ ${MERGE_TYPE} != binary ]] &&
197 + use system-bootstrap && ! has_version "dev-lang/go" &&
198 + die "dev-lang/go must be installed to use the system-bootstrap use flag"
199 +}
200 +
201 +src_unpack()
202 +{
203 + if [[ ${PV} = 9999 ]]; then
204 + git-r3_src_unpack
205 + else
206 + unpack "go${MY_PV}.src.tar.gz"
207 + fi
208 + use gccgo || use system-bootstrap ||
209 + unpack "go-$(go_os ${CBUILD})-$(go_arch ${CBUILD})-${BOOTSTRAP_VERSION}.tbz"
210 +}
211 +
212 +src_compile()
213 +{
214 + export GOROOT_BOOTSTRAP="${WORKDIR}"/go-$(go_os ${CBUILD})-$(go_arch ${CBUILD})-bootstrap
215 + if use gccgo; then
216 + mkdir -p "${GOROOT_BOOTSTRAP}/bin" || die
217 + local go_binary=$(gcc-config --get-bin-path)/go-$(gcc-major-version)
218 + [[ -x ${go_binary} ]] || go_binary=$(
219 + find "${EPREFIX}"/usr/${CHOST}/gcc-bin/*/go-$(gcc-major-version) |
220 + sort -V | tail -n1)
221 + [[ -x ${go_binary} ]] ||
222 + die "go-$(gcc-major-version): command not found"
223 + ln -s "${go_binary}" "${GOROOT_BOOTSTRAP}/bin/go" || die
224 + elif use system-bootstrap; then
225 + export GOROOT_BOOTSTRAP="${EPREFIX}"/usr/lib/go
226 + fi
227 + export GOROOT_FINAL="${EPREFIX}"/usr/lib/go
228 + export GOROOT="$(pwd)"
229 + export GOBIN="${GOROOT}/bin"
230 +
231 + # Go's build script does not use BUILD/HOST/TARGET consistently. :(
232 + export GOHOSTARCH=$(go_arch ${CBUILD})
233 + export GOHOSTOS=$(go_os ${CBUILD})
234 + export CC=$(tc-getBUILD_CC)
235 +
236 + export GOARCH=$(go_arch)
237 + export GOOS=$(go_os)
238 + export CC_FOR_TARGET=$(tc-getCC)
239 + export CXX_FOR_TARGET=$(tc-getCXX)
240 + if [[ ${ARCH} == arm ]]; then
241 + export GOARM=$(go_arm)
242 + fi
243 +
244 + cd src
245 + ./make.bash || die "build failed"
246 +}
247 +
248 +src_test()
249 +{
250 + go_cross_compile && return 0
251 +
252 + cd src
253 + PATH="${GOBIN}:${PATH}" \
254 + ./run.bash -no-rebuild || die "tests failed"
255 +}
256 +
257 +src_install()
258 +{
259 + local bin_path f x
260 +
261 + dodir /usr/lib/go
262 +
263 + # There is a known issue which requires the source tree to be installed [1].
264 + # Once this is fixed, we can consider using the doc use flag to control
265 + # installing the doc and src directories.
266 + # [1] https://golang.org/issue/2775
267 + #
268 + # deliberately use cp to retain permissions
269 + cp -R api bin doc lib pkg misc src test "${ED}"/usr/lib/go
270 + if go_cross_compile; then
271 + bin_path="bin/$(go_tuple)"
272 + else
273 + bin_path=bin
274 + fi
275 + for x in ${bin_path}/*; do
276 + f=${x##*/}
277 + dosym ../lib/go/${bin_path}/${f} /usr/bin/${f}
278 + done
279 + einstalldocs
280 +
281 + if [[ ${CHOST} == *-darwin* ]] ; then
282 + # fix install_name for test object (binutils_test) on Darwin, it
283 + # is never used in real circumstances
284 + local libmac64="${EPREFIX}"/usr/lib/go/src/cmd/vendor/github.com/
285 + libmac64+=google/pprof/internal/binutils/testdata/lib_mac_64
286 + install_name_tool -id "${libmac64}" "${D}${libmac64}"
287 + fi
288 +}
289
290 diff --git a/dev-lang/go/go-1.12.5.ebuild b/dev-lang/go/go-1.12.5.ebuild
291 new file mode 100644
292 index 00000000000..3797d6e013d
293 --- /dev/null
294 +++ b/dev-lang/go/go-1.12.5.ebuild
295 @@ -0,0 +1,246 @@
296 +# Copyright 1999-2019 Gentoo Authors
297 +# Distributed under the terms of the GNU General Public License v2
298 +
299 +EAPI=7
300 +
301 +export CBUILD=${CBUILD:-${CHOST}}
302 +export CTARGET=${CTARGET:-${CHOST}}
303 +
304 +MY_PV=${PV/_/}
305 +
306 +inherit toolchain-funcs
307 +
308 +BOOTSTRAP_VERSION="bootstrap-1.8"
309 +BOOTSTRAP_DIST="https://dev.gentoo.org/~williamh/dist"
310 +BOOTSTRAP_URI="
311 + ${BOOTSTRAP_DIST}/go-linux-amd64-${BOOTSTRAP_VERSION}.tbz
312 + ${BOOTSTRAP_DIST}/go-linux-arm-${BOOTSTRAP_VERSION}.tbz
313 + ${BOOTSTRAP_DIST}/go-linux-arm64-${BOOTSTRAP_VERSION}.tbz
314 + ${BOOTSTRAP_DIST}/go-linux-ppc64-${BOOTSTRAP_VERSION}.tbz
315 + ${BOOTSTRAP_DIST}/go-linux-ppc64le-${BOOTSTRAP_VERSION}.tbz
316 + ${BOOTSTRAP_DIST}/go-linux-s390x-${BOOTSTRAP_VERSION}.tbz
317 + ${BOOTSTRAP_DIST}/go-linux-386-${BOOTSTRAP_VERSION}.tbz
318 + ${BOOTSTRAP_DIST}/go-freebsd-amd64-${BOOTSTRAP_VERSION}.tbz
319 + ${BOOTSTRAP_DIST}/go-freebsd-386-${BOOTSTRAP_VERSION}.tbz
320 + ${BOOTSTRAP_DIST}/go-darwin-amd64-${BOOTSTRAP_VERSION}.tbz
321 + ${BOOTSTRAP_DIST}/go-solaris-amd64-${BOOTSTRAP_VERSION}.tbz
322 +"
323 +
324 +case ${PV} in
325 +*9999*)
326 + EGIT_REPO_URI="https://github.com/golang/go.git"
327 + inherit git-r3
328 + ;;
329 +*)
330 + SRC_URI="https://storage.googleapis.com/golang/go${MY_PV}.src.tar.gz "
331 + S="${WORKDIR}"/go
332 + case ${PV} in
333 + *_beta*|*_rc*) ;;
334 + *)
335 + KEYWORDS="-* ~amd64 ~arm ~arm64 ~ppc64 ~s390 ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x64-macos ~x64-solaris"
336 + # The upstream tests fail under portage but pass if the build is
337 + # run according to their documentation [1].
338 + # I am restricting the tests on released versions until this is
339 + # solved.
340 + # [1] https://golang.org/issues/18442
341 + RESTRICT="test"
342 + ;;
343 + esac
344 +esac
345 +
346 +# If gccgo or a previously installed version of dev-lang/go is not being
347 +# used to build Go, there is no way to know the architecture or operating system
348 +# of the build machine, so we need to download all of our bootstrap
349 +# archives to allow this ebuild to work under crossdev.
350 +#
351 +# https://bugs.gentoo.org/671394
352 +SRC_URI+="!gccgo? ( !system-bootstrap? ( ${BOOTSTRAP_URI} ) )"
353 +
354 +DESCRIPTION="A concurrent garbage collected and typesafe programming language"
355 +HOMEPAGE="https://golang.org"
356 +
357 +LICENSE="BSD"
358 +SLOT="0/${PV}"
359 +IUSE="gccgo system-bootstrap"
360 +
361 +BDEPEND="gccgo? ( >=sys-devel/gcc-5[go] )"
362 +RDEPEND="!<dev-go/go-tools-0_pre20150902"
363 +
364 +# These test data objects have writable/executable stacks.
365 +QA_EXECSTACK="
366 + usr/lib/go/src/debug/elf/testdata/*.obj
367 + usr/lib/go/src/*.gox
368 + "
369 +
370 +# Do not complain about CFLAGS, etc, since Go doesn't use them.
371 +QA_FLAGS_IGNORED='.*'
372 +
373 +REQUIRES_EXCLUDE="/usr/lib/go/src/debug/elf/testdata/*"
374 +
375 +# The tools in /usr/lib/go should not cause the multilib-strict check to fail.
376 +QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*"
377 +
378 +# Do not strip this package. Stripping is unsupported upstream and may
379 +# fail.
380 +RESTRICT+=" strip"
381 +
382 +DOCS=(
383 +AUTHORS
384 +CONTRIBUTING.md
385 +CONTRIBUTORS
386 +PATENTS
387 +README.md
388 +)
389 +
390 +go_arch()
391 +{
392 + # By chance most portage arch names match Go
393 + local portage_arch=$(tc-arch $@)
394 + case "${portage_arch}" in
395 + x86) echo 386;;
396 + x64-*) echo amd64;;
397 + ppc64) [[ $(tc-endian $@) = big ]] && echo ppc64 || echo ppc64le ;;
398 + s390) echo s390x ;;
399 + *) echo "${portage_arch}";;
400 + esac
401 +}
402 +
403 +go_arm()
404 +{
405 + case "${1:-${CHOST}}" in
406 + armv5*) echo 5;;
407 + armv6*) echo 6;;
408 + armv7*) echo 7;;
409 + *)
410 + die "unknown GOARM for ${1:-${CHOST}}"
411 + ;;
412 + esac
413 +}
414 +
415 +go_os()
416 +{
417 + case "${1:-${CHOST}}" in
418 + *-linux*) echo linux;;
419 + *-darwin*) echo darwin;;
420 + *-freebsd*) echo freebsd;;
421 + *-netbsd*) echo netbsd;;
422 + *-openbsd*) echo openbsd;;
423 + *-solaris*) echo solaris;;
424 + *-cygwin*|*-interix*|*-winnt*)
425 + echo windows
426 + ;;
427 + *)
428 + die "unknown GOOS for ${1:-${CHOST}}"
429 + ;;
430 + esac
431 +}
432 +
433 +go_tuple()
434 +{
435 + echo "$(go_os $@)_$(go_arch $@)"
436 +}
437 +
438 +go_cross_compile()
439 +{
440 + [[ $(go_tuple ${CBUILD}) != $(go_tuple) ]]
441 +}
442 +
443 +pkg_pretend()
444 +{
445 + # make.bash does not understand cross-compiling a cross-compiler
446 + if [[ $(go_tuple) != $(go_tuple ${CTARGET}) ]]; then
447 + die "CHOST CTARGET pair unsupported: CHOST=${CHOST} CTARGET=${CTARGET}"
448 + fi
449 + [[ ${MERGE_TYPE} != binary ]] &&
450 + use system-bootstrap && ! has_version "dev-lang/go" &&
451 + die "dev-lang/go must be installed to use the system-bootstrap use flag"
452 +}
453 +
454 +src_unpack()
455 +{
456 + if [[ ${PV} = 9999 ]]; then
457 + git-r3_src_unpack
458 + else
459 + unpack "go${MY_PV}.src.tar.gz"
460 + fi
461 + use gccgo || use system-bootstrap ||
462 + unpack "go-$(go_os ${CBUILD})-$(go_arch ${CBUILD})-${BOOTSTRAP_VERSION}.tbz"
463 +}
464 +
465 +src_compile()
466 +{
467 + export GOROOT_BOOTSTRAP="${WORKDIR}"/go-$(go_os ${CBUILD})-$(go_arch ${CBUILD})-bootstrap
468 + if use gccgo; then
469 + mkdir -p "${GOROOT_BOOTSTRAP}/bin" || die
470 + local go_binary=$(gcc-config --get-bin-path)/go-$(gcc-major-version)
471 + [[ -x ${go_binary} ]] || go_binary=$(
472 + find "${EPREFIX}"/usr/${CHOST}/gcc-bin/*/go-$(gcc-major-version) |
473 + sort -V | tail -n1)
474 + [[ -x ${go_binary} ]] ||
475 + die "go-$(gcc-major-version): command not found"
476 + ln -s "${go_binary}" "${GOROOT_BOOTSTRAP}/bin/go" || die
477 + elif use system-bootstrap; then
478 + export GOROOT_BOOTSTRAP="${EPREFIX}"/usr/lib/go
479 + fi
480 + export GOROOT_FINAL="${EPREFIX}"/usr/lib/go
481 + export GOROOT="$(pwd)"
482 + export GOBIN="${GOROOT}/bin"
483 +
484 + # Go's build script does not use BUILD/HOST/TARGET consistently. :(
485 + export GOHOSTARCH=$(go_arch ${CBUILD})
486 + export GOHOSTOS=$(go_os ${CBUILD})
487 + export CC=$(tc-getBUILD_CC)
488 +
489 + export GOARCH=$(go_arch)
490 + export GOOS=$(go_os)
491 + export CC_FOR_TARGET=$(tc-getCC)
492 + export CXX_FOR_TARGET=$(tc-getCXX)
493 + if [[ ${ARCH} == arm ]]; then
494 + export GOARM=$(go_arm)
495 + fi
496 +
497 + cd src
498 + ./make.bash || die "build failed"
499 +}
500 +
501 +src_test()
502 +{
503 + go_cross_compile && return 0
504 +
505 + cd src
506 + PATH="${GOBIN}:${PATH}" \
507 + ./run.bash -no-rebuild || die "tests failed"
508 +}
509 +
510 +src_install()
511 +{
512 + local bin_path f x
513 +
514 + dodir /usr/lib/go
515 +
516 + # There is a known issue which requires the source tree to be installed [1].
517 + # Once this is fixed, we can consider using the doc use flag to control
518 + # installing the doc and src directories.
519 + # [1] https://golang.org/issue/2775
520 + #
521 + # deliberately use cp to retain permissions
522 + cp -R api bin doc lib pkg misc src test "${ED}"/usr/lib/go
523 + if go_cross_compile; then
524 + bin_path="bin/$(go_tuple)"
525 + else
526 + bin_path=bin
527 + fi
528 + for x in ${bin_path}/*; do
529 + f=${x##*/}
530 + dosym ../lib/go/${bin_path}/${f} /usr/bin/${f}
531 + done
532 + einstalldocs
533 +
534 + if [[ ${CHOST} == *-darwin* ]] ; then
535 + # fix install_name for test object (binutils_test) on Darwin, it
536 + # is never used in real circumstances
537 + local libmac64="${EPREFIX}"/usr/lib/go/src/cmd/vendor/github.com/
538 + libmac64+=google/pprof/internal/binutils/testdata/lib_mac_64
539 + install_name_tool -id "${libmac64}" "${D}${libmac64}"
540 + fi
541 +}