From 62e47fefdcf06b1e5c78cc81265dd0503966cb26 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Thu, 30 Mar 2017 20:06:54 -0300 Subject: [PATCH 1/4] Add openssl build support for android --- Makefile.in | 15 +++++++++++++++ src/ci/run.sh | 16 ++++++++++++++++ 2 files changed, 31 insertions(+) diff --git a/Makefile.in b/Makefile.in index 99ab8f1bd80..b1c85ebe5e4 100644 --- a/Makefile.in +++ b/Makefile.in @@ -195,11 +195,15 @@ $(DOC_DIR)/%: $(S)src/doc/% @mkdir -p $(@D) cp $< $@ +OPENSSL_OS_aarch64-linux-android := linux-generic64 OPENSSL_OS_aarch64-unknown-linux-gnu := linux-aarch64 +OPENSSL_OS_arm-linux-androideabi := android OPENSSL_OS_arm-unknown-linux-gnueabi := linux-armv4 OPENSSL_OS_arm-unknown-linux-gnueabihf := linux-armv4 +OPENSSL_OS_armv7-linux-androideabi := android-armv7 OPENSSL_OS_armv7-unknown-linux-gnueabihf := linux-armv4 OPENSSL_OS_i686-apple-darwin := darwin-i386-cc +OPENSSL_OS_i686-linux-android := android-x86 OPENSSL_OS_i686-unknown-freebsd := BSD-x86-elf OPENSSL_OS_i686-unknown-linux-gnu := linux-elf OPENSSL_OS_i686-unknown-linux-musl := linux-elf @@ -217,11 +221,15 @@ OPENSSL_OS_x86_64-unknown-linux-gnu := linux-x86_64 OPENSSL_OS_x86_64-unknown-linux-musl := linux-x86_64 OPENSSL_OS_x86_64-unknown-netbsd := BSD-x86_64 +OPENSSL_AR_aarch64-linux-android := aarch64-linux-android-ar OPENSSL_AR_aarch64-unknown-linux-gnu := aarch64-linux-gnu-ar +OPENSSL_AR_arm-linux-androideabi := arm-linux-androideabi-ar OPENSSL_AR_arm-unknown-linux-gnueabi := arm-linux-gnueabi-ar OPENSSL_AR_arm-unknown-linux-gnueabihf := arm-linux-gnueabihf-ar +OPENSSL_AR_armv7-linux-androideabi := arm-linux-androideabi-ar OPENSSL_AR_armv7-unknown-linux-gnueabihf := armv7-linux-gnueabihf-ar OPENSSL_AR_i686-apple-darwin := ar +OPENSSL_AR_i686-linux-android := i686-linux-android-ar OPENSSL_AR_i686-unknown-freebsd := i686-unknown-freebsd10-ar OPENSSL_AR_i686-unknown-linux-gnu := ar OPENSSL_AR_i686-unknown-linux-musl := ar @@ -238,11 +246,16 @@ OPENSSL_AR_x86_64-unknown-freebsd := x86_64-unknown-freebsd10-ar OPENSSL_AR_x86_64-unknown-linux-gnu := ar OPENSSL_AR_x86_64-unknown-linux-musl := ar OPENSSL_AR_x86_64-unknown-netbsd := x86_64-unknown-netbsd-ar + +OPENSSL_CC_aarch64-linux-android := aarch64-linux-android-gcc OPENSSL_CC_aarch64-unknown-linux-gnu := aarch64-linux-gnu-gcc +OPENSSL_CC_arm-linux-androideabi := arm-linux-androideabi-gcc OPENSSL_CC_arm-unknown-linux-gnueabi := arm-linux-gnueabi-gcc OPENSSL_CC_arm-unknown-linux-gnueabihf := arm-linux-gnueabihf-gcc OPENSSL_CC_armv7-unknown-linux-gnueabihf := armv7-linux-gnueabihf-gcc +OPENSSL_CC_armv7-linux-androideabi := arm-linux-androideabi-gcc OPENSSL_CC_i686-apple-darwin := clang +OPENSSL_CC_i686-linux-android := i686-linux-android-gcc OPENSSL_CC_i686-unknown-freebsd := i686-unknown-freebsd10-gcc OPENSSL_CC_i686-unknown-linux-gnu := gcc OPENSSL_CC_i686-unknown-linux-musl := musl-gcc @@ -261,6 +274,8 @@ OPENSSL_CC_x86_64-unknown-linux-musl := musl-gcc OPENSSL_CC_x86_64-unknown-netbsd := x86_64-unknown-netbsd-gcc SETARCH_i686-unknown-linux-gnu := setarch i386 + +OPENSSL_CFLAGS_aarch64-linux-android := "-mandroid -fomit-frame-pointer" OPENSSL_CFLAGS_i686-apple-darwin := -m32 OPENSSL_CFLAGS_i686-unknown-linux-gnu := -m32 OPENSSL_CFLAGS_i686-unknown-linux-musl := -m32 diff --git a/src/ci/run.sh b/src/ci/run.sh index 1f20a7652d9..4ffc410be14 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -47,6 +47,22 @@ if [ -n "$CI" ] && [ "$BRANCH" != "auto-cargo" ] && [ "$ALLOW_PR" = "" ]; then exit 0 fi +# For some unknown reason libz is not found in the android docker image, so we +# use this workaround +case $TARGET in + arm-linux-androideabi | armv7-linux-androideabi ) + export DEP_Z_ROOT=/android-ndk/arm/sysroot/usr + ;; + + aarch64-linux-android ) + export DEP_Z_ROOT=/android-ndk/arm64/sysroot/usr/ + ;; + + i686-linux-android ) + export DEP_Z_ROOT=/android-ndk/x86/sysroot/usr/ + ;; +esac + $SRC/configure \ --prefix=/tmp/obj/install \ --target=$TARGET \ From 215051822706a24f6c004df0c6644efcfe5a28a6 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Thu, 30 Mar 2017 20:08:54 -0300 Subject: [PATCH 2/4] Add android Dockerfile --- src/ci/docker/android/Dockerfile | 36 ++++++++++++++++++++++++++++++++ 1 file changed, 36 insertions(+) create mode 100644 src/ci/docker/android/Dockerfile diff --git a/src/ci/docker/android/Dockerfile b/src/ci/docker/android/Dockerfile new file mode 100644 index 00000000000..a53a8ed2d77 --- /dev/null +++ b/src/ci/docker/android/Dockerfile @@ -0,0 +1,36 @@ +FROM ubuntu:16.04 + +RUN apt-get update && \ + apt-get install -y --no-install-recommends \ + ca-certificates \ + cmake \ + curl \ + gcc \ + git \ + libc6-dev \ + make \ + pkg-config + +WORKDIR /android +RUN apt-get install -y --no-install-recommends \ + unzip \ + python && \ + curl -O https://dl.google.com/android/repository/android-ndk-r13b-linux-x86_64.zip && \ + unzip -q android-ndk-r13b-linux-x86_64.zip && \ + ./android-ndk-r13b/build/tools/make_standalone_toolchain.py \ + --install-dir /android-ndk/arm --arch arm --api 21 && \ + ./android-ndk-r13b/build/tools/make_standalone_toolchain.py \ + --install-dir /android-ndk/arm64 --arch arm64 --api 21 && \ + ./android-ndk-r13b/build/tools/make_standalone_toolchain.py \ + --install-dir /android-ndk/x86 --arch x86 --api 21 && \ + rm -rf ./android-ndk-r13b-linux-x86_64.zip ./android-ndk-r13b && \ + apt-get purge --auto-remove -y unzip python + +ENV PATH=$PATH:/android-ndk/arm/bin +ENV PATH=$PATH:/android-ndk/arm64/bin +ENV PATH=$PATH:/android-ndk/x86/bin + +ENV CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android-gcc \ + CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \ + CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \ + CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc From 1f7ebd1e6035f05de41308ca54dcd1e752c10257 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Thu, 30 Mar 2017 20:15:48 -0300 Subject: [PATCH 3/4] Add android build to travis --- .travis.yml | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/.travis.yml b/.travis.yml index 19480c7d010..3752d905564 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,6 +42,18 @@ matrix: CFG_DISABLE_CROSS_TESTS=1 MAKE_TARGETS=test-unit-$TARGET + # android targets + - env: TARGET=i686-linux-android + IMAGE=android + - env: TARGET=arm-linux-androideabi + IMAGE=android + - env: TARGET=armv7-linux-androideabi + IMAGE=android + # Use nightly because of https://github.com/rust-lang/rust/issues/40903 + - env: TARGET=i686-linux-android + IMAGE=android + rust: nightly + # cross compiled targets - env: TARGET=arm-unknown-linux-gnueabi IMAGE=cross From f723268c898cda9b07902d62861f08885e29fa94 Mon Sep 17 00:00:00 2001 From: Marco A L Barbosa Date: Tue, 11 Apr 2017 17:26:22 -0300 Subject: [PATCH 4/4] Remove android build for aarch64, arm and i686 --- .travis.yml | 12 +----------- Makefile.in | 2 +- src/ci/docker/android/Dockerfile | 11 +---------- src/ci/run.sh | 14 ++------------ 4 files changed, 5 insertions(+), 34 deletions(-) diff --git a/.travis.yml b/.travis.yml index 3752d905564..8d5f2bf83e7 100644 --- a/.travis.yml +++ b/.travis.yml @@ -42,19 +42,9 @@ matrix: CFG_DISABLE_CROSS_TESTS=1 MAKE_TARGETS=test-unit-$TARGET - # android targets - - env: TARGET=i686-linux-android - IMAGE=android - - env: TARGET=arm-linux-androideabi - IMAGE=android + # cross compiled targets - env: TARGET=armv7-linux-androideabi IMAGE=android - # Use nightly because of https://github.com/rust-lang/rust/issues/40903 - - env: TARGET=i686-linux-android - IMAGE=android - rust: nightly - - # cross compiled targets - env: TARGET=arm-unknown-linux-gnueabi IMAGE=cross - env: TARGET=arm-unknown-linux-gnueabihf diff --git a/Makefile.in b/Makefile.in index b1c85ebe5e4..f32d211fcbd 100644 --- a/Makefile.in +++ b/Makefile.in @@ -195,7 +195,7 @@ $(DOC_DIR)/%: $(S)src/doc/% @mkdir -p $(@D) cp $< $@ -OPENSSL_OS_aarch64-linux-android := linux-generic64 +OPENSSL_OS_aarch64-linux-android := linux-aarch64 OPENSSL_OS_aarch64-unknown-linux-gnu := linux-aarch64 OPENSSL_OS_arm-linux-androideabi := android OPENSSL_OS_arm-unknown-linux-gnueabi := linux-armv4 diff --git a/src/ci/docker/android/Dockerfile b/src/ci/docker/android/Dockerfile index a53a8ed2d77..3125ae7b616 100644 --- a/src/ci/docker/android/Dockerfile +++ b/src/ci/docker/android/Dockerfile @@ -19,18 +19,9 @@ RUN apt-get install -y --no-install-recommends \ unzip -q android-ndk-r13b-linux-x86_64.zip && \ ./android-ndk-r13b/build/tools/make_standalone_toolchain.py \ --install-dir /android-ndk/arm --arch arm --api 21 && \ - ./android-ndk-r13b/build/tools/make_standalone_toolchain.py \ - --install-dir /android-ndk/arm64 --arch arm64 --api 21 && \ - ./android-ndk-r13b/build/tools/make_standalone_toolchain.py \ - --install-dir /android-ndk/x86 --arch x86 --api 21 && \ rm -rf ./android-ndk-r13b-linux-x86_64.zip ./android-ndk-r13b && \ apt-get purge --auto-remove -y unzip python ENV PATH=$PATH:/android-ndk/arm/bin -ENV PATH=$PATH:/android-ndk/arm64/bin -ENV PATH=$PATH:/android-ndk/x86/bin -ENV CARGO_TARGET_AARCH64_LINUX_ANDROID_LINKER=aarch64-linux-android-gcc \ - CARGO_TARGET_ARM_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \ - CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc \ - CARGO_TARGET_I686_LINUX_ANDROID_LINKER=i686-linux-android-gcc +ENV CARGO_TARGET_ARMV7_LINUX_ANDROIDEABI_LINKER=arm-linux-androideabi-gcc diff --git a/src/ci/run.sh b/src/ci/run.sh index 4ffc410be14..a42d38f689d 100755 --- a/src/ci/run.sh +++ b/src/ci/run.sh @@ -49,19 +49,9 @@ fi # For some unknown reason libz is not found in the android docker image, so we # use this workaround -case $TARGET in - arm-linux-androideabi | armv7-linux-androideabi ) +if [ "$TARGET" = armv7-linux-androideabi ]; then export DEP_Z_ROOT=/android-ndk/arm/sysroot/usr - ;; - - aarch64-linux-android ) - export DEP_Z_ROOT=/android-ndk/arm64/sysroot/usr/ - ;; - - i686-linux-android ) - export DEP_Z_ROOT=/android-ndk/x86/sysroot/usr/ - ;; -esac +fi $SRC/configure \ --prefix=/tmp/obj/install \