diff options
Diffstat (limited to 'main/go/APKBUILD')
-rw-r--r-- | main/go/APKBUILD | 151 |
1 files changed, 151 insertions, 0 deletions
diff --git a/main/go/APKBUILD b/main/go/APKBUILD new file mode 100644 index 000000000..6bfe138b9 --- /dev/null +++ b/main/go/APKBUILD @@ -0,0 +1,151 @@ +# Maintainer: Eivind Uggedal <eivind@uggedal.com> +pkgname=go +pkgver=1.2.1 +pkgrel=0 +pkgdesc="Go programming language compiler" +url="http://www.golang.org/" +arch="x86 x86_64" +license="BSD" +depends="" +depends_dev="" +makedepends="bash perl mercurial" +options="!strip" +install="" +subpackages=" + $pkgname-tools:tools + $pkgname-bash-completion:completion + $pkgname-vim:vim + " +source=" + http://go.googlecode.com/files/go${pkgver}.src.tar.gz + no-werror.patch + no-pic.patch + default-sc-getpw-r-size-max.patch + " + +_builddir="$srcdir"/$pkgname +_toolrepo=code.google.com/p/go.tools +_tooltag=release-branch.go1.2 + +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() { + export GOPATH="$srcdir" + export GOROOT="$_builddir" + export GOBIN="$GOROOT"/bin + export GOROOT_FINAL=/usr/lib/go + # ccache breaks build for some reason + unset CC + + case "$CARCH" in + x86) GOARCH=386;; + x86_64) GOARCH=amd64;; + *) return 1;; + esac + export GOARCH + + cd "$_builddir/src" + + ./make.bash || return 1 + + # FIXME: race and bench tests fail: + #PATH="$GOROOT/bin:$PATH" ./run.bash --no-rebuild --banner || return 1 + + # Build tools provided with the upstream binary distribution: + "$GOROOT"/bin/go get -d $_toolrepo/... + ( + cd "$srcdir"/src/$_toolrepo + hg update $_tooltag + ) + local tool + for tool in cover vet godoc; do + "$GOROOT"/bin/go install $_toolrepo/cmd/$tool + done +} + +package() { + local f d + cd "$_builddir" + + install -dm755 "$pkgdir"/usr/bin + for f in go gofmt; do + install -m755 bin/$f "$pkgdir"/usr/bin + done + + install -dm755 "$pkgdir"/usr/lib/go + cp -a pkg "$pkgdir"/usr/lib/go + + # The source needs to be installed due to an upstream + # bug (http://code.google.com/p/go/issues/detail?id=2775). + # When this is resolved we can split out the source to a + # go-doc sub package. + install -dm755 "$pkgdir"/usr/lib/go/src + for d in pkg cmd; do + cp -a src/$d "$pkgdir"/usr/lib/go/src + done +} + +tools() { + local tool + + pkgdesc="Go programming language tools" + depends="$pkgname" + + install -Dm755 "$_builddir"/bin/godoc "$subpkgdir"/usr/bin/godoc + + install -dm755 "$subpkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH + + for tool in cover vet; do + mv "$pkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH/$tool \ + "$subpkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH/$tool + done + + # Make documentation for tools available through godoc: + for tool in cover vet godoc; do + install -dm755 "$subpkgdir"/usr/lib/go/src/pkg/$tool + sed -e 's/^package main$/package documentation/' \ + "$srcdir"/src/$_toolrepo/cmd/$tool/doc.go > \ + "$subpkgdir"/usr/lib/go/src/pkg/$tool/doc.go + done +} + +completion() { + pkgdesc="Bash completion script for Go" + arch="noarch" + + install -Dm644 "$_builddir"/misc/bash/$pkgname \ + "$subpkgdir"/usr/share/bash-completion/completions/$pkgname +} + +vim() { + local f + + pkgdesc="Vim syntax for Go" + arch="noarch" + + for f in ftdetect/gofiletype.vim syntax/go.vim indent/go.vim; do + install -Dm644 "$_builddir"/misc/vim/$f \ + "$subpkgdir"/usr/share/vim/vimfiles/$f + done +} + +md5sums="6232fa4417004fc9dde823ad1eaf597c go1.2.1.src.tar.gz +65330c61f6d6c881033b0a95ca228edb no-werror.patch +4391be88ce8bacdd7fee433b39635583 no-pic.patch +2576180fb906455bb786ca2937bbe180 default-sc-getpw-r-size-max.patch" +sha256sums="1655a9367bec083df57cacc29add280c279791801e102fd851c00d8babd12a55 go1.2.1.src.tar.gz +65d38b9485da2ff9417a2c44a81b6e52cc9bd2727b27e7add10d48a63805d4a3 no-werror.patch +86fc68a50bc4a9336a003239adf1dcc6d7cabfb9c1bcf09b0d53d09100ceff12 no-pic.patch +be711a828ddda89dd28ffc19d88958471c832005f0666a8a28c8838c0082a208 default-sc-getpw-r-size-max.patch" +sha512sums="814fc4ea0a2ee0cb5eee0a8299c2d40ee7408b3ac5ae9251717aced20a029024c96b89385fb017958b4a79345b8460e11cdd43e97ed1bc15b151485d2229ab40 go1.2.1.src.tar.gz +3cf139723e6ff0cbf7aaf76295fe4208f2062f2d4086e36d05cad83919217b5355e0e79b0b515a06a578389301bd07b062cb58b98fc0f9e4badf190cd1c34826 no-werror.patch +a8e95c3c536a30e15b9bad5e623a085c521739639a58ac638679d99413a1bee8823729783123cbe4495ac42822df31f4776f0380a63786b9f4fc73190e012ae5 no-pic.patch +9e9a288ff912b57eff250db53891be166376ec3ee11fcde94b49f1ff1c9433ef531d6c12706258a65a8666e11142506ecc3778e4bbf43dbe23afd2492a3a17a4 default-sc-getpw-r-size-max.patch" |