3 # Copyright (C) 2006 OpenWrt.org
5 # This is free software, licensed under the GNU General Public License v2.
6 # See /LICENSE for more information.
11 echo "$SELF: strip command not defined (STRIP variable not set)"
17 [ -z "$TARGETS" ] && {
18 echo "$SELF: no directories / files specified"
19 echo "usage: $SELF [PATH...]"
23 find $TARGETS -type f -a -exec file {} \; | \
24 sed -n -e 's/^\(.*\):.*ELF.*\(executable\|relocatable\|shared object\).*,.* stripped/\1:\2/p' | \
29 [ "${S}" = "relocatable" ] && {
33 [ -z "$PATCHELF" ] || [ -z "$TOPDIR" ] || {
34 old_rpath="$($PATCHELF --print-rpath $F)"; new_rpath=""
35 for path in $old_rpath; do
37 /lib/[^/]*|/usr/lib/[^/]*|\$ORIGIN/*) new_rpath="${new_rpath:+$new_rpath:}$path" ;;
38 *) echo "$SELF: $F: removing rpath $path" ;;
41 [ "$new_rpath" = "$old_rpath" ] || $PATCHELF --set-rpath "$new_rpath" $F
45 [ "$a" = "$b" ] || chmod $b $F