summaryrefslogtreecommitdiffstats
path: root/scripts
diff options
context:
space:
mode:
authorjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-01-29 17:42:10 +0000
committerjow <jow@3c298f89-4303-0410-b956-a3cf2f4a3e73>2012-01-29 17:42:10 +0000
commit33451c5fb021f40c016a9d5344931264c275002e (patch)
tree3951feba0c20d70dc80e64350f5319688b1654e4 /scripts
parent581e492dd65dbd484ea3f742b4db3b2222e8132e (diff)
[scripts] ext-toolchain.sh: support --wrap with src == dest
git-svn-id: svn://svn.openwrt.org/openwrt/trunk@29944 3c298f89-4303-0410-b956-a3cf2f4a3e73
Diffstat (limited to 'scripts')
-rwxr-xr-xscripts/ext-toolchain.sh12
1 files changed, 9 insertions, 3 deletions
diff --git a/scripts/ext-toolchain.sh b/scripts/ext-toolchain.sh
index 257e0d8e8..23d14a748 100755
--- a/scripts/ext-toolchain.sh
+++ b/scripts/ext-toolchain.sh
@@ -205,11 +205,17 @@ wrap_bins() {
for cmd in "${CC%-*}-"*; do
if [ -x "$cmd" ]; then
local out="$1/${cmd##*/}"
+ local bin="$cmd"
+
+ if [ -x "$out" ] && ! grep -q STAGING_DIR "$out"; then
+ mv "$out" "$out.bin"
+ bin='$(dirname "$0")/'"${out##*/}"'.bin'
+ fi
echo '#!/bin/sh' > "$out"
case "${cmd##*/}" in
*-*cc|*-*cc-*|*-*++|*-*++-*|*-cpp)
- echo -n 'exec "'"$cmd"'" '"$CFLAGS"' ' >> "$out"
+ echo -n 'exec "'"$bin"'" '"$CFLAGS"' ' >> "$out"
echo -n '${STAGING_DIR:+-idirafter ' >> "$out"
echo -n '"$STAGING_DIR/usr/include" ' >> "$out"
echo -n '-L "$STAGING_DIR/usr/lib" ' >> "$out"
@@ -217,13 +223,13 @@ wrap_bins() {
echo '"$STAGING_DIR/usr/lib"} "$@"' >> "$out"
;;
*-ld)
- echo -n 'exec "'"$cmd"'" ${STAGING_DIR:+' >> "$out"
+ echo -n 'exec "'"$bin"'" ${STAGING_DIR:+' >> "$out"
echo -n '-L "$STAGING_DIR/usr/lib" ' >> "$out"
echo -n '-rpath-link ' >> "$out"
echo '"$STAGING_DIR/usr/lib"} "$@"' >> "$out"
;;
*)
- echo "exec '$cmd' \"\$@\"" >> "$out"
+ echo 'exec "'"$bin"'" "$@"' >> "$out"
;;
esac
chmod +x "$out"