3
# getdeps.sh - get dependent libs of a program
5
# nspluginwrapper (C) 2005-2007 Gwenole Beauchesne
8
# FIXME: needs pango config files, extra X11 libraries, etc. Thus it's
9
# better to rewrite the script so that to install from the actual RPMs...
11
function fatal_error() {
12
echo "Error:" ${1+"$@"} >/dev/stderr
16
if [[ $# -ne 1 ]]; then
17
echo "Usage: $0 <PROGRAM>"
22
[[ -f "$FILE" ]] || fatal_error "specified program $file does not exist"
30
function path_find() {
33
eval "echo \" \${$var[*]} \"" | grep -q $path
39
path_find $var $path || {
40
eval "$var[n$var]=$path ; n$var=\$((n$var+1))"
45
fatal_error "links to files in other paths are not supported"
48
link="`dirname $path`/$link"
50
eval "$var[n$var]=$link ; n$var=\$((n$var+1))"
57
path_find LIBS $file || {
59
local paths=`ldd $file | sed -n '/^[^l]*\(lib[^ ]*\) => \(\/[^ ]*\).*/s//\2/p'`
60
for fullpath in $paths; do
61
local path=`echo $fullpath | sed -e 's/\(\/lib[0-9]*\)\/\(tls\|i686\|mmx\|sse[23]*\)/\1/'`
68
ldso=`ldd $FILE | sed -n '/^[^\/]*\(\/[^ ]*ld-[^ ]*\) .*/s//\1/p'`