From e9b6053f5d4a07a887b5ec488d76f4a5300531fa Mon Sep 17 00:00:00 2001 From: Jonas Vautherin Date: Tue, 12 Jan 2021 01:03:33 +0100 Subject: [PATCH] Add android-x86 image --- .circleci/config.yml | 37 +++++++++++++++++++++++++++++ Makefile | 2 +- README.rst | 8 +++++++ android-x86/Dockerfile | 47 +++++++++++++++++++++++++++++++++++++ android-x86/Toolchain.cmake | 20 ++++++++++++++++ 5 files changed, 113 insertions(+), 1 deletion(-) create mode 100644 android-x86/Dockerfile create mode 100644 android-x86/Toolchain.cmake diff --git a/.circleci/config.yml b/.circleci/config.yml index 58b5260..8319d67 100644 --- a/.circleci/config.yml +++ b/.circleci/config.yml @@ -64,6 +64,27 @@ jobs: - save_cache: key: android-arm64-assets-{{ .Revision }} paths: ~/docker/android-arm64.tar + android-x86: + <<: *build-settings + steps: + - restore_cache: + key: base-assets-{{ .Revision }} + - run: + name: android-x86 build + no_output_timeout: 1.5h + command: | + docker load -i ~/docker/base.tar + make android-x86 + tagged=$(docker images -q -f 'since=dockcross/android-x86:latest' --format '{{.Repository}}:{{.Tag}}' | grep android-x86) + docker save -o ~/docker/android-x86.tar dockcross/android-x86:latest $tagged + - run: + name: android-x86 test + command: | + make android-x86.test + - save_cache: + key: android-x86-assets-{{ .Revision }} + paths: ~/docker/android-x86.tar + web-wasm: <<: *build-settings steps: @@ -662,6 +683,18 @@ jobs: tagged=$(docker images -q -f 'since=dockcross/android-arm64:latest' --format '{{.Repository}}:{{.Tag}}' | grep android-arm64) docker push $tagged fi + - restore_cache: + key: android-x86-assets-{{ .Revision }} + - deploy: + name: Deploy android-x86 + command: | + docker load -i ~/docker/android-x86.tar + if [ "${CIRCLE_BRANCH}" == "master" ]; then + docker login -u $DOCKER_USER -p $DOCKER_PASS + docker push dockcross/android-x86:latest + tagged=$(docker images -q -f 'since=dockcross/android-x86:latest' --format '{{.Repository}}:{{.Tag}}' | grep android-x86) + docker push $tagged + fi - restore_cache: key: web-wasm-assets-{{ .Revision }} - deploy: @@ -1001,6 +1034,9 @@ workflows: - android-arm64: requires: - base + - android-x86: + requires: + - base - web-wasm: requires: - base @@ -1090,6 +1126,7 @@ workflows: - base - android-arm - android-arm64 + - android-x86 - web-wasm - linux-arm64 - linux-arm64-musl diff --git a/Makefile b/Makefile index 0213011..39e4dad 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ ORG = dockcross BIN = ./bin # These images are built using the "build implicit rule" -STANDARD_IMAGES = linux-s390x android-arm android-arm64 linux-x86 linux-x64 linux-arm64 linux-arm64-musl linux-armv5 linux-armv5-musl linux-armv6 linux-armv6-musl linux-armv7 linux-armv7a linux-armv7l-musl linux-mips linux-mipsel linux-ppc64le windows-static-x86 windows-static-x64 windows-static-x64-posix windows-shared-x86 windows-shared-x64 windows-shared-x64-posix +STANDARD_IMAGES = linux-s390x android-arm android-arm64 android-x86 linux-x86 linux-x64 linux-arm64 linux-arm64-musl linux-armv5 linux-armv5-musl linux-armv6 linux-armv6-musl linux-armv7 linux-armv7a linux-armv7l-musl linux-mips linux-mipsel linux-ppc64le windows-static-x86 windows-static-x64 windows-static-x64-posix windows-shared-x86 windows-shared-x64 windows-shared-x64-posix # Generated Dockerfiles. GEN_IMAGES = linux-s390x linux-mips manylinux1-x64 manylinux1-x86 manylinux2010-x64 manylinux2010-x86 manylinux2014-x64 manylinux2014-x86 manylinux2014-aarch64 web-wasm linux-arm64 linux-arm64-musl windows-static-x86 windows-static-x64 windows-static-x64-posix windows-shared-x86 windows-shared-x64 windows-shared-x64-posix linux-armv7 linux-armv7a linux-armv7l-musl linux-armv6-musl linux-armv5 linux-armv5-musl linux-ppc64le diff --git a/README.rst b/README.rst index cb2143c..92b37f4 100644 --- a/README.rst +++ b/README.rst @@ -104,6 +104,14 @@ dockcross/android-arm64 architecture. +.. |android-x86-images| image:: https://images.microbadger.com/badges/image/dockcross/android-x86.svg + :target: https://microbadger.com/images/dockcross/android-x86 + +dockcross/android-x86 + |android-x86-images| The Android NDK standalone toolchain for the x86 + architecture. + + .. |linux-arm64-images| image:: https://images.microbadger.com/badges/image/dockcross/linux-arm64.svg :target: https://microbadger.com/images/dockcross/linux-arm64 diff --git a/android-x86/Dockerfile b/android-x86/Dockerfile new file mode 100644 index 0000000..febd235 --- /dev/null +++ b/android-x86/Dockerfile @@ -0,0 +1,47 @@ +FROM dockcross/base:latest + +RUN apt-get update && apt-get install -y unzip + +ENV CROSS_TRIPLE=i686-linux-android +ENV CROSS_ROOT=/usr/${CROSS_TRIPLE} +ENV AS=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-as \ + AR=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-ar \ + CC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-clang \ + CPP=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-cpp \ + CXX=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-clang++ \ + LD=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-ld \ + FC=${CROSS_ROOT}/bin/${CROSS_TRIPLE}-gfortran + +ENV ANDROID_NDK_REVISION 21d +ENV ANDROID_NDK_API 19 +RUN mkdir -p /build && \ + cd /build && \ + curl -O https://dl.google.com/android/repository/android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip && \ + unzip ./android-ndk-r${ANDROID_NDK_REVISION}-linux-x86_64.zip && \ + cd android-ndk-r${ANDROID_NDK_REVISION} && \ + ./build/tools/make_standalone_toolchain.py \ + --arch x86 \ + --api ${ANDROID_NDK_API} \ + --stl=libc++ \ + --install-dir=${CROSS_ROOT} && \ + cd / && \ + rm -rf /build && \ + find ${CROSS_ROOT} -exec chmod a+r '{}' \; && \ + find ${CROSS_ROOT} -executable -exec chmod a+x '{}' \; + +COPY Toolchain.cmake ${CROSS_ROOT}/ +ENV CMAKE_TOOLCHAIN_FILE ${CROSS_ROOT}/Toolchain.cmake + +# Build-time metadata as defined at http://label-schema.org +ARG BUILD_DATE +ARG IMAGE=dockcross/android-x86 +ARG VERSION=latest +ARG VCS_REF +ARG VCS_URL +LABEL org.label-schema.build-date=$BUILD_DATE \ + org.label-schema.name=$IMAGE \ + org.label-schema.version=$VERSION \ + org.label-schema.vcs-ref=$VCS_REF \ + org.label-schema.vcs-url=$VCS_URL \ + org.label-schema.schema-version="1.0" +ENV DEFAULT_DOCKCROSS_IMAGE ${IMAGE}:${VERSION} diff --git a/android-x86/Toolchain.cmake b/android-x86/Toolchain.cmake new file mode 100644 index 0000000..fd84988 --- /dev/null +++ b/android-x86/Toolchain.cmake @@ -0,0 +1,20 @@ +set(CMAKE_SYSTEM_NAME Android) +set(CMAKE_SYSTEM_VERSION 1) +set(CMAKE_ANDROID_ARCH_ABI x86) + +set(cross_triple i686-linux-android) +set(CMAKE_ANDROID_STANDALONE_TOOLCHAIN $ENV{CROSS_ROOT}) +set(CMAKE_ANDROID_ARM_MODE ON) +set(CMAKE_ANDROID_ARM_NEON ON) + +set(CMAKE_C_COMPILER $ENV{CC}) +set(CMAKE_CXX_COMPILER $ENV{CXX}) +set(CMAKE_Fortran_COMPILER $ENV{FC}) +set(CMAKE_EXE_LINKER_FLAGS "-llog") +set(CMAKE_SHARED_LINKER_FLAGS "-llog") + +set(CMAKE_FIND_ROOT_PATH $ENV{CROSS_ROOT}) +set(CMAKE_FIND_ROOT_PATH_MODE_PROGRAM NEVER) +set(CMAKE_FIND_ROOT_PATH_MODE_LIBRARY BOTH) +set(CMAKE_FIND_ROOT_PATH_MODE_INCLUDE BOTH) +set(CMAKE_SYSROOT $ENV{CROSS_ROOT}/sysroot)