1 |
commit: 03b1aa533e83d4382509bbbacaba7b32549bc853 |
2 |
Author: William Hubbs <william.hubbs <AT> sony <DOT> com> |
3 |
AuthorDate: Wed Apr 10 22:15:43 2019 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Wed Apr 10 22:17:48 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=03b1aa53 |
7 |
|
8 |
dev-lang/go: 1.11.8 and 1.12.3 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.8.ebuild | 238 +++++++++++++++++++++++++++++++++++++++++++ |
16 |
dev-lang/go/go-1.12.3.ebuild | 238 +++++++++++++++++++++++++++++++++++++++++++ |
17 |
3 files changed, 478 insertions(+) |
18 |
|
19 |
diff --git a/dev-lang/go/Manifest b/dev-lang/go/Manifest |
20 |
index 155808adb43..e854b70f6f1 100644 |
21 |
--- a/dev-lang/go/Manifest |
22 |
+++ b/dev-lang/go/Manifest |
23 |
@@ -11,5 +11,7 @@ DIST go-linux-s390x-bootstrap-1.8.tbz 57124869 BLAKE2B 920a176b8f4fc3a816e724324 |
24 |
DIST go-solaris-amd64-bootstrap-1.8.tbz 54926326 BLAKE2B 0a45312f090d81ebf46fe5950cb65c059e2801394231e715e94145d1f918eb59b10472b2385e57ebd5cfb9eca0ad7290fb118436486b665520bb540970f971ab SHA512 52b849e5b9a940e10de7ba3df0ebdf6e1c5d631de9581d936c9edf8f38e6bb3314acbc2b2d5202b0528fde2a359d52bc0c6f39acf9b1b614725e4b4a947ed10d |
25 |
DIST go1.11.6.src.tar.gz 21113406 BLAKE2B e7372e9bf6190295176c66a328b3e31f9201776f16f1165136e24bdaf5c514d7895dd5880514fa054ee958ed5ff96814de9a555e47b3f6dddd388d1e57c0d05f SHA512 bc29df69a08a4e9e703de72b5eda5f2d63b78f18f3e7a1173eae5c6dd767f29f1b865a2fc3f692e15277df2d45e74ee17875b275eb3fc50aac2b88082e618bf5 |
26 |
DIST go1.11.7.src.tar.gz 21113223 BLAKE2B e58a947a43e8dbabbe6d4dc1384239b01160e4d9cc88ed866c8d6e5a0ef66dd89203b9fb95c14c5fcc50ad47f75b17440cf1df34cb793a435d7744e630845307 SHA512 26bc2a3ab51ebe1179cd83897dae6ca17f30126189bf2c0b60060a25f3f22e72bcda383055825a9151948f074a103a177ab5550f5c2d088448bdf5455448061e |
27 |
+DIST go1.11.8.src.tar.gz 21113433 BLAKE2B 272ef36664a180640f14afba18d2f715d5a335134b33cea449d14fd3b568c2322bbbac7aab254987fbd7dcf3d486dc8b1f62f14577ae2e57b21de1720d0f29a7 SHA512 00b57b0ebbbf53f4de718bf40e5dfdaf57cafa9932917d22e9723b5a33a62d335013ab49753d98f8fe30c71daca95c7addd921825fe0c3885942b342773050cc |
28 |
DIST go1.12.1.src.tar.gz 21963082 BLAKE2B fd9c0ca19e6bd285c52034a88df1a58f96b957483362fac2e0c0f2a9dddde0543e7569d76fb93eff473774d152db361bfe9bdd354d80412c71ee5c4162010346 SHA512 b3fdfb874e6e0e0b50458085724fbd8e8b9be212df3f777b97db340aa3b80f32ee08d646a57a8a7d52ff6f19657d884dd25018c866c6173473aafa20a58f1975 |
29 |
DIST go1.12.2.src.tar.gz 21965624 BLAKE2B 9f4fbe62b37ccaf62517b2e5df3e1ada0155b7cb79067c2a74100df6d96ba89b0e372b5f1b1037b0cf98ea9f52623de00055793d011e5e39e92773a0cd87e41d SHA512 f7b8ffe8d3de7b456ba595deece5b092db8645e95d901826c33428af0151731921437222dcb5d52c9d937da4ebeb3192c30aa17052aa88c9e425e96cac2d79bb |
30 |
+DIST go1.12.3.src.tar.gz 21965718 BLAKE2B 226b1028eb47cee8ccc0b72130a098a65211cf0e54030fe626b6b9cf1c16993e0a9677a443c07abd997e0f2bfbc1711c703a40869ae1ecbb8b8dfa0fbf31c0b2 SHA512 bd33e958f2e8550da14afc0576928d00d2b8ecac569ddcf3551e44a342ce78ad3934e36109cbe6c15d31c55448ccc092f6e1fbf82685d6702402ab67106a1424 |
31 |
|
32 |
diff --git a/dev-lang/go/go-1.11.8.ebuild b/dev-lang/go/go-1.11.8.ebuild |
33 |
new file mode 100644 |
34 |
index 00000000000..4cb21b53d19 |
35 |
--- /dev/null |
36 |
+++ b/dev-lang/go/go-1.11.8.ebuild |
37 |
@@ -0,0 +1,238 @@ |
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 ~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 is not being used to build Go, there is no way to know the |
89 |
+# architecture or operating system of the build machine, so we need to |
90 |
+# download all of our bootstrap archives to allow this ebuild to work |
91 |
+# under crossdev. |
92 |
+# |
93 |
+# https://bugs.gentoo.org/671394 |
94 |
+SRC_URI+="!gccgo? ( ${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" |
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 |
+} |
192 |
+ |
193 |
+src_unpack() |
194 |
+{ |
195 |
+ if [[ ${PV} = 9999 ]]; then |
196 |
+ git-r3_src_unpack |
197 |
+ fi |
198 |
+ default |
199 |
+} |
200 |
+ |
201 |
+src_compile() |
202 |
+{ |
203 |
+ export GOROOT_BOOTSTRAP="${WORKDIR}"/go-$(go_os ${CBUILD})-$(go_arch ${CBUILD})-bootstrap |
204 |
+ if use gccgo; then |
205 |
+ mkdir -p "${GOROOT_BOOTSTRAP}/bin" || die |
206 |
+ local go_binary=$(gcc-config --get-bin-path)/go-$(gcc-major-version) |
207 |
+ [[ -x ${go_binary} ]] || go_binary=$( |
208 |
+ find "${EPREFIX}"/usr/${CHOST}/gcc-bin/*/go-$(gcc-major-version) | |
209 |
+ sort -V | tail -n1) |
210 |
+ [[ -x ${go_binary} ]] || |
211 |
+ die "go-$(gcc-major-version): command not found" |
212 |
+ ln -s "${go_binary}" "${GOROOT_BOOTSTRAP}/bin/go" || die |
213 |
+ fi |
214 |
+ export GOROOT_FINAL="${EPREFIX}"/usr/lib/go |
215 |
+ export GOROOT="$(pwd)" |
216 |
+ export GOBIN="${GOROOT}/bin" |
217 |
+ |
218 |
+ # Go's build script does not use BUILD/HOST/TARGET consistently. :( |
219 |
+ export GOHOSTARCH=$(go_arch ${CBUILD}) |
220 |
+ export GOHOSTOS=$(go_os ${CBUILD}) |
221 |
+ export CC=$(tc-getBUILD_CC) |
222 |
+ |
223 |
+ export GOARCH=$(go_arch) |
224 |
+ export GOOS=$(go_os) |
225 |
+ export CC_FOR_TARGET=$(tc-getCC) |
226 |
+ export CXX_FOR_TARGET=$(tc-getCXX) |
227 |
+ if [[ ${ARCH} == arm ]]; then |
228 |
+ export GOARM=$(go_arm) |
229 |
+ fi |
230 |
+ |
231 |
+ cd src |
232 |
+ ./make.bash || die "build failed" |
233 |
+} |
234 |
+ |
235 |
+src_test() |
236 |
+{ |
237 |
+ go_cross_compile && return 0 |
238 |
+ |
239 |
+ cd src |
240 |
+ PATH="${GOBIN}:${PATH}" \ |
241 |
+ ./run.bash -no-rebuild || die "tests failed" |
242 |
+} |
243 |
+ |
244 |
+src_install() |
245 |
+{ |
246 |
+ local bin_path f x |
247 |
+ |
248 |
+ dodir /usr/lib/go |
249 |
+ |
250 |
+ # There is a known issue which requires the source tree to be installed [1]. |
251 |
+ # Once this is fixed, we can consider using the doc use flag to control |
252 |
+ # installing the doc and src directories. |
253 |
+ # [1] https://golang.org/issue/2775 |
254 |
+ # |
255 |
+ # deliberately use cp to retain permissions |
256 |
+ cp -R api bin doc lib pkg misc src test "${ED}"/usr/lib/go |
257 |
+ if go_cross_compile; then |
258 |
+ bin_path="bin/$(go_tuple)" |
259 |
+ else |
260 |
+ bin_path=bin |
261 |
+ fi |
262 |
+ for x in ${bin_path}/*; do |
263 |
+ f=${x##*/} |
264 |
+ dosym ../lib/go/${bin_path}/${f} /usr/bin/${f} |
265 |
+ done |
266 |
+ einstalldocs |
267 |
+ |
268 |
+ if [[ ${CHOST} == *-darwin* ]] ; then |
269 |
+ # fix install_name for test object (binutils_test) on Darwin, it |
270 |
+ # is never used in real circumstances |
271 |
+ local libmac64="${EPREFIX}"/usr/lib/go/src/cmd/vendor/github.com/ |
272 |
+ libmac64+=google/pprof/internal/binutils/testdata/lib_mac_64 |
273 |
+ install_name_tool -id "${libmac64}" "${D}${libmac64}" |
274 |
+ fi |
275 |
+} |
276 |
|
277 |
diff --git a/dev-lang/go/go-1.12.3.ebuild b/dev-lang/go/go-1.12.3.ebuild |
278 |
new file mode 100644 |
279 |
index 00000000000..4cb21b53d19 |
280 |
--- /dev/null |
281 |
+++ b/dev-lang/go/go-1.12.3.ebuild |
282 |
@@ -0,0 +1,238 @@ |
283 |
+# Copyright 1999-2019 Gentoo Authors |
284 |
+# Distributed under the terms of the GNU General Public License v2 |
285 |
+ |
286 |
+EAPI=7 |
287 |
+ |
288 |
+export CBUILD=${CBUILD:-${CHOST}} |
289 |
+export CTARGET=${CTARGET:-${CHOST}} |
290 |
+ |
291 |
+MY_PV=${PV/_/} |
292 |
+ |
293 |
+inherit toolchain-funcs |
294 |
+ |
295 |
+BOOTSTRAP_VERSION="bootstrap-1.8" |
296 |
+BOOTSTRAP_DIST="https://dev.gentoo.org/~williamh/dist" |
297 |
+BOOTSTRAP_URI=" |
298 |
+ ${BOOTSTRAP_DIST}/go-linux-amd64-${BOOTSTRAP_VERSION}.tbz |
299 |
+ ${BOOTSTRAP_DIST}/go-linux-arm-${BOOTSTRAP_VERSION}.tbz |
300 |
+ ${BOOTSTRAP_DIST}/go-linux-arm64-${BOOTSTRAP_VERSION}.tbz |
301 |
+ ${BOOTSTRAP_DIST}/go-linux-ppc64-${BOOTSTRAP_VERSION}.tbz |
302 |
+ ${BOOTSTRAP_DIST}/go-linux-ppc64le-${BOOTSTRAP_VERSION}.tbz |
303 |
+ ${BOOTSTRAP_DIST}/go-linux-s390x-${BOOTSTRAP_VERSION}.tbz |
304 |
+ ${BOOTSTRAP_DIST}/go-linux-386-${BOOTSTRAP_VERSION}.tbz |
305 |
+ ${BOOTSTRAP_DIST}/go-freebsd-amd64-${BOOTSTRAP_VERSION}.tbz |
306 |
+ ${BOOTSTRAP_DIST}/go-freebsd-386-${BOOTSTRAP_VERSION}.tbz |
307 |
+ ${BOOTSTRAP_DIST}/go-darwin-amd64-${BOOTSTRAP_VERSION}.tbz |
308 |
+ ${BOOTSTRAP_DIST}/go-solaris-amd64-${BOOTSTRAP_VERSION}.tbz |
309 |
+" |
310 |
+ |
311 |
+case ${PV} in |
312 |
+*9999*) |
313 |
+ EGIT_REPO_URI="https://github.com/golang/go.git" |
314 |
+ inherit git-r3 |
315 |
+ ;; |
316 |
+*) |
317 |
+ SRC_URI="https://storage.googleapis.com/golang/go${MY_PV}.src.tar.gz " |
318 |
+ S="${WORKDIR}"/go |
319 |
+ case ${PV} in |
320 |
+ *_beta*|*_rc*) ;; |
321 |
+ *) |
322 |
+ KEYWORDS="-* ~amd64 ~arm ~arm64 ~ppc64 ~s390 ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x64-macos ~x64-solaris" |
323 |
+ # The upstream tests fail under portage but pass if the build is |
324 |
+ # run according to their documentation [1]. |
325 |
+ # I am restricting the tests on released versions until this is |
326 |
+ # solved. |
327 |
+ # [1] https://golang.org/issues/18442 |
328 |
+ RESTRICT="test" |
329 |
+ ;; |
330 |
+ esac |
331 |
+esac |
332 |
+ |
333 |
+# If gccgo is not being used to build Go, there is no way to know the |
334 |
+# architecture or operating system of the build machine, so we need to |
335 |
+# download all of our bootstrap archives to allow this ebuild to work |
336 |
+# under crossdev. |
337 |
+# |
338 |
+# https://bugs.gentoo.org/671394 |
339 |
+SRC_URI+="!gccgo? ( ${BOOTSTRAP_URI} )" |
340 |
+ |
341 |
+DESCRIPTION="A concurrent garbage collected and typesafe programming language" |
342 |
+HOMEPAGE="https://golang.org" |
343 |
+ |
344 |
+LICENSE="BSD" |
345 |
+SLOT="0/${PV}" |
346 |
+IUSE="gccgo" |
347 |
+ |
348 |
+BDEPEND="gccgo? ( >=sys-devel/gcc-5[go] )" |
349 |
+RDEPEND="!<dev-go/go-tools-0_pre20150902" |
350 |
+ |
351 |
+# These test data objects have writable/executable stacks. |
352 |
+QA_EXECSTACK=" |
353 |
+ usr/lib/go/src/debug/elf/testdata/*.obj |
354 |
+ usr/lib/go/src/*.gox |
355 |
+ " |
356 |
+ |
357 |
+# Do not complain about CFLAGS, etc, since Go doesn't use them. |
358 |
+QA_FLAGS_IGNORED='.*' |
359 |
+ |
360 |
+REQUIRES_EXCLUDE="/usr/lib/go/src/debug/elf/testdata/*" |
361 |
+ |
362 |
+# The tools in /usr/lib/go should not cause the multilib-strict check to fail. |
363 |
+QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*" |
364 |
+ |
365 |
+# Do not strip this package. Stripping is unsupported upstream and may |
366 |
+# fail. |
367 |
+RESTRICT+=" strip" |
368 |
+ |
369 |
+DOCS=( |
370 |
+AUTHORS |
371 |
+CONTRIBUTING.md |
372 |
+CONTRIBUTORS |
373 |
+PATENTS |
374 |
+README.md |
375 |
+) |
376 |
+ |
377 |
+go_arch() |
378 |
+{ |
379 |
+ # By chance most portage arch names match Go |
380 |
+ local portage_arch=$(tc-arch $@) |
381 |
+ case "${portage_arch}" in |
382 |
+ x86) echo 386;; |
383 |
+ x64-*) echo amd64;; |
384 |
+ ppc64) [[ $(tc-endian $@) = big ]] && echo ppc64 || echo ppc64le ;; |
385 |
+ s390) echo s390x ;; |
386 |
+ *) echo "${portage_arch}";; |
387 |
+ esac |
388 |
+} |
389 |
+ |
390 |
+go_arm() |
391 |
+{ |
392 |
+ case "${1:-${CHOST}}" in |
393 |
+ armv5*) echo 5;; |
394 |
+ armv6*) echo 6;; |
395 |
+ armv7*) echo 7;; |
396 |
+ *) |
397 |
+ die "unknown GOARM for ${1:-${CHOST}}" |
398 |
+ ;; |
399 |
+ esac |
400 |
+} |
401 |
+ |
402 |
+go_os() |
403 |
+{ |
404 |
+ case "${1:-${CHOST}}" in |
405 |
+ *-linux*) echo linux;; |
406 |
+ *-darwin*) echo darwin;; |
407 |
+ *-freebsd*) echo freebsd;; |
408 |
+ *-netbsd*) echo netbsd;; |
409 |
+ *-openbsd*) echo openbsd;; |
410 |
+ *-solaris*) echo solaris;; |
411 |
+ *-cygwin*|*-interix*|*-winnt*) |
412 |
+ echo windows |
413 |
+ ;; |
414 |
+ *) |
415 |
+ die "unknown GOOS for ${1:-${CHOST}}" |
416 |
+ ;; |
417 |
+ esac |
418 |
+} |
419 |
+ |
420 |
+go_tuple() |
421 |
+{ |
422 |
+ echo "$(go_os $@)_$(go_arch $@)" |
423 |
+} |
424 |
+ |
425 |
+go_cross_compile() |
426 |
+{ |
427 |
+ [[ $(go_tuple ${CBUILD}) != $(go_tuple) ]] |
428 |
+} |
429 |
+ |
430 |
+pkg_pretend() |
431 |
+{ |
432 |
+ # make.bash does not understand cross-compiling a cross-compiler |
433 |
+ if [[ $(go_tuple) != $(go_tuple ${CTARGET}) ]]; then |
434 |
+ die "CHOST CTARGET pair unsupported: CHOST=${CHOST} CTARGET=${CTARGET}" |
435 |
+ fi |
436 |
+} |
437 |
+ |
438 |
+src_unpack() |
439 |
+{ |
440 |
+ if [[ ${PV} = 9999 ]]; then |
441 |
+ git-r3_src_unpack |
442 |
+ fi |
443 |
+ default |
444 |
+} |
445 |
+ |
446 |
+src_compile() |
447 |
+{ |
448 |
+ export GOROOT_BOOTSTRAP="${WORKDIR}"/go-$(go_os ${CBUILD})-$(go_arch ${CBUILD})-bootstrap |
449 |
+ if use gccgo; then |
450 |
+ mkdir -p "${GOROOT_BOOTSTRAP}/bin" || die |
451 |
+ local go_binary=$(gcc-config --get-bin-path)/go-$(gcc-major-version) |
452 |
+ [[ -x ${go_binary} ]] || go_binary=$( |
453 |
+ find "${EPREFIX}"/usr/${CHOST}/gcc-bin/*/go-$(gcc-major-version) | |
454 |
+ sort -V | tail -n1) |
455 |
+ [[ -x ${go_binary} ]] || |
456 |
+ die "go-$(gcc-major-version): command not found" |
457 |
+ ln -s "${go_binary}" "${GOROOT_BOOTSTRAP}/bin/go" || die |
458 |
+ fi |
459 |
+ export GOROOT_FINAL="${EPREFIX}"/usr/lib/go |
460 |
+ export GOROOT="$(pwd)" |
461 |
+ export GOBIN="${GOROOT}/bin" |
462 |
+ |
463 |
+ # Go's build script does not use BUILD/HOST/TARGET consistently. :( |
464 |
+ export GOHOSTARCH=$(go_arch ${CBUILD}) |
465 |
+ export GOHOSTOS=$(go_os ${CBUILD}) |
466 |
+ export CC=$(tc-getBUILD_CC) |
467 |
+ |
468 |
+ export GOARCH=$(go_arch) |
469 |
+ export GOOS=$(go_os) |
470 |
+ export CC_FOR_TARGET=$(tc-getCC) |
471 |
+ export CXX_FOR_TARGET=$(tc-getCXX) |
472 |
+ if [[ ${ARCH} == arm ]]; then |
473 |
+ export GOARM=$(go_arm) |
474 |
+ fi |
475 |
+ |
476 |
+ cd src |
477 |
+ ./make.bash || die "build failed" |
478 |
+} |
479 |
+ |
480 |
+src_test() |
481 |
+{ |
482 |
+ go_cross_compile && return 0 |
483 |
+ |
484 |
+ cd src |
485 |
+ PATH="${GOBIN}:${PATH}" \ |
486 |
+ ./run.bash -no-rebuild || die "tests failed" |
487 |
+} |
488 |
+ |
489 |
+src_install() |
490 |
+{ |
491 |
+ local bin_path f x |
492 |
+ |
493 |
+ dodir /usr/lib/go |
494 |
+ |
495 |
+ # There is a known issue which requires the source tree to be installed [1]. |
496 |
+ # Once this is fixed, we can consider using the doc use flag to control |
497 |
+ # installing the doc and src directories. |
498 |
+ # [1] https://golang.org/issue/2775 |
499 |
+ # |
500 |
+ # deliberately use cp to retain permissions |
501 |
+ cp -R api bin doc lib pkg misc src test "${ED}"/usr/lib/go |
502 |
+ if go_cross_compile; then |
503 |
+ bin_path="bin/$(go_tuple)" |
504 |
+ else |
505 |
+ bin_path=bin |
506 |
+ fi |
507 |
+ for x in ${bin_path}/*; do |
508 |
+ f=${x##*/} |
509 |
+ dosym ../lib/go/${bin_path}/${f} /usr/bin/${f} |
510 |
+ done |
511 |
+ einstalldocs |
512 |
+ |
513 |
+ if [[ ${CHOST} == *-darwin* ]] ; then |
514 |
+ # fix install_name for test object (binutils_test) on Darwin, it |
515 |
+ # is never used in real circumstances |
516 |
+ local libmac64="${EPREFIX}"/usr/lib/go/src/cmd/vendor/github.com/ |
517 |
+ libmac64+=google/pprof/internal/binutils/testdata/lib_mac_64 |
518 |
+ install_name_tool -id "${libmac64}" "${D}${libmac64}" |
519 |
+ fi |
520 |
+} |