[Libreoffice-commits] core.git: android/Bootstrap android/source bridges/Library_cpp_uno.mk bridges/source config_host.mk.in configure.ac distro-configs/LibreOfficeAndroid.conf distro-configs/LibreOfficeAndroidX86.conf drawinglayer/source external/boost external/cppunit external/icu external/liborcus external/nss i18nutil/source include/android sal/android solenv/clang-format solenv/gbuild

Christian Lohmaier lohmaier+LibreOffice at googlemail.com
Thu Jan 18 13:44:48 UTC 2018


 android/Bootstrap/Makefile.shared                         |    2 
 android/source/build.gradle                               |   25 +++---
 android/source/gradle.properties                          |    2 
 android/source/gradle/wrapper/gradle-wrapper.properties   |    4 -
 android/source/jni/Android.mk                             |    8 --
 bridges/Library_cpp_uno.mk                                |    1 
 bridges/source/cpp_uno/gcc3_linux_arm/except.cxx          |    4 -
 bridges/source/cpp_uno/gcc3_linux_arm/share.hxx           |   53 +++++++++++---
 bridges/source/cpp_uno/gcc3_linux_arm/uno2cpp.cxx         |    7 -
 bridges/source/cpp_uno/gcc3_linux_intel/except.cxx        |    6 +
 config_host.mk.in                                         |    1 
 configure.ac                                              |   31 ++++++--
 distro-configs/LibreOfficeAndroid.conf                    |    1 
 distro-configs/LibreOfficeAndroidX86.conf                 |    1 
 drawinglayer/source/primitive2d/borderlineprimitive2d.cxx |    1 
 external/boost/UnpackedTarball_boost.mk                   |    3 
 external/boost/boost-android-unified.patch.1              |   28 +++++++
 external/cppunit/ExternalProject_cppunit.mk               |    2 
 external/icu/ExternalProject_icu.mk                       |    2 
 external/liborcus/ExternalProject_liborcus.mk             |    2 
 external/liborcus/UnpackedTarball_liborcus.mk             |    4 -
 external/nss/ExternalProject_nss.mk                       |    4 -
 external/nss/nss-android.patch.1                          |   30 +++++++
 i18nutil/source/utility/paper.cxx                         |    3 
 include/android/compatibility.hxx                         |   34 +-------
 sal/android/lo-bootstrap.c                                |    5 +
 solenv/clang-format/blacklist                             |    1 
 solenv/gbuild/platform/android.mk                         |   23 ++++--
 28 files changed, 197 insertions(+), 91 deletions(-)

New commits:
commit 4082a18406c18af7b4fcef7bd501c3679c3be56b
Author: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>
Date:   Wed Nov 22 23:08:06 2017 +0100

    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 at googlemail.com>
    Tested-by: Christian Lohmaier <lohmaier+LibreOffice at googlemail.com>

diff --git a/android/Bootstrap/Makefile.shared b/android/Bootstrap/Makefile.shared
index 332192918e9c..0c9944efff0f 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 8e9ed1e0d868..b06bd4b28f35 100644
--- a/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
+++ b/bridges/source/cpp_uno/gcc3_linux_intel/except.cxx
@@ -156,6 +156,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
@@ -173,6 +176,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
             {
@@ -247,7 +251,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 0cc343cd351d..cf9cefbd0fc8 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 26dbf1004f2a..b27e1abb4293 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 599ecc8d17a8..2e6d4e6382a9 100644
--- a/distro-configs/LibreOfficeAndroid.conf
+++ b/distro-configs/LibreOfficeAndroid.conf
@@ -9,3 +9,4 @@
 --without-helppack-integration
 --without-junit
 --disable-c++17
+--disable-largefile
diff --git a/distro-configs/LibreOfficeAndroidX86.conf b/distro-configs/LibreOfficeAndroidX86.conf
index caec0a8d68cb..4e25bc58b0bd 100644
--- a/distro-configs/LibreOfficeAndroidX86.conf
+++ b/distro-configs/LibreOfficeAndroidX86.conf
@@ -9,3 +9,4 @@
 --without-helppack-integration
 --without-junit
 --disable-c++17
+--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 4156bf7c3261..44ee759141e5 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
+
 $(eval $(call gb_UnpackedTarball_UnpackedTarball,boost))
 
 $(eval $(call gb_UnpackedTarball_set_tarball,boost,$(BOOST_TARBALL)))
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 5bceb14e373b..e1ec30938bf7 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))"
 
 # DATASUBDIR=data in cross-compiling case, because --disable-tools completely skips the
 # data directory/doesn't build the requested library in that case (icu/source/Makefile.in)
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 e9270c24a5cb..0dc6627de4a2 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..6dc43c1b4ffe 100644
--- a/external/nss/nss-android.patch.1
+++ b/external/nss/nss-android.patch.1
@@ -39,11 +39,37 @@ 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) \
                         --with-android-platform=$(ANDROID_SYSROOT)
+unified headers / ndk16 does have it in it's support module
+diff -ur nss.org/nspr/pr/src/md/unix/unix.c nss/nspr/pr/src/md/unix/unix.c
+--- nss.org/nspr/pr/src/md/unix/unix.c	2017-11-22 01:19:16.098553361 +0100
++++ nss/nspr/pr/src/md/unix/unix.c	2017-11-22 01:20:03.794550181 +0100
+@@ -2714,21 +2714,6 @@
+ #endif /* defined(_PR_NO_LARGE_FILES) || defined(SOLARIS2_5) */
+ 
+ /* Android <= 19 doesn't have mmap64. */
+-#if defined(ANDROID) && __ANDROID_API__ <= 19
+-PR_IMPORT(void) *__mmap2(void *, size_t, int, int, int, size_t);
+-
+-#define ANDROID_PAGE_SIZE 4096
+-
+-static void *
+-mmap64(void *addr, size_t len, int prot, int flags, int fd, loff_t offset)
+-{
+-    if (offset & (ANDROID_PAGE_SIZE - 1)) {
+-        errno = EINVAL;
+-        return MAP_FAILED;
+-    }
+-    return __mmap2(addr, len, prot, flags, fd, offset / ANDROID_PAGE_SIZE);
+-}
+-#endif
+ 
+ #if defined(OSF1) && defined(__GNUC__)
+ 
diff --git a/i18nutil/source/utility/paper.cxx b/i18nutil/source/utility/paper.cxx
index b052ad54de2c..0d4b434c061c 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 eb22dd8114b7..ff023e82d10f 100644
--- a/solenv/clang-format/blacklist
+++ b/solenv/clang-format/blacklist
@@ -5830,7 +5830,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
 


More information about the Libreoffice-commits mailing list