3 TARGET=$(rustc --print target-spec-json -Z unstable-options | jq '.["llvm-target"]' -r)
4 SYSROOT=$(rustc --print sysroot)
5 # We set the rpath so that Miri finds the private rustc libraries it needs.
6 # We enable debug-assertions to get tracing.
7 # We enable line-only debuginfo for backtraces.
8 export RUSTFLAGS="-C link-args=-Wl,-rpath,$SYSROOT/lib/rustlib/$TARGET/lib -C debug-assertions -C debuginfo=1"
15 exec cargo install --path "$(dirname "$0")" --force --locked --offline
21 # We we want to just build, we are done.
22 if [ "$COMMAND" = "build" ]; then exit 0; fi
24 # Get ourselves a sysroot
25 if [ -n "$MIRI_SYSROOT" ]; then
28 elif echo "$SYSROOT" | egrep -q 'build/[^/]+/stage'; then
29 # a local rustc build, assume we have a proper libstd in $SYSROOT
32 # we have to build a sysroot
33 cargo run --release --bin cargo-miri -- miri setup
34 export MIRI_SYSROOT=$HOME/.cache/miri/HOST
37 exec cargo "$COMMAND" --release "$@"