From 4082a18406c18af7b4fcef7bd501c3679c3be56b Mon Sep 17 00:00:00 2001 From: Christian Lohmaier Date: Wed, 22 Nov 2017 23:08:06 +0100 Subject: 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 Tested-by: Christian Lohmaier --- configure.ac | 31 +++++++++++++++++++++++-------- 1 file changed, 23 insertions(+), 8 deletions(-) (limited to 'configure.ac') 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" -- cgit