scripts/bundle-libraries: fall back to only copying binaries if ldd is unavailable (e.g. non-linux system)

Signed-off-by: Felix Fietkau <nbd@openwrt.org>

SVN-Revision: 40967
This commit is contained in:
Felix Fietkau 2014-06-02 13:27:23 +00:00
parent 290d01379e
commit aab9ffeacc

View file

@ -46,10 +46,7 @@ for LDD in ${PATH//://ldd }/ldd; do
LDD="" LDD=""
done done
[ -n "$LDD" -a -x "$LDD" ] || { [ -n "$LDD" -a -x "$LDD" ] || LDD=
echo "Unable to find working ldd" >&2
exit 4
}
for BIN in "$@"; do for BIN in "$@"; do
[ -n "$BIN" -a -x "$BIN" -a -n "$DIR" ] || { [ -n "$BIN" -a -x "$BIN" -a -n "$DIR" ] || {
@ -66,22 +63,24 @@ for BIN in "$@"; do
LDSO="" LDSO=""
echo "Bundling ${BIN##*/}" echo "Bundling ${BIN##*/}"
for token in $("$LDD" "$BIN" 2>/dev/null); do [ -n "$LDD" ] && {
case "$token" in */*.so*) for token in $("$LDD" "$BIN" 2>/dev/null); do
case "$token" in case "$token" in */*.so*)
*ld-*.so*) LDSO="${token##*/}" ;; case "$token" in
*) echo " * lib: ${token##*/}" ;; *ld-*.so*) LDSO="${token##*/}" ;;
esac *) echo " * lib: ${token##*/}" ;;
esac
dest="$DIR/bundled/lib/${token##*/}" dest="$DIR/bundled/lib/${token##*/}"
ddir="${dest%/*}" ddir="${dest%/*}"
[ -f "$token" -a ! -f "$dest" ] && { [ -f "$token" -a ! -f "$dest" ] && {
_md "$ddir" _md "$ddir"
_cp "$token" "$dest" _cp "$token" "$dest"
} }
;; esac ;; esac
done done
}
_md "$DIR" _md "$DIR"
@ -105,7 +104,7 @@ for BIN in "$@"; do
# is a static executable or non-elf binary # is a static executable or non-elf binary
else else
echo " * not dynamically linked" [ -n "$LDD" ] && echo " * not dynamically linked"
_cp "$BIN" "$DIR/${BIN##*/}" _cp "$BIN" "$DIR/${BIN##*/}"
fi fi
done done