rust/scripts/cargo.sh

19 lines
513 B
Bash
Raw Normal View History

#!/usr/bin/env bash
2020-11-02 11:16:57 -06:00
dir=$(dirname "$0")
source "$dir/config.sh"
# read nightly compiler from rust-toolchain file
TOOLCHAIN=$(cat "$dir/rust-toolchain" | grep channel | sed "s/channel = \"\(.*\)\"/\1/")
cmd=$1
2020-11-02 11:16:57 -06:00
shift || true
2020-09-29 11:41:59 -05:00
if [[ "$cmd" = "jit" ]]; then
RUSTFLAGS="-Cprefer-dynamic" cargo "+${TOOLCHAIN}" rustc "$@" -- -Cllvm-args=mode=jit
2020-12-25 05:13:11 -06:00
elif [[ "$cmd" = "lazy-jit" ]]; then
RUSTFLAGS="-Cprefer-dynamic" cargo "+${TOOLCHAIN}" rustc "$@" -- -Cllvm-args=mode=jit-lazy
2020-09-29 11:41:59 -05:00
else
2020-11-04 08:59:20 -06:00
cargo "+${TOOLCHAIN}" "$cmd" "$@"
2020-09-29 11:41:59 -05:00
fi