diff --git a/pkgs/development/libraries/mesa/default.nix b/pkgs/development/libraries/mesa/default.nix index c1e950c2e516..3fe641b4476c 100644 --- a/pkgs/development/libraries/mesa/default.nix +++ b/pkgs/development/libraries/mesa/default.nix @@ -91,6 +91,7 @@ "intel-nullhw" ] , mesa +, mesa-gl-headers , makeSetupHook }: @@ -151,15 +152,28 @@ in stdenv.mkDerivation { substituteInPlace src/amd/vulkan/meson.build --replace \ "get_option('datadir')" "'${placeholder "out"}/share'" + for header in ${toString mesa-gl-headers.headers}; do + if ! diff -q $header ${mesa-gl-headers}/$header; then + echo "File $header does not match between mesa and mesa-gl-headers, please update mesa-gl-headers first!" + exit 42 + fi + done + ${copyRustDeps} ''; outputs = [ - "out" "dev" "drivers" "driversdev" "opencl" "teflon" "osmesa" + "out" "dev" + "drivers" + # OpenCL drivers pull in ~1G of extra LLVM stuff, so don't install them + # if the user didn't explicitly ask for it + "opencl" # the Dozen drivers depend on libspirv2dxil, but link it statically, and # libspirv2dxil itself is pretty chonky, so relocate it to its own output in # case anything wants to use it at some point "spirv2dxil" + # tools for the host platform to be used when cross-compiling + "cross_tools" ]; # Keep build-ids so drivers can use them for caching, etc. @@ -193,8 +207,10 @@ in stdenv.mkDerivation { # Enable glvnd for dynamic libGL dispatch (lib.mesonEnable "glvnd" true) - (lib.mesonBool "gallium-nine" true) # Direct3D in Wine - (lib.mesonBool "osmesa" true) # used by wine + (lib.mesonBool "gallium-nine" false) # Direct3D9 in Wine, largely supplanted by DXVK + (lib.mesonBool "osmesa" false) # deprecated upstream + (lib.mesonEnable "gallium-xa" false) # old and mostly dead + (lib.mesonBool "teflon" true) # TensorFlow frontend # Enable all freedreno kernel mode drivers. (For example, virtio can be @@ -297,11 +313,11 @@ in stdenv.mkDerivation { wayland-scanner ] ++ lib.optionals needNativeCLC [ # `or null` to not break eval with `attribute missing` on darwin to linux cross - (buildPackages.mesa.driversdev or null) + (buildPackages.mesa.cross_tools or null) ]; disallowedRequisites = lib.optionals needNativeCLC [ - (buildPackages.mesa.driversdev or null) + (buildPackages.mesa.cross_tools or null) ]; propagatedBuildInputs = [ libdrm ]; @@ -317,7 +333,7 @@ in stdenv.mkDerivation { moveToOutput "lib/libglapi*" $drivers moveToOutput "lib/libpowervr_rogue*" $drivers moveToOutput "lib/libvulkan_*" $drivers - moveToOutput "lib/libxatracker*" $drivers + moveToOutput "lib/libteflon.so" $drivers # Update search path used by glvnd (it's pointing to $out but drivers are in $drivers) for js in $drivers/share/glvnd/egl_vendor.d/*.json; do @@ -340,14 +356,14 @@ in stdenv.mkDerivation { echo $opencl/lib/libMesaOpenCL.so > $opencl/etc/OpenCL/vendors/mesa.icd echo $opencl/lib/libRusticlOpenCL.so > $opencl/etc/OpenCL/vendors/rusticl.icd - moveToOutput bin/intel_clc $driversdev - moveToOutput bin/mesa_clc $driversdev - moveToOutput bin/vtn_bindgen $driversdev + moveToOutput bin/intel_clc $cross_tools + moveToOutput bin/mesa_clc $cross_tools + moveToOutput bin/vtn_bindgen $cross_tools + moveToOutput "lib/lib*OpenCL*" $opencl - moveToOutput "lib/libOSMesa*" $osmesa + moveToOutput bin/spirv2dxil $spirv2dxil moveToOutput "lib/libspirv_to_dxil*" $spirv2dxil - moveToOutput lib/libteflon.so $teflon ''; postFixup = '' @@ -359,15 +375,9 @@ in stdenv.mkDerivation { # remove pkgconfig files for GL/EGL; they are provided by libGL. rm -f $dev/lib/pkgconfig/{gl,egl}.pc - # Move development files for libraries in $drivers to $driversdev - mkdir -p $driversdev/include - mv $dev/include/xa_* $dev/include/d3d* -t $driversdev/include || true - mkdir -p $driversdev/lib/pkgconfig - for pc in lib/pkgconfig/{xatracker,d3d}.pc; do - if [ -f "$dev/$pc" ]; then - substituteInPlace "$dev/$pc" --replace $out $drivers - mv $dev/$pc $driversdev/$pc - fi + # remove headers moved to mesa-gl-headers + for header in ${toString mesa-gl-headers.headers}; do + rm -f $dev/$header done # update symlinks pointing to libgallium in $out