common/wrapper/cc: make this work with args containing whitespaces in quoted strings.
like -DFOO="foo blah". This fixes cross compilation in libsodium, tk and others.
This commit is contained in:
parent
afbeba04d4
commit
ff80ee06e6
|
@ -1,14 +1,19 @@
|
|||
#!/bin/sh
|
||||
#!/bin/bash
|
||||
|
||||
# compiler wrapper to get rid of -I/usr/include and -L/usr/lib, that fucks up
|
||||
# cross compilation badly.
|
||||
MYARGS=
|
||||
declare -a MYARGS
|
||||
|
||||
for i in $@; do
|
||||
if [ $i = "-L/usr/lib" -o $i = "-I/usr/include" ]; then
|
||||
continue
|
||||
ARGS=("$@")
|
||||
i=0
|
||||
while [ $i -lt ${#ARGS[@]} ]; do
|
||||
arg="${ARGS[$i]}"
|
||||
if [ "$arg" = "-I/usr/include" -o "$arg" = "-L/usr/lib" ]; then
|
||||
echo "[cc-wrapper] ignoring $arg"
|
||||
else
|
||||
MYARGS+="$i "
|
||||
MYARGS+=("${arg}")
|
||||
fi
|
||||
i=$((i+1))
|
||||
done
|
||||
exec @BIN@ ${MYARGS}
|
||||
#echo "[cc-wrapper] ${MYARGS[@]}"
|
||||
exec @BIN@ "${MYARGS[@]}"
|
||||
|
|
Loading…
Reference in New Issue