diff options
author | Timo Teräs <timo.teras@iki.fi> | 2017-06-19 12:05:27 +0000 |
---|---|---|
committer | Timo Teräs <timo.teras@iki.fi> | 2017-06-19 12:07:30 +0000 |
commit | bbff2dbbfb18d91405a9314b20ae5581d9988f2a (patch) | |
tree | 14de99a329410b91780e147a0bb3fa67fa0fbd51 /community | |
parent | 055d3f02a0c0c0a1f59bff2a4060b42c3b4a7ff5 (diff) | |
download | aports-bbff2dbbfb18d91405a9314b20ae5581d9988f2a.tar.bz2 aports-bbff2dbbfb18d91405a9314b20ae5581d9988f2a.tar.xz |
community/go: upgrade to 1.8.3, modernize aport
- remove unneeded "|| return 1"
- make copying sources as separate step
- fix 'rootpkg' to be invokable as individual step multiple times
(fix environment, and not moving things out of $builddir)
- do not ship cross-built tools in 'go-tools' package
Diffstat (limited to 'community')
-rw-r--r-- | community/go/APKBUILD | 91 |
1 files changed, 44 insertions, 47 deletions
diff --git a/community/go/APKBUILD b/community/go/APKBUILD index f0e3ace4a8..43f9ea9c4b 100644 --- a/community/go/APKBUILD +++ b/community/go/APKBUILD @@ -1,10 +1,10 @@ # Contributor: Sören Tempel <soeren+alpine@soeren-tempel.net> # Maintainer: Eivind Uggedal <eivind@uggedal.com> pkgname=go -pkgver=1.8.1 +pkgver=1.8.3 # This should be the latest commit on the corresponding release branch _toolsver="5682db0e919ed9cfc6f52ac32e170511a106eb3b" -pkgrel=2 +pkgrel=0 pkgdesc="Go programming language compiler" url="http://www.golang.org/" arch="all" @@ -46,21 +46,21 @@ for os in $_gocross; do subpackages="$subpackages $pkgname-cross-${os}:_crosspkg" done +case "$CTARGET_ARCH" in +aarch64)export GOARCH="arm64" ;; +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" ;; +*) die "Unsupported arch" ;; +esac + builddir="$srcdir"/go build() { cd "$builddir/src" - case "$CTARGET_ARCH" in - aarch64)export GOARCH="arm64" ;; - 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" ;; - *) die "Unsupported arch" ;; - esac - export GOOS="linux" export GOPATH="$srcdir" export GOROOT="$builddir" @@ -92,14 +92,13 @@ build() { fi # FIXME some tests fail: - # PATH="$GOROOT/bin:$PATH" ./run.bash -no-rebuild || return 1 + # PATH="$GOROOT/bin:$PATH" ./run.bash -no-rebuild 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 + "$GOROOT"/bin/go install golang.org/x/tools/cmd/$tool done } @@ -108,50 +107,48 @@ package() { 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 + 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/bootstrap + rm -f "$pkgdir"/usr/lib/go/pkg/tool/*/api + # 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-src sub package. - cp -a pkg src lib "$pkgdir"/usr/lib/go || return 1 - cp -r doc misc "$pkgdir"/usr/share/doc/go || return 1 + mkdir -p "$subpkgdir"/usr/lib/go/ + cp -a "$builddir"/src "$subpkgdir"/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 \{\} \+ || 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" -o -name "*.rc" -o -name "*.bat" \) \ - -exec rm -rf \{\} \+ || return 1 - - rm -rf "$pkgdir"/usr/lib/go/pkg/bootstrap - rm -f "$pkgdir"/usr/lib/go/pkg/tool/*/api + find "$subpkgdir"/usr/lib/go/src \( -type f -a -name "*_test.go" \) \ + -exec rm -rf \{\} \+ + find "$subpkgdir"/usr/lib/go/src \( -type d -a -name "testdata" \) \ + -exec rm -rf \{\} \+ + find "$subpkgdir"/usr/lib/go/src -type f -a \( -name "*.bash" -o -name "*.rc" -o -name "*.bat" \) \ + -exec rm -rf \{\} \+ } 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 + mkdir -p "$subpkgdir"/usr/bin "$subpkgdir"/usr/lib/go/bin \ + "$subpkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH for tool in $_gotools; do - [ -f "$pkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH/$tool ] \ - || continue - - mv "$pkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH/$tool \ - "$subpkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH/$tool || return 1 + if [ -f "$pkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH/$tool ]; then + mv "$pkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH/$tool \ + "$subpkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH/$tool + fi + if [ -f "$builddir/bin/$tool" ]; then + install -Dm755 "$builddir/bin/$tool" "$subpkgdir"/usr/lib/go/bin/"$tool" + ln -s /usr/lib/go/bin/"$tool" "$subpkgdir"/usr/bin/ + fi done } @@ -162,12 +159,12 @@ _crosspkg() { mkdir -p "$subpkgdir"/usr/lib/go/pkg/tool/ mv "$pkgdir"/usr/lib/go/pkg/tool/${name}_* \ - "$subpkgdir"/usr/lib/go/pkg/tool/ || return 1 + "$subpkgdir"/usr/lib/go/pkg/tool/ mv "$pkgdir"/usr/lib/go/pkg/${name}_* \ - "$subpkgdir"/usr/lib/go/pkg/ || return 1 + "$subpkgdir"/usr/lib/go/pkg/ } -sha512sums="f01fe7b35ac23101610f6fc169b88dafe2edc49b3b044d5d0aff771b05dcb2c8d2e7a5090ed6dbe67f861e78e792ace32e209ed464399ca02dcd186b13ec8037 go1.8.1.src.tar.gz -343fca47f250278b22df1c1cd92cce91e01009043d05d8ccce095e4386fa0f5ca8ccaa58232635332c7288ceca9d2a240f774f8bb3b08129a681a582cba60248 go-tools-1.8.1.tar.gz +sha512sums="c6e67dd9e3acdf2aa776d920f91f3fb1802d624ba5d51e06b2c7c6b71bcfaf91f4024f7a442cecde69175c589f7f1163f0ae86d887e15ddde710e53ce0961284 go1.8.3.src.tar.gz +343fca47f250278b22df1c1cd92cce91e01009043d05d8ccce095e4386fa0f5ca8ccaa58232635332c7288ceca9d2a240f774f8bb3b08129a681a582cba60248 go-tools-1.8.3.tar.gz 9857c71108652b8907117abf0b41ded5e332bcf864320235aadbf3a7b6afbfc0e5051f91fe143f0654b4c8d6fe9adbe7d22ca2ce50cd75c0ab7a050dfb437773 default-buildmode-pie.patch 6b36f3780ab10e5c4902473a8ab5c0417220ece584b537517e9e60979bdc5a548ed14dd2546605392c89ec5ea6691769d337d34e2e19b92eba5bbca1898f4ada set-external-linker.patch" |