about summary refs log tree commit diff
path: root/pkgs/stdenv
diff options
context:
space:
mode:
authorJohn Ericson <John.Ericson@Obsidian.Systems>2020-04-28 16:51:44 -0400
committerJohn Ericson <John.Ericson@Obsidian.Systems>2020-04-28 16:51:44 -0400
commitcf858e6d57c4753ca872ef9c24d2c31cb6a1204f (patch)
tree153dfb474d38e1248c06e035f496b66ba1b5b734 /pkgs/stdenv
parent941d2765fd34c31ab77db7b3903d97b7450030af (diff)
mkDerivation mesonFlags: Fix cross file logic to handle more cases
Otherwise eval breaks
Diffstat (limited to 'pkgs/stdenv')
-rw-r--r--pkgs/stdenv/generic/make-derivation.nix16
1 files changed, 7 insertions, 9 deletions
diff --git a/pkgs/stdenv/generic/make-derivation.nix b/pkgs/stdenv/generic/make-derivation.nix
index e6363ce42c0ae..b06541a7e4136 100644
--- a/pkgs/stdenv/generic/make-derivation.nix
+++ b/pkgs/stdenv/generic/make-derivation.nix
@@ -256,21 +256,19 @@ in rec {
 
           mesonFlags = if mesonFlags == null then null else let
             # See https://mesonbuild.com/Reference-tables.html#cpu-families
-            cpuFamilies = {
-              aarch64  = "aarch64";
-              armv5tel = "arm";
-              armv6l   = "arm";
-              armv7l   = "arm";
-              i686     = "x86";
-              x86_64   = "x86_64";
-            };
+            cpuFamily = platform: with platform;
+              /**/ if isAarch64 then "arm"
+              else if isAarch32 then "aarch64"
+              else if isx86_32  then "x86"
+              else if isx86_64  then "x86_64"
+              else platform.parsed.cpu.family + builtins.toString platform.parsed.cpu.bits;
             crossFile = builtins.toFile "cross-file.conf" (''
               [properties]
               needs_exe_wrapper = true
 
               [host_machine]
               system = '${stdenv.targetPlatform.parsed.kernel.name}'
-              cpu_family = '${cpuFamilies.${stdenv.targetPlatform.parsed.cpu.name}}'
+              cpu_family = '${cpuFamily stdenv.targetPlatform}'
               cpu = '${stdenv.targetPlatform.parsed.cpu.name}'
               endian = ${if stdenv.targetPlatform.isLittleEndian then "'little'" else "'big'"}
             ''