Import new script from upstream

This commit is contained in:
Pierre Pronchery 2018-07-01 05:06:14 +02:00
parent cf769f60b9
commit 7a1c6583e9

View File

@ -39,12 +39,20 @@ _platform_library()
{
library="$1"
libdir=$(_platform_variable "LIBDIR")
path="/lib:/usr/lib:$libdir"
if [ -f "$DESTDIR/lib/lib$library$SOEXT" \
-o -f "$DESTDIR/usr/lib/lib$library$SOEXT" \
-o -f "$DESTDIR$libdir/lib$library$SOEXT" ]; then
echo "-l$library"
if [ -f "$DESTDIR/etc/ld.so.conf" ]; then
while read line; do
#XXX breaks on whitespace
[ -n "${line%#*}" ] && path="$path:$line"
done < "$DESTDIR/etc/ld.so.conf"
fi
(IFS=:; for p in $path; do
if [ -f "$DESTDIR$p/lib$library$SOEXT" ]; then
echo "-l$library"
return
fi
done)
}