about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/mesa/default.nix
diff options
context:
space:
mode:
authorAlyssa <hi@alyssa.is>2019-04-18 12:47:37 +0200
committerAlyssa Ross <hi@alyssa.is>2019-04-23 10:02:10 +0000
commitdfdfaa2b4e97913327baadaf049b17686b0577d9 (patch)
tree95f6837faa1031e44165114aacf8a436eb87bafd /nixpkgs/pkgs/development/libraries/mesa/default.nix
parentef3c53a9174d297f258cf4e45bef712de9a2359c (diff)
downloadnixlib-dfdfaa2b4e97913327baadaf049b17686b0577d9.tar
nixlib-dfdfaa2b4e97913327baadaf049b17686b0577d9.tar.gz
nixlib-dfdfaa2b4e97913327baadaf049b17686b0577d9.tar.bz2
nixlib-dfdfaa2b4e97913327baadaf049b17686b0577d9.tar.lz
nixlib-dfdfaa2b4e97913327baadaf049b17686b0577d9.tar.xz
nixlib-dfdfaa2b4e97913327baadaf049b17686b0577d9.tar.zst
nixlib-dfdfaa2b4e97913327baadaf049b17686b0577d9.zip
mesa: make libdrm support optional
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/mesa/default.nix')
-rw-r--r--nixpkgs/pkgs/development/libraries/mesa/default.nix38
1 files changed, 24 insertions, 14 deletions
diff --git a/nixpkgs/pkgs/development/libraries/mesa/default.nix b/nixpkgs/pkgs/development/libraries/mesa/default.nix
index b72881189e5a..db01a812200a 100644
--- a/nixpkgs/pkgs/development/libraries/mesa/default.nix
+++ b/nixpkgs/pkgs/development/libraries/mesa/default.nix
@@ -1,10 +1,10 @@
 { stdenv, fetchurl, fetchpatch, lib
 , pkgconfig, intltool, autoreconfHook
-, file, expat, libdrm, xorg, wayland, wayland-protocols, openssl
+, file, expat, xorg, wayland, wayland-protocols, openssl
 , llvmPackages, libffi
 , libelf, valgrind-light, python2, python2Packages
 , libglvnd
-, enableRadv ? true
+, enableRadv ? stdenv.isLinux
 , galliumDrivers ? null
 , driDrivers ? null
 , vulkanDrivers ? null
@@ -14,14 +14,18 @@
 , vdpauSupport ? true, libvdpau
 , omxBellagioSupport ? stdenv.isLinux, libomxil-bellagio
 , vaSupport ? stdenv.isLinux, libva-minimal
+, libdrmSupport ? stdenv.isLinux, libdrm
 
 , OpenGL, Xplugin
 }:
 
 with lib;
 
+assert elem "drm" eglPlatforms -> libdrmSupport;
+assert elem "wayland" eglPlatforms -> libdrmSupport;
 assert xvmcSupport -> elem "x11" eglPlatforms;
 assert vdpauSupport -> elem "x11" eglPlatforms;
+assert enableRadv -> libdrmSupport;
 
 /** Packaging design:
   - The basic mesa ($out) contains headers and libraries (GLU is in libGLU now).
@@ -52,9 +56,11 @@ let
     then ["nouveau"]
     else ["i915" "i965" "nouveau" "radeon" "r200"]);
   defaultVulkanDrivers =
-    optionals stdenv.isLinux (if (stdenv.isAarch32 || stdenv.isAarch64)
-    then []
-    else ["intel"] ++ lib.optional enableRadv "radeon");
+    optional enableRadv "radeon"
+    ++ (optional (stdenv.isLinux
+                  && libdrmSupport
+                  && !stdenv.isAarch32
+                  && !stdenv.isAarch64) "intel");
 in
 
 let gallium_ = galliumDrivers; dri_ = driDrivers; vulkan_ = vulkanDrivers; in
@@ -116,6 +122,10 @@ let self = stdenv.mkDerivation {
       url = https://cgit.freedesktop.org/mesa/mesa/patch/?id=eb44c36cf1729e7e200b77cf8ea755dff72d1639;
       sha256 = "1izp38yja917241y7qslbkbmxv5ll9746ivgg2q5s64cwiydwrcc";
     })
+    (fetchpatch {
+      url = https://cgit.freedesktop.org/mesa/mesa/patch/?id=bcc4bfc8e80da5dc4c6ee44f791f2112dac208d1;
+      sha256 = "0rijkx80anbb7g14cg9g11ha7lcf7sixc7xsjam6myyd68nl3n5n";
+    })
   ] ++ lib.optional stdenv.isDarwin ./darwin-clock-gettime.patch;
 
   outputs = [ "out" "dev" "drivers" ]
@@ -140,7 +150,7 @@ let self = stdenv.mkDerivation {
     #      whether this is still the case and remove the check if not:
     #
     #      Last checked: v18.3.4
-    (enableFeature (stdenv.isLinux && elem "x11" eglPlatforms) "dri3")
+    (enableFeature (stdenv.isLinux && elem "x11" eglPlatforms && libdrmSupport) "dri3")
 
     # Direct3D in Wine
     (enableFeature (any (d: d != "swrast") galliumDrivers) "nine")
@@ -150,7 +160,7 @@ let self = stdenv.mkDerivation {
     "--enable-driglx-direct"
     "--enable-gles1"
     "--enable-gles2"
-    (enableFeature (elem "x11" eglPlatforms) "glx")
+    (enableFeature (elem "x11" eglPlatforms && libdrmSupport) "glx")
     # https://bugs.freedesktop.org/show_bug.cgi?id=35268
     (enableFeature (!stdenv.hostPlatform.isMusl) "glx-tls")
     # used by wine
@@ -161,7 +171,7 @@ let self = stdenv.mkDerivation {
     # used in vmware driver
     (enableFeature (any (d: d != "swrast") galliumDrivers) "xa")
 
-    (enableFeature stdenv.isLinux "gbm")
+    (enableFeature libdrmSupport "gbm")
     (enableFeature xvmcSupport "xvmc")
     (enableFeature vdpauSupport "vdpau")
     "--enable-shared-glapi"
@@ -183,7 +193,7 @@ let self = stdenv.mkDerivation {
 
   propagatedBuildInputs =
     optionals (elem "x11" eglPlatforms) (with xorg; [ libXdamage libXxf86vm ])
-    ++ optional stdenv.isLinux libdrm
+    ++ optional libdrmSupport libdrm
     ++ optionals stdenv.isDarwin [ OpenGL Xplugin ];
 
   buildInputs = [ expat llvmPackages.llvm libglvnd libelf ]
@@ -215,11 +225,6 @@ let self = stdenv.mkDerivation {
     # Some installs don't have any drivers so this directory is never created.
     mkdir -p $drivers
   '' + optionalString (galliumDrivers != []) ''
-    # move gallium-related stuff to $drivers, so $out doesn't depend on LLVM
-    mv -t "$drivers/lib/"    \
-      $out/lib/libxatracker* \
-      $out/lib/libvulkan_*
-
     # Move other drivers to a separate output
     mv $out/lib/lib*_mesa* $drivers/lib
 
@@ -260,6 +265,11 @@ let self = stdenv.mkDerivation {
     for pc in $dev/lib/pkgconfig/{d3d,xatracker}.pc; do
       substituteInPlace "$pc" --replace $out $drivers
     done
+    # move gallium-related stuff to $drivers, so $out doesn't depend on LLVM
+    mv $out/lib/libxatracker* $drivers/lib
+  '' + optionalString (vulkanDrivers != []) ''
+    # move gallium-related stuff to $drivers, so $out doesn't depend on LLVM
+    mv $out/lib/libvulkan_* $drivers/lib
   '';
 
   # TODO: