Merge staging into closure-size

The most complex problems were from dealing with switches reverted in
the meantime (gcc5, gmp6, ncurses6).
It's likely that darwin is (still) broken nontrivially.
This commit is contained in:
Vladimír Čunát
2015-11-20 14:32:58 +01:00
1278 changed files with 105731 additions and 30012 deletions

View File

@@ -63,15 +63,23 @@ stdenv.mkDerivation rec {
'' + lib.optionalString stdenv.isDarwin ''
sed -i 's,"/etc","'"$TMPDIR"'",' src/os/os_test.go
sed -i 's,/_go_os_test,'"$TMPDIR"'/_go_os_test,' src/os/path_test.go
sed -i '/TestCgoLookupIP/areturn' src/net/cgo_unix_test.go
sed -i '/TestChdirAndGetwd/areturn' src/os/os_test.go
sed -i '/TestDialDualStackLocalhost/areturn' src/net/dial_test.go
sed -i '/TestRead0/areturn' src/os/os_test.go
sed -i '/TestSystemRoots/areturn' src/crypto/x509/root_darwin_test.go
sed -i '/TestDialDualStackLocalhost/areturn' src/net/dial_test.go
# fails when running inside tmux
sed -i '/TestNohup/areturn' src/os/signal/signal_test.go
# remove IP resolving tests, on darwin they can find fe80::1%lo while expecting ::1
sed -i '/TestResolveIPAddr/areturn' src/net/ipraw_test.go
sed -i '/TestResolveTCPAddr/areturn' src/net/tcp_test.go
sed -i '/TestResolveUDPAddr/areturn' src/net/udp_test.go
sed -i '/TestCgoExternalThreadSIGPROF/areturn' src/runtime/crash_cgo_test.go
touch $TMPDIR/group $TMPDIR/hosts $TMPDIR/passwd
'';

View File

@@ -1,7 +1,7 @@
{ stdenv, lib, fetchurl, tzdata, iana_etc, go_1_4, runCommand
, perl, which, pkgconfig, patch
, pcre
, Security }:
, Security, Foundation }:
let
goBootstrap = runCommand "go-bootstrap" {} ''
@@ -25,7 +25,9 @@ stdenv.mkDerivation rec {
# perl is used for testing go vet
nativeBuildInputs = [ perl which pkgconfig patch ];
buildInputs = [ pcre ];
propagatedBuildInputs = lib.optional stdenv.isDarwin Security;
propagatedBuildInputs = lib.optionals stdenv.isDarwin [
Security Foundation
];
# I'm not sure what go wants from its 'src', but the go installation manual
# describes an installation keeping the src.
@@ -67,18 +69,31 @@ stdenv.mkDerivation rec {
'' + lib.optionalString stdenv.isLinux ''
sed -i 's,/usr/share/zoneinfo/,${tzdata}/share/zoneinfo/,' src/time/zoneinfo_unix.go
'' + lib.optionalString stdenv.isDarwin ''
substituteInPlace src/race.bash --replace \
"sysctl machdep.cpu.extfeatures | grep -qv EM64T" true
sed -i 's,strings.Contains(.*sysctl.*,true {,' src/cmd/dist/util.go
sed -i 's,"/etc","'"$TMPDIR"'",' src/os/os_test.go
sed -i 's,/_go_os_test,'"$TMPDIR"'/_go_os_test,' src/os/path_test.go
sed -i '/TestCgoLookupIP/areturn' src/net/cgo_unix_test.go
sed -i '/TestChdirAndGetwd/areturn' src/os/os_test.go
sed -i '/TestRead0/areturn' src/os/os_test.go
sed -i '/TestSystemRoots/areturn' src/crypto/x509/root_darwin_test.go
sed -i '/TestGoInstallRebuildsStalePackagesInOtherGOPATH/areturn' src/cmd/go/go_test.go
sed -i '/TestBuildDashIInstallsDependencies/areturn' src/cmd/go/go_test.go
sed -i '/TestDisasmExtld/areturn' src/cmd/objdump/objdump_test.go
touch $TMPDIR/group $TMPDIR/hosts $TMPDIR/passwd
'';
patches = [
./cacert-1.5.patch
./remove-tools-1.5.patch
];
]
# -ldflags=-s is required to compile on Darwin, see
# https://github.com/golang/go/issues/11994
++ stdenv.lib.optional stdenv.isDarwin ./strip.patch;
GOOS = if stdenv.isDarwin then "darwin" else "linux";
GOARCH = if stdenv.isDarwin then "amd64"

View File

@@ -0,0 +1,12 @@
diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go
index 0b14725..a7608ce 100644
--- a/src/cmd/go/build.go
+++ b/src/cmd/go/build.go
@@ -2310,6 +2310,7 @@ func (gcToolchain) ld(b *builder, root *action, out string, allactions []*action
}
}
var ldflags []string
+ ldflags = append(ldflags, "-s")
if buildContext.InstallSuffix != "" {
ldflags = append(ldflags, "-installsuffix", buildContext.InstallSuffix)
}