Skip to content

Commit afe2ba3

Browse files
committed
mesa: output cleanup, part 1
- add sanity check for mesa-gl-headers - drop osmesa, gallium-nine, xatracker from default build - move teflon to $drivers - rename $driversdev to $cross_tools to reflect its real use
1 parent a103c83 commit afe2ba3

File tree

1 file changed

+30
-20
lines changed

1 file changed

+30
-20
lines changed

pkgs/development/libraries/mesa/default.nix

Lines changed: 30 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -91,6 +91,7 @@
9191
"intel-nullhw"
9292
]
9393
, mesa
94+
, mesa-gl-headers
9495
, makeSetupHook
9596
}:
9697

@@ -151,15 +152,28 @@ in stdenv.mkDerivation {
151152
substituteInPlace src/amd/vulkan/meson.build --replace \
152153
"get_option('datadir')" "'${placeholder "out"}/share'"
153154
155+
for header in ${toString mesa-gl-headers.headers}; do
156+
if ! diff -q $header ${mesa-gl-headers}/$header; then
157+
echo "File $header does not match between mesa and mesa-gl-headers, please update mesa-gl-headers first!"
158+
exit 42
159+
fi
160+
done
161+
154162
${copyRustDeps}
155163
'';
156164

157165
outputs = [
158-
"out" "dev" "drivers" "driversdev" "opencl" "teflon" "osmesa"
166+
"out" "dev"
167+
"drivers"
168+
# OpenCL drivers pull in ~1G of extra LLVM stuff, so don't install them
169+
# if the user didn't explicitly ask for it
170+
"opencl"
159171
# the Dozen drivers depend on libspirv2dxil, but link it statically, and
160172
# libspirv2dxil itself is pretty chonky, so relocate it to its own output in
161173
# case anything wants to use it at some point
162174
"spirv2dxil"
175+
# tools for the host platform to be used when cross-compiling
176+
"cross_tools"
163177
];
164178

165179
# Keep build-ids so drivers can use them for caching, etc.
@@ -193,8 +207,10 @@ in stdenv.mkDerivation {
193207
# Enable glvnd for dynamic libGL dispatch
194208
(lib.mesonEnable "glvnd" true)
195209

196-
(lib.mesonBool "gallium-nine" true) # Direct3D in Wine
197-
(lib.mesonBool "osmesa" true) # used by wine
210+
(lib.mesonBool "gallium-nine" false) # Direct3D9 in Wine, largely supplanted by DXVK
211+
(lib.mesonBool "osmesa" false) # deprecated upstream
212+
(lib.mesonEnable "gallium-xa" false) # old and mostly dead
213+
198214
(lib.mesonBool "teflon" true) # TensorFlow frontend
199215

200216
# Enable all freedreno kernel mode drivers. (For example, virtio can be
@@ -297,11 +313,11 @@ in stdenv.mkDerivation {
297313
wayland-scanner
298314
] ++ lib.optionals needNativeCLC [
299315
# `or null` to not break eval with `attribute missing` on darwin to linux cross
300-
(buildPackages.mesa.driversdev or null)
316+
(buildPackages.mesa.cross_tools or null)
301317
];
302318

303319
disallowedRequisites = lib.optionals needNativeCLC [
304-
(buildPackages.mesa.driversdev or null)
320+
(buildPackages.mesa.cross_tools or null)
305321
];
306322

307323
propagatedBuildInputs = [ libdrm ];
@@ -317,7 +333,7 @@ in stdenv.mkDerivation {
317333
moveToOutput "lib/libglapi*" $drivers
318334
moveToOutput "lib/libpowervr_rogue*" $drivers
319335
moveToOutput "lib/libvulkan_*" $drivers
320-
moveToOutput "lib/libxatracker*" $drivers
336+
moveToOutput "lib/libteflon.so" $drivers
321337
322338
# Update search path used by glvnd (it's pointing to $out but drivers are in $drivers)
323339
for js in $drivers/share/glvnd/egl_vendor.d/*.json; do
@@ -340,14 +356,14 @@ in stdenv.mkDerivation {
340356
echo $opencl/lib/libMesaOpenCL.so > $opencl/etc/OpenCL/vendors/mesa.icd
341357
echo $opencl/lib/libRusticlOpenCL.so > $opencl/etc/OpenCL/vendors/rusticl.icd
342358
343-
moveToOutput bin/intel_clc $driversdev
344-
moveToOutput bin/mesa_clc $driversdev
345-
moveToOutput bin/vtn_bindgen $driversdev
359+
moveToOutput bin/intel_clc $cross_tools
360+
moveToOutput bin/mesa_clc $cross_tools
361+
moveToOutput bin/vtn_bindgen $cross_tools
362+
346363
moveToOutput "lib/lib*OpenCL*" $opencl
347-
moveToOutput "lib/libOSMesa*" $osmesa
364+
348365
moveToOutput bin/spirv2dxil $spirv2dxil
349366
moveToOutput "lib/libspirv_to_dxil*" $spirv2dxil
350-
moveToOutput lib/libteflon.so $teflon
351367
'';
352368

353369
postFixup = ''
@@ -359,15 +375,9 @@ in stdenv.mkDerivation {
359375
# remove pkgconfig files for GL/EGL; they are provided by libGL.
360376
rm -f $dev/lib/pkgconfig/{gl,egl}.pc
361377
362-
# Move development files for libraries in $drivers to $driversdev
363-
mkdir -p $driversdev/include
364-
mv $dev/include/xa_* $dev/include/d3d* -t $driversdev/include || true
365-
mkdir -p $driversdev/lib/pkgconfig
366-
for pc in lib/pkgconfig/{xatracker,d3d}.pc; do
367-
if [ -f "$dev/$pc" ]; then
368-
substituteInPlace "$dev/$pc" --replace $out $drivers
369-
mv $dev/$pc $driversdev/$pc
370-
fi
378+
# remove headers moved to mesa-gl-headers
379+
for header in ${toString mesa-gl-headers.headers}; do
380+
rm -f $dev/$header
371381
done
372382
373383
# update symlinks pointing to libgallium in $out

0 commit comments

Comments
 (0)