2020-04-07 19:51:59 +00:00
|
|
|
#!/usr/bin/env bash
|
2019-02-02 19:54:18 +00:00
|
|
|
# Set up the appropriate rustc toolchain
|
|
|
|
|
2019-10-14 17:51:41 +00:00
|
|
|
set -e
|
|
|
|
|
2019-10-18 07:58:26 +00:00
|
|
|
cd "$(dirname "$0")"
|
2019-06-03 02:23:15 +00:00
|
|
|
|
2019-11-28 11:12:01 +00:00
|
|
|
RTIM_PATH=$(command -v rustup-toolchain-install-master) || INSTALLED=false
|
2019-10-25 13:20:15 +00:00
|
|
|
CARGO_HOME=${CARGO_HOME:-$HOME/.cargo}
|
|
|
|
|
2019-11-28 11:12:01 +00:00
|
|
|
# Check if RTIM is not installed or installed in other locations not in ~/.cargo/bin
|
|
|
|
if [[ "$INSTALLED" == false || "$RTIM_PATH" == $CARGO_HOME/bin/rustup-toolchain-install-master ]]; then
|
2019-11-27 09:32:51 +00:00
|
|
|
cargo +nightly install rustup-toolchain-install-master
|
2019-10-25 13:20:15 +00:00
|
|
|
else
|
|
|
|
VERSION=$(rustup-toolchain-install-master -V | grep -o "[0-9.]*")
|
2020-02-05 13:37:33 +00:00
|
|
|
REMOTE=$(cargo +nightly search rustup-toolchain-install-master | grep -o "[0-9.]*")
|
2019-10-25 13:20:15 +00:00
|
|
|
echo "info: skipping updating rustup-toolchain-install-master at $RTIM_PATH"
|
|
|
|
echo " current version : $VERSION"
|
|
|
|
echo " remote version : $REMOTE"
|
2019-06-03 02:23:15 +00:00
|
|
|
fi
|
2019-02-02 19:54:18 +00:00
|
|
|
|
2019-10-24 14:59:57 +00:00
|
|
|
RUST_COMMIT=$(git ls-remote https://github.com/rust-lang/rust master | awk '{print $1}')
|
|
|
|
|
|
|
|
if rustc +master -Vv 2>/dev/null | grep -q "$RUST_COMMIT"; then
|
|
|
|
echo "info: master toolchain is up-to-date"
|
|
|
|
exit 0
|
|
|
|
fi
|
|
|
|
|
2019-10-25 17:16:14 +00:00
|
|
|
if [[ -n "$HOST_TOOLCHAIN" ]]; then
|
|
|
|
TOOLCHAIN=('--host' "$HOST_TOOLCHAIN")
|
|
|
|
else
|
|
|
|
TOOLCHAIN=()
|
|
|
|
fi
|
|
|
|
|
2020-05-28 13:45:24 +00:00
|
|
|
rustup-toolchain-install-master -f -n master "${TOOLCHAIN[@]}" -c rustc-dev -c llvm-tools -- "$RUST_COMMIT"
|
2019-02-02 19:54:18 +00:00
|
|
|
rustup override set master
|