summary refs log tree commit diff
path: root/pkgs/build-support
diff options
context:
space:
mode:
authorDaniel Barlow <dan@telent.net>2017-12-05 10:27:45 +0000
committerJohn Ericson <John.Ericson@Obsidian.Systems>2018-02-23 20:43:42 -0500
commit9c50ae6898b2d5dccd6e030c80535fb1a32f703d (patch)
treef957c334d3b0885adcca2cefa6f90ab805443e30 /pkgs/build-support
parent2682ba63bc0c4dea159ec664d63d375a8d75b12a (diff)
downloadnixpkgs-9c50ae6898b2d5dccd6e030c80535fb1a32f703d.tar
nixpkgs-9c50ae6898b2d5dccd6e030c80535fb1a32f703d.tar.gz
nixpkgs-9c50ae6898b2d5dccd6e030c80535fb1a32f703d.tar.bz2
nixpkgs-9c50ae6898b2d5dccd6e030c80535fb1a32f703d.tar.lz
nixpkgs-9c50ae6898b2d5dccd6e030c80535fb1a32f703d.tar.xz
nixpkgs-9c50ae6898b2d5dccd6e030c80535fb1a32f703d.tar.zst
nixpkgs-9c50ae6898b2d5dccd6e030c80535fb1a32f703d.zip
lib, treewide: Add missing MIPS arches, and fix existing usage
Existing "mips64el" should be "mipsel".

This is just the barest minimum so that nixpkgs can recognize them as
systems - although required for building individual derivations onto
MIPS boards, it is not sufficient if you want to actually build nixos on
those targets
Diffstat (limited to 'pkgs/build-support')
-rw-r--r--pkgs/build-support/bintools-wrapper/default.nix11
1 files changed, 9 insertions, 2 deletions
diff --git a/pkgs/build-support/bintools-wrapper/default.nix b/pkgs/build-support/bintools-wrapper/default.nix
index 48fd8665cb4..98b40114c69 100644
--- a/pkgs/build-support/bintools-wrapper/default.nix
+++ b/pkgs/build-support/bintools-wrapper/default.nix
@@ -58,7 +58,7 @@ let
     else if (with targetPlatform; isArm && isLinux)   then "${libc_lib}/lib/ld-linux*.so.3"
     else if targetPlatform.system == "aarch64-linux"  then "${libc_lib}/lib/ld-linux-aarch64.so.1"
     else if targetPlatform.system == "powerpc-linux"  then "${libc_lib}/lib/ld.so.1"
-    else if targetPlatform.system == "mips64el-linux" then "${libc_lib}/lib/ld.so.1"
+    else if targetPlatform.isMips                     then "${libc_lib}/lib/ld.so.1"
     else if targetPlatform.isDarwin                   then "/usr/lib/dyld"
     else if stdenv.lib.hasSuffix "pc-gnu" targetPlatform.config then "ld.so.1"
     else null;
@@ -171,13 +171,20 @@ stdenv.mkDerivation {
       else if targetPlatform.isWindows then "pe"
       else "elf" + toString targetPlatform.parsed.cpu.bits;
     endianPrefix = if targetPlatform.isBigEndian then "big" else "little";
+    sep = optionalString (targetPlatform.isx86 || targetPlatform.isArm) "-";
     arch =
       /**/ if targetPlatform.isAarch64 then endianPrefix + "aarch64"
       else if targetPlatform.isArm     then endianPrefix + "arm"
       else if targetPlatform.isx86_64  then "x86-64"
       else if targetPlatform.isi686    then "i386"
+      else if targetPlatform.isMips    then {
+          "mips"     = "btsmipn32"; # n32 variant
+          "mipsel"   = "ltsmipn32"; # n32 variant
+          "mips64"   = "btsmip";
+          "mips64el" = "ltsmip";
+        }.${targetPlatform.parsed.cpu.name}
       else throw "unknown emulation for platform: " + targetPlatform.config;
-    in targetPlatform.platform.bfdEmulation or (fmt + "-" + arch);
+    in targetPlatform.platform.bfdEmulation or (fmt + sep + arch);
 
   depsTargetTargetPropagated = extraPackages;