2007-05-28 16:10:46 +02:00
|
|
|
source $stdenv/setup
|
|
|
|
|
2008-01-07 23:54:30 +01:00
|
|
|
dontPatchELF=1 # must keep libXv, $out in RPATH
|
2007-05-28 16:10:46 +02:00
|
|
|
|
2007-07-11 13:26:35 +02:00
|
|
|
|
2008-01-07 23:54:30 +01:00
|
|
|
unpackFile() {
|
|
|
|
sh $src -x
|
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-04 11:59:33 +02:00
|
|
|
buildPhase() {
|
2010-05-30 23:56:56 +02:00
|
|
|
if test -z "$libsOnly"; then
|
|
|
|
# Create the module.
|
2010-07-18 22:21:18 +02:00
|
|
|
echo "Building linux driver against kernel: $kernel";
|
|
|
|
cd kernel
|
2010-05-30 23:56:56 +02:00
|
|
|
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
|
2010-07-18 22:21:18 +02:00
|
|
|
cd ..
|
2010-05-30 23:56:56 +02:00
|
|
|
fi
|
2008-01-07 23:54:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-04 11:59:33 +02:00
|
|
|
installPhase() {
|
2008-01-07 23:54:30 +01:00
|
|
|
|
|
|
|
# Install libGL and friends.
|
2010-05-30 23:56:56 +02:00
|
|
|
ensureDir $out/lib
|
2010-12-27 20:22:30 +01:00
|
|
|
cp -prd libcuda.* libGL.* libnvidia-cfg.* libnvidia-compiler.* libnvidia-tls.* libnvidia-glcore.* libOpenCL.* libXv* libvdpau_nvidia* tls $out/lib/
|
2010-07-18 22:21:18 +02:00
|
|
|
|
|
|
|
ln -snf libnvidia-glcore.so.$versionNumber $out/lib/libnvidia-glcore.so
|
|
|
|
ln -snf libnvidia-glcore.so.$versionNumber $out/lib/libnvidia-glcore.so.1
|
2008-01-07 23:54:30 +01:00
|
|
|
ln -snf libGL.so.$versionNumber $out/lib/libGL.so
|
|
|
|
ln -snf libGL.so.$versionNumber $out/lib/libGL.so.1
|
|
|
|
ln -snf libnvidia-cfg.so.$versionNumber $out/lib/libnvidia-cfg.so.1
|
|
|
|
ln -snf libnvidia-tls.so.$versionNumber $out/lib/libnvidia-tls.so.1
|
|
|
|
ln -snf libnvidia-tls.so.$versionNumber $out/lib/tls/libnvidia-tls.so.1
|
|
|
|
ln -snf libXvMCNVIDIA.so.$versionNumber $out/lib/libXvMCNVIDIA_dynamic.so.1
|
|
|
|
ln -snf libcuda.so.$versionNumber $out/lib/libcuda.so.1
|
2010-12-27 20:22:30 +01:00
|
|
|
ln -snf libvdpau_nvidia.so.$versionNumber $out/lib/libvdpau_nvidia.so
|
2008-01-07 23:54:30 +01:00
|
|
|
|
2008-10-08 14:45:39 +02:00
|
|
|
patchelf --set-rpath $out/lib:$glPath $out/lib/libGL.so.*.*
|
|
|
|
patchelf --set-rpath $out/lib:$glPath $out/lib/libXvMCNVIDIA.so.*.*
|
2010-12-27 20:22:30 +01:00
|
|
|
patchelf --set-rpath $out/lib:$glPath $out/lib/libvdpau_nvidia.so.*.*
|
2008-10-08 14:45:39 +02:00
|
|
|
patchelf --set-rpath $cudaPath $out/lib/libcuda.so.*.*
|
2008-01-07 23:54:30 +01:00
|
|
|
|
2010-05-30 23:56:56 +02:00
|
|
|
if test -z "$libsOnly"; then
|
|
|
|
|
|
|
|
# Install the kernel module.
|
|
|
|
ensureDir $out/lib/modules/$kernelVersion/misc
|
2010-07-18 22:21:18 +02:00
|
|
|
cp kernel/nvidia.ko $out/lib/modules/$kernelVersion/misc
|
2010-05-06 18:58:04 +02:00
|
|
|
|
2010-05-30 23:56:56 +02:00
|
|
|
# Install the X driver.
|
|
|
|
ensureDir $out/lib/xorg/modules
|
2010-07-18 22:21:18 +02:00
|
|
|
cp -p libnvidia-wfb.* $out/lib/xorg/modules/
|
|
|
|
ensureDir $out/lib/xorg/modules/drivers
|
|
|
|
cp -p nvidia_drv.so $out/lib/xorg/modules/drivers
|
|
|
|
ensureDir $out/lib/xorg/modules/extensions
|
|
|
|
cp -p libglx.so.* $out/lib/xorg/modules/extensions
|
2010-05-30 23:56:56 +02:00
|
|
|
|
|
|
|
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
|
2010-07-18 22:21:18 +02:00
|
|
|
cp $i $out/bin/$i
|
2010-05-30 23:56:56 +02:00
|
|
|
patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
|
|
|
|
--set-rpath $out/lib:$programPath:$glPath $out/bin/$i
|
|
|
|
done
|
|
|
|
|
|
|
|
# Header files etc.
|
2010-07-18 22:21:18 +02:00
|
|
|
ensureDir $out/include/nvidia
|
|
|
|
cp -p *.h $out/include/nvidia
|
|
|
|
|
|
|
|
ensureDir $out/share/man/man1
|
|
|
|
cp -p *.1.gz $out/share/man/man1
|
|
|
|
|
|
|
|
ensureDir $out/share/applications
|
|
|
|
cp -p *.desktop $out/share/applications
|
|
|
|
|
|
|
|
ensureDir $out/share/pixmaps
|
|
|
|
cp -p nvidia-settings.png $out/share/pixmaps
|
2010-05-30 23:56:56 +02:00
|
|
|
|
|
|
|
# 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
|
2008-01-07 23:54:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
genericBuild
|