1 |
commit: fb31b281fd2b9a50af15dfea5d2997448629d993 |
2 |
Author: William Hubbs <williamh <AT> gentoo <DOT> org> |
3 |
AuthorDate: Tue Feb 23 19:59:13 2016 +0000 |
4 |
Commit: William Hubbs <williamh <AT> gentoo <DOT> org> |
5 |
CommitDate: Tue Feb 23 20:00:48 2016 +0000 |
6 |
URL: https://gitweb.gentoo.org/repo/gentoo.git/commit/?id=fb31b281 |
7 |
|
8 |
dev-lang/go: revbump to 1.6-r2 to use our provided bootstrap tarballs |
9 |
|
10 |
dev-lang/go/go-1.6-r2.ebuild | 237 +++++++++++++++++++++++++++++++++++++++++++ |
11 |
1 file changed, 237 insertions(+) |
12 |
|
13 |
diff --git a/dev-lang/go/go-1.6-r2.ebuild b/dev-lang/go/go-1.6-r2.ebuild |
14 |
new file mode 100644 |
15 |
index 0000000..8db9b01 |
16 |
--- /dev/null |
17 |
+++ b/dev-lang/go/go-1.6-r2.ebuild |
18 |
@@ -0,0 +1,237 @@ |
19 |
+# Copyright 1999-2015 Gentoo Foundation |
20 |
+# Distributed under the terms of the GNU General Public License v2 |
21 |
+# $Id$ |
22 |
+ |
23 |
+EAPI=6 |
24 |
+ |
25 |
+export CBUILD=${CBUILD:-${CHOST}} |
26 |
+export CTARGET=${CTARGET:-${CHOST}} |
27 |
+ |
28 |
+MY_PV=${PV/_/} |
29 |
+ |
30 |
+inherit toolchain-funcs |
31 |
+ |
32 |
+BOOTSTRAP_DIST="https://dev.gentoo.org/~williamh/dist" |
33 |
+SRC_URI=" |
34 |
+kernel_Darwin? ( |
35 |
+ x64-macos? ( ${BOOTSTRAP_DIST}/go-darwin-amd64-bootstrap.tbz ) |
36 |
+) |
37 |
+kernel_FreeBSD? ( |
38 |
+amd64-fbsd? ( ${BOOTSTRAP_DIST}/go-freebsd-amd64-bootstrap.tbz ) |
39 |
+x86-fbsd? ( ${BOOTSTRAP_DIST}/go-freebsd-386-bootstrap.tbz ) |
40 |
+) |
41 |
+kernel_linux? ( |
42 |
+ amd64? ( ${BOOTSTRAP_DIST}/go-linux-amd64-bootstrap.tbz ) |
43 |
+ arm? ( ${BOOTSTRAP_DIST}/go-linux-arm-bootstrap.tbz ) |
44 |
+ arm64? ( ${BOOTSTRAP_DIST}/go-linux-arm64-bootstrap.tbz ) |
45 |
+ ppc64? ( ${BOOTSTRAP_DIST}/go-linux-ppc64-bootstrap.tbz ) |
46 |
+ x86? ( ${BOOTSTRAP_DIST}/go-linux-386-bootstrap.tbz ) |
47 |
+) |
48 |
+" |
49 |
+ |
50 |
+if [[ ${PV} = 9999 ]]; then |
51 |
+ EGIT_REPO_URI="git://github.com/golang/go.git" |
52 |
+ inherit git-r3 |
53 |
+else |
54 |
+ SRC_URI+="https://storage.googleapis.com/golang/go${MY_PV}.src.tar.gz" |
55 |
+ # go-bootstrap-1.4 only supports go on amd64, arm and x86 architectures. |
56 |
+ # Allowing other bootstrap options would enable arm64 and ppc64 builds. |
57 |
+ case ${PV} in |
58 |
+ *9999*|*_rc*) ;; |
59 |
+ *) |
60 |
+ KEYWORDS="-* ~amd64" |
61 |
+ ;; |
62 |
+ esac |
63 |
+fi |
64 |
+ |
65 |
+DESCRIPTION="A concurrent garbage collected and typesafe programming language" |
66 |
+HOMEPAGE="http://www.golang.org" |
67 |
+ |
68 |
+LICENSE="BSD" |
69 |
+SLOT="0/${PV}" |
70 |
+IUSE="" |
71 |
+ |
72 |
+DEPEND="" |
73 |
+RDEPEND="!<dev-go/go-tools-0_pre20150902" |
74 |
+ |
75 |
+# These test data objects have writable/executable stacks. |
76 |
+QA_EXECSTACK="usr/lib/go/src/debug/elf/testdata/*.obj" |
77 |
+ |
78 |
+REQUIRES_EXCLUDE="/usr/lib/go/src/debug/elf/testdata/*" |
79 |
+ |
80 |
+# The tools in /usr/lib/go should not cause the multilib-strict check to fail. |
81 |
+QA_MULTILIB_PATHS="usr/lib/go/pkg/tool/.*/.*" |
82 |
+ |
83 |
+# The go language uses *.a files which are _NOT_ libraries and should not be |
84 |
+# stripped. The test data objects should also be left alone and unstripped. |
85 |
+STRIP_MASK="/usr/lib/go/pkg/*.a |
86 |
+ /usr/lib/go/src/debug/elf/testdata/* |
87 |
+ /usr/lib/go/src/debug/dwarf/testdata/* |
88 |
+ /usr/lib/go/src/runtime/race/*.syso" |
89 |
+ |
90 |
+if [[ ${PV} != 9999 ]]; then |
91 |
+ S="${WORKDIR}"/go |
92 |
+fi |
93 |
+ |
94 |
+go_arch() |
95 |
+{ |
96 |
+ # By chance most portage arch names match Go |
97 |
+ local portage_arch=$(tc-arch $@) |
98 |
+ case "${portage_arch}" in |
99 |
+ x86) echo 386;; |
100 |
+ x64-*) echo amd64;; |
101 |
+ *) echo "${portage_arch}";; |
102 |
+ esac |
103 |
+} |
104 |
+ |
105 |
+go_arm() |
106 |
+{ |
107 |
+ case "${1:-${CHOST}}" in |
108 |
+ armv5*) echo 5;; |
109 |
+ armv6*) echo 6;; |
110 |
+ armv7*) echo 7;; |
111 |
+ *) |
112 |
+ die "unknown GOARM for ${1:-${CHOST}}" |
113 |
+ ;; |
114 |
+ esac |
115 |
+} |
116 |
+ |
117 |
+go_os() |
118 |
+{ |
119 |
+ case "${1:-${CHOST}}" in |
120 |
+ *-linux*) echo linux;; |
121 |
+ *-darwin*) echo darwin;; |
122 |
+ *-freebsd*) echo freebsd;; |
123 |
+ *-netbsd*) echo netbsd;; |
124 |
+ *-openbsd*) echo openbsd;; |
125 |
+ *-solaris*) echo solaris;; |
126 |
+ *-cygwin*|*-interix*|*-winnt*) |
127 |
+ echo windows |
128 |
+ ;; |
129 |
+ *) |
130 |
+ die "unknown GOOS for ${1:-${CHOST}}" |
131 |
+ ;; |
132 |
+ esac |
133 |
+} |
134 |
+ |
135 |
+go_tuple() |
136 |
+{ |
137 |
+ echo "$(go_os $@)_$(go_arch $@)" |
138 |
+} |
139 |
+ |
140 |
+go_cross_compile() |
141 |
+{ |
142 |
+ [[ $(go_tuple ${CBUILD}) != $(go_tuple) ]] |
143 |
+} |
144 |
+ |
145 |
+pkg_pretend() |
146 |
+{ |
147 |
+ # make.bash does not understand cross-compiling a cross-compiler |
148 |
+ if [[ $(go_tuple) != $(go_tuple ${CTARGET}) ]]; then |
149 |
+ die "CHOST CTARGET pair unsupported: CHOST=${CHOST} CTARGET=${CTARGET}" |
150 |
+ fi |
151 |
+} |
152 |
+ |
153 |
+src_unpack() |
154 |
+{ |
155 |
+ if [[ ${PV} = 9999 ]]; then |
156 |
+ git-r3_src_unpack |
157 |
+ fi |
158 |
+ default |
159 |
+} |
160 |
+ |
161 |
+src_compile() |
162 |
+{ |
163 |
+ export GOROOT_BOOTSTRAP="${WORKDIR}"/go-$(go_os)-$(go_arch)-bootstrap |
164 |
+ export GOROOT_FINAL="${EPREFIX}"/usr/lib/go |
165 |
+ export GOROOT="$(pwd)" |
166 |
+ export GOBIN="${GOROOT}/bin" |
167 |
+ |
168 |
+ # Go's build script does not use BUILD/HOST/TARGET consistently. :( |
169 |
+ export GOHOSTARCH=$(go_arch ${CBUILD}) |
170 |
+ export GOHOSTOS=$(go_os ${CBUILD}) |
171 |
+ export CC=$(tc-getBUILD_CC) |
172 |
+ |
173 |
+ export GOARCH=$(go_arch) |
174 |
+ export GOOS=$(go_os) |
175 |
+ export CC_FOR_TARGET=$(tc-getCC) |
176 |
+ export CXX_FOR_TARGET=$(tc-getCXX) |
177 |
+ if [[ ${ARCH} == arm ]]; then |
178 |
+ export GOARM=$(go_arm) |
179 |
+ fi |
180 |
+ |
181 |
+ cd src |
182 |
+ ./make.bash || die "build failed" |
183 |
+} |
184 |
+ |
185 |
+src_test() |
186 |
+{ |
187 |
+ go_cross_compile && return 0 |
188 |
+ |
189 |
+ cd src |
190 |
+ PATH="${GOBIN}:${PATH}" \ |
191 |
+ ./run.bash -no-rebuild || die "tests failed" |
192 |
+} |
193 |
+ |
194 |
+src_install() |
195 |
+{ |
196 |
+ local bin_path f x |
197 |
+ |
198 |
+ dodir /usr/lib/go |
199 |
+ insinto /usr/lib/go |
200 |
+ |
201 |
+ # There is a known issue which requires the source tree to be installed [1]. |
202 |
+ # Once this is fixed, we can consider using the doc use flag to control |
203 |
+ # installing the doc and src directories. |
204 |
+ # [1] https://golang.org/issue/2775 |
205 |
+ doins -r bin doc lib pkg src |
206 |
+ fperms -R +x /usr/lib/go/bin /usr/lib/go/pkg/tool |
207 |
+ |
208 |
+ cp -a misc "${D}"/usr/lib/go/misc |
209 |
+ |
210 |
+ if go_cross_compile; then |
211 |
+ bin_path="bin/$(go_tuple)" |
212 |
+ else |
213 |
+ bin_path=bin |
214 |
+ fi |
215 |
+ for x in ${bin_path}/*; do |
216 |
+ f=${x##*/} |
217 |
+ dosym ../lib/go/${bin_path}/${f} /usr/bin/${f} |
218 |
+ done |
219 |
+ dodoc AUTHORS CONTRIBUTORS PATENTS README.md |
220 |
+} |
221 |
+ |
222 |
+pkg_preinst() |
223 |
+{ |
224 |
+ has_version '<dev-lang/go-1.4' && |
225 |
+ export had_support_files=true || |
226 |
+ export had_support_files=false |
227 |
+} |
228 |
+ |
229 |
+pkg_postinst() |
230 |
+{ |
231 |
+ # If the go tool sees a package file timestamped older than a dependancy it |
232 |
+ # will rebuild that file. So, in order to stop go from rebuilding lots of |
233 |
+ # packages for every build we need to fix the timestamps. The compiler and |
234 |
+ # linker are also checked - so we need to fix them too. |
235 |
+ ebegin "fixing timestamps to avoid unnecessary rebuilds" |
236 |
+ tref="usr/lib/go/pkg/*/runtime.a" |
237 |
+ find "${EROOT}"usr/lib/go -type f \ |
238 |
+ -exec touch -r "${EROOT}"${tref} {} \; |
239 |
+ eend $? |
240 |
+ |
241 |
+ if [[ ${PV} != 9999 && -n ${REPLACING_VERSIONS} && |
242 |
+ ${REPLACING_VERSIONS} != ${PV} ]]; then |
243 |
+ elog "Release notes are located at http://golang.org/doc/go${PV}" |
244 |
+ fi |
245 |
+ |
246 |
+ if $had_support_files; then |
247 |
+ ewarn |
248 |
+ ewarn "All editor support, IDE support, shell completion" |
249 |
+ ewarn "support, etc has been removed from the go package" |
250 |
+ ewarn "upstream." |
251 |
+ ewarn "For more information on which support is available, see" |
252 |
+ ewarn "the following URL:" |
253 |
+ ewarn "https://github.com/golang/go/wiki/IDEsAndTextEditorPlugins" |
254 |
+ fi |
255 |
+} |