about summary refs log tree commit diff
path: root/pkgs/development
diff options
context:
space:
mode:
authorJohn Ericson <git@JohnEricson.me>2018-11-11 18:31:44 -0500
committerGitHub <noreply@github.com>2018-11-11 18:31:44 -0500
commitc94ccfd81ed327e75f4a3184e1e52e8a7c2eb3be (patch)
tree2c2e8f6d6eb4a239aca42638ca3fbd29b96df42a /pkgs/development
parent9997a3dc16827abb535c1f3e5cad12fe6ffdfa83 (diff)
parentb46f5e1277d7f7226c8f7d765d8dddca8bcd615d (diff)
downloadnixlib-c94ccfd81ed327e75f4a3184e1e52e8a7c2eb3be.tar
nixlib-c94ccfd81ed327e75f4a3184e1e52e8a7c2eb3be.tar.gz
nixlib-c94ccfd81ed327e75f4a3184e1e52e8a7c2eb3be.tar.bz2
nixlib-c94ccfd81ed327e75f4a3184e1e52e8a7c2eb3be.tar.lz
nixlib-c94ccfd81ed327e75f4a3184e1e52e8a7c2eb3be.tar.xz
nixlib-c94ccfd81ed327e75f4a3184e1e52e8a7c2eb3be.tar.zst
nixlib-c94ccfd81ed327e75f4a3184e1e52e8a7c2eb3be.zip
Merge pull request #50223 from ryan4729/go-cross-compile
go: make compiler usable for cross compiles
Diffstat (limited to 'pkgs/development')
-rw-r--r--pkgs/development/compilers/go/1.11.nix19
1 files changed, 11 insertions, 8 deletions
diff --git a/pkgs/development/compilers/go/1.11.nix b/pkgs/development/compilers/go/1.11.nix
index f58e0801030e..7ae372140963 100644
--- a/pkgs/development/compilers/go/1.11.nix
+++ b/pkgs/development/compilers/go/1.11.nix
@@ -131,14 +131,17 @@ 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.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 throw "Unsupported system";
-  GOARM = toString (stdenv.lib.intersectLists [(stdenv.targetPlatform.parsed.cpu.version or "")] ["5" "6" "7"]);
+  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;
   GOROOT_BOOTSTRAP = "${goBootstrap}/share/go";