mesa: make more things optional (#87438)
osmesa & gallium-nine are not needed for all systems. So this adds a flag to disable them if you don’t want them.
This commit is contained in:
parent
01377fc6ef
commit
c2039e1901
@ -11,6 +11,8 @@
|
|||||||
, eglPlatforms ? [ "x11" "surfaceless" ] ++ lib.optionals stdenv.isLinux [ "wayland" "drm" ]
|
, eglPlatforms ? [ "x11" "surfaceless" ] ++ lib.optionals stdenv.isLinux [ "wayland" "drm" ]
|
||||||
, OpenGL, Xplugin
|
, OpenGL, Xplugin
|
||||||
, withValgrind ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAarch32, valgrind-light
|
, withValgrind ? stdenv.hostPlatform.isLinux && !stdenv.hostPlatform.isAarch32, valgrind-light
|
||||||
|
, enableGalliumNine ? stdenv.isLinux
|
||||||
|
, enableOSMesa ? stdenv.isLinux
|
||||||
}:
|
}:
|
||||||
|
|
||||||
/** Packaging design:
|
/** Packaging design:
|
||||||
@ -79,7 +81,7 @@ stdenv.mkDerivation {
|
|||||||
"find_program('${buildPackages.pkg-config.targetPrefix}pkg-config')"
|
"find_program('${buildPackages.pkg-config.targetPrefix}pkg-config')"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
outputs = [ "out" "dev" "drivers" "osmesa" ];
|
outputs = [ "out" "dev" "drivers" ] ++ lib.optional enableOSMesa "osmesa";
|
||||||
|
|
||||||
# TODO: Figure out how to enable opencl without having a runtime dependency on clang
|
# TODO: Figure out how to enable opencl without having a runtime dependency on clang
|
||||||
mesonFlags = [
|
mesonFlags = [
|
||||||
@ -103,10 +105,10 @@ stdenv.mkDerivation {
|
|||||||
"-Domx-libs-path=${placeholder "drivers"}/lib/bellagio"
|
"-Domx-libs-path=${placeholder "drivers"}/lib/bellagio"
|
||||||
"-Dva-libs-path=${placeholder "drivers"}/lib/dri"
|
"-Dva-libs-path=${placeholder "drivers"}/lib/dri"
|
||||||
"-Dd3d-drivers-path=${placeholder "drivers"}/lib/d3d"
|
"-Dd3d-drivers-path=${placeholder "drivers"}/lib/d3d"
|
||||||
|
"-Dgallium-nine=${if enableGalliumNine then "true" else "false"}" # Direct3D in Wine
|
||||||
|
"-Dosmesa=${if enableOSMesa then "gallium" else "none"}" # used by wine
|
||||||
] ++ optionals stdenv.isLinux [
|
] ++ optionals stdenv.isLinux [
|
||||||
"-Dglvnd=true"
|
"-Dglvnd=true"
|
||||||
"-Dosmesa=gallium" # used by wine
|
|
||||||
"-Dgallium-nine=true" # Direct3D in Wine
|
|
||||||
];
|
];
|
||||||
|
|
||||||
buildInputs = with xorg; [
|
buildInputs = with xorg; [
|
||||||
@ -142,17 +144,17 @@ stdenv.mkDerivation {
|
|||||||
'' + optionalString stdenv.isLinux ''
|
'' + optionalString stdenv.isLinux ''
|
||||||
mkdir -p $drivers/lib
|
mkdir -p $drivers/lib
|
||||||
|
|
||||||
# move gallium-related stuff to $drivers, so $out doesn't depend on LLVM
|
if [ -n "$(shopt -s nullglob; echo "$out/lib/libxatracker"*)" -o -n "$(shopt -s nullglob; echo "$out/lib/libvulkan_"*)" ]; then
|
||||||
mv -t $drivers/lib \
|
# move gallium-related stuff to $drivers, so $out doesn't depend on LLVM
|
||||||
$out/lib/libxatracker* \
|
mv -t $drivers/lib \
|
||||||
$out/lib/libvulkan_*
|
$out/lib/libxatracker* \
|
||||||
|
$out/lib/libvulkan_*
|
||||||
|
fi
|
||||||
|
|
||||||
# Move other drivers to a separate output
|
if [ -n "$(shopt -s nullglob; echo "$out"/lib/lib*_mesa*)" ]; then
|
||||||
mv $out/lib/lib*_mesa* $drivers/lib
|
# Move other drivers to a separate output
|
||||||
|
mv $out/lib/lib*_mesa* $drivers/lib
|
||||||
# move libOSMesa to $osmesa, as it's relatively big
|
fi
|
||||||
mkdir -p $osmesa/lib
|
|
||||||
mv -t $osmesa/lib/ $out/lib/libOSMesa*
|
|
||||||
|
|
||||||
# move vendor files
|
# move vendor files
|
||||||
mv $out/share/ $drivers/
|
mv $out/share/ $drivers/
|
||||||
@ -167,6 +169,10 @@ stdenv.mkDerivation {
|
|||||||
for js in $drivers/share/vulkan/icd.d/*.json; do
|
for js in $drivers/share/vulkan/icd.d/*.json; do
|
||||||
substituteInPlace "$js" --replace "$out" "$drivers"
|
substituteInPlace "$js" --replace "$out" "$drivers"
|
||||||
done
|
done
|
||||||
|
'' + lib.optionalString enableOSMesa ''
|
||||||
|
# move libOSMesa to $osmesa, as it's relatively big
|
||||||
|
mkdir -p $osmesa/lib
|
||||||
|
mv -t $osmesa/lib/ $out/lib/libOSMesa*
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# TODO:
|
# TODO:
|
||||||
@ -181,7 +187,9 @@ stdenv.mkDerivation {
|
|||||||
|
|
||||||
# Update search path used by pkg-config
|
# Update search path used by pkg-config
|
||||||
for pc in $dev/lib/pkgconfig/{d3d,dri,xatracker}.pc; do
|
for pc in $dev/lib/pkgconfig/{d3d,dri,xatracker}.pc; do
|
||||||
substituteInPlace "$pc" --replace $out $drivers
|
if [ -f "$pc" ]; then
|
||||||
|
substituteInPlace "$pc" --replace $out $drivers
|
||||||
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
# add RPATH so the drivers can find the moved libgallium and libdricore9
|
# add RPATH so the drivers can find the moved libgallium and libdricore9
|
||||||
|
Loading…
x
Reference in New Issue
Block a user