summary refs log tree commit diff
path: root/pkgs/build-support/gcc-wrapper-old/default.nix
diff options
context:
space:
mode:
authorhsloan <ishaqsloan@gmail.com>2017-06-28 15:59:14 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2017-06-28 18:42:00 -0400
commit49347667a879991e4593c38ca18d7297f248b05c (patch)
tree2963803e233afad96908ac01f855529731ef62bf /pkgs/build-support/gcc-wrapper-old/default.nix
parentda668f66c79bd031b7231e0bd1090ec2d48d87c4 (diff)
downloadnixlib-49347667a879991e4593c38ca18d7297f248b05c.tar
nixlib-49347667a879991e4593c38ca18d7297f248b05c.tar.gz
nixlib-49347667a879991e4593c38ca18d7297f248b05c.tar.bz2
nixlib-49347667a879991e4593c38ca18d7297f248b05c.tar.lz
nixlib-49347667a879991e4593c38ca18d7297f248b05c.tar.xz
nixlib-49347667a879991e4593c38ca18d7297f248b05c.tar.zst
nixlib-49347667a879991e4593c38ca18d7297f248b05c.zip
gcc-wrapper-old: Don't use stdenv.cross
Take the dynamic linker logic for cc-wrapper for now
Diffstat (limited to 'pkgs/build-support/gcc-wrapper-old/default.nix')
-rw-r--r--pkgs/build-support/gcc-wrapper-old/default.nix26
1 files changed, 16 insertions, 10 deletions
diff --git a/pkgs/build-support/gcc-wrapper-old/default.nix b/pkgs/build-support/gcc-wrapper-old/default.nix
index f8a7c62edc73..a37d94c36e06 100644
--- a/pkgs/build-support/gcc-wrapper-old/default.nix
+++ b/pkgs/build-support/gcc-wrapper-old/default.nix
@@ -8,6 +8,7 @@
 { name ? "", stdenv, lib, nativeTools, nativeLibc, nativePrefix ? ""
 , gcc ? null, libc ? null, binutils ? null, coreutils ? null, shell ? ""
 , zlib ? null
+, hostPlatform, targetPlatform
 }:
 
 assert nativeTools -> nativePrefix != "";
@@ -69,9 +70,9 @@ stdenv.mkDerivation {
     # the style in the gcc-cross-wrapper, but to keep a stable stdenv now I
     # do this sufficient if/else.
     dynamicLinker =
-      (if stdenv.cross.arch == "arm" then "ld-linux.so.3" else
-       if stdenv.cross.arch == "mips" then "ld.so.1" else
-       if stdenv.lib.hasSuffix "pc-gnu" stdenv.cross.config then "ld.so.1" else
+      (if hostPlatform.arch == "arm" then "ld-linux.so.3" else
+       if hostPlatform.arch == "mips" then "ld.so.1" else
+       if stdenv.lib.hasSuffix "pc-gnu" hostPlatform.config then "ld.so.1" else
        abort "don't know the name of the dynamic linker for this platform");
   };
 
@@ -85,15 +86,20 @@ stdenv.mkDerivation {
         + " (wrapper script)";
     };
 
-  # The dynamic linker has different names on different Linux platforms.
+  # The dynamic linker has different names on different platforms.
   dynamicLinker =
     if !nativeLibc then
-      (if stdenv.system == "i686-linux" then "ld-linux.so.2" else
-       if stdenv.system == "x86_64-linux" then "ld-linux-x86-64.so.2" else
+      (if targetPlatform.system == "i686-linux"     then "ld-linux.so.2" else
+       if targetPlatform.system == "x86_64-linux"   then "ld-linux-x86-64.so.2" else
        # ARM with a wildcard, which can be "" or "-armhf".
-       if stdenv.isArm then "ld-linux*.so.3" else
-       if stdenv.system == "powerpc-linux" then "ld.so.1" else
-       if stdenv.system == "mips64el-linux" then "ld.so.1" else
-       abort "don't know the name of the dynamic linker for this platform")
+       if targetPlatform.isArm32                    then "ld-linux*.so.3" else
+       if targetPlatform.system == "aarch64-linux"  then "ld-linux-aarch64.so.1" else
+       if targetPlatform.system == "powerpc-linux"  then "ld.so.1" else
+       if targetPlatform.system == "mips64el-linux" then "ld.so.1" else
+       if targetPlatform.system == "x86_64-darwin"  then "/usr/lib/dyld" else
+       if stdenv.lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1" else
+       builtins.trace
+         "Don't know the name of the dynamic linker for platform ${targetPlatform.config}, so guessing instead."
+         null)
     else "";
 }