diff options
author | Eelco Dolstra | 2010-05-30 21:56:56 +0000 |
---|---|---|
committer | Eelco Dolstra | 2010-05-30 21:56:56 +0000 |
commit | a6d63f4fabb90c5964618df6e1ce1e95c89bf499 (patch) | |
tree | 9adda9323bcc84459455d353aa6a9899d4332afc /pkgs/os-specific | |
parent | 76143618b6f3611d3955deaa2f221f3d63173498 (diff) |
* nvidia_x11: added a flag to build only the libraries. This is
useful on x86_64-linux to support i686 binaries: there we need the NVIDIA OpenGL libraries, but not the kernel module or the nvidia-settings program (which just cause a lot of unnecessary and large dependencies). svn path=/nixpkgs/trunk/; revision=22061
Diffstat (limited to 'pkgs/os-specific')
-rwxr-xr-x | pkgs/os-specific/linux/nvidia-x11/builder.sh | 97 | ||||
-rw-r--r-- | pkgs/os-specific/linux/nvidia-x11/default.nix | 25 |
2 files changed, 67 insertions, 55 deletions
diff --git a/pkgs/os-specific/linux/nvidia-x11/builder.sh b/pkgs/os-specific/linux/nvidia-x11/builder.sh index 772f72f4cd81..6941288b3903 100755 --- a/pkgs/os-specific/linux/nvidia-x11/builder.sh +++ b/pkgs/os-specific/linux/nvidia-x11/builder.sh @@ -9,33 +9,34 @@ unpackFile() { buildPhase() { - echo "Building linux driver against kernel: " $kernel; - - cd usr/src/nv/ - - # Workaround: get it to build on kernels that have CONFIG_XEN set. - # Disable the test, apply a patch to disable the Xen functionality. - #substituteInPlace Makefile.kbuild --replace xen_sanity_check fnord - #patch -p1 < $xenPatch - - # Create the module. - kernelVersion=$(cd $kernel/lib/modules && ls) - sysSrc=$(echo $kernel/lib/modules/$kernelVersion/build/) - unset src # used by the nv makefile - # Hack necessary to compile on 2.6.28. - export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$sysSrc/include/asm/mach-default" - make SYSSRC=$sysSrc module - cd ../../.. + if test -z "$libsOnly"; then + echo "Building linux driver against kernel: " $kernel; + + cd usr/src/nv/ + + # Workaround: get it to build on kernels that have CONFIG_XEN + # set. Disable the test, apply a patch to disable the Xen + # functionality. + + #substituteInPlace Makefile.kbuild --replace xen_sanity_check fnord + #patch -p1 < $xenPatch + + # Create the module. + kernelVersion=$(cd $kernel/lib/modules && ls) + sysSrc=$(echo $kernel/lib/modules/$kernelVersion/build/) + unset src # used by the nv makefile + # Hack necessary to compile on 2.6.28. + export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$sysSrc/include/asm/mach-default" + make SYSSRC=$sysSrc module + cd ../../.. + fi } installPhase() { - # Install the kernel module. - ensureDir $out/lib/modules/$kernelVersion/misc - cp usr/src/nv/nvidia.ko $out/lib/modules/$kernelVersion/misc - # Install libGL and friends. + ensureDir $out/lib cp -prd usr/lib/* usr/X11R6/lib/libXv* $out/lib/ ln -snf libGLcore.so.$versionNumber $out/lib/libGLcore.so @@ -48,37 +49,45 @@ installPhase() { ln -snf libXvMCNVIDIA.so.$versionNumber $out/lib/libXvMCNVIDIA_dynamic.so.1 ln -snf libcuda.so.$versionNumber $out/lib/libcuda.so.1 - # Install the X driver. - ensureDir $out/lib/xorg/modules - cp -prd usr/X11R6/lib/modules/* $out/lib/xorg/modules/ - - 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 - - # Install the programs. - ensureDir $out/bin - patchelf --set-rpath $out/lib:$glPath $out/lib/libGL.so.*.* patchelf --set-rpath $out/lib:$glPath $out/lib/libXvMCNVIDIA.so.*.* set +e # Legacy nvidia doesn't have cuda patchelf --set-rpath $cudaPath $out/lib/libcuda.so.*.* set -e - patchelf --set-rpath $out/lib $out/lib/xorg/modules/extensions/libglx.so.*.* - - for i in nvidia-settings nvidia-xconfig; do - cp usr/bin/$i $out/bin/$i - patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \ - --set-rpath $out/lib:$programPath:$glPath $out/bin/$i - done - # Header files etc. - cp -prd usr/include usr/share $out + if test -z "$libsOnly"; then + + # Install the kernel module. + ensureDir $out/lib/modules/$kernelVersion/misc + cp usr/src/nv/nvidia.ko $out/lib/modules/$kernelVersion/misc - # Patch the `nvidia-settings.desktop' file. - substituteInPlace $out/share/applications/nvidia-settings.desktop \ - --replace '__UTILS_PATH__' $out/bin \ - --replace '__PIXMAP_PATH__' $out/share/pixmaps + # Install the X driver. + ensureDir $out/lib/xorg/modules + cp -prd usr/X11R6/lib/modules/* $out/lib/xorg/modules/ + + 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.*.* + + # Install the programs. + ensureDir $out/bin + + for i in nvidia-settings nvidia-xconfig; do + cp usr/bin/$i $out/bin/$i + patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \ + --set-rpath $out/lib:$programPath:$glPath $out/bin/$i + done + + # Header files etc. + cp -prd usr/include usr/share $out + + # Patch the `nvidia-settings.desktop' file. + substituteInPlace $out/share/applications/nvidia-settings.desktop \ + --replace '__UTILS_PATH__' $out/bin \ + --replace '__PIXMAP_PATH__' $out/share/pixmaps + fi } diff --git a/pkgs/os-specific/linux/nvidia-x11/default.nix b/pkgs/os-specific/linux/nvidia-x11/default.nix index 68263c128af3..bc88775b02f1 100644 --- a/pkgs/os-specific/linux/nvidia-x11/default.nix +++ b/pkgs/os-specific/linux/nvidia-x11/default.nix @@ -1,13 +1,16 @@ -{stdenv, fetchurl, kernel, xlibs, gtkLibs, zlib, perl}: +{ stdenv, fetchurl, kernel ? null, xlibs, gtkLibs, zlib, perl +, # Whether to build the libraries only (i.e. not the kernel module or + # nvidia-settings). Used to support 32-bit binaries on 64-bit + # Linux. + libsOnly ? false +}: -let +with stdenv.lib; - versionNumber = "195.36.24"; - -in +let versionNumber = "195.36.24"; in stdenv.mkDerivation { - name = "nvidia-x11-${versionNumber}-${kernel.version}"; + name = "nvidia-x11-${versionNumber}${optionalString (!libsOnly) "-${kernel.version}"}"; builder = ./builder.sh; @@ -24,7 +27,9 @@ stdenv.mkDerivation { } else throw "nvidia-x11 does not support platform ${stdenv.system}"; - inherit versionNumber kernel; + inherit versionNumber libsOnly; + + kernel = if libsOnly then null else kernel; dontStrip = true; @@ -32,10 +37,8 @@ stdenv.mkDerivation { cudaPath = stdenv.lib.makeLibraryPath [zlib stdenv.gcc.gcc]; - programPath = stdenv.lib.makeLibraryPath [ - gtkLibs.gtk gtkLibs.atk gtkLibs.pango gtkLibs.glib - xlibs.libXv - ]; + programPath = optionalString (!libsOnly) (stdenv.lib.makeLibraryPath + [ gtkLibs.gtk gtkLibs.atk gtkLibs.pango gtkLibs.glib xlibs.libXv ] ); buildInputs = [ perl ]; |