diff options
Diffstat (limited to 'ci/install.sh')
-rw-r--r-- | ci/install.sh | 66 |
1 files changed, 40 insertions, 26 deletions
diff --git a/ci/install.sh b/ci/install.sh index e4bd198..9d56f57 100644 --- a/ci/install.sh +++ b/ci/install.sh @@ -2,32 +2,49 @@ set -ex -case $TARGET in - # Install standard libraries needed for cross compilation - arm-unknown-linux-gnueabihf | \ - i686-apple-darwin | \ - i686-unknown-linux-gnu | \ - x86_64-unknown-linux-musl) - if [ "$TARGET" = "arm-unknown-linux-gnueabihf" ]; then - # information about the cross compiler - arm-linux-gnueabihf-gcc -v - - # tell cargo which linker to use for cross compilation - mkdir -p .cargo - cat >.cargo/config <<EOF +# Install multirust +git clone https://github.com/brson/multirust +pushd multirust +./build.sh +./install.sh --prefix=~/multirust +multirust default $CHANNEL +rustc -V +cargo -V +popd + +case "$TRAVIS_OS_NAME" in + linux) + host=x86_64-unknown-linux-gnu + ;; + osx) + host=x86_64-apple-darwin + ;; +esac + +# Install standard libraries needed for cross compilation +if [ "$host" != "$TARGET" ]; then + if [ "$TARGET" = "arm-unknown-linux-gnueabihf" ]; then + # information about the cross compiler + arm-linux-gnueabihf-gcc -v + + # tell cargo which linker to use for cross compilation + mkdir -p .cargo + cat >>.cargo/config <<EOF [target.$TARGET] linker = "arm-linux-gnueabihf-gcc" EOF + fi + + if [ "$CHANNEL" = "nightly" ]; then + multirust add-target nightly $TARGET + else + if [ "$CHANNEL" = "stable" ]; then + # e.g. 1.6.0 + version=$(rustc -V | cut -d' ' -f2) + else + version=beta fi - # e.g. 1.6.0 - # doesn't work for nightly - # version=$(rustc -V | cut -d' ' -f2) - version=$(rustc -V | cut -d' ' -f2 | cut -d'-' -f2) - - if [ "$TARGET" = "x86_64-unknown-linux-musl" ]; then - version="nightly" - fi tarball=rust-std-${version}-${TARGET} curl -Os http://static.rust-lang.org/dist/${tarball}.tar.gz @@ -38,10 +55,7 @@ EOF rm -r ${tarball} rm ${tarball}.tar.gz - ;; - # Nothing to do for native builds - *) - ;; -esac + fi +fi # TODO if you need to install extra stuff add it here |