blob: 7ed8ffe3e363bcb3ca4f18f101342e88eb6fad4d (
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
|
# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net>
# Contributor: Eivind Uggedal <eu@eju.no>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=go
# go binaries are statically linked, security updates require rebuilds
pkgver=1.13.1
pkgrel=0
pkgdesc="Go programming language compiler"
url="https://golang.org/"
arch="all"
license="BSD-3-Clause"
depends="binutils gcc"
makedepends="bash"
checkdepends="binutils-gold"
subpackages="$pkgname-doc"
source="https://golang.org/dl/go${pkgver/_/}.src.tar.gz
default-buildmode-pie.patch
set-external-linker.patch
"
case "$CARCH" in
x86) options="!check" ;; # FIXME
esac
# secfixes:
# 1.13.1-r0:
# - CVE-2019-16276
# 1.12.8-r0:
# - CVE-2019-9512
# - CVE-2019-9514
# - CVE-2019-14809
# 1.11.5-r0:
# - CVE-2019-6486
# 1.9.4-r0:
# - CVE-2018-6574
# NOTE: building go for x86 with grsec kernel requires:
# sysctl -w kernel.modify_ldt=1
# The following tests fail currently, most of them fail due to linking
# errors likely related to 'default-buildmode-pie.patch' or musl libc.
_brokentests="runtime debug/gosym cmd/.* cgo.* go_test:os/exec ^test.*"
if [ "$CBUILD" = "$CTARGET" ]; then
makedepends="go-bootstrap $makedepends"
provides="go-bootstrap=$pkgver-r$pkgrel"
subpackages="$subpackages"
else
pkgname="go-bootstrap"
makedepends="go $makedepends"
# Go expect host linker instead of the cross-compiler
export CC_FOR_TARGET="$CC"
export CC="${HOSTLD:-gcc}"
export CXX="${HOSTLD:-g++}"
export LD="${HOSTLD:-ld}"
fi
case "$CTARGET_ARCH" in
aarch64)export GOARCH="arm64" ;;
armel) export GOARCH="arm" GOARM=5 ;;
armhf) export GOARCH="arm" GOARM=6 ;;
armv7) export GOARCH="arm" GOARM=7 ;;
s390x) export GOARCH="s390x" ;;
x86) export GOARCH="386" GO386=387 ;;
x86_64) export GOARCH="amd64" ;;
ppc64le) export GOARCH="ppc64le" ;;
mips) export GOARCH="mips" GOMIPS=softfloat ;;
mips64) export GOARCH="mips64" GOMIPS64=softfloat ;;
mips64el) export GOARCH="mips64le" GOMIPS64=softfloat ;;
mipsel) export GOARCH="mipsle" GOMIPS=softfloat ;;
*) export GOARCH="unsupported";;
esac
builddir="$srcdir"/go
build() {
cd "$builddir/src"
export GOOS="linux"
export GOPATH="$srcdir"
export GOROOT="$builddir"
export GOBIN="$GOROOT"/bin
export GOROOT_FINAL=/usr/lib/go
local p; for p in /usr/lib/go-bootstrap /usr/lib/go-linux-$GOARCH-bootstrap /usr/lib/go; do
if [ -d "$p" ]; then
export GOROOT_BOOTSTRAP="$p"
break
fi
done
./make.bash
# copied from bootstrap.bash to fixup cross-built bootstrap go
if [ "$CBUILD" != "$CTARGET" ]; then
local gohostos="$(../bin/go env GOHOSTOS)"
local gohostarch="$(../bin/go env GOHOSTARCH)"
mv ../bin/*_*/* ../bin
rmdir ../bin/*_*
rm -rf "../pkg/${gohostos}_$gohostarch"* "../pkg/tool/${gohostos}_$gohostarch"*
rm -rf ../pkg/bootstrap ../pkg/obj
fi
}
check() {
cd "$builddir/src"
PATH="$builddir/bin:$PATH" ./run.bash -no-rebuild \
-run "!($(echo "$_brokentests" | tr " " "|"))$"
}
package() {
mkdir -p "$pkgdir"/usr/bin "$pkgdir"/usr/lib/go/bin "$pkgdir"/usr/share/doc/go
for binary in go gofmt; do
install -Dm755 bin/"$binary" "$pkgdir"/usr/lib/go/bin/"$binary"
ln -s /usr/lib/go/bin/"$binary" "$pkgdir"/usr/bin/
done
cp -a pkg lib "$pkgdir"/usr/lib/go
cp -r doc misc "$pkgdir"/usr/share/doc/go
rm -rf "$pkgdir"/usr/lib/go/pkg/obj
rm -rf "$pkgdir"/usr/lib/go/pkg/bootstrap
rm -f "$pkgdir"/usr/lib/go/pkg/tool/*/api
mkdir -p "$pkgdir"/usr/lib/go/
cp -a "$builddir"/src "$pkgdir"/usr/lib/go
# 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 \{\} \+
find "$pkgdir"/usr/lib/go/src \( -type d -a -name "testdata" \) \
-exec rm -rf \{\} \+
find "$pkgdir"/usr/lib/go/src -type f -a \( -name "*.bash" -o -name "*.rc" -o -name "*.bat" \) \
-exec rm -rf \{\} \+
}
sha512sums="696fc735271bd76ae59c5015c8efa52121243257f4ffcc1460fd79cf9a5e167db0b30d04137ec71a8789742673c2288bd62d55b546c2d2b2a05e8b3669af8616 go1.13.1.src.tar.gz
f0c07d9979fc3165fc78158406de8440624b3f2c6f6542c9889c71efbf3d2f02a7ffee27ccba8c2630489895d331b7b9d3a606162134dcb3e8e0b9fc06b529dc default-buildmode-pie.patch
faf8de430df185842902322f064254f3e9ecee0884b3075b5550c85da15ff61ea6c2bb8d0fb7cf3887abc0e40974bd73ee8f8c14da7f914dde7e9220177c4e2a set-external-linker.patch"
|