Gentoo Archives: gentoo-commits

From: William Hubbs <williamh@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] repo/gentoo:master commit in: dev-lang/go/
Date: Tue, 26 Feb 2019 16:48:50
Message-Id: 1551199666.c5bed68ea3f7c700de930949d8ef992a76d8f309.williamh@gentoo
1 commit: c5bed68ea3f7c700de930949d8ef992a76d8f309
2 Author: William Hubbs <william.hubbs <AT> sony <DOT> com>
3 AuthorDate: Tue Feb 26 16:33:28 2019 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Tue Feb 26 16:47:46 2019 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=c5bed68e
7
8 dev-lang/go: go 1.12 version bump
9
10 Copyright: Sony Interactive Entertainment Inc.
11 Package-Manager: Portage-2.3.51, Repoman-2.3.12
12 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
13
14 dev-lang/go/Manifest | 1 +
15 dev-lang/go/go-1.12.ebuild | 236 +++++++++++++++++++++++++++++++++++++++++++++
16 2 files changed, 237 insertions(+)
17
18 diff --git a/dev-lang/go/Manifest b/dev-lang/go/Manifest
19 index 0f5ffb89972..88721914de0 100644
20 --- a/dev-lang/go/Manifest
21 +++ b/dev-lang/go/Manifest
22 @@ -11,3 +11,4 @@ DIST go-linux-s390x-bootstrap-1.8.tbz 57124869 BLAKE2B 920a176b8f4fc3a816e724324
23 DIST go-solaris-amd64-bootstrap-1.8.tbz 54926326 BLAKE2B 0a45312f090d81ebf46fe5950cb65c059e2801394231e715e94145d1f918eb59b10472b2385e57ebd5cfb9eca0ad7290fb118436486b665520bb540970f971ab SHA512 52b849e5b9a940e10de7ba3df0ebdf6e1c5d631de9581d936c9edf8f38e6bb3314acbc2b2d5202b0528fde2a359d52bc0c6f39acf9b1b614725e4b4a947ed10d
24 DIST go1.10.8.src.tar.gz 18333813 BLAKE2B 69fd0e7c3e265162e48b2ed90c8f560071322a093e09ca926d3cb94f4f9b44548652066d0c2f44696f0da5e7342f3afa894b71116f9451a0b2438eb0e0df42df SHA512 c274b99e39b78dfdf6b6b1c4fd6a5a54bff1b3eba55a879413692586ac7f0d30772416dcb5f715213c650946ade649bd424981f77508d92510c717d1845e3ede
25 DIST go1.11.5.src.tar.gz 21108339 BLAKE2B 3a33a89e267e57fee688e4d67257810ca1f37cfb904b6806c3a566b021aa80153f59f64d3a61ed68f526f093e0d5b6b3c95565cd06622cf9a65eef81bc7e9733 SHA512 63500238e8d73e4b29279ee3eb9242960de93ccd3b52bacc4009f45cf123cb8edfe5f519d38c5b07bdf2a810925758511ff3255310a056113d0169f78be1d2f6
26 +DIST go1.12.src.tar.gz 21962486 BLAKE2B 3581fa9eb2582cec8ece233930322d964dd03e82f2e44ac0cbe75869d4c184003db2b21dcf871fafe5a81380ba7da7675b2fe3549348dfa60bf27fa9af2bb824 SHA512 6a4b8e75b3f6455885e93961c502ab40822e6353d1108ce25ca857afbdca08a64b1408dbeba2d37db581d6c85b9a919de95fb7c0d487a327e555a30b51cd8410
27
28 diff --git a/dev-lang/go/go-1.12.ebuild b/dev-lang/go/go-1.12.ebuild
29 new file mode 100644
30 index 00000000000..533fda774e4
31 --- /dev/null
32 +++ b/dev-lang/go/go-1.12.ebuild
33 @@ -0,0 +1,236 @@
34 +# Copyright 1999-2019 Gentoo Authors
35 +# Distributed under the terms of the GNU General Public License v2
36 +
37 +EAPI=7
38 +
39 +export CBUILD=${CBUILD:-${CHOST}}
40 +export CTARGET=${CTARGET:-${CHOST}}
41 +
42 +MY_PV=${PV/_/}
43 +
44 +inherit toolchain-funcs
45 +
46 +BOOTSTRAP_DIST="https://dev.gentoo.org/~williamh/dist"
47 +BOOTSTRAP_VERSION="bootstrap-1.8"
48 +BOOTSTRAP_URI="
49 +amd64? ( ${BOOTSTRAP_DIST}/go-linux-amd64-${BOOTSTRAP_VERSION}.tbz )
50 +arm? ( ${BOOTSTRAP_DIST}/go-linux-arm-${BOOTSTRAP_VERSION}.tbz )
51 +arm64? ( ${BOOTSTRAP_DIST}/go-linux-arm64-${BOOTSTRAP_VERSION}.tbz )
52 +ppc64? (
53 + ${BOOTSTRAP_DIST}/go-linux-ppc64-${BOOTSTRAP_VERSION}.tbz
54 + ${BOOTSTRAP_DIST}/go-linux-ppc64le-${BOOTSTRAP_VERSION}.tbz
55 +)
56 +s390? ( ${BOOTSTRAP_DIST}/go-linux-s390x-${BOOTSTRAP_VERSION}.tbz )
57 +x86? ( ${BOOTSTRAP_DIST}/go-linux-386-${BOOTSTRAP_VERSION}.tbz )
58 +amd64-fbsd? ( ${BOOTSTRAP_DIST}/go-freebsd-amd64-${BOOTSTRAP_VERSION}.tbz )
59 +x86-fbsd? ( ${BOOTSTRAP_DIST}/go-freebsd-386-${BOOTSTRAP_VERSION}.tbz )
60 +x64-macos? ( ${BOOTSTRAP_DIST}/go-darwin-amd64-${BOOTSTRAP_VERSION}.tbz )
61 +x64-solaris? ( ${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 ~x86 ~amd64-fbsd ~x86-fbsd ~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 +SRC_URI+="!gccgo? ( ${BOOTSTRAP_URI} )"
86 +
87 +DESCRIPTION="A concurrent garbage collected and typesafe programming language"
88 +HOMEPAGE="https://golang.org"
89 +
90 +LICENSE="BSD"
91 +SLOT="0/${PV}"
92 +IUSE="gccgo"
93 +
94 +BDEPEND="gccgo? ( >=sys-devel/gcc-5[go] )"
95 +RDEPEND="!<dev-go/go-tools-0_pre20150902"
96 +
97 +# These test data objects have writable/executable stacks.
98 +QA_EXECSTACK="
99 + usr/lib/go/src/debug/elf/testdata/*.obj
100 + usr/lib/go/src/go/internal/gccgoimporter/testdata/escapeinfo.gox
101 + usr/lib/go/src/go/internal/gccgoimporter/testdata/unicode.gox
102 + usr/lib/go/src/go/internal/gccgoimporter/testdata/time.gox
103 + "
104 +
105 +# Do not complain about CFLAGS, etc, since Go doesn't use them.
106 +QA_FLAGS_IGNORED='.*'
107 +
108 +REQUIRES_EXCLUDE="/usr/lib/go/src/debug/elf/testdata/*"
109 +
110 +# The tools in /usr/lib/go should not cause the multilib-strict check to fail.
111 +QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*"
112 +
113 +# Do not strip this package. Stripping is unsupported upstream and may
114 +# fail.
115 +RESTRICT+=" strip"
116 +
117 +DOCS=(
118 +AUTHORS
119 +CONTRIBUTING.md
120 +CONTRIBUTORS
121 +PATENTS
122 +README.md
123 +)
124 +
125 +go_arch()
126 +{
127 + # By chance most portage arch names match Go
128 + local portage_arch=$(tc-arch $@)
129 + case "${portage_arch}" in
130 + x86) echo 386;;
131 + x64-*) echo amd64;;
132 + ppc64) [[ $(tc-endian $@) = big ]] && echo ppc64 || echo ppc64le ;;
133 + s390) echo s390x ;;
134 + *) echo "${portage_arch}";;
135 + esac
136 +}
137 +
138 +go_arm()
139 +{
140 + case "${1:-${CHOST}}" in
141 + armv5*) echo 5;;
142 + armv6*) echo 6;;
143 + armv7*) echo 7;;
144 + *)
145 + die "unknown GOARM for ${1:-${CHOST}}"
146 + ;;
147 + esac
148 +}
149 +
150 +go_os()
151 +{
152 + case "${1:-${CHOST}}" in
153 + *-linux*) echo linux;;
154 + *-darwin*) echo darwin;;
155 + *-freebsd*) echo freebsd;;
156 + *-netbsd*) echo netbsd;;
157 + *-openbsd*) echo openbsd;;
158 + *-solaris*) echo solaris;;
159 + *-cygwin*|*-interix*|*-winnt*)
160 + echo windows
161 + ;;
162 + *)
163 + die "unknown GOOS for ${1:-${CHOST}}"
164 + ;;
165 + esac
166 +}
167 +
168 +go_tuple()
169 +{
170 + echo "$(go_os $@)_$(go_arch $@)"
171 +}
172 +
173 +go_cross_compile()
174 +{
175 + [[ $(go_tuple ${CBUILD}) != $(go_tuple) ]]
176 +}
177 +
178 +pkg_pretend()
179 +{
180 + # make.bash does not understand cross-compiling a cross-compiler
181 + if [[ $(go_tuple) != $(go_tuple ${CTARGET}) ]]; then
182 + die "CHOST CTARGET pair unsupported: CHOST=${CHOST} CTARGET=${CTARGET}"
183 + fi
184 +}
185 +
186 +src_unpack()
187 +{
188 + if [[ ${PV} = 9999 ]]; then
189 + git-r3_src_unpack
190 + fi
191 + default
192 +}
193 +
194 +src_compile()
195 +{
196 + export GOROOT_BOOTSTRAP="${WORKDIR}"/go-$(go_os)-$(go_arch)-bootstrap
197 + if use gccgo; then
198 + mkdir -p "${GOROOT_BOOTSTRAP}/bin" || die
199 + local go_binary=$(gcc-config --get-bin-path)/go-$(gcc-major-version)
200 + [[ -x ${go_binary} ]] || go_binary=$(
201 + find "${EPREFIX}"/usr/${CHOST}/gcc-bin/*/go-$(gcc-major-version) |
202 + sort -V | tail -n1)
203 + [[ -x ${go_binary} ]] ||
204 + die "go-$(gcc-major-version): command not found"
205 + ln -s "${go_binary}" "${GOROOT_BOOTSTRAP}/bin/go" || die
206 + fi
207 + export GOROOT_FINAL="${EPREFIX}"/usr/lib/go
208 + export GOROOT="$(pwd)"
209 + export GOBIN="${GOROOT}/bin"
210 +
211 + # Go's build script does not use BUILD/HOST/TARGET consistently. :(
212 + export GOHOSTARCH=$(go_arch ${CBUILD})
213 + export GOHOSTOS=$(go_os ${CBUILD})
214 + export CC=$(tc-getBUILD_CC)
215 +
216 + export GOARCH=$(go_arch)
217 + export GOOS=$(go_os)
218 + export CC_FOR_TARGET=$(tc-getCC)
219 + export CXX_FOR_TARGET=$(tc-getCXX)
220 + if [[ ${ARCH} == arm ]]; then
221 + export GOARM=$(go_arm)
222 + fi
223 + einfo "GOROOT_BOOTSTRAP is ${GOROOT_BOOTSTRAP}"
224 +
225 + cd src
226 + ./make.bash || die "build failed"
227 +}
228 +
229 +src_test()
230 +{
231 + go_cross_compile && return 0
232 +
233 + cd src
234 + PATH="${GOBIN}:${PATH}" \
235 + ./run.bash -no-rebuild || die "tests failed"
236 +}
237 +
238 +src_install()
239 +{
240 + local bin_path f x
241 +
242 + dodir /usr/lib/go
243 +
244 + # There is a known issue which requires the source tree to be installed [1].
245 + # Once this is fixed, we can consider using the doc use flag to control
246 + # installing the doc and src directories.
247 + # [1] https://golang.org/issue/2775
248 + #
249 + # deliberately use cp to retain permissions
250 + cp -R api bin doc lib pkg misc src test "${ED}"/usr/lib/go
251 + if go_cross_compile; then
252 + bin_path="bin/$(go_tuple)"
253 + else
254 + bin_path=bin
255 + fi
256 + for x in ${bin_path}/*; do
257 + f=${x##*/}
258 + dosym ../lib/go/${bin_path}/${f} /usr/bin/${f}
259 + done
260 + einstalldocs
261 +
262 + if [[ ${CHOST} == *-darwin* ]] ; then
263 + # fix install_name for test object (binutils_test) on Darwin, it
264 + # is never used in real circumstances
265 + local libmac64="${EPREFIX}"/usr/lib/go/src/cmd/vendor/github.com/
266 + libmac64+=google/pprof/internal/binutils/testdata/lib_mac_64
267 + install_name_tool -id "${libmac64}" "${D}${libmac64}"
268 + fi
269 +}