From 6500357180bc0ce243c66256db45dbfb42ee06cb Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Wed, 19 Apr 2017 13:51:55 -0300 Subject: [PATCH] Add host build for aarch64-linux-android --- .travis.yml | 1 + src/ci/docker/dist-aarch64-android/Dockerfile | 49 +++++++++++++++++++ src/ci/docker/dist-android/Dockerfile | 28 ++++------- src/ci/docker/dist-android/install-ndk.sh | 37 ++++++-------- src/tools/build-manifest/src/main.rs | 1 + 5 files changed, 77 insertions(+), 39 deletions(-) create mode 100644 src/ci/docker/dist-aarch64-android/Dockerfile diff --git a/.travis.yml b/.travis.yml index 0ffba70d2ef44..16c8458a3e7ad 100644 --- a/.travis.yml +++ b/.travis.yml @@ -15,6 +15,7 @@ matrix: - env: IMAGE=arm-android - env: IMAGE=armhf-gnu - env: IMAGE=cross DEPLOY=1 + - env: IMAGE=dist-aarch64-android DEPLOY=1 - env: IMAGE=dist-aarch64-linux DEPLOY=1 - env: IMAGE=dist-android DEPLOY=1 - env: IMAGE=dist-arm-linux DEPLOY=1 diff --git a/src/ci/docker/dist-aarch64-android/Dockerfile b/src/ci/docker/dist-aarch64-android/Dockerfile new file mode 100644 index 0000000000000..00a869e1fd5bc --- /dev/null +++ b/src/ci/docker/dist-aarch64-android/Dockerfile @@ -0,0 +1,49 @@ +FROM ubuntu:16.04 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + g++ \ + make \ + file \ + curl \ + ca-certificates \ + python2.7 \ + git \ + cmake \ + unzip \ + sudo \ + xz-utils \ + libssl-dev \ + pkg-config + +RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \ + dpkg -i dumb-init_*.deb && \ + rm dumb-init_*.deb + +RUN curl -o /usr/local/bin/sccache \ + https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \ + chmod +x /usr/local/bin/sccache + +RUN curl -O https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip && \ + unzip -q android-ndk-r13b-linux-x86_64.zip && \ + python2.7 android-ndk-r13b/build/tools/make_standalone_toolchain.py \ + --install-dir /android-ndk \ + --arch arm64 \ + --api 21 && \ + rm -rf android-ndk-* + +ENTRYPOINT ["/usr/bin/dumb-init", "--"] + +ENV PATH=$PATH:/android-ndk/bin + +ENV DEP_Z_ROOT=/android-ndk/sysroot/usr/ + +ENV RUST_CONFIGURE_ARGS \ + --target=aarch64-linux-android \ + --host=aarch64-linux-android \ + --aarch64-linux-android-ndk=/android-ndk \ + --disable-rpath \ + --enable-extended \ + --enable-cargo-openssl-static + +ENV SCRIPT python2.7 ../x.py dist --target aarch64-linux-android --host aarch64-linux-android diff --git a/src/ci/docker/dist-android/Dockerfile b/src/ci/docker/dist-android/Dockerfile index 99c176aa820c7..895b9a9a5e25b 100644 --- a/src/ci/docker/dist-android/Dockerfile +++ b/src/ci/docker/dist-android/Dockerfile @@ -1,7 +1,6 @@ FROM ubuntu:16.04 -RUN dpkg --add-architecture i386 && \ - apt-get update && \ +RUN apt-get update && \ apt-get install -y --no-install-recommends \ g++ \ make \ @@ -12,40 +11,33 @@ RUN dpkg --add-architecture i386 && \ git \ cmake \ unzip \ - expect \ - openjdk-9-jre \ sudo \ - libstdc++6:i386 \ xz-utils \ libssl-dev \ pkg-config -WORKDIR /android/ -ENV PATH=$PATH:/android/ndk-arm-9/bin:/android/sdk/tools:/android/sdk/platform-tools - -COPY install-ndk.sh /android/ -RUN sh /android/install-ndk.sh - RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \ dpkg -i dumb-init_*.deb && \ rm dumb-init_*.deb -ENTRYPOINT ["/usr/bin/dumb-init", "--"] RUN curl -o /usr/local/bin/sccache \ https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-04-sccache-x86_64-unknown-linux-musl && \ chmod +x /usr/local/bin/sccache +COPY install-ndk.sh /android/ +RUN sh /android/install-ndk.sh + +ENTRYPOINT ["/usr/bin/dumb-init", "--"] + ENV TARGETS=arm-linux-androideabi -ENV TARGETS=$TARGETS,i686-linux-android -ENV TARGETS=$TARGETS,aarch64-linux-android ENV TARGETS=$TARGETS,armv7-linux-androideabi +ENV TARGETS=$TARGETS,i686-linux-android ENV RUST_CONFIGURE_ARGS \ --target=$TARGETS \ --enable-extended \ - --arm-linux-androideabi-ndk=/android/ndk-arm-9 \ - --armv7-linux-androideabi-ndk=/android/ndk-arm-9 \ - --i686-linux-android-ndk=/android/ndk-x86-9 \ - --aarch64-linux-android-ndk=/android/ndk-aarch64 + --arm-linux-androideabi-ndk=/android/ndk/arm-9 \ + --armv7-linux-androideabi-ndk=/android/ndk/arm-9 \ + --i686-linux-android-ndk=/android/ndk/x86-9 ENV SCRIPT python2.7 ../x.py dist --target $TARGETS diff --git a/src/ci/docker/dist-android/install-ndk.sh b/src/ci/docker/dist-android/install-ndk.sh index 19c1b94e784c8..d26bb0cdb6ca6 100644 --- a/src/ci/docker/dist-android/install-ndk.sh +++ b/src/ci/docker/dist-android/install-ndk.sh @@ -11,28 +11,23 @@ set -ex +install_ndk() { + python2.7 android-ndk-r13b/build/tools/make_standalone_toolchain.py \ + --install-dir /android/ndk/$1-$2 \ + --arch $1 \ + --api $2 +} + +mkdir -p /android/ndk +cd android + # Prep the Android NDK # # See https://github.com/servo/servo/wiki/Building-for-Android -curl -O https://dl.google.com/android/repository/android-ndk-r11c-linux-x86_64.zip -unzip -q android-ndk-r11c-linux-x86_64.zip -bash android-ndk-r11c/build/tools/make-standalone-toolchain.sh \ - --platform=android-9 \ - --toolchain=arm-linux-androideabi-4.9 \ - --install-dir=/android/ndk-arm-9 \ - --ndk-dir=/android/android-ndk-r11c \ - --arch=arm -bash android-ndk-r11c/build/tools/make-standalone-toolchain.sh \ - --platform=android-21 \ - --toolchain=aarch64-linux-android-4.9 \ - --install-dir=/android/ndk-aarch64 \ - --ndk-dir=/android/android-ndk-r11c \ - --arch=arm64 -bash android-ndk-r11c/build/tools/make-standalone-toolchain.sh \ - --platform=android-9 \ - --toolchain=x86-4.9 \ - --install-dir=/android/ndk-x86-9 \ - --ndk-dir=/android/android-ndk-r11c \ - --arch=x86 +curl -O https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip +unzip -q android-ndk-r13b-linux-x86_64.zip + +install_ndk arm 9 +install_ndk x86 9 -rm -rf ./android-ndk-r11c-linux-x86_64.zip ./android-ndk-r11c +rm -rf android-ndk-* diff --git a/src/tools/build-manifest/src/main.rs b/src/tools/build-manifest/src/main.rs index 28c8d22707325..52ab1208fe11d 100644 --- a/src/tools/build-manifest/src/main.rs +++ b/src/tools/build-manifest/src/main.rs @@ -19,6 +19,7 @@ use std::path::{PathBuf, Path}; use std::process::{Command, Stdio}; static HOSTS: &'static [&'static str] = &[ + "aarch64-linux-android", "aarch64-unknown-linux-gnu", "arm-unknown-linux-gnueabi", "arm-unknown-linux-gnueabihf",