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