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