git.iko.soy/typeable/nixpkgs
on master help sign in
go-1.5: fix build on darwin, set to default version for all platforms
commitf77bf46c1e705934a00c52d90cc62a76fbb1f6b5 authorJude Taylor <me@jude.bio> dateMon 19 Oct 2015, 16:14 (11 years ago) parent48d837f
4 files changed+29−7
pkgs/development/compilers/go/1.4.nix+2 pkgs/development/compilers/go/1.5.nix+13−3 pkgs/development/compilers/go/strip.patch+12 pkgs/top-level/all-packages.nix+2−4
pkgs/development/compilers/go/1.4.nix+2
@@ -72,6 +72,8 @@ stdenv.mkDerivation rec {
7272 sed -i '/TestResolveTCPAddr/areturn' src/net/tcp_test.go
7373 sed -i '/TestResolveUDPAddr/areturn' src/net/udp_test.go
7474
75+ sed -i '/TestCgoExternalThreadSIGPROF/areturn' src/runtime/crash_cgo_test.go
76+
7577 touch $TMPDIR/group $TMPDIR/hosts $TMPDIR/passwd
7678 '';
7779
pkgs/development/compilers/go/1.5.nix+13−3
@@ -1,7 +1,7 @@
11{ stdenv, lib, fetchurl, tzdata, iana_etc, go_1_4, runCommand
22, perl, which, pkgconfig, patch
33, pcre
4−, Security }:
4+, Security, Foundation }:
55
66let
77 goBootstrap = runCommand "go-bootstrap" {} ''
@@ -25,7 +25,9 @@ stdenv.mkDerivation rec {
2525 # perl is used for testing go vet
2626 nativeBuildInputs = [ perl which pkgconfig patch ];
2727 buildInputs = [ pcre ];
28− propagatedBuildInputs = lib.optional stdenv.isDarwin Security;
28+ propagatedBuildInputs = lib.optionals stdenv.isDarwin [
29+ Security Foundation
30+ ];
2931
3032 # I'm not sure what go wants from its 'src', but the go installation manual
3133 # describes an installation keeping the src.
@@ -67,18 +69,26 @@ stdenv.mkDerivation rec {
6769 '' + lib.optionalString stdenv.isLinux ''
6870 sed -i 's,/usr/share/zoneinfo/,${tzdata}/share/zoneinfo/,' src/time/zoneinfo_unix.go
6971 '' + lib.optionalString stdenv.isDarwin ''
72+ substituteInPlace src/race.bash --replace \
73+ "sysctl machdep.cpu.extfeatures | grep -qv EM64T" true
74+ sed -i 's,strings.Contains(.*sysctl.*,true {,' src/cmd/dist/util.go
7075 sed -i 's,"/etc","'"$TMPDIR"'",' src/os/os_test.go
7176 sed -i 's,/_go_os_test,'"$TMPDIR"'/_go_os_test,' src/os/path_test.go
7277 sed -i '/TestRead0/areturn' src/os/os_test.go
7378 sed -i '/TestSystemRoots/areturn' src/crypto/x509/root_darwin_test.go
7479
80+ sed -i '/TestDisasmExtld/areturn' src/cmd/objdump/objdump_test.go
81+
7582 touch $TMPDIR/group $TMPDIR/hosts $TMPDIR/passwd
7683 '';
7784
7885 patches = [
7986 ./cacert-1.5.patch
8087 ./remove-tools-1.5.patch
81− ];
88+ ]
89+ # -ldflags=-s is required to compile on Darwin, see
90+ # https://github.com/golang/go/issues/11994
91+ ++ stdenv.lib.optional stdenv.isDarwin ./strip.patch;
8292
8393 GOOS = if stdenv.isDarwin then "darwin" else "linux";
8494 GOARCH = if stdenv.isDarwin then "amd64"
pkgs/development/compilers/go/strip.patchnew file+12
@@ -0,0 +1,12 @@
1+diff --git a/src/cmd/go/build.go b/src/cmd/go/build.go
2+index 0b14725..a7608ce 100644
3+--- a/src/cmd/go/build.go
4++++ b/src/cmd/go/build.go
5+@@ -2310,6 +2310,7 @@ func (gcToolchain) ld(b *builder, root *action, out string, allactions []*action
6+ }
7+ }
8+ var ldflags []string
9++ ldflags = append(ldflags, "-s")
10+ if buildContext.InstallSuffix != "" {
11+ ldflags = append(ldflags, "-installsuffix", buildContext.InstallSuffix)
12+ }
pkgs/top-level/all-packages.nix+2−4
@@ -4053,12 +4053,10 @@ let
40534053 };
40544054
40554055 go_1_5 = callPackage ../development/compilers/go/1.5.nix {
4056− inherit (darwin.apple_sdk.frameworks) Security;
4056+ inherit (darwin.apple_sdk.frameworks) Security Foundation;
40574057 };
40584058
4059− go = if stdenv.isDarwin
4060− then go_1_4 # missing DWARF files during go-1.5 build
4061− else go_1_5;
4059+ go = go_1_5;
40624060
40634061 go-repo-root = goPackages.go-repo-root.bin // { outputs = [ "bin" ]; };
40644062