PKGBUILDs/community/go/PKGBUILD

142 lines
4.7 KiB
Bash
Raw Normal View History

2016-03-28 12:18:53 +00:00
# $Id$
# Maintainer: Alexander F Rødseth <xyproto@archlinux.org>
2016-02-05 03:59:16 +00:00
# Maintainer: Pierre Neidhardt <ambrevar@gmail.com>
2016-03-28 12:18:53 +00:00
# Contributor: Vesa Kaihlavirta <vegai@iki.fi>
2016-02-05 03:59:16 +00:00
# Contributor: Rémy Oudompheng <remy@archlinux.org>
2012-11-22 18:49:32 +00:00
# Contributor: Andres Perera <andres87p gmail>
# Contributor: Matthew Bauer <mjbauer95@gmail.com>
# Contributor: Christian Himpel <chressie@gmail.com>
# Contributor: Mike Rosset <mike.rosset@gmail.com>
# Contributor: Daniel YC Lin <dlin.tw@gmail.com>
2014-03-22 15:00:40 +00:00
# Contributor: John Luebs <jkluebs@gmail.com>
2014-01-27 17:32:44 +00:00
2012-11-22 18:49:32 +00:00
# ALARM: Kevin Mihelich <kevin@archlinuxarm.org>
# - added switches for our architectures
2016-02-05 03:59:16 +00:00
pkgname=('go' 'go-tools')
2016-04-13 13:43:42 +00:00
pkgver=1.6.1
pkgrel=1
2014-03-22 15:00:40 +00:00
epoch=2
2015-09-12 14:58:15 +00:00
arch=('arm' 'armv6h' 'armv7h' 'aarch64')
2012-11-22 18:49:32 +00:00
url='http://golang.org/'
2015-09-12 14:58:15 +00:00
license=('BSD')
makedepends=('inetutils' 'git' 'go')
2013-10-30 15:09:58 +00:00
options=('!strip' 'staticlibs')
2015-01-18 01:08:44 +00:00
source=("$pkgname-$pkgver::git+https://go.googlesource.com/go#tag=$pkgname$pkgver")
2014-03-03 18:32:22 +00:00
md5sums=('SKIP')
2016-02-05 03:59:16 +00:00
_gourl=golang.org/x/tools/cmd
2012-11-22 18:49:32 +00:00
build() {
2014-03-03 18:32:22 +00:00
cd "$pkgname-$pkgver/src"
2013-04-08 18:56:19 +00:00
2015-08-21 00:19:21 +00:00
export GOARCH=arm
2013-04-08 18:56:19 +00:00
[ "$CARCH" == 'arm' ] && export GOARM=5
[ "$CARCH" == 'armv6h' ] && export GOARM=6
[ "$CARCH" == 'armv7h' ] && export GOARM=7
2015-08-21 00:19:21 +00:00
[ "$CARCH" == 'aarch64' ] && export GOARCH=arm64
2012-11-22 18:49:32 +00:00
export GOROOT_FINAL=/usr/lib/go
2015-08-20 19:27:46 +00:00
export GOROOT_BOOTSTRAP=/usr/lib/go
2012-11-22 18:49:32 +00:00
export GOOS=linux
2014-03-22 15:00:40 +00:00
export GOPATH="$srcdir/"
export GOROOT="$srcdir/$pkgname-$pkgver"
2014-05-13 13:06:49 +00:00
export GOBIN="$GOROOT/bin"
2013-04-08 18:56:19 +00:00
2016-02-05 03:59:16 +00:00
bash make.bash --no-clean
2014-03-03 18:32:22 +00:00
2016-02-05 03:59:16 +00:00
# System-wide tools
for tool in godex godoc goimports gomvpkg gorename gotype; do
$GOROOT/bin/go get -d golang.org/x/tools/cmd/$tool
$GOROOT/bin/go build -v -x -o $GOPATH/bin/$tool $_gourl/$tool
done
# Distribution tools
for tool in benchcmp bundle callgraph digraph eg fiximports html2article oracle present ssadump stress stringer ; do
$GOROOT/bin/go get -d golang.org/x/tools/cmd/$tool
$GOROOT/bin/go build -v -x -o $GOPATH/pkg/tool/${GOOS}_$GOARCH/$tool golang.org/x/tools/cmd/$tool
2014-03-22 15:00:40 +00:00
done
2012-11-22 18:49:32 +00:00
}
check() {
2014-03-03 18:32:22 +00:00
cd "$pkgname-$pkgver"
2013-04-08 18:56:19 +00:00
2015-08-21 00:19:21 +00:00
export GOARCH=arm
2013-04-08 18:56:19 +00:00
[ "$CARCH" == 'arm' ] && export GOARM=5
[ "$CARCH" == 'armv6h' ] && export GOARM=6
[ "$CARCH" == 'armv7h' ] && export GOARM=7
2015-08-21 00:19:21 +00:00
[ "$CARCH" == 'aarch64' ] && export GOARCH=arm64
2013-04-08 18:56:19 +00:00
2014-03-03 18:32:22 +00:00
export GOROOT="$srcdir/$pkgname-$pkgver"
2014-05-13 13:06:49 +00:00
export GOBIN="$GOROOT/bin"
2014-03-03 18:32:22 +00:00
export PATH="$srcdir/$pkgname-$pkgver/bin:$PATH"
2015-08-20 19:27:46 +00:00
export GOROOT_BOOTSTRAP=/usr/lib/go
2012-11-22 18:49:32 +00:00
2016-02-18 13:15:03 +00:00
# bundle does not compile with 1.6
2016-02-05 03:59:16 +00:00
for tool in godoc goimports gomvpkg gorename gotype \
2016-02-18 13:15:03 +00:00
benchcmp callgraph digraph eg fiximports html2article oracle present ssadump stress stringer; do
2016-02-05 03:59:16 +00:00
GOPATH="$srcdir" $GOROOT/bin/go test -v -x $_gourl/$tool
done
2013-10-30 15:09:58 +00:00
# TestSimpleMulticastListener will fail in standard chroot
2012-11-22 18:49:32 +00:00
cd src && bash run.bash --no-rebuild || true
}
2016-02-05 03:59:16 +00:00
package_go() {
pkgdesc='Compiler and tools for the Go programming language from Google'
optdepends=('mercurial: for fetching sources from mercurial repositories'
'git: for fetching sources from git repositories'
'bzr: for fetching sources from bazaar repositories'
'subversion: for fetching sources from subversion repositories'
'go-tools: godoc, goimports, gorename, and other tools.')
2014-03-03 18:32:22 +00:00
cd "$pkgname-$pkgver"
2012-11-29 16:12:53 +00:00
2014-03-03 18:55:01 +00:00
export GOROOT="$srcdir/$pkgname-$pkgver"
2014-05-13 13:06:49 +00:00
export GOBIN="$GOROOT/bin"
2015-08-20 19:27:46 +00:00
export GOROOT_BOOTSTRAP=/usr/lib/go
2013-04-09 22:15:48 +00:00
2016-02-05 03:59:16 +00:00
install -Dm644 LICENSE "$pkgdir/usr/share/licenses/go/LICENSE"
2014-03-22 15:00:40 +00:00
2016-02-05 03:59:16 +00:00
mkdir -p "$pkgdir/usr/"{share/go,lib/go,lib/go/pkg,lib/go/src,lib/go/site/src}
2012-11-22 18:49:32 +00:00
2013-06-02 19:05:10 +00:00
cp -r doc misc -t "$pkgdir/usr/share/go"
ln -s /usr/share/go/doc "$pkgdir/usr/lib/go/doc"
cp -a bin "$pkgdir/usr"
2016-02-05 03:59:16 +00:00
cp -a pkg/{include,linux_$GOARCH,tool} "$pkgdir/usr/lib/go/pkg"
# The 'race' folder is not always generated for all architectures.
[ -d "pkg/linux_${GOARCH}_race" ] && cp -a pkg/linux_${GOARCH}_race "$pkgdir/usr/lib/go/pkg"
2014-12-12 01:48:23 +00:00
cp -a "$GOROOT/src" "$pkgdir/usr/lib/go/"
2015-09-12 14:58:15 +00:00
cp -a "$GOROOT/lib" "$pkgdir/usr/lib/go/"
2012-11-22 18:49:32 +00:00
2016-02-05 03:59:16 +00:00
# This is to make `# go get golang.org/x/tour/gotour` and then running the
# gotour executable work out of the box.
2013-06-02 19:05:10 +00:00
ln -sf /usr/bin "$pkgdir/usr/lib/go/bin"
2012-11-22 18:49:32 +00:00
2016-02-05 03:59:16 +00:00
install -Dm644 VERSION "$pkgdir/usr/lib/go/VERSION"
install="$pkgname.install"
2014-11-07 14:39:12 +00:00
2012-11-22 18:49:32 +00:00
# For godoc
2013-06-02 19:05:10 +00:00
install -Dm644 favicon.ico "$pkgdir/usr/lib/go/favicon.ico"
2012-11-22 18:49:32 +00:00
2015-09-12 14:58:15 +00:00
# Clean Windows specific files.
2016-02-05 03:59:16 +00:00
rm -fv "$pkgdir"/usr/lib/go/src/*.bat
}
package_go-tools() {
2016-03-28 12:18:53 +00:00
pkgdesc='Developer tools for the Go programming language (includes godoc)'
2016-02-05 03:59:16 +00:00
depends=('go>2:1.5.3-1')
GOOS=linux
install -Dm644 "$srcdir/src/$_gourl/../LICENSE" "$pkgdir/usr/share/licenses/$pkgname/LICENSE"
# System-wide tools
install -dm755 "$pkgdir/usr/bin"
install -p -m755 "$srcdir/bin"/* "$pkgdir/usr/bin"
# Distribution tools
install -dm755 "$pkgdir/usr/lib/go/pkg/tool/${GOOS}_$GOARCH"
install -p -m755 "$srcdir/pkg/tool/${GOOS}_$GOARCH"/* "$pkgdir/usr/lib/go/pkg/tool/${GOOS}_$GOARCH"
2012-11-22 18:49:32 +00:00
}
2015-09-12 14:58:15 +00:00
2012-11-22 18:49:32 +00:00
# vim:set ts=2 sw=2 et: