nvidia_x11: fix missing xorg lib symlinks; refactor

The builder structure should be now easier to understand
and easier to avoid such problems in future.
Fixes #6546.
This commit is contained in:
Vladimír Čunát 2015-02-24 13:08:08 +01:00
parent dfe8d7ecd8
commit 3009cc116e

View File

@ -36,6 +36,22 @@ installPhase() {
cp -prd *.so.* tls "$out/lib/"
rm "$out"/lib/lib{glx,nvidia-wfb}.so.* # handled separately
if test -z "$libsOnly"; then
# Install the X drivers.
mkdir -p $out/lib/xorg/modules
cp -p libnvidia-wfb.* $out/lib/xorg/modules/
mkdir -p $out/lib/xorg/modules/drivers
cp -p nvidia_drv.so $out/lib/xorg/modules/drivers
mkdir -p $out/lib/xorg/modules/extensions
cp -p libglx.so.* $out/lib/xorg/modules/extensions
# Install the kernel module.
mkdir -p $out/lib/modules/$kernelVersion/misc
cp kernel/nvidia.ko $out/lib/modules/$kernelVersion/misc
cp kernel/uvm/nvidia-uvm.ko $out/lib/modules/$kernelVersion/misc
fi
# All libs except GUI-only are in $out now, so fixup them.
for libname in `find "$out/lib/" -name '*.so.*'`
do
# I'm lazy to differentiate needed libs per-library, as the closure is the same.
@ -54,33 +70,7 @@ installPhase() {
if test -z "$libsOnly"; then
# Install the kernel module.
mkdir -p $out/lib/modules/$kernelVersion/misc
cp kernel/nvidia.ko $out/lib/modules/$kernelVersion/misc
cp kernel/uvm/nvidia-uvm.ko $out/lib/modules/$kernelVersion/misc
# Install the X driver.
mkdir -p $out/lib/xorg/modules
cp -p libnvidia-wfb.* $out/lib/xorg/modules/
mkdir -p $out/lib/xorg/modules/drivers
cp -p nvidia_drv.so $out/lib/xorg/modules/drivers
mkdir -p $out/lib/xorg/modules/extensions
cp -p libglx.so.* $out/lib/xorg/modules/extensions
#patchelf --set-rpath $out/lib $out/lib/xorg/modules/extensions/libglx.so.*.*
# Install the programs.
mkdir -p $out/bin
for i in nvidia-settings nvidia-smi; do
cp $i $out/bin/$i
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath $out/lib:$programPath:$glPath $out/bin/$i
done
patchelf --set-rpath $glPath:$gtk3Path $out/lib/libnvidia-gtk3.so.*.*
# Header files etc.
# Install headers and /share files etc.
mkdir -p $out/include/nvidia
cp -p *.h $out/include/nvidia
@ -99,6 +89,18 @@ installPhase() {
--replace '__UTILS_PATH__' $out/bin \
--replace '__PIXMAP_PATH__' $out/share/pixmaps
# Install the programs.
mkdir -p $out/bin
for i in nvidia-settings nvidia-smi; do
cp $i $out/bin/$i
patchelf --interpreter "$(cat $NIX_CC/nix-support/dynamic-linker)" \
--set-rpath $out/lib:$programPath:$glPath $out/bin/$i
done
patchelf --set-rpath $glPath:$gtk3Path $out/lib/libnvidia-gtk3.so.*.*
# Test a bit.
$out/bin/nvidia-settings --version
else