2015-10-25 09:09:36 +00:00
|
|
|
#!/bin/bash
|
2015-10-23 09:49:36 +00:00
|
|
|
|
|
|
|
# compiler wrapper to get rid of -I/usr/include and -L/usr/lib, that fucks up
|
|
|
|
# cross compilation badly.
|
2015-10-25 09:09:36 +00:00
|
|
|
declare -a MYARGS
|
2015-10-23 09:49:36 +00:00
|
|
|
|
2015-10-25 09:09:36 +00:00
|
|
|
ARGS=("$@")
|
|
|
|
i=0
|
|
|
|
while [ $i -lt ${#ARGS[@]} ]; do
|
|
|
|
arg="${ARGS[$i]}"
|
2015-10-25 09:47:15 +00:00
|
|
|
if [ "$incpath" ]; then
|
|
|
|
if [ "$arg" = "/usr/include" ]; then
|
|
|
|
echo "[cc-wrapper] ignoring -I $arg"
|
|
|
|
else
|
|
|
|
MYARGS+=("-I${arg}")
|
|
|
|
fi
|
2015-10-25 12:30:52 +00:00
|
|
|
unset incpath
|
2015-10-25 09:47:15 +00:00
|
|
|
elif [ "$libpath" ]; then
|
2021-02-10 01:52:56 +00:00
|
|
|
# XXX: avoid so much repetition
|
|
|
|
if [ "$arg" = "/usr/lib" -o "$arg" = "/usr/lib32" -o "$arg" = "/usr/lib64" -o "$arg" = "/lib" ]; then
|
2015-10-25 09:47:15 +00:00
|
|
|
echo "[cc-wrapper] ignoring -L $arg"
|
|
|
|
else
|
|
|
|
MYARGS+=("-L${arg}")
|
|
|
|
fi
|
2015-10-25 12:30:52 +00:00
|
|
|
unset libpath
|
2015-10-25 09:47:15 +00:00
|
|
|
elif [ "$arg" = "-I" ]; then
|
|
|
|
incpath=1
|
|
|
|
elif [ "$arg" = "-L" ]; then
|
|
|
|
libpath=1
|
2021-02-10 01:52:56 +00:00
|
|
|
elif [ "$arg" = "-I/usr/include" -o "$arg" = "-L/usr/lib" \
|
|
|
|
-o "$arg" = "-L/usr/lib32" -o "$arg" = "-L/usr/lib64" \
|
|
|
|
-o "$arg" = "-L/lib" ]; then
|
2015-10-25 09:09:36 +00:00
|
|
|
echo "[cc-wrapper] ignoring $arg"
|
2015-10-23 09:49:36 +00:00
|
|
|
else
|
2015-10-25 09:09:36 +00:00
|
|
|
MYARGS+=("${arg}")
|
2015-10-23 09:49:36 +00:00
|
|
|
fi
|
2015-10-25 09:09:36 +00:00
|
|
|
i=$((i+1))
|
2015-10-23 09:49:36 +00:00
|
|
|
done
|
2015-10-25 09:47:15 +00:00
|
|
|
#echo "[cc-wrapper] @BIN@ ${MYARGS[@]}"
|
2015-10-25 09:09:36 +00:00
|
|
|
exec @BIN@ "${MYARGS[@]}"
|