Mail archive
alpine-devel

[alpine-devel] [PATCH] testing/go: new aport

From: Eivind Uggedal <eivind_at_uggedal.com>
Date: Thu, 10 Apr 2014 10:57:41 +0000

---
 testing/go/APKBUILD                          | 149 +++++++++++++++++++++++++++
 testing/go/default-sc-getpw-r-size-max.patch |  15 +++
 testing/go/no-pic.patch                      |  14 +++
 testing/go/no-werror.patch                   |  10 ++
 4 files changed, 188 insertions(+)
 create mode 100644 testing/go/APKBUILD
 create mode 100644 testing/go/default-sc-getpw-r-size-max.patch
 create mode 100644 testing/go/no-pic.patch
 create mode 100644 testing/go/no-werror.patch
diff --git a/testing/go/APKBUILD b/testing/go/APKBUILD
new file mode 100644
index 000000000000..8899450c2bd1
--- /dev/null
+++ b/testing/go/APKBUILD
_at_@ -0,0 +1,149 @@
+# Maintainer: Eivind Uggedal <eivind_at_uggedal.com>
+pkgname=go
+pkgver=1.2.1
+pkgrel=0
+pkgdesc="Go programming language compiler"
+url="http://www.golang.org/"
+arch="x86 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 000000000000..48ba01b6f451
--- /dev/null
+++ b/testing/go/default-sc-getpw-r-size-max.patch
_at_@ -0,0 +1,15 @@
+--- a/src/pkg/os/user/lookup_unix.go
++++ b/src/pkg/os/user/lookup_unix.go
+_at_@ -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 000000000000..633dd9a1cf0d
--- /dev/null
+++ b/testing/go/no-pic.patch
_at_@ -0,0 +1,14 @@
+--- a/src/cmd/ld/lib.c
++++ b/src/cmd/ld/lib.c
+_at_@ -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 000000000000..01f183edb078
--- /dev/null
+++ b/testing/go/no-werror.patch
_at_@ -0,0 +1,10 @@
+--- a/src/cmd/dist/build.c
++++ b/src/cmd/dist/build.c
+_at_@ -384,7 +384,6 @@ static char *proto_gccargs[] = {
+ 	"-Wno-switch",
+ 	"-Wno-comment",
+	"-Wno-missing-field-initializers",
+-	"-Werror",
+ 	"-fno-common",
+ 	"-ggdb",
+ 	"-pipe",
-- 
1.9.1
---
Unsubscribe:  alpine-devel+unsubscribe_at_lists.alpinelinux.org
Help:         alpine-devel+help_at_lists.alpinelinux.org
---
Received on Thu Apr 10 2014 - 10:57:41 UTC