diff options
| author | Albin <albin@mullvad.net> | 2025-01-27 14:41:31 +0100 |
|---|---|---|
| committer | Albin <albin@mullvad.net> | 2025-01-27 14:43:49 +0100 |
| commit | 4e270b2893232551c68f5d21b63796e7de9aa0be (patch) | |
| tree | f173ac4c681caf315190393cd62235aa2f47c427 | |
| parent | 12cfa5000bb6a93d9c0dc0e048530f2eecba8452 (diff) | |
| download | mullvadvpn-4e270b2893232551c68f5d21b63796e7de9aa0be.tar.xz mullvadvpn-4e270b2893232551c68f5d21b63796e7de9aa0be.zip | |
Add support for target dir in rustc remapping
| -rwxr-xr-x | building/rustc-remap-path-prefix.sh | 14 |
1 files changed, 11 insertions, 3 deletions
diff --git a/building/rustc-remap-path-prefix.sh b/building/rustc-remap-path-prefix.sh index 0531d206e7..0d3d31fce5 100755 --- a/building/rustc-remap-path-prefix.sh +++ b/building/rustc-remap-path-prefix.sh @@ -6,10 +6,18 @@ set -eu -SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" CARGO_HOME_PATH=${CARGO_HOME:-$HOME/.cargo} RUSTUP_HOME_PATH=${RUSTUP_HOME:-$HOME/.rustup} +SOURCE_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" && cd .. && pwd )" +CARGO_TARGET_DIR_PATH=${CARGO_TARGET_DIR:-$SOURCE_DIR/target} -echo "--remap-path-prefix $CARGO_HOME_PATH=/CARGO_HOME \ +# The order is significant. Iterated over in reverse, so last argument is +# treated as most significant. Since CARGO_TARGET_DIR_PATH might be located +# under $SOURCE_DIR, it's important to keep it last. +# See: https://github.com/rust-lang/rust/blob/55459598c250d985eb5f840306dfb59f267c03b6/compiler/rustc_span/src/source_map.rs#L1125-L1127 +echo "\ +--remap-path-prefix $CARGO_HOME_PATH=/CARGO_HOME \ --remap-path-prefix $RUSTUP_HOME_PATH=/RUSTUP_HOME \ ---remap-path-prefix $SOURCE_DIR=/SOURCE_DIR" +--remap-path-prefix $SOURCE_DIR=/SOURCE_DIR \ +--remap-path-prefix $CARGO_TARGET_DIR_PATH=/CARGO_TARGET_DIR \ +" | xargs |
