forked from rust-lang/rust
-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Auto merge of rust-lang#41864 - malbarbo:android-docker, r=alexcrichton
Add disabled android host builders Introduce the concept of disabled builder. A disabled builder is one that is not run by travis. It is intended to be run by the user who wants a rustc for a tier 2 or 3 platform. Off corse, there is no guarantee that it will work.
- Loading branch information
Showing
6 changed files
with
284 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
#!/bin/sh | ||
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT | ||
# file at the top-level directory of this distribution and at | ||
# http://rust-lang.org/COPYRIGHT. | ||
# | ||
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or | ||
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license | ||
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your | ||
# option. This file may not be copied, modified, or distributed | ||
# except according to those terms. | ||
|
||
set -ex | ||
|
||
URL=https://dl.google.com/android/repository | ||
|
||
download_ndk() { | ||
mkdir -p /android/ndk | ||
cd /android/ndk | ||
curl -O $URL/$1 | ||
unzip -q $1 | ||
rm $1 | ||
mv android-ndk-* ndk | ||
} | ||
|
||
make_standalone_toolchain() { | ||
# See https://developer.android.com/ndk/guides/standalone_toolchain.htm | ||
python2.7 /android/ndk/ndk/build/tools/make_standalone_toolchain.py \ | ||
--install-dir /android/ndk/$1-$2 \ | ||
--arch $1 \ | ||
--api $2 | ||
} | ||
|
||
remove_ndk() { | ||
rm -rf /android/ndk/ndk | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-29-sccache-x86_64-unknown-linux-musl && \ | ||
chmod +x /usr/local/bin/sccache | ||
|
||
ENTRYPOINT ["/usr/bin/dumb-init", "--"] | ||
|
||
COPY android-ndk.sh / | ||
RUN . /android-ndk.sh && \ | ||
download_ndk android-ndk-r13b-linux-x86_64.zip && \ | ||
make_standalone_toolchain arm64 21 && \ | ||
remove_ndk | ||
|
||
ENV PATH=$PATH:/android/ndk/arm64-21/bin | ||
|
||
ENV DEP_Z_ROOT=/android/ndk/arm64-21/sysroot/usr/ | ||
|
||
ENV HOSTS=aarch64-linux-android | ||
|
||
ENV RUST_CONFIGURE_ARGS \ | ||
--host=$HOSTS \ | ||
--target=$HOSTS \ | ||
--aarch64-linux-android-ndk=/android/ndk/arm64-21 \ | ||
--disable-rpath \ | ||
--enable-extended \ | ||
--enable-cargo-openssl-static | ||
|
||
ENV SCRIPT python2.7 ../x.py dist --target $HOSTS --host $HOSTS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
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-29-sccache-x86_64-unknown-linux-musl && \ | ||
chmod +x /usr/local/bin/sccache | ||
|
||
ENTRYPOINT ["/usr/bin/dumb-init", "--"] | ||
|
||
COPY android-ndk.sh / | ||
RUN . /android-ndk.sh && \ | ||
download_ndk android-ndk-r13b-linux-x86_64.zip && \ | ||
make_standalone_toolchain arm 9 && \ | ||
make_standalone_toolchain arm 21 && \ | ||
remove_ndk | ||
|
||
ENV PATH=$PATH:/android/ndk/arm-9/bin | ||
|
||
ENV DEP_Z_ROOT=/android/ndk/arm-9/sysroot/usr/ | ||
|
||
ENV HOSTS=armv7-linux-androideabi | ||
|
||
ENV RUST_CONFIGURE_ARGS \ | ||
--host=$HOSTS \ | ||
--target=$HOSTS \ | ||
--armv7-linux-androideabi-ndk=/android/ndk/arm \ | ||
--disable-rpath \ | ||
--enable-extended \ | ||
--enable-cargo-openssl-static | ||
|
||
# We support api level 9, but api level 21 is required to build llvm. To | ||
# overcome this problem we use a ndk with api level 21 to build llvm and then | ||
# switch to a ndk with api level 9 to complete the build. When the linker is | ||
# invoked there are missing symbols (like sigsetempty, not available with api | ||
# level 9), the default linker behavior is to generate an error, to allow the | ||
# build to finish we use --warn-unresolved-symbols. Note that the missing | ||
# symbols does not affect std, only the compiler (llvm) and cargo (openssl). | ||
RUN chmod 777 /android/ndk && \ | ||
ln -s /android/ndk/arm-21 /android/ndk/arm | ||
|
||
ENV SCRIPT \ | ||
python2.7 ../x.py build src/llvm --host $HOSTS --target $HOSTS && \ | ||
(export RUSTFLAGS="\"-C link-arg=-Wl,--warn-unresolved-symbols\""; \ | ||
rm /android/ndk/arm && \ | ||
ln -s /android/ndk/arm-9 /android/ndk/arm && \ | ||
python2.7 ../x.py dist --host $HOSTS --target $HOSTS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,65 @@ | ||
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-29-sccache-x86_64-unknown-linux-musl && \ | ||
chmod +x /usr/local/bin/sccache | ||
|
||
ENTRYPOINT ["/usr/bin/dumb-init", "--"] | ||
|
||
COPY android-ndk.sh / | ||
RUN . /android-ndk.sh && \ | ||
download_ndk android-ndk-r13b-linux-x86_64.zip && \ | ||
make_standalone_toolchain x86 9 && \ | ||
make_standalone_toolchain x86 21 && \ | ||
remove_ndk | ||
|
||
ENV PATH=$PATH:/android/ndk/x86-9/bin | ||
|
||
ENV DEP_Z_ROOT=/android/ndk/x86-9/sysroot/usr/ | ||
|
||
ENV HOSTS=i686-linux-android | ||
|
||
ENV RUST_CONFIGURE_ARGS \ | ||
--host=$HOSTS \ | ||
--target=$HOSTS \ | ||
--i686-linux-android-ndk=/android/ndk/x86 \ | ||
--disable-rpath \ | ||
--enable-extended \ | ||
--enable-cargo-openssl-static | ||
|
||
# We support api level 9, but api level 21 is required to build llvm. To | ||
# overcome this problem we use a ndk with api level 21 to build llvm and then | ||
# switch to a ndk with api level 9 to complete the build. When the linker is | ||
# invoked there are missing symbols (like sigsetempty, not available with api | ||
# level 9), the default linker behavior is to generate an error, to allow the | ||
# build to finish we use --warn-unresolved-symbols. Note that the missing | ||
# symbols does not affect std, only the compiler (llvm) and cargo (openssl). | ||
RUN chmod 777 /android/ndk && \ | ||
ln -s /android/ndk/x86-21 /android/ndk/x86 | ||
|
||
ENV SCRIPT \ | ||
python2.7 ../x.py build src/llvm --host $HOSTS --target $HOSTS && \ | ||
(export RUSTFLAGS="\"-C link-arg=-Wl,--warn-unresolved-symbols\""; \ | ||
rm /android/ndk/x86 && \ | ||
ln -s /android/ndk/x86-9 /android/ndk/x86 && \ | ||
python2.7 ../x.py dist --host $HOSTS --target $HOSTS) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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-29-sccache-x86_64-unknown-linux-musl && \ | ||
chmod +x /usr/local/bin/sccache | ||
|
||
ENTRYPOINT ["/usr/bin/dumb-init", "--"] | ||
|
||
COPY android-ndk.sh / | ||
RUN . /android-ndk.sh && \ | ||
download_ndk android-ndk-r13b-linux-x86_64.zip && \ | ||
make_standalone_toolchain x86_64 21 && \ | ||
remove_ndk | ||
|
||
ENV PATH=$PATH:/android/ndk/x86_64-21/bin | ||
|
||
ENV DEP_Z_ROOT=/android/ndk/x86_64-21/sysroot/usr/ | ||
|
||
ENV HOSTS=x86_64-linux-android | ||
|
||
ENV RUST_CONFIGURE_ARGS \ | ||
--host=$HOSTS \ | ||
--target=$HOSTS \ | ||
--x86_64-linux-android-ndk=/android/ndk/x86_64-21 \ | ||
--disable-rpath \ | ||
--enable-extended \ | ||
--enable-cargo-openssl-static | ||
|
||
ENV SCRIPT python2.7 ../x.py dist --target $HOSTS --host $HOSTS |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters