mirror of
https://github.com/NixOS/nixpkgs.git
synced 2024-11-27 01:13:05 +00:00
go-1.5: fix build on darwin, set to default version for all platforms
This commit is contained in:
parent
48d837f310
commit
f77bf46c1e
@ -72,6 +72,8 @@ stdenv.mkDerivation rec {
|
||||
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
|
||||
'';
|
||||
|
||||
|
@ -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,26 @@ 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 '/TestRead0/areturn' src/os/os_test.go
|
||||
sed -i '/TestSystemRoots/areturn' src/crypto/x509/root_darwin_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"
|
||||
|
12
pkgs/development/compilers/go/strip.patch
Normal file
12
pkgs/development/compilers/go/strip.patch
Normal 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)
|
||||
}
|
@ -4053,12 +4053,10 @@ let
|
||||
};
|
||||
|
||||
go_1_5 = callPackage ../development/compilers/go/1.5.nix {
|
||||
inherit (darwin.apple_sdk.frameworks) Security;
|
||||
inherit (darwin.apple_sdk.frameworks) Security Foundation;
|
||||
};
|
||||
|
||||
go = if stdenv.isDarwin
|
||||
then go_1_4 # missing DWARF files during go-1.5 build
|
||||
else go_1_5;
|
||||
go = go_1_5;
|
||||
|
||||
go-repo-root = goPackages.go-repo-root.bin // { outputs = [ "bin" ]; };
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user