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