diff options
author | Eivind Uggedal <eivind@uggedal.com> | 2015-09-30 08:31:02 +0000 |
---|---|---|
committer | Eivind Uggedal <eivind@uggedal.com> | 2015-09-30 08:31:02 +0000 |
commit | 394aeb733e12eef9fc309fb8753c28d6095f4551 (patch) | |
tree | 22c62a0dd2190ad346496169e797ea21d5379de0 /community/go/APKBUILD | |
parent | 675a55b3a13ee4daef9e7a10f9ff9ae3c640e4d0 (diff) | |
download | aports-394aeb733e12eef9fc309fb8753c28d6095f4551.tar.bz2 aports-394aeb733e12eef9fc309fb8753c28d6095f4551.tar.xz |
community/go: moved from main
Diffstat (limited to 'community/go/APKBUILD')
-rw-r--r-- | community/go/APKBUILD | 144 |
1 files changed, 144 insertions, 0 deletions
diff --git a/community/go/APKBUILD b/community/go/APKBUILD new file mode 100644 index 0000000000..ca7451fac9 --- /dev/null +++ b/community/go/APKBUILD @@ -0,0 +1,144 @@ +# Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net> +# Maintainer: Eivind Uggedal <eivind@uggedal.com> +pkgname=go +pkgver=1.5.1 +# This should be the latest commit on the corresponding release branch +_toolsver="d02228d1857b9f49cd0252788516ff5584266eb6" +pkgrel=2 +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 + golang-tools-$pkgver.tar.gz::https://github.com/golang/tools/archive/${_toolsver}.tar.gz + no-pic.patch + default-sc-getpw-r-size-max.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 "$pkgdir"/usr/share/doc/go + + for binary in go gofmt; do + install -Dm755 bin/$binary "$pkgdir"/usr/lib/go/bin/$binary || return 1 + ln -s /usr/lib/go/bin/$binary "$pkgdir"/usr/bin/$binary || 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 + + # Remove bootstrap files. + rm -rf "$pkgdir"/usr/lib/go/pkg/bootstrap +} + +tools() { + pkgdesc="Go programming language tools" + depends="$pkgname" + + install -dm755 "$subpkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH + install -Dm755 "$_builddir"/bin/godoc \ + "$pkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH/$tool + + 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="4adfbdfca523cc1c229be8a321f3602f go1.5.1.src.tar.gz +c64b28ba5df8499bcc19adc995da991a golang-tools-1.5.1.tar.gz +b303cb36017c5f1303b1567b31b48de3 no-pic.patch +12a36502180b9801f8d9e60824563c92 default-sc-getpw-r-size-max.patch" +sha256sums="a889873e98d9a72ae396a9b7dd597c29dcd709cafa9097d9c4ba04cff0ec436b go1.5.1.src.tar.gz +80db6fc563df50eb924dbf4f96cef287fc6b89cc8b98595c1dac3c80a118f290 golang-tools-1.5.1.tar.gz +973144c68d10cdc740501ad814841912bae7c3936480fabb3f7fe092ba82ba7f no-pic.patch +70f8f9b3ad6b8639db2b401ae14747a6e8d762443ca054c358a5aa4815df7d1f default-sc-getpw-r-size-max.patch" +sha512sums="a3e92058c79502cfcb7d67143db67fef97393a416322b6f8b6c52b70879e7ab56e3cec94a9ca8046cc13b134845cc1e4b53c70d7208850092bf4edf04bf439ff go1.5.1.src.tar.gz +80813c2da74c7b25fa2cfd15b2505757e7f466469ac701cb22d190dc83a607f091c4dea207a2e371e53d7a1f5459e7b53e5eea53c95565e958a6eb7fcb212359 golang-tools-1.5.1.tar.gz +e21084dc07a74c7b6437ae22034b62e3a255692d32dba767c15efdb123d3159c03a02437a41350e512eaa2478a7afbd8b409317a779c56ee4939512d060d57fa no-pic.patch +d59c977341b9ab15664b4b0c4f3df9e74ce48ffbd59594a7abb5a0907469f9d362c4e558606dd4b7cd102c165dd53027bae6aa1c48623c2105461dcad4cee14d default-sc-getpw-r-size-max.patch" |