2007-05-28 15:10:46 +01:00
|
|
|
source $stdenv/setup
|
|
|
|
|
2008-01-07 22:54:30 +00:00
|
|
|
dontPatchELF=1 # must keep libXv, $out in RPATH
|
2007-05-28 15:10:46 +01:00
|
|
|
|
2007-07-11 12:26:35 +01:00
|
|
|
|
2008-01-07 22:54:30 +00:00
|
|
|
unpackFile() {
|
2013-05-14 12:47:01 +01:00
|
|
|
skip=$(sed 's/^skip=//; t; d' $src)
|
|
|
|
tail -n +$skip $src | xz -d | tar xvf -
|
|
|
|
sourceRoot=.
|
2008-01-07 22:54:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-04 10:59:33 +01:00
|
|
|
buildPhase() {
|
2010-05-30 22:56:56 +01:00
|
|
|
if test -z "$libsOnly"; then
|
|
|
|
# Create the module.
|
2010-07-18 21:21:18 +01:00
|
|
|
echo "Building linux driver against kernel: $kernel";
|
|
|
|
cd kernel
|
2010-05-30 22:56:56 +01: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.
|
2012-03-20 00:02:24 +00:00
|
|
|
export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -I$sysSrc/include/asm/mach-default -I$sysSrc/include/generated"
|
2010-05-30 22:56:56 +01:00
|
|
|
make SYSSRC=$sysSrc module
|
2010-07-18 21:21:18 +01:00
|
|
|
cd ..
|
2010-05-30 22:56:56 +01:00
|
|
|
fi
|
2008-01-07 22:54:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
2008-06-04 10:59:33 +01:00
|
|
|
installPhase() {
|
2008-01-07 22:54:30 +00:00
|
|
|
|
|
|
|
# Install libGL and friends.
|
2013-01-08 08:29:19 +00:00
|
|
|
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
|
|
|
|
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
|
2008-01-07 22:54:30 +00:00
|
|
|
|
2008-10-08 13:45:39 +01:00
|
|
|
patchelf --set-rpath $out/lib:$glPath $out/lib/libGL.so.*.*
|
2010-12-27 19:22:30 +00:00
|
|
|
patchelf --set-rpath $out/lib:$glPath $out/lib/libvdpau_nvidia.so.*.*
|
2008-10-08 13:45:39 +01:00
|
|
|
patchelf --set-rpath $cudaPath $out/lib/libcuda.so.*.*
|
2013-02-01 12:57:59 +00:00
|
|
|
patchelf --set-rpath $openclPath $out/lib/libnvidia-opencl.so.*.*
|
2012-11-23 10:11:01 +00:00
|
|
|
|
2010-05-30 22:56:56 +01:00
|
|
|
if test -z "$libsOnly"; then
|
2012-11-23 10:11:01 +00:00
|
|
|
|
2010-05-30 22:56:56 +01:00
|
|
|
# Install the kernel module.
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/lib/modules/$kernelVersion/misc
|
2010-07-18 21:21:18 +01:00
|
|
|
cp kernel/nvidia.ko $out/lib/modules/$kernelVersion/misc
|
2010-05-06 17:58:04 +01:00
|
|
|
|
2010-05-30 22:56:56 +01:00
|
|
|
# Install the X driver.
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/lib/xorg/modules
|
2010-07-18 21:21:18 +01:00
|
|
|
cp -p libnvidia-wfb.* $out/lib/xorg/modules/
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/lib/xorg/modules/drivers
|
2010-07-18 21:21:18 +01:00
|
|
|
cp -p nvidia_drv.so $out/lib/xorg/modules/drivers
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/lib/xorg/modules/extensions
|
2010-07-18 21:21:18 +01:00
|
|
|
cp -p libglx.so.* $out/lib/xorg/modules/extensions
|
2010-05-30 22:56:56 +01: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.
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/bin
|
2010-05-30 22:56:56 +01:00
|
|
|
|
2013-07-21 18:32:54 +01:00
|
|
|
for i in nvidia-settings nvidia-smi nvidia-xconfig; do
|
2010-07-18 21:21:18 +01:00
|
|
|
cp $i $out/bin/$i
|
2010-05-30 22:56:56 +01:00
|
|
|
patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
|
|
|
|
--set-rpath $out/lib:$programPath:$glPath $out/bin/$i
|
|
|
|
done
|
2012-11-23 10:11:01 +00:00
|
|
|
|
2010-05-30 22:56:56 +01:00
|
|
|
# Header files etc.
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/include/nvidia
|
2010-07-18 21:21:18 +01:00
|
|
|
cp -p *.h $out/include/nvidia
|
|
|
|
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/share/man/man1
|
2010-07-18 21:21:18 +01:00
|
|
|
cp -p *.1.gz $out/share/man/man1
|
|
|
|
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/share/applications
|
2010-07-18 21:21:18 +01:00
|
|
|
cp -p *.desktop $out/share/applications
|
|
|
|
|
2012-01-18 20:16:00 +00:00
|
|
|
mkdir -p $out/share/pixmaps
|
2010-07-18 21:21:18 +01:00
|
|
|
cp -p nvidia-settings.png $out/share/pixmaps
|
2010-05-30 22:56:56 +01: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 22:54:30 +00:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
genericBuild
|