From f9af3ced1c69d65c5c530ec5526f5eefaf786126 Mon Sep 17 00:00:00 2001 From: Block Mechanic Date: Fri, 18 Oct 2019 22:03:51 +0200 Subject: [PATCH] Android: add all arch support Add support for armv7a, i686 and x86_64 archs to android.mk Add -fPIC to depends file as anddroid requires it see https://stackoverflow.com/questions/30498776/position-independent-executables-and-android --- depends/hosts/android.mk | 7 +++++++ depends/packages/boost.mk | 5 +++++ depends/packages/libevent.mk | 1 + depends/packages/openssl.mk | 6 +++++- depends/packages/qrencode.mk | 1 + depends/packages/qt.mk | 32 +++++++++++++++++++------------- depends/packages/zeromq.mk | 1 + depends/packages/zlib.mk | 2 +- 8 files changed, 40 insertions(+), 15 deletions(-) diff --git a/depends/hosts/android.mk b/depends/hosts/android.mk index c2a30d7a4d..969ec2a1cb 100644 --- a/depends/hosts/android.mk +++ b/depends/hosts/android.mk @@ -1,4 +1,11 @@ +ifeq ($(HOST),armv7a-linux-android) +android_AR=$(ANDROID_TOOLCHAIN_BIN)/arm-linux-androideabi-ar +android_CXX=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)eabi$(ANDROID_API_LEVEL)-clang++ +android_CC=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)eabi$(ANDROID_API_LEVEL)-clang +android_RANLIB=$(ANDROID_TOOLCHAIN_BIN)/arm-linux-androideabi-ranlib +else android_AR=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)-ar android_CXX=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)$(ANDROID_API_LEVEL)-clang++ android_CC=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)$(ANDROID_API_LEVEL)-clang android_RANLIB=$(ANDROID_TOOLCHAIN_BIN)/$(HOST)-ranlib +endif diff --git a/depends/packages/boost.mk b/depends/packages/boost.mk index 5df49b2af8..5dfa1d2cdf 100644 --- a/depends/packages/boost.mk +++ b/depends/packages/boost.mk @@ -15,6 +15,10 @@ $(package)_config_opts_mingw32=binary-format=pe target-os=windows threadapi=win3 $(package)_config_opts_x86_64_mingw32=address-model=64 $(package)_config_opts_i686_mingw32=address-model=32 $(package)_config_opts_i686_linux=address-model=32 architecture=x86 +$(package)_config_opts_i686_android=address-model=32 +$(package)_config_opts_aarch64_android=address-model=64 +$(package)_config_opts_x86_64_android=address-model=64 +$(package)_config_opts_armv7a_android=address-model=32 $(package)_toolset_$(host_os)=gcc $(package)_archiver_$(host_os)=$($(package)_ar) $(package)_toolset_darwin=darwin @@ -22,6 +26,7 @@ $(package)_archiver_darwin=$($(package)_libtool) $(package)_config_libraries=chrono,filesystem,system,thread,test $(package)_cxxflags=-std=c++11 -fvisibility=hidden $(package)_cxxflags_linux=-fPIC +$(package)_cxxflags_android=-fPIC endef define $(package)_preprocess_cmds diff --git a/depends/packages/libevent.mk b/depends/packages/libevent.mk index df6029828d..bf5de61029 100644 --- a/depends/packages/libevent.mk +++ b/depends/packages/libevent.mk @@ -19,6 +19,7 @@ define $(package)_set_vars $(package)_config_opts=--disable-shared --disable-openssl --disable-libevent-regress --disable-samples $(package)_config_opts_release=--disable-debug-mode $(package)_config_opts_linux=--with-pic + $(package)_config_opts_android=--with-pic endef define $(package)_config_cmds diff --git a/depends/packages/openssl.mk b/depends/packages/openssl.mk index 6a316a308e..ad922778ac 100644 --- a/depends/packages/openssl.mk +++ b/depends/packages/openssl.mk @@ -57,7 +57,11 @@ $(package)_config_opts_riscv64_linux=linux-generic64 $(package)_config_opts_x86_64_darwin=darwin64-x86_64-cc $(package)_config_opts_x86_64_mingw32=mingw64 $(package)_config_opts_i686_mingw32=mingw -$(package)_config_opts_android=linux-generic64 +$(package)_config_opts_android=-fPIC +$(package)_config_opts_aarch64_android=linux-generic64 +$(package)_config_opts_x86_64_android=linux-generic64 +$(package)_config_opts_armv7a_android=linux-generic32 +$(package)_config_opts_i686_android=linux-generic32 endef define $(package)_preprocess_cmds diff --git a/depends/packages/qrencode.mk b/depends/packages/qrencode.mk index 3bc2cb768c..eed2bcd980 100644 --- a/depends/packages/qrencode.mk +++ b/depends/packages/qrencode.mk @@ -8,6 +8,7 @@ define $(package)_set_vars $(package)_config_opts=--disable-shared --without-tools --without-tests --disable-sdltest $(package)_config_opts += --disable-gprof --disable-gcov --disable-mudflap $(package)_config_opts_linux=--with-pic +$(package)_config_opts_android=--with-pic endef define $(package)_preprocess_cmds diff --git a/depends/packages/qt.mk b/depends/packages/qt.mk index 2f10a587c4..d4c4ab0ae8 100644 --- a/depends/packages/qt.mk +++ b/depends/packages/qt.mk @@ -127,20 +127,26 @@ $(package)_config_opts_x86_64_linux = -xplatform linux-g++-64 $(package)_config_opts_aarch64_linux = -xplatform linux-aarch64-gnu-g++ $(package)_config_opts_riscv64_linux = -platform linux-g++ -xplatform bitcoin-linux-g++ $(package)_config_opts_mingw32 = -no-opengl -xplatform win32-g++ -device-option CROSS_COMPILE="$(host)-" -$(package)_config_opts_aarch64_android = -xplatform android-clang -$(package)_config_opts_aarch64_android += -android-sdk $(ANDROID_SDK) -$(package)_config_opts_aarch64_android += -android-ndk $(ANDROID_NDK) -$(package)_config_opts_aarch64_android += -android-ndk-platform android-$(ANDROID_API_LEVEL) -$(package)_config_opts_aarch64_android += -device-option CROSS_COMPILE="$(host)-" + +$(package)_config_opts_android = -xplatform android-clang +$(package)_config_opts_android += -android-sdk $(ANDROID_SDK) +$(package)_config_opts_android += -android-ndk $(ANDROID_NDK) +$(package)_config_opts_android += -android-ndk-platform android-$(ANDROID_API_LEVEL) +$(package)_config_opts_android += -device-option CROSS_COMPILE="$(host)-" +$(package)_config_opts_android += -egl +$(package)_config_opts_android += -qpa xcb +$(package)_config_opts_android += -no-eglfs +$(package)_config_opts_android += -opengl es2 +$(package)_config_opts_android += -qt-freetype +$(package)_config_opts_android += -no-fontconfig +$(package)_config_opts_android += -L $(host_prefix)/lib +$(package)_config_opts_android += -I $(host_prefix)/include + $(package)_config_opts_aarch64_android += -android-arch arm64-v8a -$(package)_config_opts_aarch64_android += -egl -$(package)_config_opts_aarch64_android += -qpa xcb -$(package)_config_opts_aarch64_android += -no-eglfs -$(package)_config_opts_aarch64_android += -opengl es2 -$(package)_config_opts_aarch64_android += -qt-freetype -$(package)_config_opts_aarch64_android += -no-fontconfig -$(package)_config_opts_aarch64_android += -L $(host_prefix)/lib -$(package)_config_opts_aarch64_android += -I $(host_prefix)/include +$(package)_config_opts_armv7a_android += -android-arch armeabi-v7a +$(package)_config_opts_x86_64_android += -android-arch x86_64 +$(package)_config_opts_i686_android += -android-arch i686 + $(package)_build_env = QT_RCC_TEST=1 $(package)_build_env += QT_RCC_SOURCE_DATE_OVERRIDE=1 endef diff --git a/depends/packages/zeromq.mk b/depends/packages/zeromq.mk index 9ac037ebb5..eb60f7dee0 100644 --- a/depends/packages/zeromq.mk +++ b/depends/packages/zeromq.mk @@ -10,6 +10,7 @@ define $(package)_set_vars $(package)_config_opts += --without-libsodium --without-libgssapi_krb5 --without-pgm --without-norm --without-vmci $(package)_config_opts += --disable-libunwind --disable-radix-tree --without-gcov $(package)_config_opts_linux=--with-pic + $(package)_config_opts_android=--with-pic $(package)_cxxflags=-std=c++11 endef diff --git a/depends/packages/zlib.mk b/depends/packages/zlib.mk index 017e7b2cf1..acb02020a8 100644 --- a/depends/packages/zlib.mk +++ b/depends/packages/zlib.mk @@ -11,7 +11,7 @@ $(package)_config_opts+=RANLIB="$($(package)_ranlib)" $(package)_config_opts+=AR="$($(package)_ar)" $(package)_config_opts_darwin+=AR="$($(package)_libtool)" $(package)_config_opts_darwin+=ARFLAGS="-o" -$(package)_config_opts_aarch64_android+=CHOST=$(host) +$(package)_config_opts_android+=CHOST=$(host) endef # zlib has its own custom configure script that takes in options like CC,