Preprocess arguments to rustc to workaround cargo

This commit is contained in:
Tommie Levy 2016-11-26 15:25:16 -05:00
commit dcd96e2b94

View file

@ -1,2 +1,21 @@
#!/bin/bash
RUST_BACKTRACE=1 rustc -L build/kernel $*
have_o=false
for arg in "$@"; do
if [[ "$arg" = "-o" ]]; then
have_o=true
break
fi
done
args=()
for arg in "$@"; do
if [[ $have_o = true && "$arg" =~ ^extra-filename= ]]; then
unset args[${#args[@]}-1]
elif [[ $have_o = true && "$arg" =~ ^--emit= ]]; then
args+=("--emit=link")
else
args+=("$arg")
fi
done
RUST_BACKTRACE=1 exec rustc -L build/kernel "${args[@]}"