From 53022223373ff40b45b6e4fe69720f11422d302e Mon Sep 17 00:00:00 2001 From: ryan4729 Date: Sat, 10 Nov 2018 22:41:46 -0800 Subject: [PATCH 1/2] go: make compiler usable for cross compiles --- pkgs/development/compilers/go/1.11.nix | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/pkgs/development/compilers/go/1.11.nix b/pkgs/development/compilers/go/1.11.nix index f58e0801030e..59716fbcdb69 100644 --- a/pkgs/development/compilers/go/1.11.nix +++ b/pkgs/development/compilers/go/1.11.nix @@ -133,12 +133,12 @@ stdenv.mkDerivation rec { GOOS = if stdenv.isDarwin then "darwin" else "linux"; GOARCH = if stdenv.isDarwin then "amd64" - else if stdenv.targetPlatform.isi686 then "386" - else if stdenv.targetPlatform.isx86_64 then "amd64" - else if stdenv.targetPlatform.isAarch32 then "arm" - else if stdenv.targetPlatform.isAarch64 then "arm64" + else if stdenv.hostPlatform.isi686 then "386" + else if stdenv.hostPlatform.isx86_64 then "amd64" + else if stdenv.hostPlatform.isAarch32 then "arm" + else if stdenv.hostPlatform.isAarch64 then "arm64" else throw "Unsupported system"; - GOARM = toString (stdenv.lib.intersectLists [(stdenv.targetPlatform.parsed.cpu.version or "")] ["5" "6" "7"]); + GOARM = toString (stdenv.lib.intersectLists [(stdenv.hostPlatform.parsed.cpu.version or "")] ["5" "6" "7"]); GO386 = 387; # from Arch: don't assume sse2 on i686 CGO_ENABLED = 1; GOROOT_BOOTSTRAP = "${goBootstrap}/share/go"; From b46f5e1277d7f7226c8f7d765d8dddca8bcd615d Mon Sep 17 00:00:00 2001 From: ryan4729 Date: Sun, 11 Nov 2018 14:37:12 -0800 Subject: [PATCH 2/2] go: organize GOARCH and GOOS --- pkgs/development/compilers/go/1.11.nix | 17 ++++++++++------- 1 file changed, 10 insertions(+), 7 deletions(-) diff --git a/pkgs/development/compilers/go/1.11.nix b/pkgs/development/compilers/go/1.11.nix index 59716fbcdb69..7ae372140963 100644 --- a/pkgs/development/compilers/go/1.11.nix +++ b/pkgs/development/compilers/go/1.11.nix @@ -131,13 +131,16 @@ stdenv.mkDerivation rec { substituteInPlace "src/cmd/link/internal/ld/lib.go" --replace dsymutil ${llvm}/bin/llvm-dsymutil ''; - GOOS = if stdenv.isDarwin then "darwin" else "linux"; - GOARCH = if stdenv.isDarwin then "amd64" - else if stdenv.hostPlatform.isi686 then "386" - else if stdenv.hostPlatform.isx86_64 then "amd64" - else if stdenv.hostPlatform.isAarch32 then "arm" - else if stdenv.hostPlatform.isAarch64 then "arm64" - else throw "Unsupported system"; + GOOS = stdenv.hostPlatform.parsed.kernel.name; + GOARCH = { + "i686" = "386"; + "x86_64" = "amd64"; + "aarch64" = "arm64"; + "arm" = "arm"; + "armv5tel" = "arm"; + "armv6l" = "arm"; + "armv7l" = "arm"; + }.${stdenv.hostPlatform.parsed.cpu.name} or (throw "Unsupported system"); GOARM = toString (stdenv.lib.intersectLists [(stdenv.hostPlatform.parsed.cpu.version or "")] ["5" "6" "7"]); GO386 = 387; # from Arch: don't assume sse2 on i686 CGO_ENABLED = 1;