opengl: libGL can just be symlinks instead of fake pkgconfig files
The disk-cache-key can't use "drivers" as it creates a loop.
This commit is contained in:
@@ -43,6 +43,7 @@ in {
|
||||
|
||||
mesa_glxgallium = mesa.overrideAttrs (attrs: {
|
||||
mesonFlags = attrs.mesonFlags ++ [
|
||||
"-Ddisk-cache-key=${placeholder "out"}"
|
||||
"-Dglx=gallium-xlib"
|
||||
"-Ddri-drivers="
|
||||
"-Dgallium-drivers=swrast"
|
||||
@@ -50,13 +51,23 @@ in {
|
||||
"-Dgallium-nine=false"
|
||||
];
|
||||
|
||||
# No dri drivers so need to drop all the "drivers" output code (ignoring vulkan for now)
|
||||
outputs = [ "out" "dev" "osmesa" ];
|
||||
|
||||
postInstall = ''
|
||||
# move drivers (just vulkan in our case and doesn't avoid LLVM)
|
||||
mkdir -p $drivers/lib
|
||||
mv -t $drivers/lib $out/lib/libvulkan_*
|
||||
|
||||
# move libOSMesa to $osmesa, as it's relatively big
|
||||
mkdir -p $osmesa/lib
|
||||
mv -t $osmesa/lib/ $out/lib/libOSMesa*
|
||||
|
||||
# move vendor files
|
||||
mv $out/share/ $drivers/
|
||||
|
||||
# Update search path used by Vulkan (it's pointing to $out but
|
||||
# drivers are in $drivers)
|
||||
for js in $drivers/share/vulkan/icd.d/*.json; do
|
||||
substituteInPlace "$js" --replace "$out" "$drivers"
|
||||
done
|
||||
'';
|
||||
postFixup = "";
|
||||
} );
|
||||
@@ -70,35 +81,23 @@ in {
|
||||
|
||||
nativeBuildInputs = [ xorg.lndir ];
|
||||
|
||||
# Use stub libraries from mesa_glxgallium and libglvnd and headers from lib_noglu
|
||||
# Use stub libraries from mesa_glxgallium and libglvnd
|
||||
buildCommand = ''
|
||||
mkdir -p $out/lib
|
||||
lndir -silent ${mesa_glxgallium.out}/lib $out/lib
|
||||
lndir -silent ${libglvnd.out}/lib $out/lib
|
||||
|
||||
mkdir -p $dev/{,lib/pkgconfig,nix-support}
|
||||
echo "$out" > $dev/nix-support/propagated-build-inputs
|
||||
echo ${autoVirtualGLHook} >> $dev/nix-support/propagated-build-inputs
|
||||
ln -s ${mesa.dev}/include $dev/include
|
||||
mkdir -p $dev/include
|
||||
lndir -silent ${mesa_glxgallium.dev}/include $dev/include
|
||||
lndir -silent ${libglvnd.dev}/include $dev/include
|
||||
|
||||
genPkgConfig() {
|
||||
local location="$1"
|
||||
local name="$2"
|
||||
local lib="$3"
|
||||
mkdir -p $dev/nix-support
|
||||
echo "${autoVirtualGLHook} ${mesa_glxgallium.dev} ${libglvnd.dev} $out" \
|
||||
> $dev/nix-support/propagated-build-inputs
|
||||
|
||||
cat <<EOF >$dev/lib/pkgconfig/$name.pc
|
||||
Name: $name
|
||||
Description: $lib library
|
||||
Version: ${mesa.version}
|
||||
Libs: -L$location/lib -l$lib
|
||||
Cflags: -I${mesa.dev}/include
|
||||
EOF
|
||||
}
|
||||
|
||||
genPkgConfig ${mesa_glxgallium.out} gl GL
|
||||
genPkgConfig ${libglvnd.out} egl EGL
|
||||
genPkgConfig ${mesa_glxgallium.out} glesv1_cm GLESv1_CM
|
||||
genPkgConfig ${mesa_glxgallium.out} glesv2 GLESv2
|
||||
mkdir -p $dev/lib/pkgconfig
|
||||
ln -st $dev/lib/pkgconfig ${mesa_glxgallium.dev}/lib/pkgconfig/{gl,GL,glesv1_cm,GLESv1_CM,glesv2,GLESv2}.pc
|
||||
ln -st $dev/lib/pkgconfig ${libglvnd.dev}/lib/pkgconfig/{egl,EGL}.pc
|
||||
'';
|
||||
};
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user