summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2017-11-22 23:08:06 +0100
committerJan Holesovsky <kendy@collabora.com>2019-06-05 22:19:27 +0200
commitdb3cbdf116d35782c49e22b1db32dead4e95b148 (patch)
tree2f79828cab78eca7c22c38f6cb435b86d16758ae
parent133af7066e671fbb2feb0016dac9305d291d7d90 (diff)
android: use unified headers and llvm-c++ STL (x86) with NDK 16
gnustl (and others) are to be removed in future versions of the ndk also bump gradle and build-tools to current versions along with it arm unfortunately crashes with llvm-c++, so keep with gnustl for now/fix that later Change-Id: Ic794c3293b599b77ec48096bf3283a99c09cbb79 Reviewed-on: https://gerrit.libreoffice.org/45163 Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com> Tested-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--android/Bootstrap/Makefile.shared2
-rw-r--r--android/source/build.gradle25
-rw-r--r--android/source/gradle.properties2
-rw-r--r--android/source/gradle/wrapper/gradle-wrapper.properties4
-rw-r--r--android/source/jni/Android.mk8
-rw-r--r--bridges/Library_cpp_uno.mk1
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/except.cxx4
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/share.hxx53
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx7
-rw-r--r--bridges/source/cpp_uno/gcc3_linux_intel/except.cxx6
-rw-r--r--config_host.mk.in1
-rw-r--r--configure.ac31
-rw-r--r--distro-configs/LibreOfficeAndroid.conf1
-rw-r--r--distro-configs/LibreOfficeAndroidX86.conf1
-rw-r--r--drawinglayer/source/primitive2d/borderlineprimitive2d.cxx1
-rw-r--r--external/boost/UnpackedTarball_boost.mk3
-rw-r--r--external/boost/boost-android-unified.patch.128
-rw-r--r--external/cppunit/ExternalProject_cppunit.mk2
-rw-r--r--external/icu/ExternalProject_icu.mk2
-rw-r--r--external/liborcus/ExternalProject_liborcus.mk2
-rw-r--r--external/liborcus/UnpackedTarball_liborcus.mk4
-rw-r--r--external/nss/ExternalProject_nss.mk4
-rw-r--r--external/nss/nss-android.patch.14
-rw-r--r--i18nutil/source/utility/paper.cxx3
-rw-r--r--include/android/compatibility.hxx34
-rw-r--r--sal/android/lo-bootstrap.c5
-rw-r--r--solenv/clang-format/blacklist1
-rw-r--r--solenv/gbuild/platform/android.mk23
28 files changed, 171 insertions, 91 deletions
diff --git a/android/Bootstrap/Makefile.shared b/android/Bootstrap/Makefile.shared
index ae80db1fef98..e0678ba8c779 100644
--- a/android/Bootstrap/Makefile.shared
+++ b/android/Bootstrap/Makefile.shared
@@ -60,7 +60,7 @@ WHOLELIBS = \
$(OBJLOCAL)/liblo-native-code.so : native-code.cxx $(ALL_STATIC_LIBS)
@echo "Linking $@"
mkdir -p $(OBJLOCAL)
- $(CXX) -Wl,--build-id=sha1 -Wl,--gc-sections -Wl,--version-script=../Bootstrap/version.map -Wl,--no-keep-files-mapped -Wl,--no-undefined -DANDROID -DDISABLE_DYNLOADING -shared -o $(OBJLOCAL)/liblo-native-code.so -I$(BUILDDIR)/config_host -I$(SRCDIR)/include native-code.cxx -L$(INSTDIR)/$(LIBO_LIB_FOLDER) $(WHOLELIBS) $(LIBS) -lgnustl_static -lGLESv2 -landroid -ljnigraphics -llog -lz
+ $(CXX) -Wl,--build-id=sha1 -Wl,--gc-sections -Wl,--version-script=../Bootstrap/version.map -Wl,--no-keep-files-mapped -Wl,--no-undefined -DANDROID -DDISABLE_DYNLOADING -shared -o $(OBJLOCAL)/liblo-native-code.so -I$(BUILDDIR)/config_host -I$(SRCDIR)/include native-code.cxx -L$(INSTDIR)/$(LIBO_LIB_FOLDER) $(WHOLELIBS) $(LIBS) $(if $(filter armeabi-v7a,$(ANDROID_APP_ABI)),-lgnustl_static,-lc++_static -lc++abi -landroid_support) -lGLESv2 -landroid -ljnigraphics -llog -lz
$(SODEST)/liblo-native-code.so : $(OBJLOCAL)/liblo-native-code.so
mkdir -p $(SODEST)
diff --git a/android/source/build.gradle b/android/source/build.gradle
index 1950b2357de5..c2d4aeae0e56 100644
--- a/android/source/build.gradle
+++ b/android/source/build.gradle
@@ -17,31 +17,34 @@ allprojects {
buildscript {
repositories {
jcenter()
+ maven {
+ url "https://maven.google.com"
+ }
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.3'
+ classpath 'com.android.tools.build:gradle:3.0.1'
}
}
// compile-time dependencies
dependencies {
- compile fileTree(dir: "${liboInstdir}/${liboUREJavaFolder}", include: [
+ implementation fileTree(dir: "${liboInstdir}/${liboUREJavaFolder}", include: [
"java_uno.jar",
"juh.jar",
"jurt.jar",
"ridl.jar",
"unoloader.jar"
])
- compile files("${liboInstdir}/${liboShareJavaFolder}/unoil.jar")
- debugCompile(name:'owncloud_android_lib-debug', ext:'aar')
- releaseCompile(name:'owncloud_android_lib-release', ext:'aar')
- compile 'com.android.support:design:26.1.0' // also pulls-in corresponding support libraries
- compile 'com.android.support.constraint:constraint-layout:1.0.2'
+ implementation files("${liboInstdir}/${liboShareJavaFolder}/unoil.jar")
+ debugImplementation(name:'owncloud_android_lib-debug', ext:'aar')
+ releaseImplementation(name:'owncloud_android_lib-release', ext:'aar')
+ implementation 'com.android.support:design:27.0.1' // also pulls-in corresponding support libraries
+ implementation 'com.android.support.constraint:constraint-layout:1.0.2'
}
android {
compileSdkVersion 26
- buildToolsVersion "26.0.1"
+ buildToolsVersion "27.0.1"
compileOptions {
// silence some java-language features hints
sourceCompatibility 6
@@ -77,9 +80,11 @@ android {
manifestPlaceholders = [installLocation: "preferExternal", extractNativeLibs: "true"]
}
}
+
+ flavorDimensions "default"
productFlavors {
- strippedUI
- fullUI
+ strippedUI.dimension "default"
+ fullUI.dimension "default"
}
}
diff --git a/android/source/gradle.properties b/android/source/gradle.properties
index 899c9f99f396..ad1671ef57fd 100644
--- a/android/source/gradle.properties
+++ b/android/source/gradle.properties
@@ -1 +1 @@
-org.gradle.jvmargs=-Xmx2048m
+org.gradle.jvmargs=-Xmx3072m
diff --git a/android/source/gradle/wrapper/gradle-wrapper.properties b/android/source/gradle/wrapper/gradle-wrapper.properties
index 5dc276a1ab03..26a7675eb5fc 100644
--- a/android/source/gradle/wrapper/gradle-wrapper.properties
+++ b/android/source/gradle/wrapper/gradle-wrapper.properties
@@ -1,6 +1,6 @@
-#Tue Mar 14 19:29:07 CET 2017
+#Mon Nov 20 19:19:05 CET 2017
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-distributionUrl=https\://services.gradle.org/distributions/gradle-3.3-all.zip
+distributionUrl=https\://services.gradle.org/distributions/gradle-4.1-all.zip
diff --git a/android/source/jni/Android.mk b/android/source/jni/Android.mk
deleted file mode 100644
index 939a1ea503bb..000000000000
--- a/android/source/jni/Android.mk
+++ /dev/null
@@ -1,8 +0,0 @@
-# Needed just to satisfy ndk-gdb for now, but maybe later we will actually add
-# some JNI code here
-
-LOCAL_PATH := $(call my-dir)
-
-include $(CLEAR_VARS)
-
-include $(BUILD_SHARED_LIBRARY)
diff --git a/bridges/Library_cpp_uno.mk b/bridges/Library_cpp_uno.mk
index 22ce084178b6..b64b97e6f22b 100644
--- a/bridges/Library_cpp_uno.mk
+++ b/bridges/Library_cpp_uno.mk
@@ -199,6 +199,7 @@ endif
# it off.
ifeq ($(COM),GCC)
$(eval $(call gb_Library_add_cxxflags,gcc3_uno,\
+ $(if $(filter armeabi-v7a,$(ANDROID_APP_ABI)),-I$(ANDROID_BINUTILS_PREBUILT_ROOT)/lib/gcc/arm-linux-androideabi/4.9.x/include) \
-fno-omit-frame-pointer \
-fno-strict-aliasing \
$(if $(filter TRUE,$(ENABLE_LTO)),-fno-lto) \
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx
index 43e255c21cf6..b4a5117b81c0 100644
--- a/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/except.cxx
@@ -309,7 +309,7 @@ namespace CPPU_CURRENT_NAMESPACE
return;
}
- typelib_TypeDescription * pExcTypeDescr = 0;
+ typelib_TypeDescription * pExcTypeDescr = nullptr;
OUString unoName( toUNOname( header->exceptionType->name() ) );
#if OSL_DEBUG_LEVEL > 1
OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) );
@@ -318,7 +318,7 @@ namespace CPPU_CURRENT_NAMESPACE
typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData );
if (0 == pExcTypeDescr)
{
- RuntimeException aRE( OUString("exception type not found: ") + unoName );
+ RuntimeException aRE( "exception type not found: " + unoName );
Type const & rType = cppu::UnoType<decltype(aRE)>::get();
uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno );
SAL_WARN("bridges", aRE.Message);
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx b/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx
index 7fddd841498b..62e0feece40b 100644
--- a/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/share.hxx
@@ -23,11 +23,7 @@
#include <typeinfo>
#include <exception>
#include <cstddef>
-#ifndef ANDROID
#include <unwind.h>
-#else
-#include <unwind-arm.h>
-#endif
#include <cxxabi.h>
#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
@@ -37,13 +33,35 @@
#include "config_cxxabi.h"
#include "uno/mapping.h"
-namespace CPPU_CURRENT_NAMESPACE
-{
-
- void dummy_can_throw_anything( char const * );
+#if !HAVE_CXXABI_H_CLASS_TYPE_INFO
+// <https://mentorembedded.github.io/cxx-abi/abi.html>,
+// libstdc++-v3/libsupc++/cxxabi.h:
+namespace __cxxabiv1 {
+class __class_type_info: public std::type_info {
+public:
+ explicit __class_type_info(char const * n): type_info(n) {}
+ ~__class_type_info() override;
+};
+}
+#endif
- // -- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h
+#if !HAVE_CXXABI_H_SI_CLASS_TYPE_INFO
+// <https://mentorembedded.github.io/cxx-abi/abi.html>,
+// libstdc++-v3/libsupc++/cxxabi.h:
+namespace __cxxabiv1 {
+class __si_class_type_info: public __class_type_info {
+public:
+ __class_type_info const * __base_type;
+ explicit __si_class_type_info(
+ char const * n, __class_type_info const *base):
+ __class_type_info(n), __base_type(base) {}
+ ~__si_class_type_info() override;
+};
+}
+#endif
+#if !HAVE_CXXABI_H_CXA_EH_GLOBALS
+namespace __cxxabiv1 {
struct __cxa_exception
{
std::type_info *exceptionType;
@@ -68,12 +86,26 @@ namespace CPPU_CURRENT_NAMESPACE
_Unwind_Exception unwindHeader;
};
+}
+#endif
+
+namespace CPPU_CURRENT_NAMESPACE
+{
+
+ void dummy_can_throw_anything( char const * );
+
+ // -- following decl from libstdc++-v3/libsupc++/unwind-cxx.h and unwind.h
+
extern "C" void *__cxa_allocate_exception(
std::size_t thrown_size ) throw();
extern "C" void __cxa_throw (
void *thrown_exception, std::type_info *tinfo,
void (*dest) (void *) ) __attribute__((noreturn));
+}
+
+#if !HAVE_CXXABI_H_CXA_EH_GLOBALS
+namespace __cxxabiv1 {
struct __cxa_eh_globals
{
__cxa_exception *caughtExceptions;
@@ -83,6 +115,7 @@ namespace CPPU_CURRENT_NAMESPACE
#endif
};
}
+#endif
#if !HAVE_CXXABI_H_CXA_GET_GLOBALS
namespace __cxxabiv1 {
@@ -95,7 +128,7 @@ namespace CPPU_CURRENT_NAMESPACE
void raiseException(
uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
void fillUnoException(
- __cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno );
+ __cxxabiv1::__cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno );
}
extern "C" void privateSnippetExecutor();
diff --git a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx
index 0f464e1ea6be..3fc2602a602b 100644
--- a/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx
@@ -571,10 +571,9 @@ static void cpp_call(
catch (...)
{
// fill uno exception
- fillUnoException(
- reinterpret_cast< CPPU_CURRENT_NAMESPACE::__cxa_eh_globals * >(
- __cxxabiv1::__cxa_get_globals())->caughtExceptions,
- *ppUnoExc, pThis->getBridge()->getCpp2Uno());
+ CPPU_CURRENT_NAMESPACE::fillUnoException(
+ __cxxabiv1::__cxa_get_globals()->caughtExceptions,
+ *ppUnoExc, pThis->getBridge()->getCpp2Uno());
// temporary params
for ( ; nTempIndices--; )
diff --git a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
index d5567ed6216c..f959683838f3 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
@@ -166,6 +166,9 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr )
#if OSL_DEBUG_LEVEL > 1
fprintf( stderr,"generated rtti for %s\n", rttiName );
#endif
+// TODO: incompatible with llvm-c++ in ndk16 - no __si_class_type_info or __class_type_info
+// either do as iOS one and inline thing or find another way
+#if !defined(ANDROID)
if (pTypeDescr->pBaseTypeDescription)
{
// ensure availability of base
@@ -183,6 +186,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr )
pair< t_rtti_map::iterator, bool > insertion(
m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) );
SAL_WARN_IF( !insertion.second, "bridges", "### inserting new generated rtti failed?!" );
+#endif
}
else // taking already generated rtti
{
@@ -257,7 +261,9 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
}
rtti = s_rtti->getRTTI(reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr));
TYPELIB_DANGER_RELEASE( pTypeDescr );
+#if !defined(ANDROID) // see TODO above
assert(rtti && "### no rtti for throwing exception!");
+#endif
if (! rtti)
{
throw RuntimeException(
diff --git a/config_host.mk.in b/config_host.mk.in
index 4b42b38f3d64..96bd80d67868 100644
--- a/config_host.mk.in
+++ b/config_host.mk.in
@@ -20,6 +20,7 @@ export ANDROID_NDK_HOME=@ANDROID_NDK_HOME@
export ANDROID_APP_ABI=@ANDROID_APP_ABI@
export ANDROID_SDK_HOME=@ANDROID_SDK_HOME@
export ANDROID_PACKAGE_NAME=@ANDROID_PACKAGE_NAME@
+export ANDROID_BINUTILS_PREBUILT_ROOT=@ANDROID_BINUTILS_PREBUILT_ROOT@
export ANDROID_GCC_TOOLCHAIN_VERSION=@ANDROID_GCC_TOOLCHAIN_VERSION@
export ANT=@ANT@
export ANT_HOME=@ANT_HOME@
diff --git a/configure.ac b/configure.ac
index 9b4cad2ed394..faaed1bbe8b9 100644
--- a/configure.ac
+++ b/configure.ac
@@ -388,16 +388,16 @@ if test -n "$with_android_ndk"; then
fi
case $ANDROID_NDK_VERSION in
r9*|r10*)
- AC_MSG_ERROR([Building for Android is only supported with NDK versions above 15.x*])
+ AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x*])
;;
11.1.*|12.1.*|13.1.*|14.1.*)
- AC_MSG_ERROR([Building for Android is only supported with NDK versions above 15.x.*])
+ AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
;;
- 15.0.*|15.1.*)
+ 16.*)
;;
*)
- AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only version 15.0.* and 15.1.* have been used successfully. Proceed at your own risk.])
- add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only version 15.0.* and 15.1.* have been used successfully. Proceed at your own risk."
+ AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk.])
+ add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only version 16.* have been used successfully. Proceed at your own risk."
;;
esac
@@ -431,6 +431,7 @@ if test -n "$with_android_ndk"; then
android_gnu_prefix=i686-linux-android
LLVM_TRIPLE=i686-none-linux-android
ANDROID_APP_ABI=x86
+ ANDROID_ARCH=$android_cpu
ANDROIDCFLAGS="-march=atom"
fi
@@ -469,6 +470,7 @@ if test -n "$with_android_ndk"; then
esac
ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin
ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_BINUTILS_DIR/prebuilt/$ndk_build_os-x86_64
+ AC_SUBST(ANDROID_BINUTILS_PREBUILT_ROOT)
test -z "$SYSBASE" && SYSBASE=$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}
test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
@@ -477,16 +479,29 @@ if test -n "$with_android_ndk"; then
test -z "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip
- ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE -no-canonical-prefixes"
+ ANDROIDCFLAGS="$ANDROIDCFLAGS -gcc-toolchain $ANDROID_BINUTILS_PREBUILT_ROOT -target $LLVM_TRIPLE$ANDROID_API_LEVEL -no-canonical-prefixes"
+ # android is using different sysroots for compilation and linking, but as
+ # there is no full separation in configure and elsewehere, use isystem for
+ # compilation stuff and sysroot for linking
+ ANDROIDCFLAGS="$ANDROIDCFLAGS -D__ANDROID_API__=$ANDROID_API_LEVEL -isystem $ANDROID_NDK_HOME/sysroot/usr/include"
+ ANDROIDCFLAGS="$ANDROIDCFLAGS -isystem $ANDROID_NDK_HOME/sysroot/usr/include/$android_gnu_prefix"
ANDROIDCFLAGS="$ANDROIDCFLAGS --sysroot=$SYSBASE -ffunction-sections -fdata-sections -Qunused-arguments"
- ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/$ANDROID_GCC_TOOLCHAIN_VERSION/libs/$ANDROID_APP_ABI"
+ if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
+ ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI -D_GTHREAD_USE_MUTEX_INIT_FUNC=1"
+ else
+ ANDROIDCFLAGS="$ANDROIDCFLAGS -L$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/libs/$ANDROID_APP_ABI"
+ fi
if test "$ENABLE_LTO" = TRUE; then
# -flto comes from com_GCC_defs.mk, too, but we need to make sure it gets passed as part of
# $CC and $CXX when building external libraries
ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
fi
- ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/$ANDROID_GCC_TOOLCHAIN_VERSION/include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/$ANDROID_GCC_TOOLCHAIN_VERSION/libs/$ANDROID_APP_ABI/include -I$ANDROID_NDK_HOME/sources/cxx-stl/gabi++/include"
+ if test "$ANDROID_APP_ABI" = "armeabi-v7a"; then
+ ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/include -I$ANDROID_NDK_HOME/sources/cxx-stl/gnu-libstdc++/4.9/libs/$ANDROID_APP_ABI/include -std=c++11"
+ else
+ ANDROIDCXXFLAGS="$ANDROIDCFLAGS -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++/include -I$ANDROID_NDK_HOME/sources/cxx-stl/llvm-libc++abi/include -I$ANDROID_NDK_HOME/sources/android/support/include -std=c++11"
+ fi
if test -z "$CC"; then
CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
diff --git a/distro-configs/LibreOfficeAndroid.conf b/distro-configs/LibreOfficeAndroid.conf
index 6259daa68d95..9cc574909d66 100644
--- a/distro-configs/LibreOfficeAndroid.conf
+++ b/distro-configs/LibreOfficeAndroid.conf
@@ -8,3 +8,4 @@
--without-export-validation
--without-helppack-integration
--without-junit
+--disable-largefile
diff --git a/distro-configs/LibreOfficeAndroidX86.conf b/distro-configs/LibreOfficeAndroidX86.conf
index cacd45941ecb..7a2586989391 100644
--- a/distro-configs/LibreOfficeAndroidX86.conf
+++ b/distro-configs/LibreOfficeAndroidX86.conf
@@ -8,3 +8,4 @@
--without-export-validation
--without-helppack-integration
--without-junit
+--disable-largefile
diff --git a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
index 168c7f8e87d1..56a85cd65038 100644
--- a/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
+++ b/drawinglayer/source/primitive2d/borderlineprimitive2d.cxx
@@ -26,7 +26,6 @@
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <svtools/borderhelper.hxx>
#include <editeng/borderline.hxx>
-#include <android/compatibility.hxx>
#include <algorithm>
#include <cmath>
diff --git a/external/boost/UnpackedTarball_boost.mk b/external/boost/UnpackedTarball_boost.mk
index b4211bb2fe73..adb0a8f4ae1f 100644
--- a/external/boost/UnpackedTarball_boost.mk
+++ b/external/boost/UnpackedTarball_boost.mk
@@ -37,6 +37,9 @@ boost_patches += clang-cl.patch.0
boost_patches += boost_1_60_0.undef.warning.patch
boost_patches += boost_1_63_0.undef.warning.patch.1
+# https://svn.boost.org/trac10/ticket/13230
+boost_patches += boost-android-unified.patch.1
+
boost_patches += windows-no-utf8-locales.patch.0
$(eval $(call gb_UnpackedTarball_UnpackedTarball,boost))
diff --git a/external/boost/boost-android-unified.patch.1 b/external/boost/boost-android-unified.patch.1
new file mode 100644
index 000000000000..458482a37c28
--- /dev/null
+++ b/external/boost/boost-android-unified.patch.1
@@ -0,0 +1,28 @@
+https://svn.boost.org/trac10/ticket/13230 unified headers causing trouble with that..
+diff -ur boost.org/libs/filesystem/src/operations.cpp boost/libs/filesystem/src/operations.cpp
+--- boost.org/libs/filesystem/src/operations.cpp 2017-11-22 02:21:33.724304181 +0100
++++ boost/libs/filesystem/src/operations.cpp 2017-11-22 02:21:59.686302450 +0100
+@@ -11,23 +11,6 @@
+ //--------------------------------------------------------------------------------------//
+
+ // define 64-bit offset macros BEFORE including boost/config.hpp (see ticket #5355)
+-#if !(defined(__HP_aCC) && defined(_ILP32) && !defined(_STATVFS_ACPP_PROBLEMS_FIXED))
+-#define _FILE_OFFSET_BITS 64 // at worst, these defines may have no effect,
+-#endif
+-#if !defined(__PGI)
+-#define __USE_FILE_OFFSET64 // but that is harmless on Windows and on POSIX
+- // 64-bit systems or on 32-bit systems which don't have files larger
+- // than can be represented by a traditional POSIX/UNIX off_t type.
+- // OTOH, defining them should kick in 64-bit off_t's (and thus
+- // st_size)on 32-bit systems that provide the Large File
+- // Support (LFS)interface, such as Linux, Solaris, and IRIX.
+- // The defines are given before any headers are included to
+- // ensure that they are available to all included headers.
+- // That is required at least on Solaris, and possibly on other
+- // systems as well.
+-#else
+-#define _FILE_OFFSET_BITS 64
+-#endif
+
+ // define BOOST_FILESYSTEM_SOURCE so that <boost/filesystem/config.hpp> knows
+ // the library is being built (possibly exporting rather than importing code)
diff --git a/external/cppunit/ExternalProject_cppunit.mk b/external/cppunit/ExternalProject_cppunit.mk
index c03b15cac7b0..d4f063b989b3 100644
--- a/external/cppunit/ExternalProject_cppunit.mk
+++ b/external/cppunit/ExternalProject_cppunit.mk
@@ -52,7 +52,7 @@ $(call gb_ExternalProject_get_state_target,cppunit,build) :
$(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________NONE) \
$(if $(filter WNT,$(OS)),LDFLAGS="-Wl$(COMMA)--enable-runtime-pseudo-reloc-v2") \
$(if $(filter SOLARIS,$(OS)),LIBS="-lm") \
- $(if $(filter ANDROID,$(OS)),LIBS="-lgnustl_shared -lm") \
+ $(if $(filter ANDROID,$(OS)),LIBS="$(gb_STDLIBS)") \
CXXFLAGS="$(cppunit_CXXFLAGS)" \
&& cd src \
&& $(MAKE) \
diff --git a/external/icu/ExternalProject_icu.mk b/external/icu/ExternalProject_icu.mk
index 1a9c5ff90602..c2f6f3566318 100644
--- a/external/icu/ExternalProject_icu.mk
+++ b/external/icu/ExternalProject_icu.mk
@@ -56,7 +56,7 @@ icu_LDFLAGS:=" \
$(if $(SYSBASE),-L../lib -L../../lib -L../stubdata -L../../stubdata -L$(SYSBASE)/usr/lib) \
$(if $(filter TRUE,$(HAVE_LD_BSYMBOLIC_FUNCTIONS)),\
-Wl$(COMMA)-Bsymbolic-functions -Wl$(COMMA)--dynamic-list-cpp-new -Wl$(COMMA)--dynamic-list-cpp-typeinfo) \
- $(if $(filter ANDROID,$(OS)),-lgnustl_shared -lm)"
+ $(if $(filter ANDROID,$(OS)),$(gb_STDLIBS))"
$(call gb_ExternalProject_get_state_target,icu,build) :
$(call gb_ExternalProject_run,build,\
diff --git a/external/liborcus/ExternalProject_liborcus.mk b/external/liborcus/ExternalProject_liborcus.mk
index 01c7c050d04a..928c78e3a267 100644
--- a/external/liborcus/ExternalProject_liborcus.mk
+++ b/external/liborcus/ExternalProject_liborcus.mk
@@ -44,7 +44,7 @@ else
liborcus_LIBS+=-L$(gb_StaticLibrary_WORKDIR) -lboost_system -lboost_iostreams -lboost_filesystem
endif
ifeq ($(OS),ANDROID)
-liborcus_LIBS+=-lgnustl_shared -lm
+liborcus_LIBS+=$(gb_STDLIBS)
endif
liborcus_CPPCLAGS=$(CPPFLAGS)
diff --git a/external/liborcus/UnpackedTarball_liborcus.mk b/external/liborcus/UnpackedTarball_liborcus.mk
index 6941760cd71a..aa831e3aa7db 100644
--- a/external/liborcus/UnpackedTarball_liborcus.mk
+++ b/external/liborcus/UnpackedTarball_liborcus.mk
@@ -26,7 +26,9 @@ $(eval $(call gb_UnpackedTarball_add_patches,liborcus,\
external/liborcus/windows-constants-hack.patch \
))
endif
-ifeq ($(OS),ANDROID)
+
+# TODO: remove once switching arm to llvm-c++
+ifeq ($(ANDROID_APP_ABI),armeabi-v7a)
$(eval $(call gb_UnpackedTarball_add_patches,liborcus,\
external/liborcus/android-workaround.patch \
))
diff --git a/external/nss/ExternalProject_nss.mk b/external/nss/ExternalProject_nss.mk
index 8ce10b0a4ee9..e83054ca79b7 100644
--- a/external/nss/ExternalProject_nss.mk
+++ b/external/nss/ExternalProject_nss.mk
@@ -49,9 +49,9 @@ $(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalExecuta
RANLIB="$(RANLIB)" \
NMEDIT="$(NM)edit" \
COMMA=$(COMMA) \
- CC="$(CC)" CCC="$(CXX)" \
+ CC="$(CC)$(if $(filter ANDROID,$(OS)), -D_PR_NO_LARGE_FILES=1 -DSQLITE_DISABLE_LFS=1)" CCC="$(CXX)" \
$(if $(CROSS_COMPILING),NSINSTALL="$(call gb_ExternalExecutable_get_command,python) $(SRCDIR)/external/nss/nsinstall.py") \
- $(if $(filter ANDROID,$(OS)),OS_TARGET=Android OS_TARGET_RELEASE=14 ARCHFLAG="" DEFAULT_COMPILER=clang ANDROID_NDK=$(ANDROID_NDK_HOME) ANDROID_TOOLCHAIN_VERSION=$(ANDROID_GCC_TOOLCHAIN_VERSION)) \
+ $(if $(filter ANDROID,$(OS)),OS_TARGET=Android OS_TARGET_RELEASE=14 ARCHFLAG="" DEFAULT_COMPILER=clang ANDROID_NDK=$(ANDROID_NDK_HOME) ANDROID_TOOLCHAIN_VERSION=$(ANDROID_GCC_TOOLCHAIN_VERSION) ANDROID_PREFIX=$(HOST_PLATFORM) ANDROID_SYSROOT=$(SYSBASE) ANDROID_TOOLCHAIN=$(ANDROID_BINUTILS_PREBUILT_ROOT)) \
nss_build_all \
&& rm -f $(call gb_UnpackedTarball_get_dir,nss)/dist/out/lib/*.a \
$(if $(filter MACOSX,$(OS)),\
diff --git a/external/nss/nss-android.patch.1 b/external/nss/nss-android.patch.1
index 0e91502bdfd0..50c549303604 100644
--- a/external/nss/nss-android.patch.1
+++ b/external/nss/nss-android.patch.1
@@ -39,10 +39,10 @@ diff -ur nss.org/nspr/configure nss/nspr/configure
diff -ur nss.org/nss/Makefile nss/nss/Makefile
--- nss.org/nss/Makefile 2017-09-07 15:29:44.933245745 +0200
+++ nss/nss/Makefile 2017-09-07 15:32:04.347181076 +0200
-@@ -62,6 +62,7 @@
+@@ -62,6 +62,6 @@
ifeq ($(OS_TARGET),Android)
NSPR_CONFIGURE_OPTS += --with-android-ndk=$(ANDROID_NDK) \
- --target=$(ANDROID_PREFIX) \
+- --target=$(ANDROID_PREFIX) \
+ --with-arch=toolchain-default \
--with-android-version=$(OS_TARGET_RELEASE) \
--with-android-toolchain=$(ANDROID_TOOLCHAIN) \
diff --git a/i18nutil/source/utility/paper.cxx b/i18nutil/source/utility/paper.cxx
index c12ac29704ef..de73723bd231 100644
--- a/i18nutil/source/utility/paper.cxx
+++ b/i18nutil/source/utility/paper.cxx
@@ -290,7 +290,8 @@ PaperInfo PaperInfo::getSystemDefaultPaper()
}
#endif
-#if defined(LC_PAPER) && defined(_GNU_SOURCE)
+// _NL_PAPER_WIDTH / HEIGHT not available with android unified headers
+#if defined(LC_PAPER) && defined(_GNU_SOURCE) && !defined(ANDROID)
// try LC_PAPER
locale_t loc = newlocale(LC_PAPER_MASK, "", static_cast<locale_t>(0));
if (loc != static_cast<locale_t>(0))
diff --git a/include/android/compatibility.hxx b/include/android/compatibility.hxx
index 0926358caf6f..27c99f4f2604 100644
--- a/include/android/compatibility.hxx
+++ b/include/android/compatibility.hxx
@@ -19,47 +19,25 @@
#include <math.h>
-#if defined(ANDROID)
+#if defined(ANDROID) && defined(ARM)
#include <string>
#include <sstream>
namespace std
{
+inline double fmax(double x, double y) { return ::fmax(x, y); }
-inline double fmax(double x, double y)
-{
- return ::fmax(x, y);
-}
-
-inline long stol( const std::string& str, std::size_t* /*pos*/ = 0, int base = 10 )
+inline long stol(const std::string& str, std::size_t* /*pos*/ = 0, int base = 10)
{
char* end;
return strtol(str.c_str(), &end, base);
}
-template<typename T>
-T round(T x)
-{
- return ::round(x);
-}
-
-template<typename T>
-T trunc(T x)
-{
- return ::trunc(x);
-}
+template <typename T> T round(T x) { return ::round(x); }
-template<typename T>
-T lround(T x)
-{
- return ::lround(x);
-}
+template <typename T> T trunc(T x) { return ::trunc(x); }
-template<typename T>
-T copysign(T x, T y)
-{
- return ::copysign(x, y);
-}
+template <typename T> T lround(T x) { return ::lround(x); }
template <typename T> std::string to_string(const T& rNumber)
{
diff --git a/sal/android/lo-bootstrap.c b/sal/android/lo-bootstrap.c
index 7a2da48eb93b..d1ecd810ab19 100644
--- a/sal/android/lo-bootstrap.c
+++ b/sal/android/lo-bootstrap.c
@@ -37,6 +37,11 @@
#define MAX(a,b) ((a) > (b) ? (a) : (b))
+// TODO: workaround for unified headers migration - only made available when
+// __USE_BSD or __BIONIC__ are defined, so just add those here...
+#define letoh16(x) (x)
+#define letoh32(x) (x)
+
struct engine {
int dummy;
};
diff --git a/solenv/clang-format/blacklist b/solenv/clang-format/blacklist
index d7d60551c62a..f6e2c9e1b485 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -5828,7 +5828,6 @@ include/LibreOfficeKit/LibreOfficeKitEnums.h
include/LibreOfficeKit/LibreOfficeKitGtk.h
include/LibreOfficeKit/LibreOfficeKitInit.h
include/LibreOfficeKit/LibreOfficeKitTypes.h
-include/android/compatibility.hxx
include/animations/animationnodehelper.hxx
include/apple_remote/RemoteControl.h
include/apple_remote/RemoteMainController.h
diff --git a/solenv/gbuild/platform/android.mk b/solenv/gbuild/platform/android.mk
index ae1a9ea0b618..bc8ad996f8df 100644
--- a/solenv/gbuild/platform/android.mk
+++ b/solenv/gbuild/platform/android.mk
@@ -8,15 +8,26 @@
#
ifeq ($(DISABLE_DYNLOADING),TRUE)
-# Link with -lgnustl_static
-gb_STDLIBS := \
- -lgnustl_static \
- -lm
+ifeq ($(ANDROID_APP_ABI),armeabi-v7a)
+# TODO: gnustl is deprecated/will be removed in future versions of the ndk
+gb_STDLIBS := -lgnustl_static
else
-# Link almost everything with -lgnustl_shared
gb_STDLIBS := \
- -lgnustl_shared \
+ -lc++_static \
+ -lc++abi \
+ -landroid_support \
+
+endif
+
+else
+
+ifeq ($(ANDROID_APP_ABI),armeabi-v7a)
+# TODO: gnustl is deprecated/will be removed in future versions of the ndk
+gb_STDLIBS := -lgnustl_shared
+else
+gb_STDLIBS := -lc++_shared
+endif
endif