diff options
author | Eivind Uggedal <eivind@uggedal.com> | 2015-09-15 14:24:00 +0000 |
---|---|---|
committer | Eivind Uggedal <eivind@uggedal.com> | 2015-09-15 14:25:28 +0000 |
commit | e8e6bedb868fcb59df6f0d8128d1746a7b416151 (patch) | |
tree | e88891d3bd12b684baf76bb85e1ac701f6ca8012 /main | |
parent | 800f6d9de18651c4cf07981bd9b2d380aa1c39aa (diff) | |
download | aports-e8e6bedb868fcb59df6f0d8128d1746a7b416151.tar.bz2 aports-e8e6bedb868fcb59df6f0d8128d1746a7b416151.tar.xz |
main/go: re-add removed patches during 1.5 upgrade
no-pic: This is needed for building go executables on Alpine which
uses the external linker (cgo). Examples from our tree include
docker, consul and gogs. Go does not support compiling PIC executables.
Since the gcc specs used by Alpine enables PIC by default it has to be
disabled. Without disabling PIC the executable gets a ton of erroneous
textrels which results in a segfault when musl tries to resolve them.
_SC_GETPW_R_SIZE_MAX: since musl defines this to -1 we have to
provide a default value. Use a more recent patch from upstream which
will be available in Go 1.6.
Diffstat (limited to 'main')
-rw-r--r-- | main/go/APKBUILD | 28 | ||||
-rw-r--r-- | main/go/default-sc-getpw-r-size-max.patch | 57 | ||||
-rw-r--r-- | main/go/no-pic.patch | 16 |
3 files changed, 96 insertions, 5 deletions
diff --git a/main/go/APKBUILD b/main/go/APKBUILD index aaf83da386..48a6250f43 100644 --- a/main/go/APKBUILD +++ b/main/go/APKBUILD @@ -4,7 +4,7 @@ pkgname=go pkgver=1.5.1 # This should be the latest commit on the corresponding release branch _toolsver="d02228d1857b9f49cd0252788516ff5584266eb6" -pkgrel=1 +pkgrel=2 pkgdesc="Go programming language compiler" url="http://www.golang.org/" arch="x86_64 armhf" @@ -16,7 +16,9 @@ options="!strip" install="" subpackages="$pkgname-doc $pkgname-tools $pkgname-cross" source="http://golang.org/dl/go${pkgver}.src.tar.gz - golang-tools-$pkgver.tar.gz::https://github.com/golang/tools/archive/${_toolsver}.tar.gz" + golang-tools-$pkgver.tar.gz::https://github.com/golang/tools/archive/${_toolsver}.tar.gz + no-pic.patch + default-sc-getpw-r-size-max.patch" _gotools="cover vet godoc" _gocross="darwin freebsd openbsd windows" @@ -24,6 +26,16 @@ _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" @@ -116,8 +128,14 @@ cross() { } md5sums="4adfbdfca523cc1c229be8a321f3602f go1.5.1.src.tar.gz -c64b28ba5df8499bcc19adc995da991a golang-tools-1.5.1.tar.gz" +c64b28ba5df8499bcc19adc995da991a golang-tools-1.5.1.tar.gz +b303cb36017c5f1303b1567b31b48de3 no-pic.patch +12a36502180b9801f8d9e60824563c92 default-sc-getpw-r-size-max.patch" sha256sums="a889873e98d9a72ae396a9b7dd597c29dcd709cafa9097d9c4ba04cff0ec436b go1.5.1.src.tar.gz -80db6fc563df50eb924dbf4f96cef287fc6b89cc8b98595c1dac3c80a118f290 golang-tools-1.5.1.tar.gz" +80db6fc563df50eb924dbf4f96cef287fc6b89cc8b98595c1dac3c80a118f290 golang-tools-1.5.1.tar.gz +973144c68d10cdc740501ad814841912bae7c3936480fabb3f7fe092ba82ba7f no-pic.patch +70f8f9b3ad6b8639db2b401ae14747a6e8d762443ca054c358a5aa4815df7d1f default-sc-getpw-r-size-max.patch" sha512sums="a3e92058c79502cfcb7d67143db67fef97393a416322b6f8b6c52b70879e7ab56e3cec94a9ca8046cc13b134845cc1e4b53c70d7208850092bf4edf04bf439ff go1.5.1.src.tar.gz -80813c2da74c7b25fa2cfd15b2505757e7f466469ac701cb22d190dc83a607f091c4dea207a2e371e53d7a1f5459e7b53e5eea53c95565e958a6eb7fcb212359 golang-tools-1.5.1.tar.gz" +80813c2da74c7b25fa2cfd15b2505757e7f466469ac701cb22d190dc83a607f091c4dea207a2e371e53d7a1f5459e7b53e5eea53c95565e958a6eb7fcb212359 golang-tools-1.5.1.tar.gz +e21084dc07a74c7b6437ae22034b62e3a255692d32dba767c15efdb123d3159c03a02437a41350e512eaa2478a7afbd8b409317a779c56ee4939512d060d57fa no-pic.patch +d59c977341b9ab15664b4b0c4f3df9e74ce48ffbd59594a7abb5a0907469f9d362c4e558606dd4b7cd102c165dd53027bae6aa1c48623c2105461dcad4cee14d default-sc-getpw-r-size-max.patch" diff --git a/main/go/default-sc-getpw-r-size-max.patch b/main/go/default-sc-getpw-r-size-max.patch new file mode 100644 index 0000000000..77be27d13d --- /dev/null +++ b/main/go/default-sc-getpw-r-size-max.patch @@ -0,0 +1,57 @@ +From cb867d2fd64adc851f82be3c6eb6e38ec008930b Mon Sep 17 00:00:00 2001 +From: Dominik Honnef <dominik@honnef.co> +Date: Sun, 21 Jun 2015 20:07:29 +0200 +Subject: [PATCH] os/user: don't depend on _SC_GETPW_R_SIZE_MAX on Linux + +Even Linux systems may not have _SC_GETPW_R_SIZE_MAX if using a +different libc than glibc (e.g. musl). Instead of having special-cases +for the BSDs, handle -1 correctly by always using a default buffer size. + +Fixes #11319. + +Change-Id: I8b1b260eb9830e6dbe7667f3f33d115ae4de4ce8 +Reviewed-on: https://go-review.googlesource.com/13772 +Reviewed-by: Brad Fitzpatrick <bradfitz@golang.org> +Run-TryBot: Brad Fitzpatrick <bradfitz@golang.org> +--- + src/os/user/lookup_unix.go | 19 ++++++++----------- + 1 file changed, 8 insertions(+), 11 deletions(-) + +diff --git a/src/os/user/lookup_unix.go b/src/os/user/lookup_unix.go +index f4f603e..e8a1eb1 100644 +--- a/src/os/user/lookup_unix.go ++++ b/src/os/user/lookup_unix.go +@@ -9,7 +9,6 @@ package user + + import ( + "fmt" +- "runtime" + "strconv" + "strings" + "syscall" +@@ -55,17 +54,15 @@ func lookupUnix(uid int, username string, lookupByName bool) (*User, error) { + var pwd C.struct_passwd + var result *C.struct_passwd + +- var bufSize C.long +- if runtime.GOOS == "dragonfly" || runtime.GOOS == "freebsd" { +- // DragonFly and FreeBSD do not have _SC_GETPW_R_SIZE_MAX +- // and just return -1. So just use the same +- // size that Linux returns. ++ bufSize := C.sysconf(C._SC_GETPW_R_SIZE_MAX) ++ if bufSize == -1 { ++ // DragonFly and FreeBSD do not have _SC_GETPW_R_SIZE_MAX. ++ // Additionally, not all Linux systems have it, either. For ++ // example, the musl libc returns -1. + bufSize = 1024 +- } else { +- bufSize = C.sysconf(C._SC_GETPW_R_SIZE_MAX) +- if bufSize <= 0 || bufSize > 1<<20 { +- return nil, fmt.Errorf("user: unreasonable _SC_GETPW_R_SIZE_MAX of %d", bufSize) +- } ++ } ++ if bufSize <= 0 || bufSize > 1<<20 { ++ return nil, fmt.Errorf("user: unreasonable _SC_GETPW_R_SIZE_MAX of %d", bufSize) + } + buf := C.malloc(C.size_t(bufSize)) + defer C.free(buf) diff --git a/main/go/no-pic.patch b/main/go/no-pic.patch new file mode 100644 index 0000000000..5a4e3966d6 --- /dev/null +++ b/main/go/no-pic.patch @@ -0,0 +1,16 @@ +diff --git a/src/cmd/link/internal/ld/lib.go b/src/cmd/link/internal/ld/lib.go +index 8ccbec9dd634..4e96bfadc260 100644 +--- a/src/cmd/link/internal/ld/lib.go ++++ b/src/cmd/link/internal/ld/lib.go +@@ -1071,6 +1071,11 @@ func hostlink() { + argv = append(argv, peimporteddlls()...) + } + ++ // The Go linker does not currently support building PIE ++ // executables when using the external linker. See: ++ // https://github.com/golang/go/issues/6940 ++ argv = append(argv, "-fno-PIC") ++ + if Debug['v'] != 0 { + fmt.Fprintf(&Bso, "host link:") + for _, v := range argv { |