aboutsummaryrefslogtreecommitdiffstats
path: root/find-requires.in
diff options
context:
space:
mode:
Diffstat (limited to 'find-requires.in')
-rwxr-xr-xfind-requires.in27
1 files changed, 20 insertions, 7 deletions
diff --git a/find-requires.in b/find-requires.in
index 553c34c..6aabbd5 100755
--- a/find-requires.in
+++ b/find-requires.in
@@ -10,9 +10,9 @@ ulimit -c 0
#
# --- Set needed to 0 for traditional find-requires behavior.
needed=1
-if [ X"$1" = Xldd ]; then
+if [ X"$3" = Xldd ]; then
needed=0
-elif [ X"$1" = Xobjdump ]; then
+elif [ X"$3" = Xobjdump ]; then
needed=1
fi
@@ -213,11 +213,24 @@ fi
for i in `echo $filelist | tr '[:blank:]' "\n" | egrep "(/usr(/X11R6)?)?/lib(|64)/[^/]+\.so$"`; do
objd=`objdump -p ${i} | grep SONAME`
lib64=`if file -L $i 2>/dev/null | grep "ELF 64-bit" >/dev/null; then echo "(64bit)"; fi` && \
- [ -h ${i} -a -n "${objd}" ] && \
- ldd ${i} \
- | grep -v "statically linked" \
- | grep -v "/\(lib\|lib64\)/\(ld\|ld64\|ld-linux.*\)\.so" \
- | perl -p -e "s/\s+(\S+)\.so.*/devel(\1$lib64)/g"
+ if [ -h ${i} -a -n "${objd}" ]; then
+ if [ "$needed" -eq 1 ]; then
+ ldd ${i} \
+ | grep -v "statically linked" \
+ | grep -v "/\(lib\|lib64\)/\(ld\|ld64\|ld-linux.*\)\.so" \
+ | perl -p -e "s/\s+(\S+)\.so.*/devel(\1$lib64)/g"
+ else
+ objdump -p $i | awk 'BEGIN { START=0; }
+ /^$/ { START=0; }
+ /^Dynamic Section:$/ { START=1; }
+ (START==1) && /NEEDED/ {
+ sub(/^/, "devel(", $2) ;
+ sub(/\.so.*$/, "'$lib64')", $2) ;
+ print $2 ;
+ }
+ '
+ fi
+ fi
done | egrep -v 'devel\(linux-gate|linux-vdso32|linux-vdso64|lib(c|pthread|rt)(\(64bit\))?\)' | sort -u
#