1
0
mirror of git://projects.qi-hardware.com/openwrt-xburst.git synced 2024-11-27 17:55:55 +02:00

[scripts] ext-toolchain.sh: support --wrap with src == dest

git-svn-id: svn://svn.openwrt.org/openwrt/trunk@29944 3c298f89-4303-0410-b956-a3cf2f4a3e73
This commit is contained in:
jow 2012-01-29 17:42:10 +00:00
parent 581e492dd6
commit 33451c5fb0

View File

@ -205,11 +205,17 @@ wrap_bins() {
for cmd in "${CC%-*}-"*; do for cmd in "${CC%-*}-"*; do
if [ -x "$cmd" ]; then if [ -x "$cmd" ]; then
local out="$1/${cmd##*/}" 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" echo '#!/bin/sh' > "$out"
case "${cmd##*/}" in case "${cmd##*/}" in
*-*cc|*-*cc-*|*-*++|*-*++-*|*-cpp) *-*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:+-idirafter ' >> "$out"
echo -n '"$STAGING_DIR/usr/include" ' >> "$out" echo -n '"$STAGING_DIR/usr/include" ' >> "$out"
echo -n '-L "$STAGING_DIR/usr/lib" ' >> "$out" echo -n '-L "$STAGING_DIR/usr/lib" ' >> "$out"
@ -217,13 +223,13 @@ wrap_bins() {
echo '"$STAGING_DIR/usr/lib"} "$@"' >> "$out" echo '"$STAGING_DIR/usr/lib"} "$@"' >> "$out"
;; ;;
*-ld) *-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 '-L "$STAGING_DIR/usr/lib" ' >> "$out"
echo -n '-rpath-link ' >> "$out" echo -n '-rpath-link ' >> "$out"
echo '"$STAGING_DIR/usr/lib"} "$@"' >> "$out" echo '"$STAGING_DIR/usr/lib"} "$@"' >> "$out"
;; ;;
*) *)
echo "exec '$cmd' \"\$@\"" >> "$out" echo 'exec "'"$bin"'" "$@"' >> "$out"
;; ;;
esac esac
chmod +x "$out" chmod +x "$out"