Add a simple argument parser to build.sh

This commit is contained in:
yvt 2022-03-23 23:16:45 +09:00
parent 44c0204af3
commit 72306608e0

View File

@ -3,6 +3,21 @@
#set -x
set -e
codegen_channel=debug
while [[ $# -gt 0 ]]; do
case $1 in
--release)
codegen_channel=release
shift
;;
*)
echo "Unknown option $1"
exit 1
;;
esac
done
if [ -f ./gcc_path ]; then
export GCC_PATH=$(cat gcc_path)
else
@ -21,7 +36,7 @@ if [[ "$1" == "--features" ]]; then
shift
fi
if [[ "$1" == "--release" ]]; then
if [[ "$codegen_channel" == "release" ]]; then
export CHANNEL='release'
CARGO_INCREMENTAL=1 cargo rustc --release $features
else
@ -37,3 +52,4 @@ mkdir -p target/out/gccjit
echo "[BUILD] sysroot"
time ./build_sysroot/build_sysroot.sh $CHANNEL