linuxPackages.nvidia_x11: install libraries with correct sonames
Use the real soname from the library to determine where to link it, and use a symlink structure that does not make ldconfig explode.
This commit is contained in:
parent
b409cdb759
commit
6663591207
@ -185,20 +185,27 @@ installPhase() {
|
||||
patchelf --set-rpath "$out/lib:$libPath" "$libname"
|
||||
fi
|
||||
|
||||
libname_short=`echo -n "$libname" | sed 's/so\..*/so/'`
|
||||
# Manually create the right symlinks for the libraries.
|
||||
#
|
||||
# We can't just use ldconfig, because it does not create libfoo.so symlinks,
|
||||
# only libfoo.so.1.
|
||||
# Also, the symlink chain must be libfoo.so -> libfoo.so.1 -> libfoo.so.123.45,
|
||||
# or ldconfig will explode.
|
||||
# See: https://github.com/bminor/glibc/blob/6f3f6c506cdaf981a4374f1f12863b98ac7fea1a/elf/ldconfig.c#L854-L877
|
||||
|
||||
if [[ "$libname" != "$libname_short" ]]; then
|
||||
ln -srnf "$libname" "$libname_short"
|
||||
fi
|
||||
libbase=$(basename "$libname")
|
||||
libdir=$(dirname "$libname")
|
||||
soname=$(patchelf --print-soname "$libname")
|
||||
unversioned=${libbase/\.so\.[0-9\.]*/.so}
|
||||
|
||||
if [[ $libname_short =~ libEGL.so || $libname_short =~ libEGL_nvidia.so || $libname_short =~ libGLX.so || $libname_short =~ libGLX_nvidia.so ]]; then
|
||||
major=0
|
||||
else
|
||||
major=1
|
||||
fi
|
||||
if [[ -n "$soname" ]]; then
|
||||
if [[ "$soname" != "$libbase" ]]; then
|
||||
ln -s "$libbase" "$libdir/$soname"
|
||||
fi
|
||||
|
||||
if [[ "$libname" != "$libname_short.$major" ]]; then
|
||||
ln -srnf "$libname" "$libname_short.$major"
|
||||
if [[ "$soname" != "$unversioned" ]]; then
|
||||
ln -s "$soname" "$libdir/$unversioned"
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user