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