mesa: Move the DriConf defaults from $drivers to $out

The effective change is that "drirc.d/00-mesa-defaults.conf" will now be
installed to $out instead of $drivers and not appear under
"/run/opengl-driver/share/" anymore.

This is done to fix #89421, i.e. so that Mesa will find and load the
included DriConf defaults. The other files in "$drivers/share" will not
be moved to $out as some Nixpkgs logic might depend on them being
available under "/run/opengl-driver/share/" (e.g. addOpenGLRunpath).
This commit is contained in:
Michael Weiss 2020-06-06 16:27:09 +02:00
parent cff356b82d
commit cd41673813
No known key found for this signature in database
GPG key ID: 5BE487C4D4771D83

View file

@ -79,6 +79,12 @@ stdenv.mkDerivation {
substituteInPlace meson.build --replace \
"find_program('pkg-config')" \
"find_program('${buildPackages.pkg-config.targetPrefix}pkg-config')"
# The drirc.d directory cannot be installed to $drivers as that would cause a cyclic dependency:
substituteInPlace src/util/xmlconfig.c --replace \
'DATADIR "/drirc.d"' '"${placeholder "out"}/drirc.d"'
substituteInPlace src/util/meson.build --replace \
"get_option('datadir')" "'${placeholder "out"}'"
'';
outputs = [ "out" "dev" "drivers" ] ++ lib.optional enableOSMesa "osmesa";
@ -86,6 +92,7 @@ stdenv.mkDerivation {
# TODO: Figure out how to enable opencl without having a runtime dependency on clang
mesonFlags = [
"--sysconfdir=/etc"
"--datadir=${placeholder "drivers"}/share" # Vendor files
# Don't build in debug mode
# https://gitlab.freedesktop.org/mesa/mesa/blob/master/docs/meson.html#L327
@ -156,9 +163,6 @@ stdenv.mkDerivation {
mv $out/lib/lib*_mesa* $drivers/lib
fi
# move vendor files
mv $out/share/ $drivers/
# Update search path used by glvnd
for js in $drivers/share/glvnd/egl_vendor.d/*.json; do
substituteInPlace "$js" --replace '"libEGL_' '"'"$drivers/lib/libEGL_"