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() {
|
2013-05-14 13:47:01 +02:00
|
|
|
skip=$(sed 's/^skip=//; t; d' $src)
|
|
|
|
tail -n +$skip $src | xz -d | tar xvf -
|
|
|
|
sourceRoot=.
|
2008-01-07 23:54:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
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)
|
2014-01-05 02:57:21 +01:00
|
|
|
sysSrc=$(echo $kernel/lib/modules/$kernelVersion/source)
|
|
|
|
sysOut=$(echo $kernel/lib/modules/$kernelVersion/build)
|
2010-05-30 23:56:56 +02:00
|
|
|
unset src # used by the nv makefile
|
2014-01-05 02:57:21 +01:00
|
|
|
make SYSSRC=$sysSrc SYSOUT=$sysOut module
|
2014-05-01 16:37:14 +02:00
|
|
|
cd uvm
|
|
|
|
make SYSSRC=$sysSrc SYSOUT=$sysOut module
|
|
|
|
cd ..
|
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
|
|
|
|
2010-05-30 23:56:56 +02:00
|
|
|
if test -z "$libsOnly"; then
|
|
|
|
# Install the kernel module.
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p $out/lib/modules/$kernelVersion/misc
|
2010-07-18 22:21:18 +02:00
|
|
|
cp kernel/nvidia.ko $out/lib/modules/$kernelVersion/misc
|
2014-05-01 16:37:14 +02:00
|
|
|
cp kernel/uvm/nvidia-uvm.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.
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p $out/lib/xorg/modules
|
2010-07-18 22:21:18 +02:00
|
|
|
cp -p libnvidia-wfb.* $out/lib/xorg/modules/
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p $out/lib/xorg/modules/drivers
|
2010-07-18 22:21:18 +02:00
|
|
|
cp -p nvidia_drv.so $out/lib/xorg/modules/drivers
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p $out/lib/xorg/modules/extensions
|
2010-07-18 22:21:18 +02:00
|
|
|
cp -p libglx.so.* $out/lib/xorg/modules/extensions
|
2010-05-30 23:56:56 +02:00
|
|
|
|
2014-08-20 23:27:37 +02:00
|
|
|
#patchelf --set-rpath $out/lib $out/lib/xorg/modules/extensions/libglx.so.*.*
|
2010-05-30 23:56:56 +02:00
|
|
|
|
|
|
|
# Install the programs.
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p $out/bin
|
2010-05-30 23:56:56 +02:00
|
|
|
|
2014-05-22 12:55:28 +02:00
|
|
|
for i in nvidia-settings nvidia-smi; do
|
2014-05-22 12:51:55 +02:00
|
|
|
cp $i $out/bin/$i
|
|
|
|
patchelf --interpreter "$(cat $NIX_GCC/nix-support/dynamic-linker)" \
|
|
|
|
--set-rpath $out/lib:$programPath:$glPath $out/bin/$i
|
2010-05-30 23:56:56 +02:00
|
|
|
done
|
2012-11-23 11:11:01 +01:00
|
|
|
|
2010-05-30 23:56:56 +02:00
|
|
|
# Header files etc.
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p $out/include/nvidia
|
2010-07-18 22:21:18 +02:00
|
|
|
cp -p *.h $out/include/nvidia
|
|
|
|
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p $out/share/man/man1
|
2010-07-18 22:21:18 +02:00
|
|
|
cp -p *.1.gz $out/share/man/man1
|
2014-05-22 12:55:28 +02:00
|
|
|
rm $out/share/man/man1/nvidia-xconfig.1.gz
|
2010-07-18 22:21:18 +02:00
|
|
|
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p $out/share/applications
|
2010-07-18 22:21:18 +02:00
|
|
|
cp -p *.desktop $out/share/applications
|
|
|
|
|
2012-01-18 21:16:00 +01:00
|
|
|
mkdir -p $out/share/pixmaps
|
2010-07-18 22:21:18 +02:00
|
|
|
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
|
2014-05-22 12:51:55 +02:00
|
|
|
|
|
|
|
# Test a bit.
|
|
|
|
$out/bin/nvidia-settings --version
|
2010-05-30 23:56:56 +02:00
|
|
|
fi
|
2014-08-20 23:27:37 +02:00
|
|
|
|
|
|
|
|
|
|
|
# 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.*.*
|
2008-01-07 23:54:30 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
|
|
|
|
genericBuild
|