Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add host build for aarch64-linux-android #41149

Closed
wants to merge 3 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
10 changes: 10 additions & 0 deletions src/bootstrap/native.rs
Original file line number Diff line number Diff line change
Expand Up @@ -274,11 +274,15 @@ pub fn openssl(build: &Build, target: &str) {
configure.arg("no-ssl3");

let os = match target {
"aarch64-linux-android" => "linux-aarch64",
"aarch64-unknown-linux-gnu" => "linux-aarch64",
"arm-linux-androideabi" => "android",
"arm-unknown-linux-gnueabi" => "linux-armv4",
"arm-unknown-linux-gnueabihf" => "linux-armv4",
"armv7-linux-androideabi" => "android-armv7",
"armv7-unknown-linux-gnueabihf" => "linux-armv4",
"i686-apple-darwin" => "darwin-i386-cc",
"i686-linux-android" => "android-x86",
"i686-unknown-freebsd" => "BSD-x86-elf",
"i686-unknown-linux-gnu" => "linux-elf",
"i686-unknown-linux-musl" => "linux-elf",
Expand All @@ -302,6 +306,12 @@ pub fn openssl(build: &Build, target: &str) {
for flag in build.cflags(target) {
configure.arg(flag);
}
// There is no specific os target for android aarch64,
// so we use linux-aarch64 and pass some extra cflags
if os == "linux-aarch64" {
configure.arg("-mandroid");
configure.arg("-fomit-frame-pointer");
}
configure.current_dir(&obj);
println!("Configuring openssl for {}", target);
build.run_quiet(&mut configure);
Expand Down
48 changes: 30 additions & 18 deletions src/ci/docker/arm-android/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -12,35 +11,48 @@ RUN dpkg --add-architecture i386 && \
git \
cmake \
unzip \
expect \
openjdk-9-jre-headless \
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 install-sdk.sh accept-licenses.sh /android/
RUN sh /android/install-ndk.sh
RUN sh /android/install-sdk.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

COPY start-emulator.sh /android/

ENTRYPOINT ["/usr/bin/dumb-init", "--", "/android/start-emulator.sh"]

RUN curl -o /usr/local/bin/sccache \
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-02-24-sccache-x86_64-unknown-linux-gnu && \
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 arm \
--api 9 && \
rm -rf android-ndk-*

RUN dpkg --add-architecture i386 && \
apt-get update && \
apt-get install -y --no-install-recommends \
expect \
openjdk-9-jre-headless \
libstdc++6:i386

WORKDIR /android/
ENV PATH=$PATH:/android-ndk/bin
ENV PATH=$PATH:/android/sdk/tools
ENV PATH=$PATH:/android/sdk/platform-tools

COPY accept-licenses.sh /android/
COPY install-sdk.sh /android/
RUN sh /android/install-sdk.sh

COPY start-emulator.sh /android/
ENTRYPOINT ["/usr/bin/dumb-init", "--", "/android/start-emulator.sh"]

ENV RUST_CONFIGURE_ARGS \
--target=arm-linux-androideabi \
--arm-linux-androideabi-ndk=/android/ndk-arm-9
--arm-linux-androideabi-ndk=/android-ndk

ENV SCRIPT python2.7 ../x.py test --target arm-linux-androideabi
33 changes: 0 additions & 33 deletions src/ci/docker/arm-android/install-ndk.sh

This file was deleted.

49 changes: 49 additions & 0 deletions src/ci/docker/dist-aarch64-android/Dockerfile
Original file line number Diff line number Diff line change
@@ -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
28 changes: 10 additions & 18 deletions src/ci/docker/dist-android/Dockerfile
Original file line number Diff line number Diff line change
@@ -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 \
Expand All @@ -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
37 changes: 16 additions & 21 deletions src/ci/docker/dist-android/install-ndk.sh
Original file line number Diff line number Diff line change
Expand Up @@ -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-*
1 change: 1 addition & 0 deletions src/tools/build-manifest/src/main.rs
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down