Kaydet (Commit) 4082a184 authored tarafından Christian Lohmaier's avatar Christian Lohmaier

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/45163Reviewed-by: 's avatarChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>
Tested-by: 's avatarChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>
üst 0e8d0fe0
...@@ -60,7 +60,7 @@ WHOLELIBS = \ ...@@ -60,7 +60,7 @@ WHOLELIBS = \
$(OBJLOCAL)/liblo-native-code.so : native-code.cxx $(ALL_STATIC_LIBS) $(OBJLOCAL)/liblo-native-code.so : native-code.cxx $(ALL_STATIC_LIBS)
@echo "Linking $@" @echo "Linking $@"
mkdir -p $(OBJLOCAL) 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 $(SODEST)/liblo-native-code.so : $(OBJLOCAL)/liblo-native-code.so
mkdir -p $(SODEST) mkdir -p $(SODEST)
......
...@@ -17,31 +17,34 @@ allprojects { ...@@ -17,31 +17,34 @@ allprojects {
buildscript { buildscript {
repositories { repositories {
jcenter() jcenter()
maven {
url "https://maven.google.com"
}
} }
dependencies { dependencies {
classpath 'com.android.tools.build:gradle:2.3.3' classpath 'com.android.tools.build:gradle:3.0.1'
} }
} }
// compile-time dependencies // compile-time dependencies
dependencies { dependencies {
compile fileTree(dir: "${liboInstdir}/${liboUREJavaFolder}", include: [ implementation fileTree(dir: "${liboInstdir}/${liboUREJavaFolder}", include: [
"java_uno.jar", "java_uno.jar",
"juh.jar", "juh.jar",
"jurt.jar", "jurt.jar",
"ridl.jar", "ridl.jar",
"unoloader.jar" "unoloader.jar"
]) ])
compile files("${liboInstdir}/${liboShareJavaFolder}/unoil.jar") implementation files("${liboInstdir}/${liboShareJavaFolder}/unoil.jar")
debugCompile(name:'owncloud_android_lib-debug', ext:'aar') debugImplementation(name:'owncloud_android_lib-debug', ext:'aar')
releaseCompile(name:'owncloud_android_lib-release', ext:'aar') releaseImplementation(name:'owncloud_android_lib-release', ext:'aar')
compile 'com.android.support:design:26.1.0' // also pulls-in corresponding support libraries implementation 'com.android.support:design:27.0.1' // also pulls-in corresponding support libraries
compile 'com.android.support.constraint:constraint-layout:1.0.2' implementation 'com.android.support.constraint:constraint-layout:1.0.2'
} }
android { android {
compileSdkVersion 26 compileSdkVersion 26
buildToolsVersion "26.0.1" buildToolsVersion "27.0.1"
compileOptions { compileOptions {
// silence some java-language features hints // silence some java-language features hints
sourceCompatibility 6 sourceCompatibility 6
...@@ -77,9 +80,11 @@ android { ...@@ -77,9 +80,11 @@ android {
manifestPlaceholders = [installLocation: "preferExternal", extractNativeLibs: "true"] manifestPlaceholders = [installLocation: "preferExternal", extractNativeLibs: "true"]
} }
} }
flavorDimensions "default"
productFlavors { productFlavors {
strippedUI strippedUI.dimension "default"
fullUI fullUI.dimension "default"
} }
} }
......
org.gradle.jvmargs=-Xmx2048m org.gradle.jvmargs=-Xmx3072m
#Tue Mar 14 19:29:07 CET 2017 #Mon Nov 20 19:19:05 CET 2017
distributionBase=GRADLE_USER_HOME distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists distributionPath=wrapper/dists
zipStoreBase=GRADLE_USER_HOME zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists 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
# 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)
...@@ -199,6 +199,7 @@ endif ...@@ -199,6 +199,7 @@ endif
# it off. # it off.
ifeq ($(COM),GCC) ifeq ($(COM),GCC)
$(eval $(call gb_Library_add_cxxflags,gcc3_uno,\ $(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-omit-frame-pointer \
-fno-strict-aliasing \ -fno-strict-aliasing \
$(if $(filter TRUE,$(ENABLE_LTO)),-fno-lto) \ $(if $(filter TRUE,$(ENABLE_LTO)),-fno-lto) \
......
...@@ -309,7 +309,7 @@ namespace CPPU_CURRENT_NAMESPACE ...@@ -309,7 +309,7 @@ namespace CPPU_CURRENT_NAMESPACE
return; return;
} }
typelib_TypeDescription * pExcTypeDescr = 0; typelib_TypeDescription * pExcTypeDescr = nullptr;
OUString unoName( toUNOname( header->exceptionType->name() ) ); OUString unoName( toUNOname( header->exceptionType->name() ) );
#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1
OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) ); OString cstr_unoName( OUStringToOString( unoName, RTL_TEXTENCODING_ASCII_US ) );
...@@ -318,7 +318,7 @@ namespace CPPU_CURRENT_NAMESPACE ...@@ -318,7 +318,7 @@ namespace CPPU_CURRENT_NAMESPACE
typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData ); typelib_typedescription_getByName( &pExcTypeDescr, unoName.pData );
if (0 == pExcTypeDescr) 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(); Type const & rType = cppu::UnoType<decltype(aRE)>::get();
uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno ); uno_type_any_constructAndConvert( pUnoExc, &aRE, rType.getTypeLibType(), pCpp2Uno );
SAL_WARN("bridges", aRE.Message); SAL_WARN("bridges", aRE.Message);
......
...@@ -23,11 +23,7 @@ ...@@ -23,11 +23,7 @@
#include <typeinfo> #include <typeinfo>
#include <exception> #include <exception>
#include <cstddef> #include <cstddef>
#ifndef ANDROID
#include <unwind.h> #include <unwind.h>
#else
#include <unwind-arm.h>
#endif
#include <cxxabi.h> #include <cxxabi.h>
#ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h #ifndef _GLIBCXX_CDTOR_CALLABI // new in GCC 4.7 cxxabi.h
...@@ -37,13 +33,35 @@ ...@@ -37,13 +33,35 @@
#include "config_cxxabi.h" #include "config_cxxabi.h"
#include "uno/mapping.h" #include "uno/mapping.h"
namespace CPPU_CURRENT_NAMESPACE #if !HAVE_CXXABI_H_CLASS_TYPE_INFO
{ // <https://mentorembedded.github.io/cxx-abi/abi.html>,
// libstdc++-v3/libsupc++/cxxabi.h:
void dummy_can_throw_anything( char const * ); 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 struct __cxa_exception
{ {
std::type_info *exceptionType; std::type_info *exceptionType;
...@@ -68,12 +86,26 @@ namespace CPPU_CURRENT_NAMESPACE ...@@ -68,12 +86,26 @@ namespace CPPU_CURRENT_NAMESPACE
_Unwind_Exception unwindHeader; _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( extern "C" void *__cxa_allocate_exception(
std::size_t thrown_size ) throw(); std::size_t thrown_size ) throw();
extern "C" void __cxa_throw ( extern "C" void __cxa_throw (
void *thrown_exception, std::type_info *tinfo, void *thrown_exception, std::type_info *tinfo,
void (*dest) (void *) ) __attribute__((noreturn)); void (*dest) (void *) ) __attribute__((noreturn));
}
#if !HAVE_CXXABI_H_CXA_EH_GLOBALS
namespace __cxxabiv1 {
struct __cxa_eh_globals struct __cxa_eh_globals
{ {
__cxa_exception *caughtExceptions; __cxa_exception *caughtExceptions;
...@@ -83,6 +115,7 @@ namespace CPPU_CURRENT_NAMESPACE ...@@ -83,6 +115,7 @@ namespace CPPU_CURRENT_NAMESPACE
#endif #endif
}; };
} }
#endif
#if !HAVE_CXXABI_H_CXA_GET_GLOBALS #if !HAVE_CXXABI_H_CXA_GET_GLOBALS
namespace __cxxabiv1 { namespace __cxxabiv1 {
...@@ -95,7 +128,7 @@ namespace CPPU_CURRENT_NAMESPACE ...@@ -95,7 +128,7 @@ namespace CPPU_CURRENT_NAMESPACE
void raiseException( void raiseException(
uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ); uno_Any * pUnoExc, uno_Mapping * pUno2Cpp );
void fillUnoException( void fillUnoException(
__cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno ); __cxxabiv1::__cxa_exception * header, uno_Any *, uno_Mapping * pCpp2Uno );
} }
extern "C" void privateSnippetExecutor(); extern "C" void privateSnippetExecutor();
......
...@@ -571,10 +571,9 @@ static void cpp_call( ...@@ -571,10 +571,9 @@ static void cpp_call(
catch (...) catch (...)
{ {
// fill uno exception // fill uno exception
fillUnoException( CPPU_CURRENT_NAMESPACE::fillUnoException(
reinterpret_cast< CPPU_CURRENT_NAMESPACE::__cxa_eh_globals * >( __cxxabiv1::__cxa_get_globals()->caughtExceptions,
__cxxabiv1::__cxa_get_globals())->caughtExceptions, *ppUnoExc, pThis->getBridge()->getCpp2Uno());
*ppUnoExc, pThis->getBridge()->getCpp2Uno());
// temporary params // temporary params
for ( ; nTempIndices--; ) for ( ; nTempIndices--; )
......
...@@ -156,6 +156,9 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) ...@@ -156,6 +156,9 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr )
#if OSL_DEBUG_LEVEL > 1 #if OSL_DEBUG_LEVEL > 1
fprintf( stderr,"generated rtti for %s\n", rttiName ); fprintf( stderr,"generated rtti for %s\n", rttiName );
#endif #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) if (pTypeDescr->pBaseTypeDescription)
{ {
// ensure availability of base // ensure availability of base
...@@ -173,6 +176,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr ) ...@@ -173,6 +176,7 @@ type_info * RTTI::getRTTI( typelib_CompoundTypeDescription *pTypeDescr )
pair< t_rtti_map::iterator, bool > insertion( pair< t_rtti_map::iterator, bool > insertion(
m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) ); m_generatedRttis.insert( t_rtti_map::value_type( unoName, rtti ) ) );
SAL_WARN_IF( !insertion.second, "bridges", "### inserting new generated rtti failed?!" ); SAL_WARN_IF( !insertion.second, "bridges", "### inserting new generated rtti failed?!" );
#endif
} }
else // taking already generated rtti else // taking already generated rtti
{ {
...@@ -247,7 +251,9 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp ) ...@@ -247,7 +251,9 @@ void raiseException( uno_Any * pUnoExc, uno_Mapping * pUno2Cpp )
} }
rtti = s_rtti->getRTTI(reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr)); rtti = s_rtti->getRTTI(reinterpret_cast<typelib_CompoundTypeDescription *>(pTypeDescr));
TYPELIB_DANGER_RELEASE( pTypeDescr ); TYPELIB_DANGER_RELEASE( pTypeDescr );
#if !defined(ANDROID) // see TODO above
assert(rtti && "### no rtti for throwing exception!"); assert(rtti && "### no rtti for throwing exception!");
#endif
if (! rtti) if (! rtti)
{ {
throw RuntimeException( throw RuntimeException(
......
...@@ -20,6 +20,7 @@ export ANDROID_NDK_HOME=@ANDROID_NDK_HOME@ ...@@ -20,6 +20,7 @@ export ANDROID_NDK_HOME=@ANDROID_NDK_HOME@
export ANDROID_APP_ABI=@ANDROID_APP_ABI@ export ANDROID_APP_ABI=@ANDROID_APP_ABI@
export ANDROID_SDK_HOME=@ANDROID_SDK_HOME@ export ANDROID_SDK_HOME=@ANDROID_SDK_HOME@
export ANDROID_PACKAGE_NAME=@ANDROID_PACKAGE_NAME@ 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 ANDROID_GCC_TOOLCHAIN_VERSION=@ANDROID_GCC_TOOLCHAIN_VERSION@
export ANT=@ANT@ export ANT=@ANT@
export ANT_HOME=@ANT_HOME@ export ANT_HOME=@ANT_HOME@
......
...@@ -388,16 +388,16 @@ if test -n "$with_android_ndk"; then ...@@ -388,16 +388,16 @@ if test -n "$with_android_ndk"; then
fi fi
case $ANDROID_NDK_VERSION in case $ANDROID_NDK_VERSION in
r9*|r10*) 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.*) 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.]) 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 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 16.* have been used successfully. Proceed at your own risk."
;; ;;
esac esac
...@@ -431,6 +431,7 @@ if test -n "$with_android_ndk"; then ...@@ -431,6 +431,7 @@ if test -n "$with_android_ndk"; then
android_gnu_prefix=i686-linux-android android_gnu_prefix=i686-linux-android
LLVM_TRIPLE=i686-none-linux-android LLVM_TRIPLE=i686-none-linux-android
ANDROID_APP_ABI=x86 ANDROID_APP_ABI=x86
ANDROID_ARCH=$android_cpu
ANDROIDCFLAGS="-march=atom" ANDROIDCFLAGS="-march=atom"
fi fi
...@@ -469,6 +470,7 @@ if test -n "$with_android_ndk"; then ...@@ -469,6 +470,7 @@ if test -n "$with_android_ndk"; then
esac esac
ANDROID_COMPILER_BIN=$ANDROID_COMPILER_DIR/prebuilt/$ndk_build_os-x86_64/bin 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 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 "$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 test -z "$AR" && AR=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ar
...@@ -477,16 +479,29 @@ if test -n "$with_android_ndk"; then ...@@ -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 "$RANLIB" && RANLIB=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-ranlib
test -z "$STRIP" && STRIP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-strip 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 --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 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 # -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 # $CC and $CXX when building external libraries
ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2" ANDROIDCFLAGS="$ANDROIDCFLAGS -flto -fuse-linker-plugin -O2"
fi 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 if test -z "$CC"; then
CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS" CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
......
...@@ -9,3 +9,4 @@ ...@@ -9,3 +9,4 @@
--without-helppack-integration --without-helppack-integration
--without-junit --without-junit
--disable-c++17 --disable-c++17
--disable-largefile
...@@ -9,3 +9,4 @@ ...@@ -9,3 +9,4 @@
--without-helppack-integration --without-helppack-integration
--without-junit --without-junit
--disable-c++17 --disable-c++17
--disable-largefile
...@@ -26,7 +26,6 @@ ...@@ -26,7 +26,6 @@
#include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx> #include <drawinglayer/primitive2d/polypolygonprimitive2d.hxx>
#include <svtools/borderhelper.hxx> #include <svtools/borderhelper.hxx>
#include <editeng/borderline.hxx> #include <editeng/borderline.hxx>
#include <android/compatibility.hxx>
#include <algorithm> #include <algorithm>
#include <cmath> #include <cmath>
......
...@@ -37,6 +37,9 @@ boost_patches += clang-cl.patch.0 ...@@ -37,6 +37,9 @@ boost_patches += clang-cl.patch.0
boost_patches += boost_1_60_0.undef.warning.patch boost_patches += boost_1_60_0.undef.warning.patch
boost_patches += boost_1_63_0.undef.warning.patch.1 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_UnpackedTarball,boost))
$(eval $(call gb_UnpackedTarball_set_tarball,boost,$(BOOST_TARBALL))) $(eval $(call gb_UnpackedTarball_set_tarball,boost,$(BOOST_TARBALL)))
......
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)
...@@ -52,7 +52,7 @@ $(call gb_ExternalProject_get_state_target,cppunit,build) : ...@@ -52,7 +52,7 @@ $(call gb_ExternalProject_get_state_target,cppunit,build) :
$(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________NONE) \ $(if $(filter MACOSX,$(OS)),--prefix=/@.__________________________________________________NONE) \
$(if $(filter WNT,$(OS)),LDFLAGS="-Wl$(COMMA)--enable-runtime-pseudo-reloc-v2") \ $(if $(filter WNT,$(OS)),LDFLAGS="-Wl$(COMMA)--enable-runtime-pseudo-reloc-v2") \
$(if $(filter SOLARIS,$(OS)),LIBS="-lm") \ $(if $(filter SOLARIS,$(OS)),LIBS="-lm") \
$(if $(filter ANDROID,$(OS)),LIBS="-lgnustl_shared -lm") \ $(if $(filter ANDROID,$(OS)),LIBS="$(gb_STDLIBS)") \
CXXFLAGS="$(cppunit_CXXFLAGS)" \ CXXFLAGS="$(cppunit_CXXFLAGS)" \
&& cd src \ && cd src \
&& $(MAKE) \ && $(MAKE) \
......
...@@ -56,7 +56,7 @@ icu_LDFLAGS:=" \ ...@@ -56,7 +56,7 @@ icu_LDFLAGS:=" \
$(if $(SYSBASE),-L../lib -L../../lib -L../stubdata -L../../stubdata -L$(SYSBASE)/usr/lib) \ $(if $(SYSBASE),-L../lib -L../../lib -L../stubdata -L../../stubdata -L$(SYSBASE)/usr/lib) \
$(if $(filter TRUE,$(HAVE_LD_BSYMBOLIC_FUNCTIONS)),\ $(if $(filter TRUE,$(HAVE_LD_BSYMBOLIC_FUNCTIONS)),\
-Wl$(COMMA)-Bsymbolic-functions -Wl$(COMMA)--dynamic-list-cpp-new -Wl$(COMMA)--dynamic-list-cpp-typeinfo) \ -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 # 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) # data directory/doesn't build the requested library in that case (icu/source/Makefile.in)
......
...@@ -44,7 +44,7 @@ else ...@@ -44,7 +44,7 @@ else
liborcus_LIBS+=-L$(gb_StaticLibrary_WORKDIR) -lboost_system -lboost_iostreams -lboost_filesystem liborcus_LIBS+=-L$(gb_StaticLibrary_WORKDIR) -lboost_system -lboost_iostreams -lboost_filesystem
endif endif
ifeq ($(OS),ANDROID) ifeq ($(OS),ANDROID)
liborcus_LIBS+=-lgnustl_shared -lm liborcus_LIBS+=$(gb_STDLIBS)
endif endif
liborcus_CPPCLAGS=$(CPPFLAGS) liborcus_CPPCLAGS=$(CPPFLAGS)
......
...@@ -26,7 +26,9 @@ $(eval $(call gb_UnpackedTarball_add_patches,liborcus,\ ...@@ -26,7 +26,9 @@ $(eval $(call gb_UnpackedTarball_add_patches,liborcus,\
external/liborcus/windows-constants-hack.patch \ external/liborcus/windows-constants-hack.patch \
)) ))
endif 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,\ $(eval $(call gb_UnpackedTarball_add_patches,liborcus,\
external/liborcus/android-workaround.patch \ external/liborcus/android-workaround.patch \
)) ))
......
...@@ -49,9 +49,9 @@ $(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalExecuta ...@@ -49,9 +49,9 @@ $(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalExecuta
RANLIB="$(RANLIB)" \ RANLIB="$(RANLIB)" \
NMEDIT="$(NM)edit" \ NMEDIT="$(NM)edit" \
COMMA=$(COMMA) \ 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 $(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 \ nss_build_all \
&& rm -f $(call gb_UnpackedTarball_get_dir,nss)/dist/out/lib/*.a \ && rm -f $(call gb_UnpackedTarball_get_dir,nss)/dist/out/lib/*.a \
$(if $(filter MACOSX,$(OS)),\ $(if $(filter MACOSX,$(OS)),\
......
...@@ -39,11 +39,37 @@ diff -ur nss.org/nspr/configure nss/nspr/configure ...@@ -39,11 +39,37 @@ diff -ur nss.org/nspr/configure nss/nspr/configure
diff -ur nss.org/nss/Makefile nss/nss/Makefile diff -ur nss.org/nss/Makefile nss/nss/Makefile
--- nss.org/nss/Makefile 2017-09-07 15:29:44.933245745 +0200 --- nss.org/nss/Makefile 2017-09-07 15:29:44.933245745 +0200
+++ nss/nss/Makefile 2017-09-07 15:32:04.347181076 +0200 +++ nss/nss/Makefile 2017-09-07 15:32:04.347181076 +0200
@@ -62,6 +62,7 @@ @@ -62,6 +62,6 @@
ifeq ($(OS_TARGET),Android) ifeq ($(OS_TARGET),Android)
NSPR_CONFIGURE_OPTS += --with-android-ndk=$(ANDROID_NDK) \ NSPR_CONFIGURE_OPTS += --with-android-ndk=$(ANDROID_NDK) \
--target=$(ANDROID_PREFIX) \ - --target=$(ANDROID_PREFIX) \
+ --with-arch=toolchain-default \ + --with-arch=toolchain-default \
--with-android-version=$(OS_TARGET_RELEASE) \ --with-android-version=$(OS_TARGET_RELEASE) \
--with-android-toolchain=$(ANDROID_TOOLCHAIN) \ --with-android-toolchain=$(ANDROID_TOOLCHAIN) \
--with-android-platform=$(ANDROID_SYSROOT) --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__)
...@@ -290,7 +290,8 @@ PaperInfo PaperInfo::getSystemDefaultPaper() ...@@ -290,7 +290,8 @@ PaperInfo PaperInfo::getSystemDefaultPaper()
} }
#endif #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 // try LC_PAPER
locale_t loc = newlocale(LC_PAPER_MASK, "", static_cast<locale_t>(0)); locale_t loc = newlocale(LC_PAPER_MASK, "", static_cast<locale_t>(0));
if (loc != static_cast<locale_t>(0)) if (loc != static_cast<locale_t>(0))
......
...@@ -19,47 +19,25 @@ ...@@ -19,47 +19,25 @@
#include <math.h> #include <math.h>
#if defined(ANDROID) #if defined(ANDROID) && defined(ARM)
#include <string> #include <string>
#include <sstream> #include <sstream>
namespace std namespace std
{ {
inline double fmax(double x, double y) { return ::fmax(x, y); }
inline double fmax(double x, double y) inline long stol(const std::string& str, std::size_t* /*pos*/ = 0, int base = 10)
{
return ::fmax(x, y);
}
inline long stol( const std::string& str, std::size_t* /*pos*/ = 0, int base = 10 )
{ {
char* end; char* end;
return strtol(str.c_str(), &end, base); return strtol(str.c_str(), &end, base);
} }
template<typename T> template <typename T> T round(T x) { return ::round(x); }
T round(T x)
{
return ::round(x);
}
template<typename T>
T trunc(T x)
{
return ::trunc(x);
}
template<typename T> template <typename T> T trunc(T x) { return ::trunc(x); }
T lround(T x)
{
return ::lround(x);
}
template<typename T> template <typename T> T lround(T x) { return ::lround(x); }
T copysign(T x, T y)
{
return ::copysign(x, y);
}
template <typename T> std::string to_string(const T& rNumber) template <typename T> std::string to_string(const T& rNumber)
{ {
......
...@@ -37,6 +37,11 @@ ...@@ -37,6 +37,11 @@
#define MAX(a,b) ((a) > (b) ? (a) : (b)) #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 { struct engine {
int dummy; int dummy;
}; };
......
...@@ -5830,7 +5830,6 @@ include/LibreOfficeKit/LibreOfficeKitEnums.h ...@@ -5830,7 +5830,6 @@ include/LibreOfficeKit/LibreOfficeKitEnums.h
include/LibreOfficeKit/LibreOfficeKitGtk.h include/LibreOfficeKit/LibreOfficeKitGtk.h
include/LibreOfficeKit/LibreOfficeKitInit.h include/LibreOfficeKit/LibreOfficeKitInit.h
include/LibreOfficeKit/LibreOfficeKitTypes.h include/LibreOfficeKit/LibreOfficeKitTypes.h
include/android/compatibility.hxx
include/animations/animationnodehelper.hxx include/animations/animationnodehelper.hxx
include/apple_remote/RemoteControl.h include/apple_remote/RemoteControl.h
include/apple_remote/RemoteMainController.h include/apple_remote/RemoteMainController.h
......
...@@ -8,15 +8,26 @@ ...@@ -8,15 +8,26 @@
# #
ifeq ($(DISABLE_DYNLOADING),TRUE) 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 else
# Link almost everything with -lgnustl_shared
gb_STDLIBS := \ 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 endif
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment