mirror of
https://github.com/rust-lang/mdBook
synced 2024-12-13 22:32:35 +00:00
5da75bc798
travis started to fail for beta channel.
59 lines
1.1 KiB
Bash
59 lines
1.1 KiB
Bash
# `install` phase: install stuff needed for the `script` phase
|
|
|
|
set -ex
|
|
|
|
case "$TRAVIS_OS_NAME" in
|
|
linux)
|
|
host=x86_64-unknown-linux-gnu
|
|
;;
|
|
osx)
|
|
host=x86_64-apple-darwin
|
|
;;
|
|
esac
|
|
|
|
mktempd() {
|
|
echo $(mktemp -d 2>/dev/null || mktemp -d -t tmp)
|
|
}
|
|
|
|
install_rustup() {
|
|
local td=$(mktempd)
|
|
|
|
pushd $td
|
|
curl -O https://static.rust-lang.org/rustup/dist/$host/rustup-setup
|
|
chmod +x rustup-setup
|
|
./rustup-setup -y
|
|
popd
|
|
|
|
rm -r $td
|
|
rustup self update
|
|
rustup install "$CHANNEL"
|
|
rustup default "$CHANNEL"
|
|
rustc -V
|
|
cargo -V
|
|
}
|
|
|
|
install_standard_crates() {
|
|
if [ "$host" != "$TARGET" ]; then
|
|
if [ ! "$CHANNEL" = "stable" ]; then
|
|
rustup target add $TARGET
|
|
else
|
|
local version=$(rustc -V | cut -d' ' -f2)
|
|
local tarball=rust-std-${version}-${TARGET}
|
|
|
|
local td=$(mktempd)
|
|
curl -s https://static.rust-lang.org/dist/${tarball}.tar.gz | \
|
|
tar --strip-components 1 -C $td -xz
|
|
|
|
$td/install.sh --prefix=$(rustc --print sysroot)
|
|
|
|
rm -r $td
|
|
fi
|
|
fi
|
|
}
|
|
|
|
main() {
|
|
install_rustup
|
|
install_standard_crates
|
|
}
|
|
|
|
main
|