blob: ca37936b31bba6f275f53644696e9c815b4f2304 (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
|
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Maintainer: Eivind Uggedal <eivind@uggedal.com>
pkgname=go
pkgver=1.6.1
# This should be the latest commit on the corresponding release branch
_toolsver="c887be1b2ebd11663d4bf2fbca508c449172339e"
pkgrel=0
pkgdesc="Go programming language compiler"
url="http://www.golang.org/"
arch="all"
license="BSD"
depends=""
depends_dev=""
makedepends="bash go-bootstrap"
options="!strip"
install=""
subpackages="$pkgname-doc $pkgname-tools $pkgname-cross"
source="http://golang.org/dl/go${pkgver}.src.tar.gz
$pkgname-tools-$pkgver.tar.gz::https://github.com/golang/tools/archive/${_toolsver}.tar.gz
no-pic.patch
fix-musl.patch"
# NOTE: building go for x86 with grsec kernel requires:
# sysctl -w kernel.modify_ldt=1
_gotools="cover vet godoc"
_gocross="darwin freebsd openbsd windows"
_builddir="$srcdir"/$pkgname
_tooldir="$srcdir"/tools-${_toolsver}
prepare() {
local i
cd "$_builddir"
for i in $source; do
case $i in
*.patch) msg $i; patch -p1 -i "$srcdir"/$i || return 1;;
esac
done
}
build() {
cd "$_builddir/src"
export GOPATH="$srcdir"
export GOROOT="$_builddir"
export GOBIN="$GOROOT"/bin
export GOROOT_FINAL=/usr/lib/go
export GOROOT_BOOTSTRAP=/usr/lib/go-bootstrap
case "$CARCH" in
x86) export GOARCH="386" ;;
x86_64) export GOARCH="amd64" ;;
arm*) export GOARCH="arm" ;;
*) return 1 ;;
esac
./make.bash --no-clean || return 1
for os in $_gocross; do
for arch in "386" "amd64"; do
GOARCH=$arch GOOS=$os ./make.bash --no-clean || return 1
done
done
# FIXME some tests fail:
# PATH="$GOROOT/bin:$PATH" ./run.bash -no-rebuild || return 1
mkdir -p "$GOPATH"/src/golang.org/x/tools
cp -r "$_tooldir"/* "$GOPATH"/src/golang.org/x/tools
for tool in $_gotools; do
"$GOROOT"/bin/go install \
golang.org/x/tools/cmd/$tool || return 1
done
}
package() {
cd "$_builddir"
mkdir -p "$pkgdir"/usr/bin "$pkgdir"/usr/lib/go/bin "$pkgdir"/usr/share/doc/go
for binary in go gofmt; do
mv bin/"$binary" "$pkgdir"/usr/lib/go/bin/ || return 1
ln -s /usr/lib/go/bin/"$binary" "$pkgdir"/usr/bin/ || return 1
done
# The source needs to be installed due to an upstream
# bug (https://github.com/golang/go/issues/2775).
# When this is resolved we can split out the source to a
# go-doc sub package.
cp -a pkg src "$pkgdir"/usr/lib/go || return 1
cp -r doc misc "$pkgdir"/usr/share/doc/go || return 1
# Remove tests from /usr/lib/go/src.
# Those shouldn't be affacted by the upstream bug (see above).
find "$pkgdir"/usr/lib/go/src \( -type f -a -name "*_test.go" \) \
-exec rm -rf \{\} \+ || return 1
find "$pkgdir"/usr/lib/go/src \( -type d -a -name "testdata" \) \
-exec rm -rf \{\} \+ || return 1
find "$pkgdir"/usr/lib/go/src \( -type f -a -name "*.bash" \) \
-exec rm -rf \{\} \+ || return 1
rm -rf "$pkgdir"/usr/lib/go/pkg/bootstrap
rm -f "$pkgdir"/usr/lib/go/pkg/tool/*/api
}
tools() {
pkgdesc="Go programming language tools"
depends="$pkgname"
mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/usr/lib/go/bin
for binary in "$_builddir"/bin/*; do
mv $binary "$subpkgdir"/usr/lib/go/bin || return 1
ln -s /usr/lib/go/bin/"${binary##*/}" "$subpkgdir"/usr/bin/ || return 1
done
mkdir -p "$subpkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH
cp "$subpkgdir"/usr/lib/go/bin/godoc \
"$pkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH/godoc || return 1
for tool in $_gotools; do
mv "$pkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH/$tool \
"$subpkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH/$tool || return 1
done
}
cross() {
pkgdesk="Go cross compilers"
depends="$pkgname"
mkdir -p "$subpkgdir"/usr/lib/go/pkg/tool
for os in $_gocross; do
mv "$pkgdir"/usr/lib/go/pkg/tool/${os}_* \
"$subpkgdir"/usr/lib/go/pkg/tool || return 1
mv "$pkgdir"/usr/lib/go/pkg/${os}_* \
"$subpkgdir"/usr/lib/go/pkg || return 1
done
}
md5sums="29e1b0369825a56d79f6bd4eb29b0864 go1.6.1.src.tar.gz
733a96b59562ed84ff552542f16a3ab3 go-tools-1.6.1.tar.gz
efa8ac40fa8429f7cd6f23eca05a0a0f no-pic.patch
b7b8ea485b39a99e7959d27cbd57a32b fix-musl.patch"
sha256sums="1d4b53cdee51b2298afcf50926a7fa44b286f0bf24ff8323ce690a66daa7193f go1.6.1.src.tar.gz
955e5a119babad356d9cf00cdaaf3c27648d4451109b467c872fad8cc94d5b56 go-tools-1.6.1.tar.gz
1eb60ded9035e9692e4c17b2bb6e9c073e21261eaafa56ee0528d5d2c43a936d no-pic.patch
d9cb3c128f198d2aabfa96a117e2238a1ac0aaec3e50b9c6b7cf63ab8850f5a4 fix-musl.patch"
sha512sums="31ea2504f8ab0fd709005275d0c2129b6cdb4e5d34d6e2b435b23480674b135d1bff8de863b1e01201e757523f4dc28b6ebefeb87d7e855f2509a6837e436fab go1.6.1.src.tar.gz
955def7cc3e5ceb5d8e47477400007d32c25f3bc2764f04a0451bd0235af507e63a0966d201a345f51ac764471da8620b5357d1099ec39e2422bd04d25fd71b8 go-tools-1.6.1.tar.gz
51e4c3ee0cda98090db5d00468072bcbf5f0a1a429dd8dedddccaa1467b285f724b012be96d329566b195470bea0aaf4b464e8ba6d2029b0dd42678a7a14b663 no-pic.patch
5132a833f34ca8a0ebc7ee9eb66d75a6e0c45adf19980996bdb18b9c886077ef752e2b27d2bb23397245b9a225baf8c45f265a8f4521e136e69eb5d85d070e31 fix-musl.patch"
|