diff options
-rw-r--r-- | autodeps/linux.req | 41 |
1 files changed, 28 insertions, 13 deletions
diff --git a/autodeps/linux.req b/autodeps/linux.req index 1f51a2281..00a706dfb 100644 --- a/autodeps/linux.req +++ b/autodeps/linux.req @@ -7,6 +7,16 @@ ulimit -c 0 +# +# --- Set needed to 0 for traditional find-requires behavior. +if [ X"$1" = Xldd ]; then + needed=0 +else + needed=1 +fi + +# +# --- Grab the file manifest and classify files. filelist=`sed "s/['\"]/\\\&/g"` exelist=`echo $filelist | xargs -r file | egrep -v ":.* (commands|script) " | \ grep ":.*executable" | cut -d: -f1` @@ -27,9 +37,10 @@ case `uname -m` in *) mark64="()(64bit)" ;; esac +if [ "$needed" -eq 0 ]; then # -# --- Executable sonames. -for f in $exelist; do +# --- Executable dependency sonames. + for f in $exelist; do [ -r $f -a -x $f ] || continue lib64=`if file -L $f 2>/dev/null | \ grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi` @@ -39,11 +50,11 @@ for f in $exelist; do printf "%s'$lib64'\n", $1 } }' -done | xargs -r -n 1 basename | sort -u + done | xargs -r -n 1 basename | sort -u # -# --- Library sonames. -for f in $liblist; do +# --- Library dependency sonames. + for f in $liblist; do [ -r $f ] || continue lib64=`if file -L $f 2>/dev/null | \ grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi` @@ -53,7 +64,8 @@ for f in $liblist; do printf "%s'$lib64'\n", $1 } }' -done | xargs -r -n 1 basename | sort -u + done | xargs -r -n 1 basename | sort -u +fi # # --- Script interpreters. @@ -68,7 +80,7 @@ done [ -n "$interplist" ] && { echo "$interplist" | tr '[:blank:]' \\n | sort -u ; } # -# --- Find perl module files. +# --- Add perl module files to perllist. for f in $filelist; do [ -r $f -a "${f%.pm}" != "${f}" ] && perllist="$perllist $f" done @@ -80,17 +92,20 @@ for f in $liblist $exelist ; do [ -r $f ] || continue lib64=`if file -L $f 2>/dev/null | \ grep "ELF 64-bit" >/dev/null; then echo "$mark64"; fi` - objdump -p $f | awk ' - BEGIN { START=0; LIBNAME=""; } - /Version References:/ { START=1; } - /required from/ && (START==1) { + objdump -p $f | awk 'BEGIN { START=0; LIBNAME=""; needed='$needed'; } + /^$/ { START=0; } + /^Dynamic Section:$/ { START=1; } + (START==1) && /NEEDED/ { + if (needed) { print $2 ; } + } + /^Version References:$/ { START=2; } + (START==2) && /required from/ { sub(/:/, "", $3); LIBNAME=$3; } - (START==1) && (LIBNAME!="") && ($4!="") && (($4~/^GLIBC_*/) || ($4~/^GCC_*/)) { + (START==2) && (LIBNAME!="") && ($4!="") && (($4~/^GLIBC_*/) || ($4~/^GCC_*/)) { print LIBNAME "(" $4 ")'$lib64'"; } - /^$/ { START=0; } ' done | sort -u |