1 |
commit: 7783b1430d62f8d4b2ab4492ec92263c4016bed9 |
2 |
Author: William Hubbs <william.hubbs <AT> sony <DOT> com> |
3 |
AuthorDate: Thu Jan 24 16:51:18 2019 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Thu Jan 24 16:52:03 2019 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=7783b143 |
7 |
|
8 |
dev-lang/go: 1.10.8 and 1.11.5 security bumps |
9 |
|
10 |
This is going directly to stable on amd64. |
11 |
Bug: https://github.com/golang/go/issues/29903 |
12 |
Copyright: Sony Interactive Entertainment Inc. |
13 |
Package-Manager: Portage-2.3.56, Repoman-2.3.12 |
14 |
RepoMan-Options: --force |
15 |
|
16 |
Signed-off-by: William Hubbs <williamh <AT> gentoo.org> |
17 |
|
18 |
dev-lang/go/Manifest | 2 + |
19 |
dev-lang/go/go-1.10.8.ebuild | 228 +++++++++++++++++++++++++++++++++++++++++ |
20 |
dev-lang/go/go-1.11.5.ebuild | 236 +++++++++++++++++++++++++++++++++++++++++++ |
21 |
3 files changed, 466 insertions(+) |
22 |
|
23 |
diff --git a/dev-lang/go/Manifest b/dev-lang/go/Manifest |
24 |
index 88a8275796f..2edca5a6180 100644 |
25 |
--- a/dev-lang/go/Manifest |
26 |
+++ b/dev-lang/go/Manifest |
27 |
@@ -10,4 +10,6 @@ DIST go-linux-ppc64le-bootstrap-1.8.tbz 52211575 BLAKE2B 7a28ec5a381369c4e9415c8 |
28 |
DIST go-linux-s390x-bootstrap-1.8.tbz 57124869 BLAKE2B 920a176b8f4fc3a816e724324bbb30a383d599e31a0d2093d24797dbcd0e799a662a3589dbb87d2f5dd16df07c4cf8f1e444e87b540ec732746bb025dc9271f8 SHA512 d429cae870d66217ab2e07c74209d3031d97baa4f899b4d70ae6283a1a5b1434b037904c4cfca0b2bc798d5ba0b358c3739e000eccbc74809baf564c5686df5a |
29 |
DIST go-solaris-amd64-bootstrap-1.8.tbz 54926326 BLAKE2B 0a45312f090d81ebf46fe5950cb65c059e2801394231e715e94145d1f918eb59b10472b2385e57ebd5cfb9eca0ad7290fb118436486b665520bb540970f971ab SHA512 52b849e5b9a940e10de7ba3df0ebdf6e1c5d631de9581d936c9edf8f38e6bb3314acbc2b2d5202b0528fde2a359d52bc0c6f39acf9b1b614725e4b4a947ed10d |
30 |
DIST go1.10.7.src.tar.gz 18333472 BLAKE2B 8e1d85ced41541f1c7a02208da6ff518d7af76e078c47b2b269b31868fad8578b70494aad0ab35a33b1273d2f55523ee5e97e688991a62bf2289821c1c669c1f SHA512 798e0ea053b38f4b4f5a6fbdefb30ad09d95b7e8af424bd5f1aa7856bf7ca4e9c9bbd32926e2936f2b332f88a1980e92e6b61862fd9e779edf64f965fd8d1ffe |
31 |
+DIST go1.10.8.src.tar.gz 18333813 BLAKE2B 69fd0e7c3e265162e48b2ed90c8f560071322a093e09ca926d3cb94f4f9b44548652066d0c2f44696f0da5e7342f3afa894b71116f9451a0b2438eb0e0df42df SHA512 c274b99e39b78dfdf6b6b1c4fd6a5a54bff1b3eba55a879413692586ac7f0d30772416dcb5f715213c650946ade649bd424981f77508d92510c717d1845e3ede |
32 |
DIST go1.11.4.src.tar.gz 21108067 BLAKE2B 3e9e433d9f85cadcf4c62bbc7a27d80944d4dbe4f4e43bdeddc407a7957a51b28082d5b90d4e27f06cc554792bb9eb7ccbf221003f012c91cd1f329af998ae4e SHA512 9aa2e1800807841ec0432289b672c1607bdcb295f29c02d38adfaf1e3bf043040c9f916e4cb170875d92fe168c5ba6baef2b3d1f824a56ff9138ca2cdcc646e0 |
33 |
+DIST go1.11.5.src.tar.gz 21108339 BLAKE2B 3a33a89e267e57fee688e4d67257810ca1f37cfb904b6806c3a566b021aa80153f59f64d3a61ed68f526f093e0d5b6b3c95565cd06622cf9a65eef81bc7e9733 SHA512 63500238e8d73e4b29279ee3eb9242960de93ccd3b52bacc4009f45cf123cb8edfe5f519d38c5b07bdf2a810925758511ff3255310a056113d0169f78be1d2f6 |
34 |
|
35 |
diff --git a/dev-lang/go/go-1.10.8.ebuild b/dev-lang/go/go-1.10.8.ebuild |
36 |
new file mode 100644 |
37 |
index 00000000000..d56956f0dd5 |
38 |
--- /dev/null |
39 |
+++ b/dev-lang/go/go-1.10.8.ebuild |
40 |
@@ -0,0 +1,228 @@ |
41 |
+# Copyright 1999-2019 Gentoo Authors |
42 |
+# Distributed under the terms of the GNU General Public License v2 |
43 |
+ |
44 |
+EAPI=6 |
45 |
+ |
46 |
+export CBUILD=${CBUILD:-${CHOST}} |
47 |
+export CTARGET=${CTARGET:-${CHOST}} |
48 |
+ |
49 |
+MY_PV=${PV/_/} |
50 |
+ |
51 |
+inherit toolchain-funcs |
52 |
+ |
53 |
+BOOTSTRAP_DIST="https://dev.gentoo.org/~williamh/dist" |
54 |
+BOOTSTRAP_VERSION="bootstrap-1.8" |
55 |
+BOOTSTRAP_URI=" |
56 |
+amd64? ( ${BOOTSTRAP_DIST}/go-linux-amd64-${BOOTSTRAP_VERSION}.tbz ) |
57 |
+arm? ( ${BOOTSTRAP_DIST}/go-linux-arm-${BOOTSTRAP_VERSION}.tbz ) |
58 |
+arm64? ( ${BOOTSTRAP_DIST}/go-linux-arm64-${BOOTSTRAP_VERSION}.tbz ) |
59 |
+ppc64? ( |
60 |
+ ${BOOTSTRAP_DIST}/go-linux-ppc64-${BOOTSTRAP_VERSION}.tbz |
61 |
+ ${BOOTSTRAP_DIST}/go-linux-ppc64le-${BOOTSTRAP_VERSION}.tbz |
62 |
+) |
63 |
+s390? ( ${BOOTSTRAP_DIST}/go-linux-s390x-${BOOTSTRAP_VERSION}.tbz ) |
64 |
+x86? ( ${BOOTSTRAP_DIST}/go-linux-386-${BOOTSTRAP_VERSION}.tbz ) |
65 |
+amd64-fbsd? ( ${BOOTSTRAP_DIST}/go-freebsd-amd64-${BOOTSTRAP_VERSION}.tbz ) |
66 |
+x86-fbsd? ( ${BOOTSTRAP_DIST}/go-freebsd-386-${BOOTSTRAP_VERSION}.tbz ) |
67 |
+x64-macos? ( ${BOOTSTRAP_DIST}/go-darwin-amd64-${BOOTSTRAP_VERSION}.tbz ) |
68 |
+x64-solaris? ( ${BOOTSTRAP_DIST}/go-solaris-amd64-${BOOTSTRAP_VERSION}.tbz ) |
69 |
+" |
70 |
+ |
71 |
+case ${PV} in |
72 |
+*9999*) |
73 |
+ EGIT_REPO_URI="https://github.com/golang/go.git" |
74 |
+ inherit git-r3 |
75 |
+ ;; |
76 |
+*) |
77 |
+ SRC_URI="https://storage.googleapis.com/golang/go${MY_PV}.src.tar.gz " |
78 |
+ S="${WORKDIR}"/go |
79 |
+ case ${PV} in |
80 |
+ *_beta*|*_rc*) ;; |
81 |
+ *) |
82 |
+ KEYWORDS="-* amd64 ~arm ~arm64 ~ppc64 ~s390 ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x64-macos ~x64-solaris" |
83 |
+ # The upstream tests fail under portage but pass if the build is |
84 |
+ # run according to their documentation [1]. |
85 |
+ # I am restricting the tests on released versions until this is |
86 |
+ # solved. |
87 |
+ # [1] https://golang.org/issues/18442 |
88 |
+ RESTRICT="test" |
89 |
+ ;; |
90 |
+ esac |
91 |
+esac |
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 |
+DEPEND="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/go/internal/gccgoimporter/testdata/escapeinfo.gox |
108 |
+ usr/lib/go/src/go/internal/gccgoimporter/testdata/unicode.gox |
109 |
+ usr/lib/go/src/go/internal/gccgoimporter/testdata/time.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)-$(go_arch)-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 |
+ einfo "GOROOT_BOOTSTRAP is ${GOROOT_BOOTSTRAP}" |
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 |
|
270 |
diff --git a/dev-lang/go/go-1.11.5.ebuild b/dev-lang/go/go-1.11.5.ebuild |
271 |
new file mode 100644 |
272 |
index 00000000000..21d56ebb034 |
273 |
--- /dev/null |
274 |
+++ b/dev-lang/go/go-1.11.5.ebuild |
275 |
@@ -0,0 +1,236 @@ |
276 |
+# Copyright 1999-2019 Gentoo Authors |
277 |
+# Distributed under the terms of the GNU General Public License v2 |
278 |
+ |
279 |
+EAPI=6 |
280 |
+ |
281 |
+export CBUILD=${CBUILD:-${CHOST}} |
282 |
+export CTARGET=${CTARGET:-${CHOST}} |
283 |
+ |
284 |
+MY_PV=${PV/_/} |
285 |
+ |
286 |
+inherit toolchain-funcs |
287 |
+ |
288 |
+BOOTSTRAP_DIST="https://dev.gentoo.org/~williamh/dist" |
289 |
+BOOTSTRAP_VERSION="bootstrap-1.8" |
290 |
+BOOTSTRAP_URI=" |
291 |
+amd64? ( ${BOOTSTRAP_DIST}/go-linux-amd64-${BOOTSTRAP_VERSION}.tbz ) |
292 |
+arm? ( ${BOOTSTRAP_DIST}/go-linux-arm-${BOOTSTRAP_VERSION}.tbz ) |
293 |
+arm64? ( ${BOOTSTRAP_DIST}/go-linux-arm64-${BOOTSTRAP_VERSION}.tbz ) |
294 |
+ppc64? ( |
295 |
+ ${BOOTSTRAP_DIST}/go-linux-ppc64-${BOOTSTRAP_VERSION}.tbz |
296 |
+ ${BOOTSTRAP_DIST}/go-linux-ppc64le-${BOOTSTRAP_VERSION}.tbz |
297 |
+) |
298 |
+s390? ( ${BOOTSTRAP_DIST}/go-linux-s390x-${BOOTSTRAP_VERSION}.tbz ) |
299 |
+x86? ( ${BOOTSTRAP_DIST}/go-linux-386-${BOOTSTRAP_VERSION}.tbz ) |
300 |
+amd64-fbsd? ( ${BOOTSTRAP_DIST}/go-freebsd-amd64-${BOOTSTRAP_VERSION}.tbz ) |
301 |
+x86-fbsd? ( ${BOOTSTRAP_DIST}/go-freebsd-386-${BOOTSTRAP_VERSION}.tbz ) |
302 |
+x64-macos? ( ${BOOTSTRAP_DIST}/go-darwin-amd64-${BOOTSTRAP_VERSION}.tbz ) |
303 |
+x64-solaris? ( ${BOOTSTRAP_DIST}/go-solaris-amd64-${BOOTSTRAP_VERSION}.tbz ) |
304 |
+" |
305 |
+ |
306 |
+case ${PV} in |
307 |
+*9999*) |
308 |
+ EGIT_REPO_URI="https://github.com/golang/go.git" |
309 |
+ inherit git-r3 |
310 |
+ ;; |
311 |
+*) |
312 |
+ SRC_URI="https://storage.googleapis.com/golang/go${MY_PV}.src.tar.gz " |
313 |
+ S="${WORKDIR}"/go |
314 |
+ case ${PV} in |
315 |
+ *_beta*|*_rc*) ;; |
316 |
+ *) |
317 |
+ KEYWORDS="-* amd64 ~arm ~arm64 ~ppc64 ~s390 ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x64-macos ~x64-solaris" |
318 |
+ # The upstream tests fail under portage but pass if the build is |
319 |
+ # run according to their documentation [1]. |
320 |
+ # I am restricting the tests on released versions until this is |
321 |
+ # solved. |
322 |
+ # [1] https://golang.org/issues/18442 |
323 |
+ RESTRICT="test" |
324 |
+ ;; |
325 |
+ esac |
326 |
+esac |
327 |
+SRC_URI+="!gccgo? ( ${BOOTSTRAP_URI} )" |
328 |
+ |
329 |
+DESCRIPTION="A concurrent garbage collected and typesafe programming language" |
330 |
+HOMEPAGE="https://golang.org" |
331 |
+ |
332 |
+LICENSE="BSD" |
333 |
+SLOT="0/${PV}" |
334 |
+IUSE="gccgo" |
335 |
+ |
336 |
+DEPEND="gccgo? ( >=sys-devel/gcc-5[go] )" |
337 |
+RDEPEND="!<dev-go/go-tools-0_pre20150902" |
338 |
+ |
339 |
+# These test data objects have writable/executable stacks. |
340 |
+QA_EXECSTACK=" |
341 |
+ usr/lib/go/src/debug/elf/testdata/*.obj |
342 |
+ usr/lib/go/src/go/internal/gccgoimporter/testdata/escapeinfo.gox |
343 |
+ usr/lib/go/src/go/internal/gccgoimporter/testdata/unicode.gox |
344 |
+ usr/lib/go/src/go/internal/gccgoimporter/testdata/time.gox |
345 |
+ " |
346 |
+ |
347 |
+# Do not complain about CFLAGS, etc, since Go doesn't use them. |
348 |
+QA_FLAGS_IGNORED='.*' |
349 |
+ |
350 |
+REQUIRES_EXCLUDE="/usr/lib/go/src/debug/elf/testdata/*" |
351 |
+ |
352 |
+# The tools in /usr/lib/go should not cause the multilib-strict check to fail. |
353 |
+QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*" |
354 |
+ |
355 |
+# Do not strip this package. Stripping is unsupported upstream and may |
356 |
+# fail. |
357 |
+RESTRICT+=" strip" |
358 |
+ |
359 |
+DOCS=( |
360 |
+AUTHORS |
361 |
+CONTRIBUTING.md |
362 |
+CONTRIBUTORS |
363 |
+PATENTS |
364 |
+README.md |
365 |
+) |
366 |
+ |
367 |
+go_arch() |
368 |
+{ |
369 |
+ # By chance most portage arch names match Go |
370 |
+ local portage_arch=$(tc-arch $@) |
371 |
+ case "${portage_arch}" in |
372 |
+ x86) echo 386;; |
373 |
+ x64-*) echo amd64;; |
374 |
+ ppc64) [[ $(tc-endian $@) = big ]] && echo ppc64 || echo ppc64le ;; |
375 |
+ s390) echo s390x ;; |
376 |
+ *) echo "${portage_arch}";; |
377 |
+ esac |
378 |
+} |
379 |
+ |
380 |
+go_arm() |
381 |
+{ |
382 |
+ case "${1:-${CHOST}}" in |
383 |
+ armv5*) echo 5;; |
384 |
+ armv6*) echo 6;; |
385 |
+ armv7*) echo 7;; |
386 |
+ *) |
387 |
+ die "unknown GOARM for ${1:-${CHOST}}" |
388 |
+ ;; |
389 |
+ esac |
390 |
+} |
391 |
+ |
392 |
+go_os() |
393 |
+{ |
394 |
+ case "${1:-${CHOST}}" in |
395 |
+ *-linux*) echo linux;; |
396 |
+ *-darwin*) echo darwin;; |
397 |
+ *-freebsd*) echo freebsd;; |
398 |
+ *-netbsd*) echo netbsd;; |
399 |
+ *-openbsd*) echo openbsd;; |
400 |
+ *-solaris*) echo solaris;; |
401 |
+ *-cygwin*|*-interix*|*-winnt*) |
402 |
+ echo windows |
403 |
+ ;; |
404 |
+ *) |
405 |
+ die "unknown GOOS for ${1:-${CHOST}}" |
406 |
+ ;; |
407 |
+ esac |
408 |
+} |
409 |
+ |
410 |
+go_tuple() |
411 |
+{ |
412 |
+ echo "$(go_os $@)_$(go_arch $@)" |
413 |
+} |
414 |
+ |
415 |
+go_cross_compile() |
416 |
+{ |
417 |
+ [[ $(go_tuple ${CBUILD}) != $(go_tuple) ]] |
418 |
+} |
419 |
+ |
420 |
+pkg_pretend() |
421 |
+{ |
422 |
+ # make.bash does not understand cross-compiling a cross-compiler |
423 |
+ if [[ $(go_tuple) != $(go_tuple ${CTARGET}) ]]; then |
424 |
+ die "CHOST CTARGET pair unsupported: CHOST=${CHOST} CTARGET=${CTARGET}" |
425 |
+ fi |
426 |
+} |
427 |
+ |
428 |
+src_unpack() |
429 |
+{ |
430 |
+ if [[ ${PV} = 9999 ]]; then |
431 |
+ git-r3_src_unpack |
432 |
+ fi |
433 |
+ default |
434 |
+} |
435 |
+ |
436 |
+src_compile() |
437 |
+{ |
438 |
+ export GOROOT_BOOTSTRAP="${WORKDIR}"/go-$(go_os)-$(go_arch)-bootstrap |
439 |
+ if use gccgo; then |
440 |
+ mkdir -p "${GOROOT_BOOTSTRAP}/bin" || die |
441 |
+ local go_binary=$(gcc-config --get-bin-path)/go-$(gcc-major-version) |
442 |
+ [[ -x ${go_binary} ]] || go_binary=$( |
443 |
+ find "${EPREFIX}"/usr/${CHOST}/gcc-bin/*/go-$(gcc-major-version) | |
444 |
+ sort -V | tail -n1) |
445 |
+ [[ -x ${go_binary} ]] || |
446 |
+ die "go-$(gcc-major-version): command not found" |
447 |
+ ln -s "${go_binary}" "${GOROOT_BOOTSTRAP}/bin/go" || die |
448 |
+ fi |
449 |
+ export GOROOT_FINAL="${EPREFIX}"/usr/lib/go |
450 |
+ export GOROOT="$(pwd)" |
451 |
+ export GOBIN="${GOROOT}/bin" |
452 |
+ |
453 |
+ # Go's build script does not use BUILD/HOST/TARGET consistently. :( |
454 |
+ export GOHOSTARCH=$(go_arch ${CBUILD}) |
455 |
+ export GOHOSTOS=$(go_os ${CBUILD}) |
456 |
+ export CC=$(tc-getBUILD_CC) |
457 |
+ |
458 |
+ export GOARCH=$(go_arch) |
459 |
+ export GOOS=$(go_os) |
460 |
+ export CC_FOR_TARGET=$(tc-getCC) |
461 |
+ export CXX_FOR_TARGET=$(tc-getCXX) |
462 |
+ if [[ ${ARCH} == arm ]]; then |
463 |
+ export GOARM=$(go_arm) |
464 |
+ fi |
465 |
+ einfo "GOROOT_BOOTSTRAP is ${GOROOT_BOOTSTRAP}" |
466 |
+ |
467 |
+ cd src |
468 |
+ ./make.bash || die "build failed" |
469 |
+} |
470 |
+ |
471 |
+src_test() |
472 |
+{ |
473 |
+ go_cross_compile && return 0 |
474 |
+ |
475 |
+ cd src |
476 |
+ PATH="${GOBIN}:${PATH}" \ |
477 |
+ ./run.bash -no-rebuild || die "tests failed" |
478 |
+} |
479 |
+ |
480 |
+src_install() |
481 |
+{ |
482 |
+ local bin_path f x |
483 |
+ |
484 |
+ dodir /usr/lib/go |
485 |
+ |
486 |
+ # There is a known issue which requires the source tree to be installed [1]. |
487 |
+ # Once this is fixed, we can consider using the doc use flag to control |
488 |
+ # installing the doc and src directories. |
489 |
+ # [1] https://golang.org/issue/2775 |
490 |
+ # |
491 |
+ # deliberately use cp to retain permissions |
492 |
+ cp -R api bin doc lib pkg misc src test "${ED}"/usr/lib/go |
493 |
+ if go_cross_compile; then |
494 |
+ bin_path="bin/$(go_tuple)" |
495 |
+ else |
496 |
+ bin_path=bin |
497 |
+ fi |
498 |
+ for x in ${bin_path}/*; do |
499 |
+ f=${x##*/} |
500 |
+ dosym ../lib/go/${bin_path}/${f} /usr/bin/${f} |
501 |
+ done |
502 |
+ einstalldocs |
503 |
+ |
504 |
+ if [[ ${CHOST} == *-darwin* ]] ; then |
505 |
+ # fix install_name for test object (binutils_test) on Darwin, it |
506 |
+ # is never used in real circumstances |
507 |
+ local libmac64="${EPREFIX}"/usr/lib/go/src/cmd/vendor/github.com/ |
508 |
+ libmac64+=google/pprof/internal/binutils/testdata/lib_mac_64 |
509 |
+ install_name_tool -id "${libmac64}" "${D}${libmac64}" |
510 |
+ fi |
511 |
+} |