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