From 25351012b26b5e8c5010eb9b339f9551da27cdac Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Vladim=C3=ADr=20=C4=8Cun=C3=A1t?= Date: Wed, 20 Aug 2014 23:27:37 +0200 Subject: [PATCH] nvidia: fix problems with -glsi and glx ..by generalizing the build script. Obsoletes #3699, and it should finally fix problems around 816d971a. --- pkgs/os-specific/linux/nvidia-x11/builder.sh | 54 +++++++++---------- pkgs/os-specific/linux/nvidia-x11/default.nix | 12 ++--- 2 files changed, 31 insertions(+), 35 deletions(-) diff --git a/pkgs/os-specific/linux/nvidia-x11/builder.sh b/pkgs/os-specific/linux/nvidia-x11/builder.sh index 6acab2424c8d..4291116f4ef4 100755 --- a/pkgs/os-specific/linux/nvidia-x11/builder.sh +++ b/pkgs/os-specific/linux/nvidia-x11/builder.sh @@ -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.*.* } diff --git a/pkgs/os-specific/linux/nvidia-x11/default.nix b/pkgs/os-specific/linux/nvidia-x11/default.nix index 5cd1bf180d67..c89846db72cf 100644 --- a/pkgs/os-specific/linux/nvidia-x11/default.nix +++ b/pkgs/os-specific/linux/nvidia-x11/default.nix @@ -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 ];