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