# Contributor: Sören Tempel # Maintainer: Eivind Uggedal pkgname=go pkgver=1.6.2 # This should be the latest commit on the corresponding release branch _toolsver="c887be1b2ebd11663d4bf2fbca508c449172339e" pkgrel=2 pkgdesc="Go programming language compiler" url="http://www.golang.org/" arch="all" license="BSD" depends="" depends_dev="" makedepends="bash go-bootstrap" options="!strip" install="" subpackages="$pkgname-doc $pkgname-tools $pkgname-cross" source="http://golang.org/dl/go${pkgver}.src.tar.gz $pkgname-tools-$pkgver.tar.gz::https://github.com/golang/tools/archive/${_toolsver}.tar.gz no-pic.patch " # NOTE: building go for x86 with grsec kernel requires: # sysctl -w kernel.modify_ldt=1 _gotools="cover vet godoc stringer" _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;; esac done } build() { cd "$_builddir/src" export GOPATH="$srcdir" export GOROOT="$_builddir" export GOBIN="$GOROOT"/bin export GOROOT_FINAL=/usr/lib/go export GOROOT_BOOTSTRAP=/usr/lib/go-bootstrap case "$CARCH" in x86) export GOARCH="386" ;; x86_64) export GOARCH="amd64" ;; arm*) export GOARCH="arm" ;; *) return 1 ;; esac ./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 done # FIXME some tests fail: # PATH="$GOROOT/bin:$PATH" ./run.bash -no-rebuild || return 1 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 done } package() { cd "$_builddir" 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 done # 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. cp -a pkg src lib "$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/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" \) \ -exec rm -rf \{\} \+ || return 1 rm -rf "$pkgdir"/usr/lib/go/pkg/bootstrap rm -f "$pkgdir"/usr/lib/go/pkg/tool/*/api } 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 for tool in $_gotools; do if test -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 || return 1 fi done } cross() { pkgdesk="Go cross compilers" depends="$pkgname" mkdir -p "$subpkgdir"/usr/lib/go/pkg/tool 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}_* \ "$subpkgdir"/usr/lib/go/pkg || return 1 done } md5sums="d1b50fa98d9a71eeee829051411e6207 go1.6.2.src.tar.gz 733a96b59562ed84ff552542f16a3ab3 go-tools-1.6.2.tar.gz efa8ac40fa8429f7cd6f23eca05a0a0f no-pic.patch" sha256sums="787b0b750d037016a30c6ed05a8a70a91b2e9db4bd9b1a2453aa502a63f1bccc go1.6.2.src.tar.gz 955e5a119babad356d9cf00cdaaf3c27648d4451109b467c872fad8cc94d5b56 go-tools-1.6.2.tar.gz 1eb60ded9035e9692e4c17b2bb6e9c073e21261eaafa56ee0528d5d2c43a936d no-pic.patch" sha512sums="e148022f9e18b5d5b05744f1aa9fa3ef82e255752179545711ade077e271216aa5b450859a764fdfb028ae4faa26adad8d0a0a5268b31396ab9d14de3cb2f20a go1.6.2.src.tar.gz 955def7cc3e5ceb5d8e47477400007d32c25f3bc2764f04a0451bd0235af507e63a0966d201a345f51ac764471da8620b5357d1099ec39e2422bd04d25fd71b8 go-tools-1.6.2.tar.gz 51e4c3ee0cda98090db5d00468072bcbf5f0a1a429dd8dedddccaa1467b285f724b012be96d329566b195470bea0aaf4b464e8ba6d2029b0dd42678a7a14b663 no-pic.patch"