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