diff options
author | Sören Tempel <soeren+git@soeren-tempel.net> | 2015-08-15 00:51:18 +0200 |
---|---|---|
committer | Francesco Colista <fcolista@alpinelinux.org> | 2015-08-17 09:45:08 +0000 |
commit | 330d303d57c584df80b7ec5ebe459b7f61132055 (patch) | |
tree | 8952c162ee7a4b20bb2446c927a98dbcbb45f7d4 | |
parent | 7d5c4f3da8f8613a4539169c5e8ad7f6111764b4 (diff) | |
download | aports-330d303d57c584df80b7ec5ebe459b7f61132055.tar.bz2 aports-330d303d57c584df80b7ec5ebe459b7f61132055.tar.xz |
main/go: major cleanup
-rw-r--r-- | main/go/APKBUILD | 84 |
1 files changed, 33 insertions, 51 deletions
diff --git a/main/go/APKBUILD b/main/go/APKBUILD index 46a829c679..62d891b830 100644 --- a/main/go/APKBUILD +++ b/main/go/APKBUILD @@ -4,7 +4,7 @@ pkgname=go pkgver=1.4.2 # This should be the latest commit on the corresponding release branch _toolsver="abf43428cc239218424c7a44dc9b5987cd351c3e" -pkgrel=2 +pkgrel=3 pkgdesc="Go programming language compiler" url="http://www.golang.org/" arch="x86 x86_64 armhf" @@ -14,7 +14,7 @@ depends_dev="" makedepends="bash perl" options="!strip" install="" -subpackages="$pkgname-tools:tools $pkgname-cross:cross" +subpackages="$pkgname-doc $pkgname-tools $pkgname-cross" source=" http://golang.org/dl/go${pkgver}.src.tar.gz tools.tar.gz::https://github.com/golang/tools/archive/${_toolsver}.tar.gz @@ -26,44 +26,39 @@ source=" default-sc-getpw-r-size-max.patch " +_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;; + *.patch) patch -p1 -i "$srcdir"/$i || return 1 ;; esac done } build() { + cd "$_builddir/src" + unset CC # ccache breaks build for some reason + 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) - export GOARCH="386" ;; - x86_64) - export GOARCH="amd64" ;; - arm*) - export GOARCH="arm" - export GOARM="6" ;; - *) - return 1 ;; + x86) export GOARCH="386" ;; + x86_64) export GOARCH="amd64" ;; + arm*) export GOARCH="arm" ;; + *) return 1 ;; esac - cd "$_builddir/src" - ./make.bash || return 1 - - for os in darwin freebsd openbsd windows; do + ./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 @@ -75,55 +70,43 @@ build() { mkdir -p "$GOPATH"/src/golang.org/x/tools cp -r "$_tooldir"/* "$GOPATH"/src/golang.org/x/tools - local tool= - for tool in cover vet godoc; do - "$GOROOT"/bin/go install golang.org/x/tools/cmd/$tool + for tool in $_gotools; do + "$GOROOT"/bin/go install \ + golang.org/x/tools/cmd/$tool || return 1 done } package() { - local f= d= cd "$_builddir" + mkdir -p "$pkgdir"/usr/bin "$pkgdir"/usr/lib/go "$pkgdir"/usr/share/doc/go - 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 + install -Dm755 bin/go "$pkgdir"/usr/bin || return 1 + install -Dm755 bin/gofmt "$pkgdir"/usr/bin || return 1 # 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. - install -dm755 "$pkgdir"/usr/lib/go/src - for p in src/*; do - if [ -d "$p" ]; then - cp -r $p "$pkgdir"/usr/lib/go/src - fi - done + 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 \( -type f -a -iname '*_test*' \) \ + -o \( -type d -name 'testdata' \) -exec rm -rf \{\} \+ } tools() { 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 + install -Dm755 "$_builddir"/bin/godoc \ + "$pkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH/$tool - local tool= - for tool in cover vet; do + for tool in $_gotools; 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/golang.org/x/tools/cmd/$tool/doc.go > \ - "$subpkgdir"/usr/lib/go/src/pkg/$tool/doc.go + "$subpkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH/$tool || return 1 done } @@ -134,7 +117,7 @@ cross() { mkdir -p "$subpkgdir"/usr/lib/go/pkg/tool \ "$subpkgdir"/usr/lib/go/src/runtime - for os in darwin freebsd openbsd windows; do + 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}_* \ @@ -142,7 +125,6 @@ cross() { mv "$pkgdir"/usr/lib/go/src/runtime/zasm_${os}*.h \ "$subpkgdir"/usr/lib/go/src/runtime || return 1 done - } md5sums="907f85c8fa765d31f7f955836fec4049 go1.4.2.src.tar.gz |