git.iko.soy/typeable/nixpkgs
on master help sign in
Merge pull request #50223 from ryan4729/go-cross-compile

go: make compiler usable for cross compiles

commitc94ccfd81ed327e75f4a3184e1e52e8a7c2eb3be authorJohn Ericson <git@JohnEricson.me> dateSun 11 Nov 2018, 18:31 (8 years ago) parent9997a3db46f5e1
1 file changed+11−8
pkgs/development/compilers/go/1.11.nix+11−8
pkgs/development/compilers/go/1.11.nix+11−8
@@ -131,14 +131,17 @@ stdenv.mkDerivation rec {
131131 substituteInPlace "src/cmd/link/internal/ld/lib.go" --replace dsymutil ${llvm}/bin/llvm-dsymutil
132132 '';
133133
134− GOOS = if stdenv.isDarwin then "darwin" else "linux";
135− GOARCH = if stdenv.isDarwin then "amd64"
136− else if stdenv.targetPlatform.isi686 then "386"
137− else if stdenv.targetPlatform.isx86_64 then "amd64"
138− else if stdenv.targetPlatform.isAarch32 then "arm"
139− else if stdenv.targetPlatform.isAarch64 then "arm64"
140− else throw "Unsupported system";
141− GOARM = toString (stdenv.lib.intersectLists [(stdenv.targetPlatform.parsed.cpu.version or "")] ["5" "6" "7"]);
134+ GOOS = stdenv.hostPlatform.parsed.kernel.name;
135+ GOARCH = {
136+ "i686" = "386";
137+ "x86_64" = "amd64";
138+ "aarch64" = "arm64";
139+ "arm" = "arm";
140+ "armv5tel" = "arm";
141+ "armv6l" = "arm";
142+ "armv7l" = "arm";
143+ }.${stdenv.hostPlatform.parsed.cpu.name} or (throw "Unsupported system");
144+ GOARM = toString (stdenv.lib.intersectLists [(stdenv.hostPlatform.parsed.cpu.version or "")] ["5" "6" "7"]);
142145 GO386 = 387; # from Arch: don't assume sse2 on i686
143146 CGO_ENABLED = 1;
144147 GOROOT_BOOTSTRAP = "${goBootstrap}/share/go";