Gentoo Archives: gentoo-commits

From: Dane Smith <c1pher@g.o>
To: gentoo-commits@l.g.o
Subject: [gentoo-commits] dev/c1pher:master commit in: dev-lang/go/, dev-lang/go/files/
Date: Sat, 29 Sep 2012 22:04:52
Message-Id: 1348956231.8893c7d56abb2fb04f52d49b0f0000df43267d25.c1pher@gentoo
1 commit: 8893c7d56abb2fb04f52d49b0f0000df43267d25
2 Author: Dane Smith <c1pher <AT> gentoo <DOT> org>
3 AuthorDate: Sat Sep 29 22:03:51 2012 +0000
4 Commit: Dane Smith <c1pher <AT> gentoo <DOT> org>
5 CommitDate: Sat Sep 29 22:03:51 2012 +0000
6 URL: http://git.overlays.gentoo.org/gitweb/?p=dev/c1pher.git;a=commit;h=8893c7d5
7
8 go version bump for my testing.
9
10 ---
11 dev-lang/go/Manifest | 4 +
12 dev-lang/go/files/go-1.0.3-hardened.patch | 44 +++++++++
13 dev-lang/go/go-1.0.3.ebuild | 139 +++++++++++++++++++++++++++++
14 dev-lang/go/metadata.xml | 13 +++
15 4 files changed, 200 insertions(+), 0 deletions(-)
16
17 diff --git a/dev-lang/go/Manifest b/dev-lang/go/Manifest
18 new file mode 100644
19 index 0000000..f4c134f
20 --- /dev/null
21 +++ b/dev-lang/go/Manifest
22 @@ -0,0 +1,4 @@
23 +AUX go-1.0.3-hardened.patch 1306 SHA256 793f3b25c8fdcaa39415388ee534aabeceb48c2c08ce1f59d7fa16abaf1034d2 SHA512 d31a11157884e6ea03d21c8bfab03087264f458ef120250e4e919a7eb595f30fbde913bb970918b0cb3af86ea6aefa59ab254af84a9295ab933f045a60e31085 WHIRLPOOL dcafb608fc2e1a2e4d72dfca7d0a58543f8a05a6f99502f74e4558764be33536392bbc63ef1c7c7fe21b7cf8e26b3cea46feee3d2d376bf4458f3ce6d16691ee
24 +DIST go1.0.3.src.tar.gz 7404849 SHA256 7fba3533d172f13629d3d8a79e57c620632b0bd075abe11d7698b338be0ae3df SHA512 8006b1c38b7d49f3ae040e405d1897218cbc941a81349f270e6f5fdfeb84ed9267cfcbadb414da4cef1135bb0e2377b295ade3f3d6411c6ae15149f7e1b717b1 WHIRLPOOL 15d8576a7210dcac0da45e3e43686e2b3135c01cc047f8881338fb437a54fd56c69b8eacbc1a395ebc0813e6940bbdfcde37518b214ba162851bc669a268b0f4
25 +EBUILD go-1.0.3.ebuild 3191 SHA256 7dede5ef3aff941a9d11154ccfb7db7c7091d98b3df6c900da80c5687c2926d6 SHA512 97c889c9b43302ca7fe2fd10999086e2248930ae0104e9dfbc77b36d1fcafb62076a517fb49df0ab65fc7dcd288e166ee220e2b694a67f688dcfe04131b4682d WHIRLPOOL 98d190be371d00a3514372efda7bc25335746681b66b751098b5c9232c412f4523ecdd17fd164e22abe3e3e7ff5069bf029eec4aa16e2beadd8766aec16e5af5
26 +MISC metadata.xml 448 SHA256 d53ad6b454d72353e0308a91a989a1a3345ae97c0199748dee1862576ad4476a SHA512 0c5fb551437353e87f87c91e576ef224b770f686700150c19e7f34e6903ba26910293bb74db9732a220006b873113662464646dd96e61503e4aa90cc84e14f75 WHIRLPOOL b3846a0fad8844ad7ec961b512cb12a9d588bfac28b2dc53798399ac8628ccbf6c06c5666b03eabef05b0acb0cea04d563252eaaa893341c5b3fe59475ffdab5
27
28 diff --git a/dev-lang/go/files/go-1.0.3-hardened.patch b/dev-lang/go/files/go-1.0.3-hardened.patch
29 new file mode 100644
30 index 0000000..39e9ccb
31 --- /dev/null
32 +++ b/dev-lang/go/files/go-1.0.3-hardened.patch
33 @@ -0,0 +1,44 @@
34 +Index: src/cmd/6l/asm.c
35 +===================================================================
36 +--- a/src/cmd/6l/asm.c
37 ++++ b/src/cmd/6l/asm.c
38 +@@ -1082,6 +1082,11 @@
39 + ph->type = PT_GNU_STACK;
40 + ph->flags = PF_W+PF_R;
41 + ph->align = 8;
42 ++
43 ++ ph = newElfPhdr();
44 ++ ph->type = PT_PAX_FLAGS;
45 ++ ph->flags = 0x2a00; // mprotect, randexec, emutramp disabled
46 ++ ph->align = 8;
47 +
48 + sh = newElfShstrtab(elfstr[ElfStrShstrtab]);
49 + sh->type = SHT_STRTAB;
50 +Index: src/cmd/8l/asm.c
51 +===================================================================
52 +--- a/src/cmd/8l/asm.c
53 ++++ b/src/cmd/8l/asm.c
54 +@@ -1127,6 +1127,11 @@
55 + ph->flags = PF_W+PF_R;
56 + ph->align = 4;
57 +
58 ++ ph = newElfPhdr();
59 ++ ph->type = PT_PAX_FLAGS;
60 ++ ph->flags = 0x2a00; // mprotect, randexec, emutramp disabled
61 ++ ph->align = 8;
62 ++
63 + sh = newElfShstrtab(elfstr[ElfStrShstrtab]);
64 + sh->type = SHT_STRTAB;
65 + sh->addralign = 1;
66 +Index: src/cmd/ld/elf.h
67 +===================================================================
68 +--- a/src/cmd/ld/elf.h
69 ++++ b/src/cmd/ld/elf.h
70 +@@ -251,6 +251,7 @@
71 + #define PT_LOPROC 0x70000000 /* First processor-specific type. */
72 + #define PT_HIPROC 0x7fffffff /* Last processor-specific type. */
73 + #define PT_GNU_STACK 0x6474e551
74 ++#define PT_PAX_FLAGS 0x65041580
75 +
76 + /* Values for p_flags. */
77 + #define PF_X 0x1 /* Executable. */
78
79 diff --git a/dev-lang/go/go-1.0.3.ebuild b/dev-lang/go/go-1.0.3.ebuild
80 new file mode 100644
81 index 0000000..e830e9c
82 --- /dev/null
83 +++ b/dev-lang/go/go-1.0.3.ebuild
84 @@ -0,0 +1,139 @@
85 +# Copyright 1999-2012 Gentoo Foundation
86 +# Distributed under the terms of the GNU General Public License v2
87 +# $Header: /var/cvsroot/gentoo-x86/dev-lang/go/go-1.0.2.ebuild,v 1.4 2012/09/14 18:29:06 maekke Exp $
88 +
89 +EAPI=4
90 +
91 +export CTARGET=${CTARGET:-${CHOST}}
92 +
93 +if [[ ${PV} = 9999 ]]; then
94 + EHG_REPO_URI="https://go.googlecode.com/hg"
95 + inherit mercurial
96 +fi
97 +inherit bash-completion-r1 elisp-common eutils
98 +
99 +if [[ ${PV} != 9999 ]]; then
100 + SRC_URI="http://go.googlecode.com/files/go${PV}.src.tar.gz"
101 + # Upstream only supports go on amd64, arm and x86 architectures.
102 + KEYWORDS="-* ~amd64 ~arm ~x86"
103 +fi
104 +
105 +DESCRIPTION="A concurrent garbage collected and typesafe programming language"
106 +HOMEPAGE="http://www.golang.org"
107 +
108 +LICENSE="BSD"
109 +SLOT="0"
110 +IUSE="bash-completion emacs vim-syntax zsh-completion"
111 +
112 +DEPEND="sys-apps/ed
113 + ${COMMON_DEPEND}"
114 +RDEPEND="bash-completion? ( app-shells/bash-completion )
115 + emacs? ( virtual/emacs )
116 + vim-syntax? ( || ( app-editors/vim app-editors/gvim ) )
117 + zsh-completion? ( app-shells/zsh-completion )
118 + ${COMMON_DEPEND}"
119 +
120 + # The go language stores binary data for packages in *.a files.
121 + # These are _NOT_ libraries, and should not be stripped.
122 +STRIP_MASK="/usr/lib/go/pkg/linux*/*.a"
123 +
124 +if [[ ${PV} != 9999 ]]; then
125 + S="${WORKDIR}"/go
126 +fi
127 +
128 +src_prepare()
129 +{
130 + if [[ ${PV} != 9999 ]]; then
131 + epatch "${FILESDIR}"/${P}-hardened.patch
132 + fi
133 + epatch_user
134 +}
135 +
136 +src_compile()
137 +{
138 + export GOROOT_FINAL=/usr/lib/go
139 + export GOROOT="$(pwd)"
140 + export GOBIN="${GOROOT}/bin"
141 + if [[ $CTARGET = armv5* ]]
142 + then
143 + export GOARM=5
144 + fi
145 +
146 + cd src
147 + ./make.bash || die "build failed"
148 + cd ..
149 +
150 + if use emacs; then
151 + elisp-compile misc/emacs/*.el
152 + fi
153 +}
154 +
155 +src_test()
156 +{
157 + cd src
158 + PATH="${GOBIN}:${PATH}" \
159 + ./run.bash --no-rebuild --banner || die "tests failed"
160 +}
161 +
162 +src_install()
163 +{
164 + dobin bin/*
165 + dodoc AUTHORS CONTRIBUTORS PATENTS README
166 +
167 + dodir /usr/lib/go
168 + insinto /usr/lib/go
169 +
170 + # There is a known issue which requires the source tree to be installed [1].
171 + # Once this is fixed, we can consider using the doc use flag to control
172 + # installing the doc and src directories.
173 + # [1] http://code.google.com/p/go/issues/detail?id=2775
174 + doins -r doc lib pkg src
175 +
176 + if use bash-completion; then
177 + dobashcomp misc/bash/go
178 + fi
179 +
180 + if use emacs; then
181 + elisp-install ${PN} misc/emacs/*.el misc/emacs/*.elc
182 + fi
183 +
184 + if use vim-syntax; then
185 + insinto /usr/share/vim/vimfiles
186 + doins -r misc/vim/ftdetect
187 + doins -r misc/vim/ftplugin
188 + doins -r misc/vim/syntax
189 + doins -r misc/vim/plugin
190 + doins -r misc/vim/indent
191 + fi
192 +
193 + if use zsh-completion; then
194 + insinto /usr/share/zsh/site-functions
195 + doins misc/zsh/go
196 + fi
197 +
198 + fperms -R +x /usr/lib/go/pkg/tool
199 +}
200 +
201 +pkg_postinst()
202 +{
203 + if use emacs; then
204 + elisp-site-regen
205 + fi
206 +
207 + # If the go tool sees a package file timestamped older than a dependancy it
208 + # will rebuild that file. So, in order to stop go from rebuilding lots of
209 + # packages for every build we need to fix the timestamps. The compiler and
210 + # linker are also checked - so we need to fix them too.
211 + ebegin "fixing timestamps to avoid unnecessary rebuilds"
212 + tref="usr/lib/go/pkg/*/runtime.a"
213 + find "${ROOT}"usr/lib/go/pkg -type f \
214 + -exec touch -r "${ROOT}"${tref} {} \;
215 + eend $?
216 +}
217 +
218 +pkg_postrm()
219 +{
220 + if use emacs; then
221 + elisp-site-regen
222 + fi
223 +}
224
225 diff --git a/dev-lang/go/metadata.xml b/dev-lang/go/metadata.xml
226 new file mode 100644
227 index 0000000..b8d8656
228 --- /dev/null
229 +++ b/dev-lang/go/metadata.xml
230 @@ -0,0 +1,13 @@
231 +<?xml version="1.0" encoding="UTF-8"?>
232 +<!DOCTYPE pkgmetadata SYSTEM "http://www.gentoo.org/dtd/metadata.dtd">
233 +<pkgmetadata>
234 + <maintainer>
235 + <email>williamh@g.o</email>
236 + <name>William Hubbs</name>
237 + </maintainer>
238 + <longdescription lang="en">
239 + Go is a new systems programming language developped at google by
240 + Rob Pike. It has garbage collection, coroutines, communication
241 + channels and a clean syntax.
242 + </longdescription>
243 +</pkgmetadata>