2016-08-08 05:55:30 +08:00
|
|
|
set -ex
|
|
|
|
|
|
|
|
. $(dirname $0)/env.sh
|
|
|
|
|
2016-08-09 09:37:04 +08:00
|
|
|
install_qemu() {
|
2016-08-14 06:22:12 +08:00
|
|
|
case ${QEMU_ARCH:-$TRAVIS_OS_NAME} in
|
|
|
|
i386)
|
|
|
|
dpkg --add-architecture $QEMU_ARCH
|
2016-08-09 10:49:31 +08:00
|
|
|
apt-get install -y --no-install-recommends \
|
2016-08-14 06:22:12 +08:00
|
|
|
binfmt-support qemu-user-static:$QEMU_ARCH
|
2016-08-09 09:37:04 +08:00
|
|
|
;;
|
2016-08-14 06:22:12 +08:00
|
|
|
linux)
|
2016-08-11 00:50:41 +08:00
|
|
|
apt-get update
|
|
|
|
apt-get install -y --no-install-recommends \
|
2016-08-14 06:22:12 +08:00
|
|
|
binfmt-support qemu-user-static
|
2016-08-11 00:50:41 +08:00
|
|
|
;;
|
2016-08-09 09:37:04 +08:00
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2016-08-08 06:32:53 +08:00
|
|
|
install_binutils() {
|
2016-08-14 06:22:12 +08:00
|
|
|
if [[ $TRAVIS_OS_NAME == "osx" ]]; then
|
|
|
|
brew install binutils
|
|
|
|
fi
|
2016-08-08 06:23:30 +08:00
|
|
|
}
|
|
|
|
|
2016-08-08 06:03:44 +08:00
|
|
|
install_rust() {
|
2016-08-14 06:22:12 +08:00
|
|
|
if [[ $TRAVIS_OS_NAME == "osx" ]]; then
|
|
|
|
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=nightly
|
|
|
|
else
|
|
|
|
rustup default nightly
|
|
|
|
fi
|
2016-08-08 06:03:44 +08:00
|
|
|
|
|
|
|
rustc -V
|
|
|
|
cargo -V
|
|
|
|
}
|
2016-08-08 05:55:30 +08:00
|
|
|
|
2016-08-08 06:03:44 +08:00
|
|
|
add_rustup_target() {
|
2016-08-14 01:45:19 +08:00
|
|
|
if [[ $TARGET != $HOST && ${CARGO:-cargo} == "cargo" ]]; then
|
2016-08-08 06:03:44 +08:00
|
|
|
rustup target add $TARGET
|
|
|
|
fi
|
2016-08-08 05:55:30 +08:00
|
|
|
}
|
|
|
|
|
2016-08-14 00:32:52 +08:00
|
|
|
install_xargo() {
|
|
|
|
if [[ $CARGO == "xargo" ]]; then
|
2016-08-14 01:55:09 +08:00
|
|
|
curl -sf "https://raw.githubusercontent.com/japaric/rust-everywhere/master/install.sh" | \
|
2016-08-14 06:22:12 +08:00
|
|
|
bash -s -- --from japaric/xargo --at /root/.cargo/bin
|
2016-08-08 06:03:44 +08:00
|
|
|
fi
|
2016-08-08 05:55:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
main() {
|
2016-08-14 06:24:52 +08:00
|
|
|
if [[ $TRAVIS_OS_NAME == "osx" || ${IN_DOCKER_CONTAINER:-n} == "y" ]]; then
|
2016-08-09 09:37:04 +08:00
|
|
|
install_qemu
|
|
|
|
install_binutils
|
|
|
|
install_rust
|
|
|
|
add_rustup_target
|
2016-08-14 00:32:52 +08:00
|
|
|
install_xargo
|
2016-08-09 09:37:04 +08:00
|
|
|
fi
|
2016-08-08 05:55:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
main
|