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: Fri, 02 Apr 2021 16:05:05
Message-Id: 1617379376.d7048f76ed5b4d3adbe8fdeb5ec7e53c7e0e5bc5.williamh@gentoo
1 commit: d7048f76ed5b4d3adbe8fdeb5ec7e53c7e0e5bc5
2 Author: William Hubbs <williamh <AT> gentoo <DOT> org>
3 AuthorDate: Fri Apr 2 16:02:56 2021 +0000
4 Commit: William Hubbs <williamh <AT> gentoo <DOT> org>
5 CommitDate: Fri Apr 2 16:02:56 2021 +0000
6 URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=d7048f76
7
8 dev-lang/go: 1.16.3 bump
9
10 Signed-off-by: William Hubbs <williamh <AT> gentoo.org>
11
12 dev-lang/go/Manifest | 1 +
13 dev-lang/go/go-1.16.3.ebuild | 197 +++++++++++++++++++++++++++++++++++++++++++
14 2 files changed, 198 insertions(+)
15
16 diff --git a/dev-lang/go/Manifest b/dev-lang/go/Manifest
17 index 07556e9172d..a598708df2f 100644
18 --- a/dev-lang/go/Manifest
19 +++ b/dev-lang/go/Manifest
20 @@ -1,2 +1,3 @@
21 DIST go1.15.10.src.tar.gz 23021993 BLAKE2B 8143f7703d07d4793521bbb6b935b87ecd87df451cc5d03370a01bddabc284e85ec94a16fed378ee9ac8e3f0d6999402025bb1d6afa3c1810c6343205c4eb2d4 SHA512 4f0ceff8dc035ec50cd0d136678573f4d624bca6a19293d5ffd75868d94d264291e44519bc450e40e8de486ee44d720555550eecf86cbae1f0d64dee00f90764
22 DIST go1.16.2.src.tar.gz 20905135 BLAKE2B 35fccc72604bf8cc7b1b5677d995b88e3232559e32af51f96a63bfc8cabecec09d885b5b8aa4b2ba03c481254da20dbf9bd83387091931c08a1c5c180c071931 SHA512 d14858a75cc7411975aaca705e66145287dc96b4fac1b1b06b95377dc5e5d2762f060973744114f42c780b34ea4baef7038c94616649c2dcc5c97e261cefc6bd
23 +DIST go1.16.3.src.tar.gz 20912861 BLAKE2B da6752d06b86a5349a1bc11e7e4c61543fa75cf72d971fb7559c059b3d5d7721d4cba16ad63eeb00398c6e0c8b1b1d42f07c665182b4b70da83fe648f813eee0 SHA512 8808a3112a5bc89799491ed1aa1cb8744a5cc8d3cb5caa2a7dd711405266925093f90d437fccb66a48e5f994c7339077814f495a88baa7961e9cc9b0a6a838c7
24
25 diff --git a/dev-lang/go/go-1.16.3.ebuild b/dev-lang/go/go-1.16.3.ebuild
26 new file mode 100644
27 index 00000000000..461f57dcd52
28 --- /dev/null
29 +++ b/dev-lang/go/go-1.16.3.ebuild
30 @@ -0,0 +1,197 @@
31 +# Copyright 1999-2021 Gentoo Authors
32 +# Distributed under the terms of the GNU General Public License v2
33 +
34 +EAPI=7
35 +
36 +export CBUILD=${CBUILD:-${CHOST}}
37 +export CTARGET=${CTARGET:-${CHOST}}
38 +
39 +MY_PV=${PV/_/}
40 +
41 +inherit toolchain-funcs
42 +
43 +case ${PV} in
44 +*9999*)
45 + EGIT_REPO_URI="https://github.com/golang/go.git"
46 + inherit git-r3
47 + ;;
48 +*)
49 + SRC_URI="https://storage.googleapis.com/golang/go${MY_PV}.src.tar.gz "
50 + S="${WORKDIR}"/go
51 + case ${PV} in
52 + *_beta*|*_rc*) ;;
53 + *)
54 + KEYWORDS="-* ~amd64 ~arm ~arm64 ~ppc64 ~s390 ~x86 ~amd64-linux ~x86-linux ~x64-macos ~x64-solaris"
55 + ;;
56 + esac
57 +esac
58 +
59 +DESCRIPTION="A concurrent garbage collected and typesafe programming language"
60 +HOMEPAGE="https://golang.org"
61 +
62 +LICENSE="BSD"
63 +SLOT="0/${PV}"
64 +
65 +BDEPEND="|| (
66 + dev-lang/go
67 + dev-lang/go-bootstrap )"
68 +RDEPEND="!<dev-go/go-tools-0_pre20150902"
69 +
70 +# Do not complain about CFLAGS, etc, since Go doesn't use them.
71 +QA_FLAGS_IGNORED='.*'
72 +
73 +# The tools in /usr/lib/go should not cause the multilib-strict check to fail.
74 +QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*"
75 +
76 +# Do not strip this package. Stripping is unsupported upstream and may
77 +# fail.
78 +RESTRICT+=" strip"
79 +
80 +DOCS=(
81 +AUTHORS
82 +CONTRIBUTING.md
83 +CONTRIBUTORS
84 +PATENTS
85 +README.md
86 +)
87 +
88 +go_arch()
89 +{
90 + # By chance most portage arch names match Go
91 + local portage_arch=$(tc-arch $@)
92 + case "${portage_arch}" in
93 + x86) echo 386;;
94 + x64-*) echo amd64;;
95 + ppc64) [[ $(tc-endian $@) = big ]] && echo ppc64 || echo ppc64le ;;
96 + s390) echo s390x ;;
97 + *) echo "${portage_arch}";;
98 + esac
99 +}
100 +
101 +go_arm()
102 +{
103 + case "${1:-${CHOST}}" in
104 + armv5*) echo 5;;
105 + armv6*) echo 6;;
106 + armv7*) echo 7;;
107 + *)
108 + die "unknown GOARM for ${1:-${CHOST}}"
109 + ;;
110 + esac
111 +}
112 +
113 +go_os()
114 +{
115 + case "${1:-${CHOST}}" in
116 + *-linux*) echo linux;;
117 + *-darwin*) echo darwin;;
118 + *-freebsd*) echo freebsd;;
119 + *-netbsd*) echo netbsd;;
120 + *-openbsd*) echo openbsd;;
121 + *-solaris*) echo solaris;;
122 + *-cygwin*|*-interix*|*-winnt*)
123 + echo windows
124 + ;;
125 + *)
126 + die "unknown GOOS for ${1:-${CHOST}}"
127 + ;;
128 + esac
129 +}
130 +
131 +go_tuple()
132 +{
133 + echo "$(go_os $@)_$(go_arch $@)"
134 +}
135 +
136 +go_cross_compile()
137 +{
138 + [[ $(go_tuple ${CBUILD}) != $(go_tuple) ]]
139 +}
140 +
141 +src_compile()
142 +{
143 + if has_version -b dev-lang/go; then
144 + export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go"
145 + elif has_version -b dev-lang/go-bootstrap; then
146 + export GOROOT_BOOTSTRAP="${BROOT}/usr/lib/go-bootstrap"
147 + else
148 + eerror "Go cannot be built without go or go-bootstrap installed"
149 + die "Should not be here, please report a bug"
150 + fi
151 +
152 + export GOROOT_FINAL="${EPREFIX}"/usr/lib/go
153 + export GOROOT="$(pwd)"
154 + export GOBIN="${GOROOT}/bin"
155 +
156 + # Go's build script does not use BUILD/HOST/TARGET consistently. :(
157 + export GOHOSTARCH=$(go_arch ${CBUILD})
158 + export GOHOSTOS=$(go_os ${CBUILD})
159 + export CC=$(tc-getBUILD_CC)
160 +
161 + export GOARCH=$(go_arch)
162 + export GOOS=$(go_os)
163 + export CC_FOR_TARGET=$(tc-getCC)
164 + export CXX_FOR_TARGET=$(tc-getCXX)
165 + if [[ ${ARCH} == arm ]]; then
166 + export GOARM=$(go_arm)
167 + fi
168 +
169 + cd src
170 + bash -x ./make.bash || die "build failed"
171 +}
172 +
173 +src_test()
174 +{
175 + go_cross_compile && return 0
176 +
177 + cd src
178 + PATH="${GOBIN}:${PATH}" \
179 + ./run.bash -no-rebuild || die "tests failed"
180 + cd ..
181 + rm -fr pkg/*_race || die
182 + rm -fr pkg/obj/go-build || die
183 +}
184 +
185 +src_install()
186 +{
187 + # There is a known issue which requires the source tree to be installed [1].
188 + # Once this is fixed, we can consider using the doc use flag to control
189 + # installing the doc and src directories.
190 + # The use of cp is deliberate in order to retain permissions
191 + # [1] https://golang.org/issue/2775
192 + dodir /usr/lib/go
193 + cp -R api bin doc lib pkg misc src test "${ED}"/usr/lib/go
194 + einstalldocs
195 +
196 + # testdata directories are not needed on the installed system
197 + rm -fr $(find "${ED}"/usr/lib/go -iname testdata -type d -print)
198 +
199 + local bin_path
200 + if go_cross_compile; then
201 + bin_path="bin/$(go_tuple)"
202 + else
203 + bin_path=bin
204 + fi
205 + local f x
206 + for x in ${bin_path}/*; do
207 + f=${x##*/}
208 + dosym ../lib/go/${bin_path}/${f} /usr/bin/${f}
209 + done
210 +
211 + # install the @golang-rebuild set for Portage
212 + insinto /usr/share/portage/config/sets
213 + newins "${FILESDIR}"/go-sets.conf go.conf
214 +}
215 +
216 +pkg_postinst() {
217 + [[ -z ${REPLACING_VERSIONS} ]] && return
218 + einfo "After ${CATEGORY}/${PN} is updated it is recommended to rebuild"
219 + einfo "all packages compiled with previous versions of ${CATEGORY}/${PN}"
220 + einfo "due to the static linking nature of go."
221 + einfo "If this is not done, the packages compiled with the older"
222 + einfo "version of the compiler will not be updated until they are"
223 + einfo "updated individually, which could mean they will have"
224 + einfo "vulnerabilities."
225 + einfo "Run 'emerge @golang-rebuild' to rebuild all 'go' packages"
226 + einfo "See https://bugs.gentoo.org/752153 for more info"
227 +}