* 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
This commit is contained in:
parent
76143618b6
commit
a6d63f4fab
@ -9,33 +9,34 @@ unpackFile() {
|
||||
|
||||
|
||||
buildPhase() {
|
||||
echo "Building linux driver against kernel: " $kernel;
|
||||
if test -z "$libsOnly"; then
|
||||
echo "Building linux driver against kernel: " $kernel;
|
||||
|
||||
cd usr/src/nv/
|
||||
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
|
||||
# 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 ../../..
|
||||
# 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
|
||||
}
|
||||
|
||||
|
||||
|
@ -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 ];
|
||||
|
||||
|
@ -6419,7 +6419,7 @@ let
|
||||
inherit fetchurl stdenv builderDefs kernel lib;
|
||||
};
|
||||
|
||||
nvidia_x11 = import ../os-specific/linux/nvidia-x11 {
|
||||
nvidia_x11 = makeOverridable (import ../os-specific/linux/nvidia-x11) {
|
||||
inherit stdenv fetchurl kernel xlibs gtkLibs zlib perl;
|
||||
};
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user