diff --git a/.travis.yml b/.travis.yml index 8879f23183..d92b97c298 100644 --- a/.travis.yml +++ b/.travis.yml @@ -74,6 +74,24 @@ matrix: DOCKER=alexcrichton/rust-slave-linux-cross:2016-11-11 SKIP_TESTS=1 + # Android use a local docker image + - os: linux + env: TARGET=arm-linux-androideabi + DOCKER=android + SKIP_TESTS=1 + - os: linux + env: TARGET=armv7-linux-androideabi + DOCKER=android + SKIP_TESTS=1 + - os: linux + env: TARGET=aarch64-linux-android + DOCKER=android + SKIP_TESTS=1 + - os: linux + env: TARGET=i686-linux-android + DOCKER=android + SKIP_TESTS=1 + # On OSX we want to target 10.7 so we ensure that the appropriate # environment variable is set to tell the linker what we want. - os: osx @@ -101,16 +119,7 @@ install: script: - mkdir target - if [ ! -z "$DOCKER" ]; then - docker run - --entrypoint bash - -u `id -u`:`id -g` - -v $HOME/rust:/travis-rust:ro - -v `pwd`:/buildslave:ro - -v `pwd`/target:/buildslave/target - -e TARGET=$TARGET - -e SKIP_TESTS=$SKIP_TESTS - -it $DOCKER - ci/run-docker.sh; + sh ci/build-run-docker.sh "$DOCKER" "$TARGET" "$SKIP_TESTS"; else PATH=$HOME/rust/bin:$PATH sh ci/run.sh; fi diff --git a/Cargo.lock b/Cargo.lock index e3c102e4e9..cfe51004df 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -56,7 +56,7 @@ name = "backtrace-sys" version = "0.1.4" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.39 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -152,7 +152,7 @@ name = "curl-sys" version = "0.3.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.39 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "libz-sys 1.0.8 (registry+https://github.com/rust-lang/crates.io-index)", "openssl-sys 0.9.2 (registry+https://github.com/rust-lang/crates.io-index)", @@ -220,7 +220,7 @@ dependencies = [ [[package]] name = "gcc" -version = "0.3.39" +version = "0.3.45" source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] @@ -332,7 +332,7 @@ name = "libz-sys" version = "1.0.8" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.39 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", "pkg-config 0.3.8 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -377,7 +377,7 @@ name = "miniz-sys" version = "0.1.7" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ - "gcc 0.3.39 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", "libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", ] @@ -528,7 +528,7 @@ dependencies = [ "clap 2.18.0 (registry+https://github.com/rust-lang/crates.io-index)", "download 0.3.0", "error-chain 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)", - "gcc 0.3.39 (registry+https://github.com/rust-lang/crates.io-index)", + "gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)", "itertools 0.4.19 (registry+https://github.com/rust-lang/crates.io-index)", "kernel32-sys 0.2.2 (registry+https://github.com/rust-lang/crates.io-index)", "lazy_static 0.1.16 (registry+https://github.com/rust-lang/crates.io-index)", @@ -592,7 +592,7 @@ dependencies = [ "tempdir 0.3.4 (registry+https://github.com/rust-lang/crates.io-index)", "toml 0.1.30 (registry+https://github.com/rust-lang/crates.io-index)", "url 1.1.1 (registry+https://github.com/rust-lang/crates.io-index)", - "wait-timeout 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)", + "wait-timeout 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)", "walkdir 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)", "winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)", "winreg 0.3.5 (registry+https://github.com/rust-lang/crates.io-index)", @@ -900,7 +900,7 @@ source = "registry+https://github.com/rust-lang/crates.io-index" [[package]] name = "wait-timeout" -version = "0.1.3" +version = "0.1.5" source = "registry+https://github.com/rust-lang/crates.io-index" dependencies = [ "libc 0.2.18 (registry+https://github.com/rust-lang/crates.io-index)", @@ -978,7 +978,7 @@ dependencies = [ "checksum error-chain 0.7.1 (registry+https://github.com/rust-lang/crates.io-index)" = "1cd681735364a04cd5d69f01a4f6768e70473941f8d86d8c224faf6955a75799" "checksum filetime 0.1.10 (registry+https://github.com/rust-lang/crates.io-index)" = "5363ab8e4139b8568a6237db5248646e5a8a2f89bd5ccb02092182b11fd3e922" "checksum flate2 0.2.14 (registry+https://github.com/rust-lang/crates.io-index)" = "3eeb481e957304178d2e782f2da1257f1434dfecbae883bafb61ada2a9fea3bb" -"checksum gcc 0.3.39 (registry+https://github.com/rust-lang/crates.io-index)" = "771e4a97ff6f237cf0f7d5f5102f6e28bb9743814b6198d684da5c58b76c11e0" +"checksum gcc 0.3.45 (registry+https://github.com/rust-lang/crates.io-index)" = "40899336fb50db0c78710f53e87afc54d8c7266fb76262fecc78ca1a7f09deae" "checksum gdi32-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "0912515a8ff24ba900422ecda800b52f4016a56251922d397c576bf92c690518" "checksum hpack 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "3d2da7d3a34cf6406d9d700111b8eafafe9a251de41ae71d8052748259343b58" "checksum httparse 1.1.2 (registry+https://github.com/rust-lang/crates.io-index)" = "46534074dbb80b070d60a5cb8ecadd8963a00a438ae1a95268850a7ef73b67ae" @@ -1051,7 +1051,7 @@ dependencies = [ "checksum userenv-sys 0.2.0 (registry+https://github.com/rust-lang/crates.io-index)" = "71d28ea36bbd9192d75bd9fa9b39f96ddb986eaee824adae5d53b6e51919b2f3" "checksum utf8-ranges 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "a1ca13c08c41c9c3e04224ed9ff80461d97e121589ff27c753a16cb10830ae0f" "checksum vec_map 0.6.0 (registry+https://github.com/rust-lang/crates.io-index)" = "cac5efe5cb0fa14ec2f84f83c701c562ee63f6dcc680861b21d65c682adfb05f" -"checksum wait-timeout 0.1.3 (registry+https://github.com/rust-lang/crates.io-index)" = "3e8ab44ea5707ff5261a802e8be19697a2e342ecc55409b062c285fc4f624d05" +"checksum wait-timeout 0.1.5 (registry+https://github.com/rust-lang/crates.io-index)" = "b9f3bf741a801531993db6478b95682117471f76916f5e690dd8d45395b09349" "checksum walkdir 0.1.8 (registry+https://github.com/rust-lang/crates.io-index)" = "c66c0b9792f0a765345452775f3adbd28dde9d33f30d13e5dcc5ae17cf6f3780" "checksum webpki 0.3.0 (registry+https://github.com/rust-lang/crates.io-index)" = "813503a5985585e0812d430cd1328ee322f47f66629c8ed4ecab939cf9e92f91" "checksum winapi 0.2.8 (registry+https://github.com/rust-lang/crates.io-index)" = "167dc9d6949a9b857f3451275e911c3f44255842c1f7a76f33c55103a909087a" diff --git a/ci/build-run-docker.sh b/ci/build-run-docker.sh new file mode 100644 index 0000000000..1186c7faa2 --- /dev/null +++ b/ci/build-run-docker.sh @@ -0,0 +1,24 @@ +#!/bin/sh + +set -ex + +mkdir -p target + +DOCKER="$1" +TARGET="$2" +SKIP_TESTS="$3" + +if [ -f "ci/docker/$DOCKER/Dockerfile" ]; then + docker build -t "$DOCKER" "ci/docker/$DOCKER/" +fi + +docker run \ + --entrypoint bash \ + -u `id -u`:`id -g` \ + -v $HOME/rust:/travis-rust:ro \ + -v `pwd`:/buildslave:ro \ + -v `pwd`/target:/buildslave/target \ + -e TARGET=$TARGET \ + -e SKIP_TESTS=$SKIP_TESTS \ + -it $DOCKER \ + ci/run-docker.sh diff --git a/ci/docker/android/Dockerfile b/ci/docker/android/Dockerfile new file mode 100644 index 0000000000..5c54ad47cf --- /dev/null +++ b/ci/docker/android/Dockerfile @@ -0,0 +1,35 @@ +FROM ubuntu:16.04 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + cmake \ + curl \ + gcc \ + libc6-dev \ + make \ + pkg-config + +RUN apt-get install -y --no-install-recommends \ + unzip \ + python && \ + curl -O https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip && \ + unzip -q android-ndk-r13b-linux-x86_64.zip && \ + ./android-ndk-r13b/build/tools/make_standalone_toolchain.py \ + --install-dir /android-ndk/arm \ + --arch arm \ + --api 21 && \ + ./android-ndk-r13b/build/tools/make_standalone_toolchain.py \ + --install-dir /android-ndk/arm64 \ + --arch arm64 \ + --api 21 && \ + ./android-ndk-r13b/build/tools/make_standalone_toolchain.py \ + --install-dir /android-ndk/x86 \ + --arch x86 \ + --api 21 && \ + rm -rf ./android-ndk-r13b-linux-x86_64.zip ./android-ndk-r13b && \ + apt-get purge --auto-remove -y unzip python + +ENV PATH=$PATH:/android-ndk/arm/bin:/android-ndk/arm64/bin:/android-ndk/x86/bin + +WORKDIR /buildslave diff --git a/ci/run-docker.sh b/ci/run-docker.sh index e9886ed5ae..58a082b81d 100644 --- a/ci/run-docker.sh +++ b/ci/run-docker.sh @@ -2,6 +2,19 @@ set -ex +# For some unknown reason libz is not found in the android docker image, so we +# use this workaround +case $TARGET in + arm-linux-androideabi | armv7-linux-androideabi ) + export DEP_Z_ROOT=/android-ndk/arm/sysroot/usr/;; + + aarch64-linux-android ) + export DEP_Z_ROOT=/android-ndk/arm64/sysroot/usr/;; + + i686-linux-android ) + export DEP_Z_ROOT=/android-ndk/x86/sysroot/usr/;; +esac + upper_target=$(echo $TARGET | tr '[a-z]' '[A-Z]' | tr '-' '_') export PATH=/travis-rust/bin:$PATH export LD_LIBRARY_PATH=/travis-rust/lib:$LD_LIBRARY_PATH @@ -34,6 +47,27 @@ case $TARGET in OPENSSL_SETARCH='setarch i386' OPENSSL_CFLAGS=-m32 ;; + arm-linux-androideabi) + OPENSSL_OS=android + OPENSSL_CC=arm-linux-androideabi-gcc + OPENSSL_AR=arm-linux-androideabi-ar + ;; + armv7-linux-androideabi) + OPENSSL_OS=android-armv7 + OPENSSL_CC=arm-linux-androideabi-gcc + OPENSSL_AR=arm-linux-androideabi-ar + ;; + aarch64-linux-android) + OPENSSL_OS=linux-generic64 + OPENSSL_CC=aarch64-linux-android-gcc + OPENSSL_AR=aarch64-linux-android-ar + OPENSSL_CFLAGS="-mandroid -fomit-frame-pointer" + ;; + i686-linux-android) + OPENSSL_OS=android-x86 + OPENSSL_CC=i686-linux-android-gcc + OPENSSL_AR=i686-linux-android-ar + ;; arm-*-linux-gnueabi) OPENSSL_OS=linux-armv4 OPENSSL_CC=arm-linux-gnueabi-gcc diff --git a/src/rustup-dist/src/dist.rs b/src/rustup-dist/src/dist.rs index f16499ac11..581acf7003 100644 --- a/src/rustup-dist/src/dist.rs +++ b/src/rustup-dist/src/dist.rs @@ -85,7 +85,7 @@ static LIST_OSES: &'static [&'static str] = &["pc-windows", "rumprun-netbsd", "unknown-freebsd"]; static LIST_ENVS: &'static [&'static str] = - &["gnu", "msvc", "gnueabi", "gnueabihf", "gnuabi64", "androideabi", "musl"]; + &["gnu", "msvc", "gnueabi", "gnueabihf", "gnuabi64", "androideabi", "android", "musl"]; // MIPS platforms don't indicate endianness in uname, however binaries only // run on boxes with the same endianness, as expected. @@ -161,6 +161,10 @@ impl TargetTriple { }; let host_triple = match (sysname, machine) { + (_, b"arm") if cfg!(target_os = "android") => Some("arm-linux-androideabi"), + (_, b"armv7l") if cfg!(target_os = "android") => Some("armv7-linux-androideabi"), + (_, b"aarch64") if cfg!(target_os = "android") => Some("aarch64-linux-android"), + (_, b"i686") if cfg!(target_os = "android") => Some("i686-linux-android"), (b"Linux", b"x86_64") => Some("x86_64-unknown-linux-gnu"), (b"Linux", b"i686") => Some("i686-unknown-linux-gnu"), (b"Linux", b"mips") => Some(TRIPLE_MIPS_UNKNOWN_LINUX_GNU),