author | Alexander Rødseth
<xyproto@archlinux.org> 2014-03-22 01:23:36 UTC |
committer | Alexander Rødseth
<xyproto@archlinux.org> 2014-03-22 01:23:36 UTC |
parent | cfde757b8fe658957cae7b95d6553c214f4d4529 |
PKGBUILD | +21 | -18 |
diff --git a/PKGBUILD b/PKGBUILD index 2e5e529..5b6ee90 100644 --- a/PKGBUILD +++ b/PKGBUILD @@ -6,11 +6,12 @@ # Contributor: Christian Himpel <chressie@gmail.com> # Contributor: Mike Rosset <mike.rosset@gmail.com> # Contributor: Daniel YC Lin <dlin.tw@gmail.com> +# Contributor: John Luebs <jkluebs@gmail.com> pkgname=go +epoch=2 pkgver=1.2.1 pkgrel=2 -epoch=2 pkgdesc='Compiler and tools for the Go programming language from Google' arch=('x86_64' 'i686') url='http://golang.org/' @@ -26,8 +27,10 @@ source=("$pkgname-$pkgver::hg+https://code.google.com/p/$pkgname#branch=release- md5sums=('SKIP') build() { - cd "$pkgname-$pkgver/src" + export GOROOT="$srcdir/$pkgname-$pkgver" + cd "$GOROOT/src" + export GOPATH="$srcdir/" export GOROOT_FINAL=/usr/lib/go # @@ -45,22 +48,25 @@ build() { # Crosscompilation for various platforms (including linux) for os in linux; do # darwin freebsd windows; do - for platform in amd64 386; do + for arch in amd64 386; do export GOOS="$os" - export GOARCH="$platform" + export GOARCH="$arch" bash make.bash --no-clean - - if [ $platform$CARCH == amd64x86_64 ]; then - # Many thanks to Daniel YC Lin - ../bin/go get -d code.google.com/p/go.tools/cmd/godoc - ../bin/go build -o "$srcdir/godoc" code.google.com/p/go.tools/cmd/godoc - ../bin/go get -d code.google.com/p/go.tools/cmd/vet - ../bin/go build -o ../pkg/tool/$platform/vet code.google.com/p/go.tools/cmd/vet - ../bin/go get -d code.google.com/p/go.tools/cmd/lint - ../bin/go build -o ../pkg/tool/$platform/lint code.google.com/p/go.tools/cmd/lint - fi done done + + GOOS=linux + case "$CARCH" in + x86_64) GOARCH=amd64 ;; + i686) GOARCH=386 ;; + esac + + $GOROOT/bin/go get -d code.google.com/p/go.tools/cmd/godoc + $GOROOT/bin/go build -o $srcdir/godoc code.google.com/p/go.tools/cmd/godoc + for tool in vet cover; do + $GOROOT/bin/go get -d code.google.com/p/go.tools/cmd/${tool} + $GOROOT/bin/go build -o $GOROOT/pkg/tool/${GOOS}_${GOARCH}/${tool} code.google.com/p/go.tools/cmd/${tool} + done } check() { @@ -84,12 +90,9 @@ check() { package() { cd "$pkgname-$pkgver" - export GOROOT="$srcdir/$pkgname-$pkgver" - if [ -e ../godoc ]; then - install -Dm755 ../godoc "$pkgdir/usr/bin/godoc" - fi + install -Dm755 $srcdir/godoc $pkgdir/usr/bin/godoc install -Dm644 LICENSE \ "$pkgdir/usr/share/licenses/go/LICENSE"