xonotic/misc/buildfiles/copystrip/strip
2010-03-18 14:22:15 +01:00

41 lines
675 B
Bash
Executable File

#!/bin/sh
#THIS-IS-COPYSTRIP
# locate original 'strip' utility
stripfile=$1
case "$COPYSTRIP_STRIP" in
*/*)
echo >&2 "Using $COPYSTRIP_STRIP..."
cp "$stripfile" "$stripfile-withdebug"
exec "$COPYSTRIP_STRIP" "$stripfile"
;;
esac
p=$PATH
while [ -n "$p" ]; do
item=${p%%:*}/${COPYSTRIP_STRIP:-strip}
if [ -x "$item" ]; then
case "`sed -n 2p "$item"`" in
\#THIS-IS-COPYSTRIP)
echo >&2 "Found myself in $item"
;;
*)
echo >&2 "Using $item..."
cp "$stripfile" "$stripfile-withdebug"
exec "$item" "$stripfile"
;;
esac
fi
case "$p" in
*:*)
p=${p#*:}
;;
*)
echo >&2 "No strip found in PATH."
exit 1
;;
esac
done