From 7a1c6583e929d20d598fa12d120d2628ba753821 Mon Sep 17 00:00:00 2001 From: Pierre Pronchery Date: Sun, 1 Jul 2018 05:06:14 +0200 Subject: [PATCH] Import new script from upstream --- tools/platform.sh | 16 ++++++++++++---- 1 file changed, 12 insertions(+), 4 deletions(-) diff --git a/tools/platform.sh b/tools/platform.sh index 37b88e4..2d29d46 100755 --- a/tools/platform.sh +++ b/tools/platform.sh @@ -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) }