From 321b4e76b29bffe252e242c4b793c10acaa6239f Mon Sep 17 00:00:00 2001 From: Olivier Thauvin Date: Tue, 6 Feb 2007 14:49:49 +0000 Subject: Use objdump instead of ldd for devel dependencies finder (#25877) --- find-requires.in | 27 ++++++++++++++++++++------- 1 file 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 # -- cgit v1.2.1