2016-08-08 05:55:30 +08:00
|
|
|
case $TRAVIS_OS_NAME in
|
|
|
|
linux)
|
2016-08-30 08:31:49 +08:00
|
|
|
HOST=x86_64-unknown-linux-gnu
|
|
|
|
NM=nm
|
|
|
|
OBJDUMP=objdump
|
|
|
|
LINUX=y
|
2016-08-08 05:55:30 +08:00
|
|
|
;;
|
|
|
|
osx)
|
2016-08-30 08:31:49 +08:00
|
|
|
HOST=x86_64-apple-darwin
|
|
|
|
NM=gnm
|
|
|
|
OBJDUMP=gobjdump
|
|
|
|
OSX=y
|
2016-08-08 05:55:30 +08:00
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2016-08-30 08:31:49 +08:00
|
|
|
# NOTE For rustup
|
|
|
|
export PATH="$HOME/.cargo/bin:$PATH"
|
|
|
|
|
|
|
|
CARGO=cargo
|
|
|
|
RUN_TESTS=y
|
|
|
|
|
|
|
|
# NOTE For the host and its 32-bit variants we don't need prefixed tools or QEMU
|
|
|
|
if [[ $TARGET != $HOST && ! $TARGET =~ ^i.86- ]]; then
|
|
|
|
GCC_TRIPLE=${TARGET//unknown-/}
|
|
|
|
|
|
|
|
case $TARGET in
|
|
|
|
armv7-unknown-linux-gnueabihf)
|
|
|
|
GCC_TRIPLE=arm-linux-gnueabihf
|
|
|
|
;;
|
|
|
|
powerpc64le-unknown-linux-gnu)
|
|
|
|
# QEMU crashes even when executing the simplest cross compiled C program:
|
|
|
|
# `int main() { return 0; }`
|
|
|
|
RUN_TESTS=n
|
|
|
|
;;
|
2016-09-22 19:15:05 +08:00
|
|
|
thumbv*-none-eabi*)
|
2016-08-30 08:31:49 +08:00
|
|
|
CARGO=xargo
|
|
|
|
GCC_TRIPLE=arm-none-eabi
|
|
|
|
# Bare metal targets. No `std` or `test` crates for these targets.
|
|
|
|
RUN_TESTS=n
|
|
|
|
;;
|
|
|
|
esac
|
|
|
|
|
2016-08-30 10:35:53 +08:00
|
|
|
export CARGO_TARGET_$(echo $TARGET | tr a-z- A-Z_)_LINKER=$GCC_TRIPLE-gcc
|
|
|
|
|
2016-08-30 08:31:49 +08:00
|
|
|
if [[ $RUN_TESTS == y ]]; then
|
|
|
|
# NOTE(export) so this can reach the processes that `cargo test` spawns
|
|
|
|
export QEMU_LD_PREFIX=/usr/$GCC_TRIPLE
|
|
|
|
fi
|
|
|
|
|
|
|
|
PREFIX=$GCC_TRIPLE-
|
|
|
|
fi
|