opengl: Update VirtualGL system (mostly for switch to meson build)
This commit is contained in:
@@ -1,11 +1,11 @@
|
|||||||
# This override makes OpenGL just automagically work with VirtualGL
|
# This override makes OpenGL just automagically work with VirtualGL
|
||||||
#
|
#
|
||||||
# Add a setup hook to the mesa_noglu package that automatically adds
|
# Add a setup hook to the mesa package that automatically adds a
|
||||||
# a libvglfaker.so dependency to executables that depend on libGL.so.
|
# libvglfaker.so dependency to executables that depend on libGL.so.
|
||||||
|
|
||||||
{ super, stdenv, buildEnv, substituteAll, bash
|
{ super, stdenv, buildEnv, substituteAll, bash
|
||||||
, autoreconfHook, pkgconfig, python2
|
, autoreconfHook, pkgconfig, python2
|
||||||
, xorg, llvmPackages, expat, mesa_glxgallium, mesa_noglu, libglvnd }:
|
, xorg, llvmPackages, expat, mesa_glxgallium, mesa, libglvnd }:
|
||||||
|
|
||||||
let
|
let
|
||||||
autoVirtualGLHook =
|
autoVirtualGLHook =
|
||||||
@@ -23,7 +23,7 @@ let
|
|||||||
extraOutputsToInstall = [ "dev" ];
|
extraOutputsToInstall = [ "dev" ];
|
||||||
};
|
};
|
||||||
|
|
||||||
virtualglLib = (super.virtualglLib.override { inherit libGLU_combined fltk; }).overrideAttrs (attrs: {
|
virtualglLib = (super.virtualglLib.override { inherit libGL libGLU fltk; }).overrideAttrs (attrs: {
|
||||||
postFixup = attrs.postFixup or "" + ''
|
postFixup = attrs.postFixup or "" + ''
|
||||||
patchelf --set-rpath /usr/lib${stdenv.lib.optionalString stdenv.is64bit "64"}/nvidia:"$(patchelf --print-rpath $out/lib/libvglfaker.so)" $out/lib/libvglfaker.so
|
patchelf --set-rpath /usr/lib${stdenv.lib.optionalString stdenv.is64bit "64"}/nvidia:"$(patchelf --print-rpath $out/lib/libvglfaker.so)" $out/lib/libvglfaker.so
|
||||||
'';
|
'';
|
||||||
@@ -41,52 +41,31 @@ in {
|
|||||||
|
|
||||||
# Mesa build for glxgallium software rendering (works with all X11 forwarding)
|
# Mesa build for glxgallium software rendering (works with all X11 forwarding)
|
||||||
|
|
||||||
mesa_glxgallium = stdenv.mkDerivation rec {
|
mesa_glxgallium = mesa.overrideAttrs (attrs: {
|
||||||
version = super.mesa_noglu.version;
|
mesonFlags = attrs.mesonFlags ++ [
|
||||||
name = "mesa-glxgallium-${version}";
|
"-Dglx=gallium-xlib"
|
||||||
src = super.mesa_noglu.src;
|
"-Ddri-drivers="
|
||||||
|
"-Dgallium-drivers=swrast"
|
||||||
outputs = [ "out" "dev" ];
|
"-Dglvnd=false"
|
||||||
|
"-Dgallium-nine=false"
|
||||||
configureFlags = [
|
|
||||||
"--with-gallium-drivers=swrast"
|
|
||||||
"--with-platforms=x11" # surfaceless would make sense, but egl requires dri
|
|
||||||
"--disable-dri"
|
|
||||||
"--enable-glx=gallium-xlib" # gallium-xlib requires no dri
|
|
||||||
"--enable-gallium-osmesa"
|
|
||||||
"--enable-llvm"
|
|
||||||
"--disable-egl" # egl requries dri for some reason
|
|
||||||
"--disable-gbm" # gbm requires dri for some reason
|
|
||||||
"--enable-llvm-shared-libs"
|
|
||||||
"--disable-opencl"
|
|
||||||
];
|
];
|
||||||
|
|
||||||
nativeBuildInputs = [
|
# No dri drivers so need to drop all the "drivers" output code (ignoring vulkan for now)
|
||||||
autoreconfHook pkgconfig
|
outputs = [ "out" "dev" "osmesa" ];
|
||||||
python2
|
|
||||||
];
|
|
||||||
propagatedBuildInputs = [ ];
|
|
||||||
buildInputs = [
|
|
||||||
llvmPackages.llvm
|
|
||||||
xorg.xorgproto xorg.libX11 xorg.libXext xorg.libxcb
|
|
||||||
expat
|
|
||||||
];
|
|
||||||
|
|
||||||
enableParallelBuilding = true;
|
postInstall = ''
|
||||||
|
# move libOSMesa to $osmesa, as it's relatively big
|
||||||
|
mkdir -p $osmesa/lib
|
||||||
|
mv -t $osmesa/lib/ $out/lib/libOSMesa*
|
||||||
|
'';
|
||||||
|
postFixup = "";
|
||||||
|
} );
|
||||||
|
|
||||||
meta = with stdenv.lib; {
|
# Duplicate mesa/stubs.nix with mesa_glxgallium stuffed in as the libGL source
|
||||||
description = "An open source implementation of OpenGL";
|
|
||||||
homepage = https://www.mesa3d.org/;
|
|
||||||
license = licenses.mit; # X11 variant, in most files
|
|
||||||
platforms = platforms.linux;
|
|
||||||
};
|
|
||||||
};
|
|
||||||
|
|
||||||
|
|
||||||
# Duplicate mesa_noglu.stub with mesa_glxgallium stuffed in as the libGL source
|
|
||||||
|
|
||||||
libGL = stdenv.mkDerivation {
|
libGL = stdenv.mkDerivation {
|
||||||
name = "libGL-${libglvnd.version}";
|
inherit (libglvnd) version;
|
||||||
|
pname = "libGL";
|
||||||
outputs = [ "out" "dev" ];
|
outputs = [ "out" "dev" ];
|
||||||
|
|
||||||
nativeBuildInputs = [ xorg.lndir ];
|
nativeBuildInputs = [ xorg.lndir ];
|
||||||
@@ -100,7 +79,7 @@ in {
|
|||||||
mkdir -p $dev/{,lib/pkgconfig,nix-support}
|
mkdir -p $dev/{,lib/pkgconfig,nix-support}
|
||||||
echo "$out" > $dev/nix-support/propagated-build-inputs
|
echo "$out" > $dev/nix-support/propagated-build-inputs
|
||||||
echo ${autoVirtualGLHook} >> $dev/nix-support/propagated-build-inputs
|
echo ${autoVirtualGLHook} >> $dev/nix-support/propagated-build-inputs
|
||||||
ln -s ${mesa_noglu.dev}/include $dev/include
|
ln -s ${mesa.dev}/include $dev/include
|
||||||
|
|
||||||
genPkgConfig() {
|
genPkgConfig() {
|
||||||
local location="$1"
|
local location="$1"
|
||||||
@@ -110,16 +89,16 @@ in {
|
|||||||
cat <<EOF >$dev/lib/pkgconfig/$name.pc
|
cat <<EOF >$dev/lib/pkgconfig/$name.pc
|
||||||
Name: $name
|
Name: $name
|
||||||
Description: $lib library
|
Description: $lib library
|
||||||
Version: ${mesa_noglu.version}
|
Version: ${mesa.version}
|
||||||
Libs: -L$location/lib -l$lib
|
Libs: -L$location/lib -l$lib
|
||||||
Cflags: -I${mesa_noglu.dev}/include
|
Cflags: -I${mesa.dev}/include
|
||||||
EOF
|
EOF
|
||||||
}
|
}
|
||||||
|
|
||||||
genPkgConfig ${mesa_glxgallium.out} gl GL
|
genPkgConfig ${mesa_glxgallium.out} gl GL
|
||||||
genPkgConfig ${libglvnd.out} egl EGL
|
genPkgConfig ${libglvnd.out} egl EGL
|
||||||
genPkgConfig ${libglvnd.out} glesv1_cm GLESv1_CM
|
genPkgConfig ${mesa_glxgallium.out} glesv1_cm GLESv1_CM
|
||||||
genPkgConfig ${libglvnd.out} glesv2 GLESv2
|
genPkgConfig ${mesa_glxgallium.out} glesv2 GLESv2
|
||||||
'';
|
'';
|
||||||
};
|
};
|
||||||
}
|
}
|
||||||
|
|||||||
Reference in New Issue
Block a user