diff options
author | Matthew Bauer <mjbauer95@gmail.com> | 2019-06-28 23:46:55 -0400 |
---|---|---|
committer | Vladimír Čunát <v@cunat.cz> | 2019-07-09 14:51:41 +0200 |
commit | 5c8472a2a17625855d0811ebb5709c9aa84fdd3f (patch) | |
tree | 94fe7596301e1703304468ebddc44e405aad2e29 /pkgs | |
parent | ed27ba064ca6f8c7837a6dec2d2af424092485be (diff) | |
download | nixpkgs-5c8472a2a17625855d0811ebb5709c9aa84fdd3f.tar nixpkgs-5c8472a2a17625855d0811ebb5709c9aa84fdd3f.tar.gz nixpkgs-5c8472a2a17625855d0811ebb5709c9aa84fdd3f.tar.bz2 nixpkgs-5c8472a2a17625855d0811ebb5709c9aa84fdd3f.tar.lz nixpkgs-5c8472a2a17625855d0811ebb5709c9aa84fdd3f.tar.xz nixpkgs-5c8472a2a17625855d0811ebb5709c9aa84fdd3f.tar.zst nixpkgs-5c8472a2a17625855d0811ebb5709c9aa84fdd3f.zip |
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.
Diffstat (limited to 'pkgs')
-rw-r--r-- | pkgs/development/libraries/mesa/default.nix | 81 |
1 files changed, 14 insertions, 67 deletions
diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index 1f1962d6402..2c5e4a8e034 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -5,9 +5,9 @@ , libelf, libvdpau, python3Packages , libglvnd , enableRadv ? true -, galliumDrivers ? null -, driDrivers ? null -, vulkanDrivers ? null +, galliumDrivers ? ["auto"] +, driDrivers ? ["auto"] +, vulkanDrivers ? ["auto"] , eglPlatforms ? [ "x11" ] ++ lib.optionals stdenv.isLinux [ "wayland" "drm" ] , OpenGL, Xplugin , withValgrind ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAarch32, valgrind-light @@ -27,43 +27,6 @@ with stdenv.lib; let - # platforms that have PCIe slots and thus can use most non-integrated GPUs - pciePlatform = !stdenv.hostPlatform.isAarch32 && !stdenv.hostPlatform.isAarch64; - defaultGalliumDrivers = optionals (elem "drm" eglPlatforms) ([ "virgl" ] - ++ lib.optionals pciePlatform [ "r300" "r600" "radeonsi" ] - ++ lib.optionals (pciePlatform || stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "nouveau" ] - ++ lib.optionals stdenv.hostPlatform.isx86 [ "svga" ] - ++ lib.optionals (stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "vc4" ] - ++ lib.optionals stdenv.hostPlatform.isAarch64 [ "freedreno" "etnaviv" ] - ); - defaultDriDrivers = optionals (elem "drm" eglPlatforms) ([ ] - ++ lib.optionals pciePlatform [ "r200" ] - ++ lib.optionals (pciePlatform || stdenv.hostPlatform.isAarch32 || stdenv.hostPlatform.isAarch64) [ "nouveau" ] - ++ lib.optionals stdenv.hostPlatform.isx86 [ "i915" "i965" ]); - defaultVulkanDrivers = optionals stdenv.hostPlatform.isLinux ([ ] - ++ lib.optional stdenv.hostPlatform.isx86 "intel" - ++ lib.optional enableRadv "amd"); -in - -let gallium_ = galliumDrivers; dri_ = driDrivers; vulkan_ = vulkanDrivers; in - -let - galliumDrivers = - (if gallium_ == null - then defaultGalliumDrivers - else gallium_) - ++ lib.optional stdenv.isLinux "swrast"; - driDrivers = - (if dri_ == null - then optionals (elem "drm" eglPlatforms) defaultDriDrivers - else dri_); - vulkanDrivers = - if vulkan_ == null - then defaultVulkanDrivers - else vulkan_; -in - -let version = "19.1.1"; branch = head (splitString "." version); in @@ -110,8 +73,7 @@ stdenv.mkDerivation rec { }) ]; - outputs = [ "out" "dev" "drivers" ] - ++ lib.optional (elem "swrast" galliumDrivers) "osmesa"; + outputs = [ "out" "dev" "drivers" "osmesa" ]; # TODO: Figure out how to enable opencl without having a runtime dependency on clang mesonFlags = [ @@ -135,28 +97,11 @@ stdenv.mkDerivation rec { "-Domx-libs-path=${placeholder "drivers"}/lib/bellagio" "-Dva-libs-path=${placeholder "drivers"}/lib/dri" "-Dd3d-drivers-path=${placeholder "drivers"}/lib/d3d" - - "-Dgallium-vdpau=true" - "-Dgallium-xvmc=true" - "-Dgallium-opencl=disabled" - "-Dshared-glapi=true" - "-Dgles1=true" - "-Dgles2=true" - "-Dglx=dri" + ] ++ optionals stdenv.isLinux [ "-Dglvnd=true" - "-Dllvm=true" - "-Dshared-llvm=true" - "-Dglx-direct=true" - ] ++ optional (elem "swrast" galliumDrivers) "-Dosmesa=gallium" # used by wine - ++ optionals (stdenv.isLinux) [ - "-Ddri3=true" - "-Dgallium-omx=bellagio" - "-Dgallium-va=true" - "-Dgallium-xa=true" # used in vmware driver - "-Dgallium-nine=true" # Direct3D in Wine - "-Dgbm=true" - "-Degl=true" - ]; + "-Dosmesa=gallium" # used by wine + "-Dgallium-nine=true" # Direct3D in Wine + ]; buildInputs = with xorg; [ expat llvmPackages.llvm libglvnd xorgproto @@ -183,8 +128,8 @@ stdenv.mkDerivation rec { postInstall = '' # Some installs don't have any drivers so this directory is never created. - mkdir -p $drivers - '' + optionalString (galliumDrivers != []) '' + mkdir -p $drivers $osmesa + '' + optionalString stdenv.isLinux '' mkdir -p $drivers/lib # move gallium-related stuff to $drivers, so $out doesn't depend on LLVM @@ -206,7 +151,7 @@ stdenv.mkDerivation rec { for js in $drivers/share/glvnd/egl_vendor.d/*.json; do substituteInPlace "$js" --replace '"libEGL_' '"'"$drivers/lib/libEGL_" done - '' + optionalString (vulkanDrivers != []) '' + # Update search path used by Vulkan (it's pointing to $out but # drivers are in $drivers) for js in $drivers/share/vulkan/icd.d/*.json; do @@ -217,7 +162,7 @@ stdenv.mkDerivation rec { # TODO: # check $out doesn't depend on llvm: builder failures are ignored # for some reason grep -qv '${llvmPackages.llvm}' -R "$out"; - postFixup = optionalString (galliumDrivers != []) '' + postFixup = optionalString stdenv.isLinux '' # set the default search path for DRI drivers; used e.g. by X server substituteInPlace "$dev/lib/pkgconfig/dri.pc" --replace "$drivers" "${libglvnd.driverLink}" @@ -238,6 +183,8 @@ stdenv.mkDerivation rec { done ''; + NIX_CFLAGS_COMPILE = stdenv.lib.optionalString stdenv.isDarwin "-fno-common"; + passthru = { inherit libdrm; inherit (libglvnd) driverLink; |