android: Add x86-64 build too.

This will make it possible to create AAB's that contain 3 ABIs:
armeabi-v7a, arm64-v8a and x86_64.

If you want to build for just one ABI, use --with-android-abi=... where
the value is one of those three above.

Change-Id: I553b8ca941db67eddc1d712a96b818f9cfedd0fa
Reviewed-on: https://gerrit.libreoffice.org/c/online/+/97227
Tested-by: Jan Holesovsky <kendy@collabora.com>
Reviewed-by: Jan Holesovsky <kendy@collabora.com>
This commit is contained in:
Jan Holesovsky 2020-06-26 14:25:48 +02:00
parent c776c0f953
commit 661bb47d07
3 changed files with 130 additions and 70 deletions

View file

@ -65,6 +65,43 @@ build the native parts on Windows.
# install
PATH="$PATH":~/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin make -j8 ANDROID_ABI=arm64-v8a CC=aarch64-linux-android21-clang CXX=aarch64-linux-android21-clang++ SYSLIBS=-static-libstdc++ install INSTALLDIR=/opt/poco-android-64bit
* Poco for x86_64 (if you want to add the support for that into the APK too):
# checkout the 1.10.1 in yet another location
git clone https://github.com/pocoproject/poco poco-android-x86-64
cd poco-android-x86-64
git checkout -b poco-1.10.1 origin/poco-1.10.1
# and apply the following patch:
diff --git a/build/config/Android b/build/config/Android
index 9227a3352..1abf6df7c 100644
--- a/build/config/Android
+++ b/build/config/Android
@@ -25,10 +25,14 @@ ifeq ($(ANDROID_ABI),x86)
TOOL = i686-linux-android
ARCHFLAGS = -march=i686 -msse3 -mstackrealign -mfpmath=sse
else
+ifeq ($(ANDROID_ABI),x86_64)
+TOOL = x86_64-linux-android
+else
$(error Invalid ABI specified in ANDROID_ABI)
endif
endif
endif
+endif
#
# Define Tools
# configure
./configure --config=Android --no-samples --no-tests --omit=Crypto,NetSSL_OpenSSL,Zip,Data,Data/SQLite,Data/ODBC,Data/MySQL,MongoDB,PDF,CppParser,PageCompiler,JWT
# build
PATH="$PATH":~/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin make -j8 ANDROID_ABI=x86_64 CC=x86_64-linux-android21-clang CXX=x86_64-linux-android21-clang++ SYSLIBS=-static-libstdc++
# install
PATH="$PATH":~/Android/Sdk/ndk-bundle/toolchains/llvm/prebuilt/linux-x86_64/bin make -j8 ANDROID_ABI=x86_64 CC=x86_64-linux-android21-clang CXX=x86_64-linux-android21-clang++ SYSLIBS=-static-libstdc++ install INSTALLDIR=/opt/poco-android-x86-64
* Configure the online.git (eg. in online-android folder)
Don't forget to change --with-lo-builddir in the following:

View file

@ -36,9 +36,9 @@ elseif(${ANDROID_ABI} STREQUAL "arm64-v8a")
set(POCOINCLUDE_ABI @POCOINCLUDE_ARM64_V8A@)
set(POCOLIB_ABI @POCOLIB_ARM64_V8A@)
elseif(${ANDROID_ABI} STREQUAL "x86_64")
set(LOBUILDDIR_ABI @LOBUILDDIR@)
set(POCOINCLUDE_ABI @POCOINCLUDE@)
set(POCOLIB_ABI @POCOLIB@)
set(LOBUILDDIR_ABI @LOBUILDDIR_X86_64@)
set(POCOINCLUDE_ABI @POCOINCLUDE_X86_64@)
set(POCOLIB_ABI @POCOLIB_X86_64@)
else()
MESSAGE(FATAL_ERROR "Cannot build for ABI ${ANDROID_ABI}, please add support for that.")
endif()

View file

@ -166,6 +166,16 @@ AC_ARG_WITH(android-package-versioncode,
[Set the versionCode for the Android package.]),
,)
AC_ARG_WITH(android-abi,
AS_HELP_STRING([--with-android-abi=x86_64],
[Allows specification of a concrete ABI that is to be built for. By default, builds for all the 3
supported ABIs at the same time: armeabi-v7a, arm64-v8a and x86_64.
Please note that you need to specify the parameters for --with-lo-builddir,
--with-poco-includes and --with-poco-libs in the order of armeabi-v7a:arm64-v8a:x86_64. For
example, when you use --with-android-abi=x86_64,
you have to specify --with-lo-builddir=::/path/to/x86-64/builddir]),
,)
AC_ARG_WITH([app-name],
AS_HELP_STRING([--with-app-name=<name>],
[Set the user-visible name of the app you build.]))
@ -356,17 +366,28 @@ fi
# to the Mac.
# Android: We need these to setup the CMakeLists.txt properly.
LOBUILDDIR=
if test -z "$ANDROID_ABI"; then
ANDROID_ABI="armeabi-v7a"
fi
ANDROID_ABI=
LOBUILDDIR_ARM64_V8A=
LOBUILDDIR_X86_64=
POCOINCLUDE=
POCOINCLUDE_ARM64_V8A=
POCOINCLUDE_X86_64=
POCOLIB=
POCOLIB_ARM64_V8A=
POCOLIB_X86_64=
POCODEBUG=
CORE_VERSION_HASH=""
if test \( "$enable_iosapp" = "yes" -a `uname -s` = "Darwin" \) -o \( "$enable_androidapp" = "yes" \); then
if test "$enable_androidapp" = "yes" ; then
AC_MSG_CHECKING([for Android ABI to build for])
if test -z "$with_android_abi" ; then
ANDROID_ABI="armeabi-v7a arm64-v8a x86_64"
else
ANDROID_ABI=`echo $with_android_abi | sed 's/:/ /g'`
fi
AC_MSG_RESULT([$ANDROID_ABI])
fi
AC_MSG_CHECKING([for LibreOffice build tree to build against])
if test -z "$with_lo_builddir"; then
AC_MSG_ERROR([You MUST use the --with-lo-builddir option when configuring the mobile app build tree.])
@ -374,28 +395,11 @@ if test \( "$enable_iosapp" = "yes" -a `uname -s` = "Darwin" \) -o \( "$enable_a
LOBUILDDIR="$with_lo_builddir"
if test "$enable_androidapp" = "yes" ; then
if echo "$LOBUILDDIR" | grep -qs ':' ; then
ANDROID_ABI="armeabi-v7a arm64-v8a"
LOBUILDDIR=`echo $with_lo_builddir | sed 's/:.*//'`
LOBUILDDIR_ARM64_V8A=`echo $with_lo_builddir | sed 's/^.*://'`
fi
# Sanity check, just a random object file in the LibreOffice build tree - 64bit
if test "$ANDROID_ABI" = "x86_64" ; then
if test -f "$LOBUILDDIR/workdir/LinkTarget/StaticLibrary/liblibpng.a" ; then
AC_MSG_RESULT([$LOBUILDDIR])
else
AC_MSG_ERROR([This is not a LibreOffice 64bit core build directory: $LOBUILDDIR])
fi
else
if test "$ANDROID_ABI" != "armeabi-v7a" ; then
if test -f "$LOBUILDDIR_ARM64_V8A/workdir/LinkTarget/StaticLibrary/liblibpng.a" ; then
AC_MSG_RESULT([$LOBUILDDIR_ARM64_V8A])
else
AC_MSG_ERROR([This is not a LibreOffice 64bit core build directory: $LOBUILDDIR_ARM64_V8A])
fi
fi
fi
if echo "$LOBUILDDIR" | grep -qs ':' ; then
LOBUILDDIR=`echo $with_lo_builddir | cut -d: -f1`
LOBUILDDIR_ARM64_V8A=`echo $with_lo_builddir | cut -d: -f2`
LOBUILDDIR_X86_64=`echo $with_lo_builddir | cut -d: -f3`
fi
fi
# Get the git hash of the core build
@ -408,6 +412,22 @@ if test \( "$enable_iosapp" = "yes" -a `uname -s` = "Darwin" \) -o \( "$enable_a
AC_MSG_ERROR([This is not a LibreOffice core build directory: $LOBUILDDIR])
fi
if test -n "$LOBUILDDIR_ARM64_V8A" ; then
if test -f "$LOBUILDDIR_ARM64_V8A/workdir/LinkTarget/StaticLibrary/liblibpng.a" ; then
AC_MSG_RESULT([$LOBUILDDIR_ARM64_V8A])
else
AC_MSG_ERROR([This is not a LibreOffice ARM64 core build directory: $LOBUILDDIR_ARM64_V8A])
fi
fi
if test -n "$LOBUILDDIR_X86_64" ; then
if test -f "$LOBUILDDIR_X86_64/workdir/LinkTarget/StaticLibrary/liblibpng.a" ; then
AC_MSG_RESULT([$LOBUILDDIR_X86_64])
else
AC_MSG_ERROR([This is not a LibreOffice x86-64 core build directory: $LOBUILDDIR_X86_64])
fi
fi
AC_MSG_CHECKING([for Poco include directory to build against])
if test -z "$with_poco_includes"; then
AC_MSG_ERROR([You MUST use the --with-poco-includes option when configuring the mobile app build tree.])
@ -415,27 +435,11 @@ if test \( "$enable_iosapp" = "yes" -a `uname -s` = "Darwin" \) -o \( "$enable_a
POCOINCLUDE="$with_poco_includes"
if test "$enable_androidapp" = "yes" ; then
if echo "$POCOINCLUDE" | grep -qs ':' ; then
POCOINCLUDE=`echo $with_poco_includes | sed 's/:.*//'`
POCOINCLUDE_ARM64_V8A=`echo $with_poco_includes | sed 's/^.*://'`
fi
# Sanity check - 64bit
if test "$ANDROID_ABI" = "x86_64" ; then
if test -f "$POCOINCLUDE/Poco/Poco.h"; then
AC_MSG_RESULT([$POCOINCLUDE])
else
AC_MSG_ERROR([This is not a Poco 64bit include directory: $POCOINCLUDE])
fi
else
if test "$ANDROID_ABI" != "armeabi-v7a" ; then
if test -f "$POCOINCLUDE_ARM64_V8A/Poco/Poco.h"; then
AC_MSG_RESULT([$POCOINCLUDE_ARM64_V8A])
else
AC_MSG_ERROR([This is not a Poco 64bit include directory: $POCOINCLUDE_ARM64_V8A])
fi
fi
fi
if echo "$POCOINCLUDE" | grep -qs ':' ; then
POCOINCLUDE=`echo $with_poco_includes | cut -d: -f1`
POCOINCLUDE_ARM64_V8A=`echo $with_poco_includes | cut -d: -f2`
POCOINCLUDE_X86_64=`echo $with_poco_includes | cut -d: -f3`
fi
fi
# Sanity check
@ -445,6 +449,22 @@ if test \( "$enable_iosapp" = "yes" -a `uname -s` = "Darwin" \) -o \( "$enable_a
AC_MSG_ERROR([This is not a Poco include directory: $POCOINCLUDE])
fi
if test -n "$POCOINCLUDE_ARM64_V8A" ; then
if test -f "$POCOINCLUDE_ARM64_V8A/Poco/Poco.h"; then
AC_MSG_RESULT([$POCOINCLUDE_ARM64_V8A])
else
AC_MSG_ERROR([This is not a Poco ARM64 include directory: $POCOINCLUDE_ARM64_V8A])
fi
fi
if test -n "$POCOINCLUDE_X86_64" ; then
if test -f "$POCOINCLUDE_X86_64/Poco/Poco.h"; then
AC_MSG_RESULT([$POCOINCLUDE_X86_64])
else
AC_MSG_ERROR([This is not a Poco x86-64 include directory: $POCOINCLUDE_X86_64])
fi
fi
AC_MSG_CHECKING([for Poco lib directory to build against])
if test -z "$with_poco_libs"; then
AC_MSG_ERROR([You MUST use the --with-poco-libs option when configuring the mobile app build tree.])
@ -452,27 +472,11 @@ if test \( "$enable_iosapp" = "yes" -a `uname -s` = "Darwin" \) -o \( "$enable_a
POCOLIB="$with_poco_libs"
if test "$enable_androidapp" = "yes" ; then
if echo "$POCOLIB" | grep -qs ':' ; then
POCOLIB=`echo $with_poco_libs | sed 's/:.*//'`
POCOLIB_ARM64_V8A=`echo $with_poco_libs | sed 's/^.*://'`
fi
# Sanity check - 64bit
if test "$ANDROID_ABI" = "x86_64" ; then
if test -f "$POCOLIB/libPocoFoundation.a"; then
AC_MSG_RESULT([$POCOLIB])
else
AC_MSG_ERROR([This is not a Poco 64bit lib directory: $POCOLIB])
fi
else
if test "$ANDROID_ABI" != "armeabi-v7a" ; then
if test -f "$POCOLIB_ARM64_V8A/libPocoFoundation.a"; then
AC_MSG_RESULT([$POCOLIB_ARM64_V8A])
else
AC_MSG_ERROR([This is not a Poco 64bit lib directory: $POCOLIB_ARM64_V8A])
fi
fi
fi
if echo "$POCOLIB" | grep -qs ':' ; then
POCOLIB=`echo $with_poco_libs | cut -d: -f1`
POCOLIB_ARM64_V8A=`echo $with_poco_libs | cut -d: -f2`
POCOLIB_X86_64=`echo $with_poco_libs | cut -d: -f3`
fi
fi
# Sanity check
@ -482,6 +486,22 @@ if test \( "$enable_iosapp" = "yes" -a `uname -s` = "Darwin" \) -o \( "$enable_a
AC_MSG_ERROR([This is not a Poco lib directory: $POCOLIB])
fi
if test -n "$POCOLIB_ARM64_V8A" ; then
if test -f "$POCOLIB_ARM64_V8A/libPocoFoundation.a"; then
AC_MSG_RESULT([$POCOLIB_ARM64_V8A])
else
AC_MSG_ERROR([This is not a Poco ARM64 lib directory: $POCOLIB_ARM64_V8A])
fi
fi
if test -n "$POCOLIB_X86_64" ; then
if test -f "$POCOLIB_X86_64/libPocoFoundation.a"; then
AC_MSG_RESULT([$POCOLIB_X86_64])
else
AC_MSG_ERROR([This is not a Poco x86-64 lib directory: $POCOLIB_X86_64])
fi
fi
if test "$ENABLE_DEBUG" = "true" ; then
POCODEBUG=d
fi
@ -489,10 +509,13 @@ fi
AC_SUBST(LOBUILDDIR)
AC_SUBST(ANDROID_ABI)
AC_SUBST(LOBUILDDIR_ARM64_V8A)
AC_SUBST(LOBUILDDIR_X86_64)
AC_SUBST(POCOINCLUDE)
AC_SUBST(POCOINCLUDE_ARM64_V8A)
AC_SUBST(POCOINCLUDE_X86_64)
AC_SUBST(POCOLIB)
AC_SUBST(POCOLIB_ARM64_V8A)
AC_SUBST(POCOLIB_X86_64)
AC_SUBST(POCODEBUG)
AC_SUBST([CORE_VERSION_HASH])