summary refs log tree commit diff
path: root/pkgs/development/libraries/mesa
diff options
context:
space:
mode:
authorJona Stubbe <nixos@crystalgamma.de>2018-08-22 19:27:23 +0200
committerJona Stubbe <nixos@crystalgamma.de>2018-08-22 19:27:23 +0200
commita1f57027551caac627c56f085233744533576f11 (patch)
tree547e42d8c86d62066d6b26d48ef894ba4b798be1 /pkgs/development/libraries/mesa
parentd944690b7b7a512268467e0bc9d45ca6bcdf9824 (diff)
downloadnixpkgs-a1f57027551caac627c56f085233744533576f11.tar
nixpkgs-a1f57027551caac627c56f085233744533576f11.tar.gz
nixpkgs-a1f57027551caac627c56f085233744533576f11.tar.bz2
nixpkgs-a1f57027551caac627c56f085233744533576f11.tar.lz
nixpkgs-a1f57027551caac627c56f085233744533576f11.tar.xz
nixpkgs-a1f57027551caac627c56f085233744533576f11.tar.zst
nixpkgs-a1f57027551caac627c56f085233744533576f11.zip
mesa: restructure driver selection to be more architecture-neutral
This allows Mesa to also build on ppc64le.
Diffstat (limited to 'pkgs/development/libraries/mesa')
-rw-r--r--pkgs/development/libraries/mesa/default.nix29
1 files changed, 15 insertions, 14 deletions
diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix
index e1a9477dcd6..2f8a4bda88a 100644
--- a/pkgs/development/libraries/mesa/default.nix
+++ b/pkgs/development/libraries/mesa/default.nix
@@ -24,24 +24,25 @@
 with stdenv.lib;
 
 if ! lists.elem stdenv.system platforms.mesaPlatforms then
-  throw "unsupported platform for Mesa"
+  throw "${stdenv.system}: unsupported platform for Mesa"
 else
 
 let
-  defaultGalliumDrivers =
-    if stdenv.isAarch32
-    then ["virgl" "nouveau" "freedreno" "vc4" "etnaviv" "imx"]
-    else if stdenv.isAarch64
-    then ["virgl" "nouveau" "vc4" ]
-    else ["virgl" "svga" "i915" "r300" "r600" "radeonsi" "nouveau"];
-  defaultDriDrivers =
-    if (stdenv.isAarch32 || stdenv.isAarch64)
-    then ["nouveau"]
-    else ["i915" "i965" "nouveau" "radeon" "r200"];
+  inherit (stdenv) hostPlatform;
+  defaultGalliumDrivers = [ "virgl" "nouveau" ]
+    ++ (if hostPlatform.isAarch32 || hostPlatform.isAarch64 then
+      [ "vc4" ]
+      ++ lib.optionals hostPlatform.isAarch64 [ "freedreno" "etnaviv" "imx" ]
+    else
+      [ "r300" "r600" "radeonsi"]
+      ++ lib.optionals hostPlatform.isx86 [ "i915" "svga" ]
+    );
+  defaultDriDrivers = [ "nouveau" ]
+    ++ lib.optionals (!hostPlatform.isAarch32 && !hostPlatform.isAarch64) [ "radeon" "r200" ]
+    ++ lib.optionals hostPlatform.isx86 [ "i915" "i965" ];
   defaultVulkanDrivers =
-    if (stdenv.isAarch32 || stdenv.isAarch64)
-    then []
-    else ["intel"] ++ lib.optional enableRadv "radeon";
+    lib.optional hostPlatform.isx86 "intel"
+    ++ lib.optional enableRadv "radeon";
 in
 
 let gallium_ = galliumDrivers; dri_ = driDrivers; vulkan_ = vulkanDrivers; in