mirror of
https://github.com/signalapp/libsignal.git
synced 2024-09-20 03:52:17 +02:00
build_helpers.sh: fix error message if Rust isn't installed
This commit is contained in:
parent
44b0f96c1c
commit
2e42d72ef8
@ -6,16 +6,18 @@
|
||||
# shellcheck shell=bash
|
||||
|
||||
check_rust() {
|
||||
if ! which rustup > /dev/null; then
|
||||
if ! which rustup > /dev/null && [[ -n "$SHELL" ]]; then
|
||||
# Try to find rustup using the user's default shell.
|
||||
# This will be important when running from inside Xcode,
|
||||
# which does not run in an existing shell context.
|
||||
RUSTUP_PATH=$("$SHELL" -c 'which rustup')
|
||||
PATH=$(dirname "$RUSTUP_PATH"):$PATH
|
||||
# which does not run in a login shell context.
|
||||
RUSTUP_PATH=$("$SHELL" -c 'which rustup' || true)
|
||||
if [[ "$RUSTUP_PATH" == /* || "$RUSTUP_PATH" == '~'/* ]]; then
|
||||
PATH=$(dirname "$RUSTUP_PATH"):$PATH
|
||||
fi
|
||||
fi
|
||||
|
||||
if ! which rustup > /dev/null; then
|
||||
echo 'error: rustup not found; get it from https://rustup.rs/' >&2
|
||||
echo 'error: rustup not found; install Rust from https://rustup.rs/' >&2
|
||||
exit 1
|
||||
fi
|
||||
|
||||
@ -23,7 +25,7 @@ check_rust() {
|
||||
echo "error: Rust target ${CARGO_BUILD_TARGET} not installed" >&2
|
||||
echo 'note: get it by running' >&2
|
||||
printf "\n\t%s\n\n" "rustup +${RUSTUP_TOOLCHAIN:-$(cat ./rust-toolchain)} target add ${CARGO_BUILD_TARGET}" >&2
|
||||
exit 2
|
||||
exit 1
|
||||
fi
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user