Skip to content

Commit a319155

Browse files
committed
Auto merge of #3885 - malbarbo:android-build, r=alexcrichton
Add android build support This add android build support, including openssl.
2 parents ec8e824 + f723268 commit a319155

File tree

4 files changed

+50
-0
lines changed

4 files changed

+50
-0
lines changed

.travis.yml

+2
Original file line numberDiff line numberDiff line change
@@ -43,6 +43,8 @@ matrix:
4343
MAKE_TARGETS=test-unit-$TARGET
4444

4545
# cross compiled targets
46+
- env: TARGET=armv7-linux-androideabi
47+
IMAGE=android
4648
- env: TARGET=arm-unknown-linux-gnueabi
4749
IMAGE=cross
4850
- env: TARGET=arm-unknown-linux-gnueabihf

Makefile.in

+15
Original file line numberDiff line numberDiff line change
@@ -195,11 +195,15 @@ $(DOC_DIR)/%: $(S)src/doc/%
195195
@mkdir -p $(@D)
196196
cp $< $@
197197

198+
OPENSSL_OS_aarch64-linux-android := linux-aarch64
198199
OPENSSL_OS_aarch64-unknown-linux-gnu := linux-aarch64
200+
OPENSSL_OS_arm-linux-androideabi := android
199201
OPENSSL_OS_arm-unknown-linux-gnueabi := linux-armv4
200202
OPENSSL_OS_arm-unknown-linux-gnueabihf := linux-armv4
203+
OPENSSL_OS_armv7-linux-androideabi := android-armv7
201204
OPENSSL_OS_armv7-unknown-linux-gnueabihf := linux-armv4
202205
OPENSSL_OS_i686-apple-darwin := darwin-i386-cc
206+
OPENSSL_OS_i686-linux-android := android-x86
203207
OPENSSL_OS_i686-unknown-freebsd := BSD-x86-elf
204208
OPENSSL_OS_i686-unknown-linux-gnu := linux-elf
205209
OPENSSL_OS_i686-unknown-linux-musl := linux-elf
@@ -217,11 +221,15 @@ OPENSSL_OS_x86_64-unknown-linux-gnu := linux-x86_64
217221
OPENSSL_OS_x86_64-unknown-linux-musl := linux-x86_64
218222
OPENSSL_OS_x86_64-unknown-netbsd := BSD-x86_64
219223

224+
OPENSSL_AR_aarch64-linux-android := aarch64-linux-android-ar
220225
OPENSSL_AR_aarch64-unknown-linux-gnu := aarch64-linux-gnu-ar
226+
OPENSSL_AR_arm-linux-androideabi := arm-linux-androideabi-ar
221227
OPENSSL_AR_arm-unknown-linux-gnueabi := arm-linux-gnueabi-ar
222228
OPENSSL_AR_arm-unknown-linux-gnueabihf := arm-linux-gnueabihf-ar
229+
OPENSSL_AR_armv7-linux-androideabi := arm-linux-androideabi-ar
223230
OPENSSL_AR_armv7-unknown-linux-gnueabihf := armv7-linux-gnueabihf-ar
224231
OPENSSL_AR_i686-apple-darwin := ar
232+
OPENSSL_AR_i686-linux-android := i686-linux-android-ar
225233
OPENSSL_AR_i686-unknown-freebsd := i686-unknown-freebsd10-ar
226234
OPENSSL_AR_i686-unknown-linux-gnu := ar
227235
OPENSSL_AR_i686-unknown-linux-musl := ar
@@ -238,11 +246,16 @@ OPENSSL_AR_x86_64-unknown-freebsd := x86_64-unknown-freebsd10-ar
238246
OPENSSL_AR_x86_64-unknown-linux-gnu := ar
239247
OPENSSL_AR_x86_64-unknown-linux-musl := ar
240248
OPENSSL_AR_x86_64-unknown-netbsd := x86_64-unknown-netbsd-ar
249+
250+
OPENSSL_CC_aarch64-linux-android := aarch64-linux-android-gcc
241251
OPENSSL_CC_aarch64-unknown-linux-gnu := aarch64-linux-gnu-gcc
252+
OPENSSL_CC_arm-linux-androideabi := arm-linux-androideabi-gcc
242253
OPENSSL_CC_arm-unknown-linux-gnueabi := arm-linux-gnueabi-gcc
243254
OPENSSL_CC_arm-unknown-linux-gnueabihf := arm-linux-gnueabihf-gcc
244255
OPENSSL_CC_armv7-unknown-linux-gnueabihf := armv7-linux-gnueabihf-gcc
256+
OPENSSL_CC_armv7-linux-androideabi := arm-linux-androideabi-gcc
245257
OPENSSL_CC_i686-apple-darwin := clang
258+
OPENSSL_CC_i686-linux-android := i686-linux-android-gcc
246259
OPENSSL_CC_i686-unknown-freebsd := i686-unknown-freebsd10-gcc
247260
OPENSSL_CC_i686-unknown-linux-gnu := gcc
248261
OPENSSL_CC_i686-unknown-linux-musl := musl-gcc
@@ -261,6 +274,8 @@ OPENSSL_CC_x86_64-unknown-linux-musl := musl-gcc
261274
OPENSSL_CC_x86_64-unknown-netbsd := x86_64-unknown-netbsd-gcc
262275

263276
SETARCH_i686-unknown-linux-gnu := setarch i386
277+
278+
OPENSSL_CFLAGS_aarch64-linux-android := "-mandroid -fomit-frame-pointer"
264279
OPENSSL_CFLAGS_i686-apple-darwin := -m32
265280
OPENSSL_CFLAGS_i686-unknown-linux-gnu := -m32
266281
OPENSSL_CFLAGS_i686-unknown-linux-musl := -m32

src/ci/docker/android/Dockerfile

+27
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,27 @@
1+
FROM ubuntu:16.04
2+
3+
RUN apt-get update && \
4+
apt-get install -y --no-install-recommends \
5+
ca-certificates \
6+
cmake \
7+
curl \
8+
gcc \
9+
git \
10+
libc6-dev \
11+
make \
12+
pkg-config
13+
14+
WORKDIR /android
15+
RUN apt-get install -y --no-install-recommends \
16+
unzip \
17+
python && \
18+
curl -O https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip && \
19+
unzip -q android-ndk-r13b-linux-x86_64.zip && \
20+
./android-ndk-r13b/build/tools/make_standalone_toolchain.py \
21+
--install-dir /android-ndk/arm --arch arm --api 21 && \
22+
rm -rf ./android-ndk-r13b-linux-x86_64.zip ./android-ndk-r13b && \
23+
apt-get purge --auto-remove -y unzip python
24+
25+
ENV PATH=$PATH:/android-ndk/arm/bin
26+
27+
ENV CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc

src/ci/run.sh

+6
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,12 @@ if [ -n "$CI" ] && [ "$BRANCH" != "auto-cargo" ] && [ "$ALLOW_PR" = "" ]; then
4747
exit 0
4848
fi
4949

50+
# For some unknown reason libz is not found in the android docker image, so we
51+
# use this workaround
52+
if [ "$TARGET" = armv7-linux-androideabi ]; then
53+
export DEP_Z_ROOT=/android-ndk/arm/sysroot/usr
54+
fi
55+
5056
$SRC/configure \
5157
--prefix=/tmp/obj/install \
5258
--target=$TARGET \

0 commit comments

Comments
 (0)