PKGBUILDs/community/go/PKGBUILD

134 lines
4.2 KiB
Bash
Raw Normal View History

2013-04-08 18:56:19 +00:00
# $Id: PKGBUILD 86967 2013-03-25 13:19:54Z arodseth $
2012-11-22 18:49:32 +00:00
# Maintainer: Vesa Kaihlavirta <vegai@iki.fi>
# Maintainer: Alexander Rødseth <rodseth@gmail.com>
# Contributor: Rémy Oudompheng <remy@archlinux.org>
# 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
2013-04-08 18:56:19 +00:00
# ALARM: Alexander Rødseth <rodseth@gmail.com>
2013-04-09 22:15:48 +00:00
# - Go 1.1beta2 support
2012-11-22 18:49:32 +00:00
pkgname=go
2014-03-22 15:00:40 +00:00
epoch=2
2015-01-18 01:08:44 +00:00
pkgver=1.4.1
2014-12-12 01:48:23 +00:00
pkgrel=1
2013-06-02 19:05:10 +00:00
pkgdesc='Compiler and tools for the Go programming language from Google'
2012-11-22 18:49:32 +00:00
url='http://golang.org/'
license=('custom')
2015-01-18 01:08:44 +00:00
makedepends=('inetutils' 'git' 'mercurial')
2013-10-30 15:09:58 +00:00
options=('!strip' 'staticlibs')
2014-03-26 13:05:40 +00:00
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')
2013-03-25 21:30:50 +00:00
install="$pkgname.install"
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')
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
[ "$CARCH" == 'arm' ] && export GOARM=5
[ "$CARCH" == 'armv6h' ] && export GOARM=6
[ "$CARCH" == 'armv7h' ] && export GOARM=7
2012-11-22 18:49:32 +00:00
2013-04-08 18:56:19 +00:00
export GOARCH=arm
2012-11-22 18:49:32 +00:00
export GOROOT_FINAL=/usr/lib/go
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
2012-11-22 18:49:32 +00:00
bash make.bash
2014-03-03 18:32:22 +00:00
2014-12-12 01:48:23 +00:00
$GOROOT/bin/go get -d golang.org/x/tools/cmd/godoc
$GOROOT/bin/go build -o $srcdir/godoc golang.org/x/tools/cmd/godoc
2014-03-22 15:00:40 +00:00
for tool in vet cover; do
2014-12-12 01:48:23 +00:00
$GOROOT/bin/go get -d golang.org/x/tools/cmd/${tool}
$GOROOT/bin/go build -o $GOROOT/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
[ "$CARCH" == 'arm' ] && export GOARM=5
[ "$CARCH" == 'armv6h' ] && export GOARM=6
[ "$CARCH" == 'armv7h' ] && export GOARM=7
export GOARCH=arm
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"
2012-11-22 18:49:32 +00:00
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
}
package() {
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"
2013-04-09 22:15:48 +00:00
2014-05-13 13:06:49 +00:00
install -Dm755 "$srcdir/godoc" "$pkgdir/usr/bin/godoc"
2014-03-22 15:00:40 +00:00
2012-11-22 18:49:32 +00:00
install -Dm644 LICENSE \
2013-06-02 19:05:10 +00:00
"$pkgdir/usr/share/licenses/go/LICENSE"
2012-11-22 18:49:32 +00:00
2013-05-26 17:41:54 +00:00
mkdir -p \
2013-06-02 19:05:10 +00:00
"$pkgdir/"{etc/profile.d,usr/{share/go,lib/go,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"
cp -a pkg "$pkgdir/usr/lib/go"
2014-12-12 01:48:23 +00:00
cp -a "$GOROOT/src" "$pkgdir/usr/lib/go/"
2013-06-02 19:05:10 +00:00
cp -a $GOROOT/src/cmd "$pkgdir/usr/lib/go/src/cmd"
cp -a $GOROOT/src/lib9 "$pkgdir/usr/lib/go/src/"
cp -a $GOROOT/lib "$pkgdir/usr/lib/go/"
cp -a $GOROOT/include "$pkgdir/usr/lib/go/"
2012-11-22 18:49:32 +00:00
2013-06-02 19:05:10 +00:00
install -Dm644 src/Make.* "$pkgdir/usr/lib/go/src"
2012-11-22 18:49:32 +00:00
# Remove object files from target src dir
2013-06-02 19:05:10 +00:00
find "$pkgdir/usr/lib/go/src/" -type f -name '*.[ao]' -delete
2013-04-08 18:56:19 +00:00
2012-11-28 19:20:12 +00:00
# Fix for FS#32813
2013-06-02 19:05:10 +00:00
find "$pkgdir" -type f -name sql.go -exec chmod -x {} \;
2013-04-08 18:56:19 +00:00
2012-11-28 19:20:12 +00:00
# Remove all executable source files
2014-12-12 01:48:23 +00:00
find "$pkgdir/usr/lib/go/src" -type f -executable -delete
2012-11-22 18:49:32 +00:00
# Headers for C modules
2014-12-12 01:48:23 +00:00
install -Dm644 src/runtime/runtime.h \
"$pkgdir/usr/lib/go/src/runtime/runtime.h"
install -Dm644 src/runtime/cgocall.h \
"$pkgdir/usr/lib/go/src/runtime/cgocall.h"
2012-11-22 18:49:32 +00:00
# This is to make go get code.google.com/p/go-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
2014-11-07 14:39:12 +00:00
# For FS#42660 / FS#42661 / gox
install -Dm755 src/make.bash "$pkgdir/usr/lib/go/src/make.bash"
install -Dm755 src/run.bash "$pkgdir/usr/lib/go/src/run.bash"
cp -r misc/ "$pkgdir/usr/lib/go/"
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
2013-06-02 19:05:10 +00:00
rm -f "$pkgdir/usr/share/go/doc/articles/wiki/get.bin"
2012-11-22 18:49:32 +00:00
2013-06-02 19:05:10 +00:00
install -Dm644 VERSION "$pkgdir/usr/lib/go/VERSION"
2013-06-01 12:58:40 +00:00
2013-06-03 15:39:59 +00:00
find "$pkgdir/usr/"{lib/go/pkg,bin} -type f -exec touch '{}' +
2012-11-22 18:49:32 +00:00
}
# vim:set ts=2 sw=2 et: