mesa: add driversdev output and test that dev doesn't depend on drivers
OpenGL applications should not depend on the Mesa drivers, since these are supposed to be loaded at runtime from /run/opengl-driver using the glvnd library. Furthermore, the drivers output has a large closure since it depends on LLVM. The only dependency from dev to drivers came from the xatracker pkg-config file. This commit moves this file into a new output called driversdev.
This commit is contained in:
parent
aa0b68b26a
commit
acbfd3f7c0
|
@ -34,9 +34,8 @@ let
|
||||||
# Release frequency: https://www.mesa3d.org/releasing.html#schedule
|
# Release frequency: https://www.mesa3d.org/releasing.html#schedule
|
||||||
version = "21.0.2";
|
version = "21.0.2";
|
||||||
branch = versions.major version;
|
branch = versions.major version;
|
||||||
in
|
|
||||||
|
|
||||||
stdenv.mkDerivation {
|
self = stdenv.mkDerivation {
|
||||||
pname = "mesa";
|
pname = "mesa";
|
||||||
inherit version;
|
inherit version;
|
||||||
|
|
||||||
|
@ -88,7 +87,9 @@ stdenv.mkDerivation {
|
||||||
"find_program('${stdenv.cc.targetPrefix}nm')"
|
"find_program('${stdenv.cc.targetPrefix}nm')"
|
||||||
'';
|
'';
|
||||||
|
|
||||||
outputs = [ "out" "dev" "drivers" ] ++ lib.optional enableOSMesa "osmesa";
|
outputs = [ "out" "dev" "drivers" ]
|
||||||
|
++ lib.optional enableOSMesa "osmesa"
|
||||||
|
++ lib.optional stdenv.isLinux "driversdev";
|
||||||
|
|
||||||
# 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 = [
|
||||||
|
@ -181,20 +182,22 @@ stdenv.mkDerivation {
|
||||||
mv -t $osmesa/lib/ $out/lib/libOSMesa*
|
mv -t $osmesa/lib/ $out/lib/libOSMesa*
|
||||||
'';
|
'';
|
||||||
|
|
||||||
# TODO:
|
|
||||||
# check $out doesn't depend on llvm: builder failures are ignored
|
|
||||||
# for some reason grep -qv '${llvmPackages.llvm}' -R "$out";
|
|
||||||
postFixup = optionalString stdenv.isLinux ''
|
postFixup = optionalString stdenv.isLinux ''
|
||||||
# set the default search path for DRI drivers; used e.g. by X server
|
# set the default search path for DRI drivers; used e.g. by X server
|
||||||
substituteInPlace "$dev/lib/pkgconfig/dri.pc" --replace "$drivers" "${libglvnd.driverLink}"
|
substituteInPlace "$dev/lib/pkgconfig/dri.pc" --replace "$drivers" "${libglvnd.driverLink}"
|
||||||
|
substituteInPlace "$dev/lib/pkgconfig/d3d.pc" --replace "$drivers" "${libglvnd.driverLink}"
|
||||||
|
|
||||||
# remove pkgconfig files for GL/EGL; they are provided by libGL.
|
# remove pkgconfig files for GL/EGL; they are provided by libGL.
|
||||||
rm -f $dev/lib/pkgconfig/{gl,egl}.pc
|
rm -f $dev/lib/pkgconfig/{gl,egl}.pc
|
||||||
|
|
||||||
# Update search path used by pkg-config
|
# Move development files for libraries in $drivers to $driversdev
|
||||||
for pc in $dev/lib/pkgconfig/{d3d,dri,xatracker}.pc; do
|
mkdir -p $driversdev/include
|
||||||
if [ -f "$pc" ]; then
|
mv $dev/include/xa_* $dev/include/d3d* $driversdev/include
|
||||||
substituteInPlace "$pc" --replace $out $drivers
|
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
|
fi
|
||||||
done
|
done
|
||||||
|
|
||||||
|
@ -212,6 +215,14 @@ stdenv.mkDerivation {
|
||||||
passthru = {
|
passthru = {
|
||||||
inherit libdrm;
|
inherit libdrm;
|
||||||
inherit (libglvnd) driverLink;
|
inherit (libglvnd) driverLink;
|
||||||
|
|
||||||
|
tests.devDoesNotDependOnLLVM = stdenv.mkDerivation {
|
||||||
|
name = "mesa-dev-does-not-depend-on-llvm";
|
||||||
|
buildCommand = ''
|
||||||
|
echo ${self.dev} >>$out
|
||||||
|
'';
|
||||||
|
disallowedRequisites = [ llvmPackages.llvm self.drivers ];
|
||||||
|
};
|
||||||
};
|
};
|
||||||
|
|
||||||
meta = {
|
meta = {
|
||||||
|
@ -231,4 +242,6 @@ stdenv.mkDerivation {
|
||||||
platforms = platforms.mesaPlatforms;
|
platforms = platforms.mesaPlatforms;
|
||||||
maintainers = with maintainers; [ primeos vcunat ]; # Help is welcome :)
|
maintainers = with maintainers; [ primeos vcunat ]; # Help is welcome :)
|
||||||
};
|
};
|
||||||
}
|
};
|
||||||
|
|
||||||
|
in self
|
||||||
|
|
|
@ -433,7 +433,7 @@ self: super:
|
||||||
});
|
});
|
||||||
|
|
||||||
xf86videovmware = super.xf86videovmware.overrideAttrs (attrs: {
|
xf86videovmware = super.xf86videovmware.overrideAttrs (attrs: {
|
||||||
buildInputs = attrs.buildInputs ++ [ mesa llvm ]; # for libxatracker
|
buildInputs = attrs.buildInputs ++ [ mesa mesa.driversdev llvm ]; # for libxatracker
|
||||||
meta = attrs.meta // {
|
meta = attrs.meta // {
|
||||||
platforms = ["i686-linux" "x86_64-linux"];
|
platforms = ["i686-linux" "x86_64-linux"];
|
||||||
};
|
};
|
||||||
|
|
Loading…
Reference in New Issue