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-30 08:31:49 +08:00
|
|
|
if [[ $QEMU_LD_PREFIX ]]; then
|
2016-08-24 09:46:36 +08:00
|
|
|
apt-get update
|
|
|
|
apt-get install -y --no-install-recommends \
|
|
|
|
binfmt-support qemu-user-static
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
|
|
|
install_gist() {
|
2016-08-30 10:25:23 +08:00
|
|
|
if [[ $OSX ]]; then
|
|
|
|
gem install gist -v 4.5.0
|
|
|
|
fi
|
2016-08-09 09:37:04 +08:00
|
|
|
}
|
|
|
|
|
2016-08-08 06:32:53 +08:00
|
|
|
install_binutils() {
|
2016-08-30 08:31:49 +08:00
|
|
|
if [[ $OSX ]]; then
|
2016-08-14 06:22:12 +08:00
|
|
|
brew install binutils
|
|
|
|
fi
|
2016-08-08 06:23:30 +08:00
|
|
|
}
|
|
|
|
|
2016-08-08 06:03:44 +08:00
|
|
|
install_rust() {
|
2016-08-30 08:31:49 +08:00
|
|
|
if [[ $OSX ]]; then
|
2016-08-14 06:22:12 +08:00
|
|
|
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
|
|
|
|
2016-08-28 01:34:39 +08:00
|
|
|
rustup -V
|
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-30 08:31:49 +08:00
|
|
|
if [[ $TARGET != $HOST && $CARGO == cargo ]]; then
|
2016-08-08 06:03:44 +08:00
|
|
|
rustup target add $TARGET
|
|
|
|
fi
|
2016-08-08 05:55:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
main() {
|
2016-08-30 08:31:49 +08:00
|
|
|
if [[ $OSX || ${IN_DOCKER_CONTAINER:-n} == y ]]; then
|
2016-08-09 09:37:04 +08:00
|
|
|
install_qemu
|
2016-08-24 09:46:36 +08:00
|
|
|
install_gist
|
2016-08-09 09:37:04 +08:00
|
|
|
install_binutils
|
|
|
|
install_rust
|
|
|
|
add_rustup_target
|
|
|
|
fi
|
2016-08-08 05:55:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
main
|