3 COPY scripts/android-base-apt-get.sh /scripts/
4 RUN sh /scripts/android-base-apt-get.sh
6 COPY scripts/android-ndk.sh /scripts/
7 RUN . /scripts/android-ndk.sh && \
8 download_ndk android-ndk-r15c-linux-x86_64.zip && \
9 make_standalone_toolchain x86 14 && \
10 make_standalone_toolchain x86 21 && \
13 RUN chmod 777 /android/ndk && \
14 ln -s /android/ndk/x86-21 /android/ndk/x86
16 ENV PATH=$PATH:/android/ndk/x86-14/bin
18 ENV DEP_Z_ROOT=/android/ndk/x86-14/sysroot/usr/
20 ENV HOSTS=i686-linux-android
22 ENV RUST_CONFIGURE_ARGS \
23 --i686-linux-android-ndk=/android/ndk/x86 \
26 --enable-cargo-openssl-static
28 # We support api level 14, but api level 21 is required to build llvm. To
29 # overcome this problem we use a ndk with api level 21 to build llvm and then
30 # switch to a ndk with api level 14 to complete the build. When the linker is
31 # invoked there are missing symbols (like sigsetempty, not available with api
32 # level 14), the default linker behavior is to generate an error, to allow the
33 # build to finish we use --warn-unresolved-symbols. Note that the missing
34 # symbols does not affect std, only the compiler (llvm) and cargo (openssl).
36 python3 ../x.py --stage 2 build src/llvm --host $HOSTS --target $HOSTS && \
37 (export RUSTFLAGS="\"-C link-arg=-Wl,--warn-unresolved-symbols\""; \
38 rm /android/ndk/x86 && \
39 ln -s /android/ndk/x86-14 /android/ndk/x86 && \
40 python3 ../x.py dist --host $HOSTS --target $HOSTS)
42 COPY scripts/sccache.sh /scripts/
43 RUN sh /scripts/sccache.sh