3
0
Fork 0
forked from mirrors/nixpkgs

nvidia: fix problems with -glsi and glx

..by generalizing the build script.
Obsoletes #3699, and it should finally fix problems around 816d971a.
This commit is contained in:
Vladimír Čunát 2014-08-20 23:27:37 +02:00
parent facb810bcc
commit 25351012b2
2 changed files with 31 additions and 35 deletions

View file

@ -30,32 +30,7 @@ buildPhase() {
installPhase() {
# Install libGL and friends.
mkdir -p $out/lib/vendors
for f in \
libcuda libGL libnvcuvid libnvidia-cfg libnvidia-compiler \
libnvidia-encode libnvidia-glcore libnvidia-ml libnvidia-opencl \
libnvidia-tls libOpenCL libnvidia-tls libvdpau_nvidia libEGL libGLESv2
do
cp -prd $f.* $out/lib/
ln -snf $f.so.$versionNumber $out/lib/$f.so
ln -snf $f.so.$versionNumber $out/lib/$f.so.1
done
cp -p nvidia.icd $out/lib/vendors/
cp -prd tls $out/lib/
cp -prd libOpenCL.so.1.0.0 $out/lib/
ln -snf libOpenCL.so.1.0.0 $out/lib/libOpenCL.so
ln -snf libOpenCL.so.1.0.0 $out/lib/libOpenCL.so.1
patchelf --set-rpath $out/lib:$glPath $out/lib/libGL.so.*.*
patchelf --set-rpath $out/lib:$glPath $out/lib/libvdpau_nvidia.so.*.*
patchelf --set-rpath $cudaPath $out/lib/libcuda.so.*.*
patchelf --set-rpath $openclPath $out/lib/libnvidia-opencl.so.*.*
if test -z "$libsOnly"; then
# Install the kernel module.
mkdir -p $out/lib/modules/$kernelVersion/misc
cp kernel/nvidia.ko $out/lib/modules/$kernelVersion/misc
@ -69,10 +44,7 @@ installPhase() {
mkdir -p $out/lib/xorg/modules/extensions
cp -p libglx.so.* $out/lib/xorg/modules/extensions
ln -snf libnvidia-wfb.so.$versionNumber $out/lib/xorg/modules/libnvidia-wfb.so.1
ln -snf libglx.so.$versionNumber $out/lib/xorg/modules/extensions/libglx.so
patchelf --set-rpath $out/lib $out/lib/xorg/modules/extensions/libglx.so.*.*
#patchelf --set-rpath $out/lib $out/lib/xorg/modules/extensions/libglx.so.*.*
# Install the programs.
mkdir -p $out/bin
@ -105,6 +77,30 @@ installPhase() {
# Test a bit.
$out/bin/nvidia-settings --version
fi
# Install libGL and friends.
mkdir -p "$out/lib/vendors"
cp -p nvidia.icd $out/lib/vendors/
cp -prd *.so.* tls "$out/lib/"
rm "$out"/lib/lib{glx,nvidia-wfb}.so.* # handled separately
for libname in `find "$out/lib/" -name '*.so.*'`
do
# I'm lazy to differentiate needed libs per-library, as the closure is the same.
# Unfortunately --shrink-rpath would strip too much.
patchelf --set-rpath "$out/lib:$allLibPath" "$libname"
libname_short=`echo -n "$libname" | sed 's/so\..*/so/'`
ln -srnf "$libname" "$libname_short"
ln -srnf "$libname" "$libname_short.1"
done
#patchelf --set-rpath $out/lib:$glPath $out/lib/libGL.so.*.*
#patchelf --set-rpath $out/lib:$glPath $out/lib/libvdpau_nvidia.so.*.*
#patchelf --set-rpath $cudaPath $out/lib/libcuda.so.*.*
#patchelf --set-rpath $openclPath $out/lib/libnvidia-opencl.so.*.*
}

View file

@ -14,6 +14,7 @@ let
versionNumber = "340.32";
inherit (stdenv.lib) makeLibraryPath;
in
stdenv.mkDerivation {
@ -40,13 +41,12 @@ stdenv.mkDerivation {
dontStrip = true;
glPath = stdenv.lib.makeLibraryPath [xlibs.libXext xlibs.libX11 xlibs.libXrandr];
glPath = makeLibraryPath [xlibs.libXext xlibs.libX11 xlibs.libXrandr];
cudaPath = makeLibraryPath [zlib stdenv.gcc.gcc];
openclPath = makeLibraryPath [zlib];
allLibPath = makeLibraryPath [xlibs.libXext xlibs.libX11 xlibs.libXrandr zlib stdenv.gcc.gcc];
cudaPath = stdenv.lib.makeLibraryPath [zlib stdenv.gcc.gcc];
openclPath = stdenv.lib.makeLibraryPath [zlib];
programPath = optionalString (!libsOnly) (stdenv.lib.makeLibraryPath
programPath = optionalString (!libsOnly) (makeLibraryPath
[ gtk atk pango glib gdk_pixbuf xlibs.libXv ] );
buildInputs = [ perl ];