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 arm 14 && \
10 make_standalone_toolchain arm 21 && \
13 RUN chmod 777 /android/ndk && \
14 ln -s /android/ndk/arm-21 /android/ndk/arm
16 ENV PATH=$PATH:/android/ndk/arm-14/bin
18 ENV DEP_Z_ROOT=/android/ndk/arm-14/sysroot/usr/
20 ENV HOSTS=armv7-linux-androideabi
22 ENV RUST_CONFIGURE_ARGS \
23 --armv7-linux-androideabi-ndk=/android/ndk/arm \
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 build src/llvm --host $HOSTS --target $HOSTS && \
37 (export RUSTFLAGS="\"-C link-arg=-Wl,--warn-unresolved-symbols\""; \
38 rm /android/ndk/arm && \
39 ln -s /android/ndk/arm-14 /android/ndk/arm && \
40 python3 ../x.py dist --host $HOSTS --target $HOSTS)
42 COPY scripts/sccache.sh /scripts/
43 RUN sh /scripts/sccache.sh