git.iko.soy/typeable/nixpkgs
on master help sign in
mesa: fix darwin and use meson auto features (PR #63912)

This fixes the darwin build, while also using Meson’s auto features as much as possible. As a result, we avoid using having to specify default drivers and instead delegate that to Mesa’s build system. Removed other flags that were specified to the default in Mesa. The -fno-common is needed to address undefined symbol _lp_dummy_tile in the build.

commit5c8472a2a17625855d0811ebb5709c9aa84fdd3f authorMatthew Bauer <mjbauer95@gmail.com> dateFri 28 Jun 2019, 23:46 (7 years ago) parented27ba0
1 file changed+14−67
pkgs/development/libraries/mesa/default.nix+14−67
pkgs/development/libraries/mesa/default.nix+14−67
@@ -5,9 +5,9 @@
55, libelf, libvdpau, python3Packages
66, libglvnd
77, enableRadv ? true
8−, galliumDrivers ? null
9−, driDrivers ? null
10−, vulkanDrivers ? null
8+, galliumDrivers ? ["auto"]
9+, driDrivers ? ["auto"]
10+, vulkanDrivers ? ["auto"]
1111, eglPlatforms ? [ "x11" ] ++ lib.optionals stdenv.isLinux [ "wayland" "drm" ]
1212, OpenGL, Xplugin
1313, withValgrind ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAarch32, valgrind-light
@@ -26,43 +26,6 @@
2626
2727with stdenv.lib;
2828
29−let
30− # platforms that have PCIe slots and thus can use most non-integrated GPUs
31− pciePlatform = !stdenv.hostPlatform.isAarch32 && !stdenv.hostPlatform.isAarch64;
32− defaultGalliumDrivers = optionals (elem "drm" eglPlatforms) ([ "virgl" ]
33− ++ lib.optionals pciePlatform [ "r300" "r600" "radeonsi" ]
34− ++ lib.optionals (pciePlatform || stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "nouveau" ]
35− ++ lib.optionals stdenv.hostPlatform.isx86 [ "svga" ]
36− ++ lib.optionals (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "vc4" ]
37− ++ lib.optionals stdenv.hostPlatform.isAarch64 [ "freedreno" "etnaviv" ]
38− );
39− defaultDriDrivers = optionals (elem "drm" eglPlatforms) ([ ]
40− ++ lib.optionals pciePlatform [ "r200" ]
41− ++ lib.optionals (pciePlatform || stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "nouveau" ]
42− ++ lib.optionals stdenv.hostPlatform.isx86 [ "i915" "i965" ]);
43− defaultVulkanDrivers = optionals stdenv.hostPlatform.isLinux ([ ]
44− ++ lib.optional stdenv.hostPlatform.isx86 "intel"
45− ++ lib.optional enableRadv "amd");
46−in
47−
48−let gallium_ = galliumDrivers; dri_ = driDrivers; vulkan_ = vulkanDrivers; in
49−
50−let
51− galliumDrivers =
52− (if gallium_ == null
53− then defaultGalliumDrivers
54− else gallium_)
55− ++ lib.optional stdenv.isLinux "swrast";
56− driDrivers =
57− (if dri_ == null
58− then optionals (elem "drm" eglPlatforms) defaultDriDrivers
59− else dri_);
60− vulkanDrivers =
61− if vulkan_ == null
62− then defaultVulkanDrivers
63− else vulkan_;
64−in
65−
6629let
6730 version = "19.1.1";
6831 branch = head (splitString "." version);
@@ -110,8 +73,7 @@ stdenv.mkDerivation rec {
11073 })
11174 ];
11275
113− outputs = [ "out" "dev" "drivers" ]
114− ++ lib.optional (elem "swrast" galliumDrivers) "osmesa";
76+ outputs = [ "out" "dev" "drivers" "osmesa" ];
11577
11678 # TODO: Figure out how to enable opencl without having a runtime dependency on clang
11779 mesonFlags = [
@@ -135,28 +97,11 @@ stdenv.mkDerivation rec {
13597 "-Domx-libs-path=${placeholder "drivers"}/lib/bellagio"
13698 "-Dva-libs-path=${placeholder "drivers"}/lib/dri"
13799 "-Dd3d-drivers-path=${placeholder "drivers"}/lib/d3d"
138−
139− "-Dgallium-vdpau=true"
140− "-Dgallium-xvmc=true"
141− "-Dgallium-opencl=disabled"
142− "-Dshared-glapi=true"
143− "-Dgles1=true"
144− "-Dgles2=true"
145− "-Dglx=dri"
100+ ] ++ optionals stdenv.isLinux [
146101 "-Dglvnd=true"
147− "-Dllvm=true"
148− "-Dshared-llvm=true"
149− "-Dglx-direct=true"
150− ] ++ optional (elem "swrast" galliumDrivers) "-Dosmesa=gallium" # used by wine
151− ++ optionals (stdenv.isLinux) [
152− "-Ddri3=true"
153− "-Dgallium-omx=bellagio"
154− "-Dgallium-va=true"
155− "-Dgallium-xa=true" # used in vmware driver
156− "-Dgallium-nine=true" # Direct3D in Wine
157− "-Dgbm=true"
158− "-Degl=true"
159− ];
102+ "-Dosmesa=gallium" # used by wine
103+ "-Dgallium-nine=true" # Direct3D in Wine
104+ ];
160105
161106 buildInputs = with xorg; [
162107 expat llvmPackages.llvm libglvnd xorgproto
@@ -183,8 +128,8 @@ stdenv.mkDerivation rec {
183128
184129 postInstall = ''
185130 # Some installs don't have any drivers so this directory is never created.
186− mkdir -p $drivers
187− '' + optionalString (galliumDrivers != []) ''
131+ mkdir -p $drivers $osmesa
132+ '' + optionalString stdenv.isLinux ''
188133 mkdir -p $drivers/lib
189134
190135 # move gallium-related stuff to $drivers, so $out doesn't depend on LLVM
@@ -206,7 +151,7 @@ stdenv.mkDerivation rec {
206151 for js in $drivers/share/glvnd/egl_vendor.d/*.json; do
207152 substituteInPlace "$js" --replace '"libEGL_' '"'"$drivers/lib/libEGL_"
208153 done
209− '' + optionalString (vulkanDrivers != []) ''
154+
210155 # Update search path used by Vulkan (it's pointing to $out but
211156 # drivers are in $drivers)
212157 for js in $drivers/share/vulkan/icd.d/*.json; do
@@ -217,7 +162,7 @@ stdenv.mkDerivation rec {
217162 # TODO:
218163 # check $out doesn't depend on llvm: builder failures are ignored
219164 # for some reason grep -qv '${llvmPackages.llvm}' -R "$out";
220− postFixup = optionalString (galliumDrivers != []) ''
165+ postFixup = optionalString stdenv.isLinux ''
221166 # set the default search path for DRI drivers; used e.g. by X server
222167 substituteInPlace "$dev/lib/pkgconfig/dri.pc" --replace "$drivers" "${libglvnd.driverLink}"
223168
@@ -238,6 +183,8 @@ stdenv.mkDerivation rec {
238183 done
239184 '';
240185
186+ NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-fno-common";
187+
241188 passthru = {
242189 inherit libdrm;
243190 inherit (libglvnd) driverLink;