Skip to content

Commit 9bc7938

Browse files
committed
more tweaks
1 parent 7d09313 commit 9bc7938

File tree

1 file changed

+16
-16
lines changed

1 file changed

+16
-16
lines changed

miri

Lines changed: 16 additions & 16 deletions
Original file line numberDiff line numberDiff line change
@@ -63,21 +63,22 @@ esac
6363

6464
## Preparation
6565
# macOS does not have a useful readlink/realpath so we have to use Python instead...
66-
MIRIDIR=$(dirname "$(python3 -c 'import os, sys; print(os.path.realpath(sys.argv[1]))' "$0")")
66+
MIRIDIR=$(python3 -c 'import os, sys; print(os.path.dirname(os.path.realpath(sys.argv[1])))' "$0")
6767
# Determine toolchain *in the Miri dir* and use that.
6868
TOOLCHAIN=$(cd "$MIRIDIR"; rustup show active-toolchain | head -n 1 | cut -d ' ' -f 1)
69+
6970
# Determine some toolchain properties
7071
TARGET=$(rustc +$TOOLCHAIN --version --verbose | grep "^host:" | cut -d ' ' -f 2)
7172
SYSROOT=$(rustc +$TOOLCHAIN --print sysroot)
7273
LIBDIR=$SYSROOT/lib/rustlib/$TARGET/lib
73-
7474
if ! test -d "$LIBDIR"; then
7575
echo "Something went wrong determining the library dir."
7676
echo "I got $LIBDIR but that does not exist."
7777
echo "Please report a bug at https://github.com/rust-lang/miri/issues."
7878
exit 2
7979
fi
8080

81+
# Prepare flags for cargo and rustc.
8182
CARGO="cargo +$TOOLCHAIN"
8283
if [ -z "$CARGO_INCREMENTAL" ]; then
8384
# Default CARGO_INCREMENTAL to 1.
@@ -91,6 +92,19 @@ fi
9192
# We enable debug-assertions to get tracing.
9293
# We enable line-only debuginfo for backtraces.
9394
export RUSTFLAGS="-C link-args=-Wl,-rpath,$LIBDIR -C debug-assertions -C debuginfo=1 $RUSTFLAGS"
95+
# Determine flags passed to all cargo invocations.
96+
# This is a bit more annoying that one would hope due to
97+
# <https://github.com/rust-lang/cargo/issues/6992>.
98+
case "$COMMAND" in
99+
*-debug)
100+
CARGO_INSTALL_FLAGS="--target $TARGET --debug $CARGO_EXTRA_FLAGS"
101+
CARGO_BUILD_FLAGS="--target $TARGET $CARGO_EXTRA_FLAGS"
102+
;;
103+
*)
104+
CARGO_INSTALL_FLAGS="--target $TARGET $CARGO_EXTRA_FLAGS"
105+
CARGO_BUILD_FLAGS="--target $TARGET --release $CARGO_EXTRA_FLAGS"
106+
;;
107+
esac
94108

95109
## Helper functions
96110

@@ -119,20 +133,6 @@ find_sysroot() {
119133

120134
## Main
121135

122-
# Determine flags passed to all cargo invocations.
123-
# This is a bit more annoying that one would hope due to
124-
# <https://github.com/rust-lang/cargo/issues/6992>.
125-
case "$COMMAND" in
126-
*-debug)
127-
CARGO_INSTALL_FLAGS="--target $TARGET --debug $CARGO_EXTRA_FLAGS"
128-
CARGO_BUILD_FLAGS="--target $TARGET $CARGO_EXTRA_FLAGS"
129-
;;
130-
*)
131-
CARGO_INSTALL_FLAGS="--target $TARGET $CARGO_EXTRA_FLAGS"
132-
CARGO_BUILD_FLAGS="--target $TARGET --release $CARGO_EXTRA_FLAGS"
133-
;;
134-
esac
135-
136136
# Run command.
137137
case "$COMMAND" in
138138
install|install-debug)

0 commit comments

Comments
 (0)