aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorEivind Uggedal <eivind@uggedal.com>2014-04-10 10:57:41 +0000
committerNatanael Copa <ncopa@alpinelinux.org>2014-04-11 13:04:37 +0000
commitabfdfd32d2c6818c467d6255f035bf0254bd8350 (patch)
tree02b9e246a3ac02da67ef8e80cb11aadec3a94231
parent683515962c34e476f97d6079926612be9cab0d37 (diff)
downloadaports-abfdfd32d2c6818c467d6255f035bf0254bd8350.tar.bz2
aports-abfdfd32d2c6818c467d6255f035bf0254bd8350.tar.xz
testing/go: new aport
-rw-r--r--testing/go/APKBUILD149
-rw-r--r--testing/go/default-sc-getpw-r-size-max.patch15
-rw-r--r--testing/go/no-pic.patch14
-rw-r--r--testing/go/no-werror.patch10
4 files changed, 188 insertions, 0 deletions
diff --git a/testing/go/APKBUILD b/testing/go/APKBUILD
new file mode 100644
index 0000000000..b9cbee4b28
--- /dev/null
+++ b/testing/go/APKBUILD
@@ -0,0 +1,149 @@
+# Maintainer: Eivind Uggedal <eivind@uggedal.com>
+pkgname=go
+pkgver=1.2.1
+pkgrel=0
+pkgdesc="Go programming language compiler"
+url="http://www.golang.org/"
+arch="x86_64"
+license="BSD"
+depends=""
+depends_dev=""
+makedepends="bash perl mercurial"
+options="!strip"
+install=""
+subpackages="
+ $pkgname-tools:tools
+ $pkgname-bash-completion:completion
+ $pkgname-vim:vim
+ "
+source="
+ http://go.googlecode.com/files/go${pkgver}.src.tar.gz
+ no-werror.patch
+ no-pic.patch
+ default-sc-getpw-r-size-max.patch
+ "
+
+_builddir="$srcdir"/$pkgname
+_toolrepo=code.google.com/p/go.tools
+_tooltag=release-branch.go1.2
+
+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() {
+ export GOPATH="$srcdir"
+ export GOROOT="$_builddir"
+ export GOBIN="$GOROOT"/bin
+ export GOROOT_FINAL=/usr/lib/go
+
+ case "$CARCH" in
+ x86) GOARCH=386;;
+ x86_64) GOARCH=amd64;;
+ *) return 1;;
+ esac
+ export GOARCH
+
+ cd "$_builddir/src"
+
+ ./make.bash || return 1
+
+ # FIXME: race and bench tests fail:
+ #PATH="$GOROOT/bin:$PATH" ./run.bash --no-rebuild --banner || return 1
+
+ # Build tools provided with the upstream binary distribution:
+ "$GOROOT"/bin/go get -d $_toolrepo/...
+ (
+ cd "$srcdir"/src/$_toolrepo
+ hg update $_tooltag
+ )
+ local tool
+ for tool in cover vet godoc; do
+ "$GOROOT"/bin/go install $_toolrepo/cmd/$tool
+ done
+}
+
+package() {
+ local f d
+ cd "$_builddir"
+
+ install -dm755 "$pkgdir"/usr/bin
+ for f in go gofmt; do
+ install -m755 bin/$f "$pkgdir"/usr/bin
+ done
+
+ install -dm755 "$pkgdir"/usr/lib/go
+ cp -a pkg "$pkgdir"/usr/lib/go
+
+ # The source needs to be installed due to an upstream
+ # bug (http://code.google.com/p/go/issues/detail?id=2775).
+ # When this is resolved we can split out the source to a
+ # go-doc sub package.
+ install -dm755 "$pkgdir"/usr/lib/go/src
+ for d in pkg cmd; do
+ cp -a src/$d "$pkgdir"/usr/lib/go/src
+ done
+}
+
+tools() {
+ local tool
+
+ pkgdesc="Go programming language tools"
+ depends="$pkgname"
+
+ install -Dm755 "$_builddir"/bin/godoc "$subpkgdir"/usr/bin/godoc
+
+ install -dm755 "$subpkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH
+
+ for tool in cover vet; do
+ mv "$pkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH/$tool \
+ "$subpkgdir"/usr/lib/go/pkg/tool/linux_$GOARCH/$tool
+ done
+
+ # Make documentation for tools available through godoc:
+ for tool in cover vet godoc; do
+ install -dm755 "$subpkgdir"/usr/lib/go/src/pkg/$tool
+ sed -e 's/^package main$/package documentation/' \
+ "$srcdir"/src/$_toolrepo/cmd/$tool/doc.go > \
+ "$subpkgdir"/usr/lib/go/src/pkg/$tool/doc.go
+ done
+}
+
+completion() {
+ pkgdesc="Bash completion script for Go"
+ arch="noarch"
+
+ install -Dm644 "$_builddir"/misc/bash/$pkgname \
+ "$subpkgdir"/usr/share/bash-completion/completions/$pkgname
+}
+
+vim() {
+ local f
+
+ pkgdesc="Vim syntax for Go"
+ arch="noarch"
+
+ for f in ftdetect/gofiletype.vim syntax/go.vim indent/go.vim; do
+ install -Dm644 "$_builddir"/misc/vim/$f \
+ "$subpkgdir"/usr/share/vim/vimfiles/$f
+ done
+}
+
+md5sums="6232fa4417004fc9dde823ad1eaf597c go1.2.1.src.tar.gz
+65330c61f6d6c881033b0a95ca228edb no-werror.patch
+4391be88ce8bacdd7fee433b39635583 no-pic.patch
+2576180fb906455bb786ca2937bbe180 default-sc-getpw-r-size-max.patch"
+sha256sums="1655a9367bec083df57cacc29add280c279791801e102fd851c00d8babd12a55 go1.2.1.src.tar.gz
+65d38b9485da2ff9417a2c44a81b6e52cc9bd2727b27e7add10d48a63805d4a3 no-werror.patch
+86fc68a50bc4a9336a003239adf1dcc6d7cabfb9c1bcf09b0d53d09100ceff12 no-pic.patch
+be711a828ddda89dd28ffc19d88958471c832005f0666a8a28c8838c0082a208 default-sc-getpw-r-size-max.patch"
+sha512sums="814fc4ea0a2ee0cb5eee0a8299c2d40ee7408b3ac5ae9251717aced20a029024c96b89385fb017958b4a79345b8460e11cdd43e97ed1bc15b151485d2229ab40 go1.2.1.src.tar.gz
+3cf139723e6ff0cbf7aaf76295fe4208f2062f2d4086e36d05cad83919217b5355e0e79b0b515a06a578389301bd07b062cb58b98fc0f9e4badf190cd1c34826 no-werror.patch
+a8e95c3c536a30e15b9bad5e623a085c521739639a58ac638679d99413a1bee8823729783123cbe4495ac42822df31f4776f0380a63786b9f4fc73190e012ae5 no-pic.patch
+9e9a288ff912b57eff250db53891be166376ec3ee11fcde94b49f1ff1c9433ef531d6c12706258a65a8666e11142506ecc3778e4bbf43dbe23afd2492a3a17a4 default-sc-getpw-r-size-max.patch"
diff --git a/testing/go/default-sc-getpw-r-size-max.patch b/testing/go/default-sc-getpw-r-size-max.patch
new file mode 100644
index 0000000000..48ba01b6f4
--- /dev/null
+++ b/testing/go/default-sc-getpw-r-size-max.patch
@@ -0,0 +1,15 @@
+--- a/src/pkg/os/user/lookup_unix.go
++++ b/src/pkg/os/user/lookup_unix.go
+@@ -57,6 +57,12 @@
+ bufSize = 1024
+ } else {
+ bufSize = C.sysconf(C._SC_GETPW_R_SIZE_MAX)
++ // The musl alternative standard library on Linux
++ // return -1 as specified by POSIX if there are no
++ // hard limit on _SC_GETPW_R_SIZE_MAX.
++ if bufSize == -1 {
++ bufSize = 1024
++ }
+ if bufSize <= 0 || bufSize > 1<<20 {
+ return nil, fmt.Errorf("user: unreasonable _SC_GETPW_R_SIZE_MAX of %d", bufSize)
+ }
diff --git a/testing/go/no-pic.patch b/testing/go/no-pic.patch
new file mode 100644
index 0000000000..633dd9a1cf
--- /dev/null
+++ b/testing/go/no-pic.patch
@@ -0,0 +1,14 @@
+--- a/src/cmd/ld/lib.c
++++ b/src/cmd/ld/lib.c
+@@ -786,6 +786,11 @@ hostlink(void)
+ p = strchr(p + 1, ' ');
+ }
+
++ // The Go linker does not currently support building objects that
++ // may be linked into a PIE. See:
++ // https://code.google.com/p/go/issues/detail?id=6940
++ argv[argc++] = "-fno-PIC";
++
+ argv[argc] = nil;
+
+ quotefmtinstall();
diff --git a/testing/go/no-werror.patch b/testing/go/no-werror.patch
new file mode 100644
index 0000000000..01f183edb0
--- /dev/null
+++ b/testing/go/no-werror.patch
@@ -0,0 +1,10 @@
+--- a/src/cmd/dist/build.c
++++ b/src/cmd/dist/build.c
+@@ -384,7 +384,6 @@ static char *proto_gccargs[] = {
+ "-Wno-switch",
+ "-Wno-comment",
+ "-Wno-missing-field-initializers",
+- "-Werror",
+ "-fno-common",
+ "-ggdb",
+ "-pipe",