Skip to content

Commit 2e509d2

Browse files
committed
Add disabled android host builders
1 parent 222971f commit 2e509d2

File tree

6 files changed

+284
-5
lines changed

6 files changed

+284
-5
lines changed

src/ci/docker/android-ndk.sh

+35
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
#!/bin/sh
2+
# Copyright 2017 The Rust Project Developers. See the COPYRIGHT
3+
# file at the top-level directory of this distribution and at
4+
# http://rust-lang.org/COPYRIGHT.
5+
#
6+
# Licensed under the Apache License, Version 2.0 <LICENSE-APACHE or
7+
# http://www.apache.org/licenses/LICENSE-2.0> or the MIT license
8+
# <LICENSE-MIT or http://opensource.org/licenses/MIT>, at your
9+
# option. This file may not be copied, modified, or distributed
10+
# except according to those terms.
11+
12+
set -ex
13+
14+
URL=https://dl.google.com/android/repository
15+
16+
download_ndk() {
17+
mkdir -p /android/ndk
18+
cd /android/ndk
19+
curl -O $URL/$1
20+
unzip -q $1
21+
rm $1
22+
mv android-ndk-* ndk
23+
}
24+
25+
make_standalone_toolchain() {
26+
# See https://developer.android.com/ndk/guides/standalone_toolchain.htm
27+
python2.7 /android/ndk/ndk/build/tools/make_standalone_toolchain.py \
28+
--install-dir /android/ndk/$1-$2 \
29+
--arch $1 \
30+
--api $2
31+
}
32+
33+
remove_ndk() {
34+
rm -rf /android/ndk/ndk
35+
}
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update && \
4+
apt-get install -y --no-install-recommends \
5+
g++ \
6+
make \
7+
file \
8+
curl \
9+
ca-certificates \
10+
python2.7 \
11+
git \
12+
cmake \
13+
unzip \
14+
sudo \
15+
xz-utils \
16+
libssl-dev \
17+
pkg-config
18+
19+
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
20+
dpkg -i dumb-init_*.deb && \
21+
rm dumb-init_*.deb
22+
23+
RUN curl -o /usr/local/bin/sccache \
24+
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-29-sccache-x86_64-unknown-linux-musl && \
25+
chmod +x /usr/local/bin/sccache
26+
27+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
28+
29+
COPY android-ndk.sh /
30+
RUN . /android-ndk.sh && \
31+
download_ndk android-ndk-r13b-linux-x86_64.zip && \
32+
make_standalone_toolchain arm64 21 && \
33+
remove_ndk
34+
35+
ENV PATH=$PATH:/android/ndk/arm64-21/bin
36+
37+
ENV DEP_Z_ROOT=/android/ndk/arm64-21/sysroot/usr/
38+
39+
ENV HOSTS=aarch64-linux-android
40+
41+
ENV RUST_CONFIGURE_ARGS \
42+
--host=$HOSTS \
43+
--target=$HOSTS \
44+
--aarch64-linux-android-ndk=/android/ndk/arm64-21 \
45+
--disable-rpath \
46+
--enable-extended \
47+
--enable-cargo-openssl-static
48+
49+
ENV SCRIPT python2.7 ../x.py dist --target $HOSTS --host $HOSTS
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update && \
4+
apt-get install -y --no-install-recommends \
5+
g++ \
6+
make \
7+
file \
8+
curl \
9+
ca-certificates \
10+
python2.7 \
11+
git \
12+
cmake \
13+
unzip \
14+
sudo \
15+
xz-utils \
16+
libssl-dev \
17+
pkg-config
18+
19+
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
20+
dpkg -i dumb-init_*.deb && \
21+
rm dumb-init_*.deb
22+
23+
RUN curl -o /usr/local/bin/sccache \
24+
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-29-sccache-x86_64-unknown-linux-musl && \
25+
chmod +x /usr/local/bin/sccache
26+
27+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
28+
29+
COPY android-ndk.sh /
30+
RUN . /android-ndk.sh && \
31+
download_ndk android-ndk-r13b-linux-x86_64.zip && \
32+
make_standalone_toolchain arm 9 && \
33+
make_standalone_toolchain arm 21 && \
34+
remove_ndk
35+
36+
ENV PATH=$PATH:/android/ndk/arm-9/bin
37+
38+
ENV DEP_Z_ROOT=/android/ndk/arm-9/sysroot/usr/
39+
40+
ENV HOSTS=armv7-linux-androideabi
41+
42+
ENV RUST_CONFIGURE_ARGS \
43+
--host=$HOSTS \
44+
--target=$HOSTS \
45+
--armv7-linux-androideabi-ndk=/android/ndk/arm \
46+
--disable-rpath \
47+
--enable-extended \
48+
--enable-cargo-openssl-static
49+
50+
# We support api level 9, but api level 21 is required to build llvm. To
51+
# overcome this problem we use a ndk with api level 21 to build llvm and then
52+
# switch to a ndk with api level 9 to complete the build. When the linker is
53+
# invoked there are missing symbols (like sigsetempty, not available with api
54+
# level 9), the default linker behavior is to generate an error, to allow the
55+
# build to finish we use --warn-unresolved-symbols. Note that the missing
56+
# symbols does not affect std, only the compiler (llvm) and cargo (openssl).
57+
RUN chmod 777 /android/ndk && \
58+
ln -s /android/ndk/arm-21 /android/ndk/arm
59+
60+
ENV SCRIPT \
61+
python2.7 ../x.py build src/llvm --host $HOSTS --target $HOSTS && \
62+
(export RUSTFLAGS="\"-C link-arg=-Wl,--warn-unresolved-symbols\""; \
63+
rm /android/ndk/arm && \
64+
ln -s /android/ndk/arm-9 /android/ndk/arm && \
65+
python2.7 ../x.py dist --host $HOSTS --target $HOSTS)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,65 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update && \
4+
apt-get install -y --no-install-recommends \
5+
g++ \
6+
make \
7+
file \
8+
curl \
9+
ca-certificates \
10+
python2.7 \
11+
git \
12+
cmake \
13+
unzip \
14+
sudo \
15+
xz-utils \
16+
libssl-dev \
17+
pkg-config
18+
19+
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
20+
dpkg -i dumb-init_*.deb && \
21+
rm dumb-init_*.deb
22+
23+
RUN curl -o /usr/local/bin/sccache \
24+
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-29-sccache-x86_64-unknown-linux-musl && \
25+
chmod +x /usr/local/bin/sccache
26+
27+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
28+
29+
COPY android-ndk.sh /
30+
RUN . /android-ndk.sh && \
31+
download_ndk android-ndk-r13b-linux-x86_64.zip && \
32+
make_standalone_toolchain x86 9 && \
33+
make_standalone_toolchain x86 21 && \
34+
remove_ndk
35+
36+
ENV PATH=$PATH:/android/ndk/x86-9/bin
37+
38+
ENV DEP_Z_ROOT=/android/ndk/x86-9/sysroot/usr/
39+
40+
ENV HOSTS=i686-linux-android
41+
42+
ENV RUST_CONFIGURE_ARGS \
43+
--host=$HOSTS \
44+
--target=$HOSTS \
45+
--i686-linux-android-ndk=/android/ndk/x86 \
46+
--disable-rpath \
47+
--enable-extended \
48+
--enable-cargo-openssl-static
49+
50+
# We support api level 9, but api level 21 is required to build llvm. To
51+
# overcome this problem we use a ndk with api level 21 to build llvm and then
52+
# switch to a ndk with api level 9 to complete the build. When the linker is
53+
# invoked there are missing symbols (like sigsetempty, not available with api
54+
# level 9), the default linker behavior is to generate an error, to allow the
55+
# build to finish we use --warn-unresolved-symbols. Note that the missing
56+
# symbols does not affect std, only the compiler (llvm) and cargo (openssl).
57+
RUN chmod 777 /android/ndk && \
58+
ln -s /android/ndk/x86-21 /android/ndk/x86
59+
60+
ENV SCRIPT \
61+
python2.7 ../x.py build src/llvm --host $HOSTS --target $HOSTS && \
62+
(export RUSTFLAGS="\"-C link-arg=-Wl,--warn-unresolved-symbols\""; \
63+
rm /android/ndk/x86 && \
64+
ln -s /android/ndk/x86-9 /android/ndk/x86 && \
65+
python2.7 ../x.py dist --host $HOSTS --target $HOSTS)
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,49 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update && \
4+
apt-get install -y --no-install-recommends \
5+
g++ \
6+
make \
7+
file \
8+
curl \
9+
ca-certificates \
10+
python2.7 \
11+
git \
12+
cmake \
13+
unzip \
14+
sudo \
15+
xz-utils \
16+
libssl-dev \
17+
pkg-config
18+
19+
RUN curl -OL https://github.com/Yelp/dumb-init/releases/download/v1.2.0/dumb-init_1.2.0_amd64.deb && \
20+
dpkg -i dumb-init_*.deb && \
21+
rm dumb-init_*.deb
22+
23+
RUN curl -o /usr/local/bin/sccache \
24+
https://s3.amazonaws.com/rust-lang-ci/rust-ci-mirror/2017-04-29-sccache-x86_64-unknown-linux-musl && \
25+
chmod +x /usr/local/bin/sccache
26+
27+
ENTRYPOINT ["/usr/bin/dumb-init", "--"]
28+
29+
COPY android-ndk.sh /
30+
RUN . /android-ndk.sh && \
31+
download_ndk android-ndk-r13b-linux-x86_64.zip && \
32+
make_standalone_toolchain x86_64 21 && \
33+
remove_ndk
34+
35+
ENV PATH=$PATH:/android/ndk/x86_64-21/bin
36+
37+
ENV DEP_Z_ROOT=/android/ndk/x86_64-21/sysroot/usr/
38+
39+
ENV HOSTS=x86_64-linux-android
40+
41+
ENV RUST_CONFIGURE_ARGS \
42+
--host=$HOSTS \
43+
--target=$HOSTS \
44+
--x86_64-linux-android-ndk=/android/ndk/x86_64-21 \
45+
--disable-rpath \
46+
--enable-extended \
47+
--enable-cargo-openssl-static
48+
49+
ENV SCRIPT python2.7 ../x.py dist --target $HOSTS --host $HOSTS

src/ci/docker/run.sh

+21-5
Original file line numberDiff line numberDiff line change
@@ -21,11 +21,27 @@ root_dir="`dirname $src_dir`"
2121

2222
source "$ci_dir/shared.sh"
2323

24-
retry docker \
25-
build \
26-
--rm \
27-
-t rust-ci \
28-
"`dirname "$script"`/$image"
24+
if [ -f "$docker_dir/$image/Dockerfile" ]; then
25+
retry docker \
26+
build \
27+
--rm \
28+
-t rust-ci \
29+
"$docker_dir/$image"
30+
elif [ -f "$docker_dir/disabled/$image/Dockerfile" ]; then
31+
if [ -n "$TRAVIS_OS_NAME" ]; then
32+
echo Cannot run disabled images on travis!
33+
exit 1
34+
fi
35+
retry docker \
36+
build \
37+
--rm \
38+
-t rust-ci \
39+
-f "$docker_dir/disabled/$image/Dockerfile" \
40+
"$docker_dir"
41+
else
42+
echo Invalid image: $image
43+
exit 1
44+
fi
2945

3046
objdir=$root_dir/obj
3147

0 commit comments

Comments
 (0)