2016-08-08 05:55:30 +08:00
|
|
|
set -ex
|
|
|
|
|
|
|
|
. $(dirname $0)/env.sh
|
|
|
|
|
2016-08-09 10:20:46 +08:00
|
|
|
install_deps() {
|
2016-08-09 10:27:08 +08:00
|
|
|
if [[ ${DOCKER} == "i" ]]; then
|
2016-08-09 10:32:12 +08:00
|
|
|
apt-get update
|
2016-08-09 10:20:46 +08:00
|
|
|
apt-get install -y --no-install-recommends \
|
|
|
|
ca-certificates curl
|
|
|
|
fi
|
|
|
|
}
|
|
|
|
|
2016-08-09 09:37:04 +08:00
|
|
|
install_qemu() {
|
|
|
|
case $TARGET in
|
2016-08-09 12:07:33 +08:00
|
|
|
mipsel-unknown-linux-gnu | \
|
2016-08-09 10:49:31 +08:00
|
|
|
powerpc64le-unknown-linux-gnu)
|
|
|
|
apt-get install -y --no-install-recommends \
|
|
|
|
qemu-user
|
2016-08-09 09:37:04 +08:00
|
|
|
;;
|
2016-08-11 02:01:22 +08:00
|
|
|
mips-unknown-linux-gnu | \
|
|
|
|
powerpc64-unknown-linux-gnu)
|
2016-08-11 00:50:41 +08:00
|
|
|
dpkg --add-architecture i386
|
|
|
|
apt-get update
|
|
|
|
apt-get install -y --no-install-recommends \
|
|
|
|
qemu-user:i386
|
|
|
|
;;
|
2016-08-09 09:37:04 +08:00
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2016-08-08 06:32:53 +08:00
|
|
|
install_binutils() {
|
|
|
|
case $TRAVIS_OS_NAME in
|
|
|
|
osx)
|
|
|
|
brew install binutils
|
2016-08-08 06:03:44 +08:00
|
|
|
;;
|
|
|
|
*)
|
|
|
|
;;
|
|
|
|
esac
|
2016-08-08 05:55:30 +08:00
|
|
|
}
|
|
|
|
|
2016-08-08 06:32:53 +08:00
|
|
|
install_c_toolchain() {
|
|
|
|
case $TARGET in
|
|
|
|
aarch64-unknown-linux-gnu)
|
|
|
|
sudo apt-get install -y --no-install-recommends \
|
2016-08-09 09:41:08 +08:00
|
|
|
gcc-aarch64-linux-gnu libc6-dev-arm64-cross
|
|
|
|
;;
|
2016-08-10 04:37:24 +08:00
|
|
|
i586-unknown-linux-gnu)
|
|
|
|
apt-get install -y --no-install-recommends \
|
2016-08-10 05:17:06 +08:00
|
|
|
gcc libc6-dev-i386 lib32gcc-5-dev
|
2016-08-10 04:37:24 +08:00
|
|
|
;;
|
2016-08-09 11:03:44 +08:00
|
|
|
mips-unknown-linux-gnu)
|
|
|
|
apt-get install -y --no-install-recommends \
|
2016-08-11 09:00:51 +08:00
|
|
|
gcc gcc-mips-linux-gnu libc6-dev libc6-dev-mips-cross
|
2016-08-09 11:03:44 +08:00
|
|
|
;;
|
2016-08-09 12:07:33 +08:00
|
|
|
mipsel-unknown-linux-gnu)
|
|
|
|
apt-get install -y --no-install-recommends \
|
2016-08-11 09:00:51 +08:00
|
|
|
gcc gcc-mipsel-linux-gnu libc6-dev libc6-dev-mipsel-cross
|
2016-08-09 12:07:33 +08:00
|
|
|
;;
|
2016-08-09 10:59:31 +08:00
|
|
|
powerpc64-unknown-linux-gnu)
|
|
|
|
apt-get install -y --no-install-recommends \
|
2016-08-11 09:00:51 +08:00
|
|
|
gcc gcc-powerpc64-linux-gnu libc6-dev libc6-dev-ppc64-cross
|
2016-08-09 10:59:31 +08:00
|
|
|
;;
|
2016-08-09 10:37:48 +08:00
|
|
|
powerpc64le-unknown-linux-gnu)
|
2016-08-09 10:43:01 +08:00
|
|
|
apt-get install -y --no-install-recommends \
|
2016-08-11 09:00:51 +08:00
|
|
|
gcc gcc-powerpc64le-linux-gnu libc6-dev libc6-dev-ppc64el-cross
|
2016-08-08 06:23:30 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
}
|
|
|
|
|
2016-08-08 06:03:44 +08:00
|
|
|
install_rust() {
|
|
|
|
curl https://sh.rustup.rs -sSf | sh -s -- -y --default-toolchain=nightly
|
|
|
|
|
|
|
|
rustc -V
|
|
|
|
cargo -V
|
|
|
|
}
|
2016-08-08 05:55:30 +08:00
|
|
|
|
2016-08-08 06:03:44 +08:00
|
|
|
add_rustup_target() {
|
|
|
|
if [[ $TARGET != $HOST ]]; then
|
|
|
|
rustup target add $TARGET
|
|
|
|
fi
|
2016-08-08 05:55:30 +08:00
|
|
|
}
|
|
|
|
|
2016-08-08 06:03:44 +08:00
|
|
|
configure_cargo() {
|
|
|
|
if [[ $PREFIX ]]; then
|
|
|
|
${PREFIX}gcc -v
|
|
|
|
|
|
|
|
mkdir -p .cargo
|
|
|
|
cat >>.cargo/config <<EOF
|
|
|
|
[target.$TARGET]
|
|
|
|
linker = "${PREFIX}gcc"
|
|
|
|
EOF
|
|
|
|
fi
|
2016-08-08 05:55:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
main() {
|
2016-08-09 10:14:04 +08:00
|
|
|
if [[ ${DOCKER:-n} != "y" ]]; then
|
2016-08-09 10:20:46 +08:00
|
|
|
install_deps
|
2016-08-09 09:37:04 +08:00
|
|
|
install_qemu
|
|
|
|
install_binutils
|
|
|
|
install_c_toolchain
|
|
|
|
install_rust
|
|
|
|
add_rustup_target
|
|
|
|
configure_cargo
|
|
|
|
fi
|
2016-08-08 05:55:30 +08:00
|
|
|
}
|
|
|
|
|
|
|
|
main
|