summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2019-08-07 12:06:25 +0200
committerChristian Lohmaier <lohmaier+LibreOffice@googlemail.com>2019-08-08 15:59:29 +0200
commita7f6338875931d8afff55cb39ead8f6600af04cb (patch)
tree0678222d12a0ddc8b328d758c3a76395f4d944af
parentbef93028584ab804d6daba4c4abcabfe6e58dc0f (diff)
android: support NDK 19 and above (20 as of this commit)
support for targeting API 14 and 15 was removed in NDK 18, so set minimum version to 16 mips support was removed in NDK 17 Clang now takes care about correct linking with libc++ shared or static, so don't manually specify them anymore. Same with __ANDROID_API_LEVEL__ define and the sysroot / isystem handling, that is all covered by a single -target <triple><version> simplifying things quite a bit. also align ownloud sdk values with main build.gradle Change-Id: Ib3ae4484e52214677e826270b731ecf7c5c15445 Reviewed-on: https://gerrit.libreoffice.org/77104 Reviewed-by: Jan Holesovsky <kendy@collabora.com> Tested-by: Jenkins Reviewed-by: Christian Lohmaier <lohmaier+LibreOffice@googlemail.com>
-rw-r--r--android/Bootstrap/Makefile.shared2
-rw-r--r--android/source/build.gradle6
-rw-r--r--bridges/Library_cpp_uno.mk4
-rw-r--r--configure.ac78
-rw-r--r--external/nss/ExternalProject_nss.mk2
-rw-r--r--external/owncloud-android-lib/build.gradle16
-rw-r--r--solenv/gbuild/platform/ANDROID_GODSON_GCC.mk17
-rw-r--r--solenv/gbuild/platform/android.mk9
8 files changed, 48 insertions, 86 deletions
diff --git a/android/Bootstrap/Makefile.shared b/android/Bootstrap/Makefile.shared
index 942f5f8179ee..0be8e1e14250 100644
--- a/android/Bootstrap/Makefile.shared
+++ b/android/Bootstrap/Makefile.shared
@@ -59,7 +59,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 -Wl,-soname,liblo-native-code.so -o $(OBJLOCAL)/liblo-native-code.so -I$(BUILDDIR)/config_host -I$(SRCDIR)/include native-code.cxx -L$(INSTDIR)/$(LIBO_LIB_FOLDER) $(WHOLELIBS) $(LIBS) -lc++_static -lc++abi -landroid_support $(if $(filter armeabi-v7a,$(ANDROID_APP_ABI)),-lunwind) $(addprefix -l,$(NSSLIBS)) -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 -Wl,-soname,liblo-native-code.so -o $(OBJLOCAL)/liblo-native-code.so -I$(BUILDDIR)/config_host -I$(SRCDIR)/include native-code.cxx -L$(INSTDIR)/$(LIBO_LIB_FOLDER) $(WHOLELIBS) $(LIBS) -static-libstdc++ $(addprefix -l,$(NSSLIBS)) -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 e1358684b05a..1ea328c4e6cf 100644
--- a/android/source/build.gradle
+++ b/android/source/build.gradle
@@ -61,7 +61,7 @@ android {
strippedUIEditing.assets.srcDirs 'assets_strippedUI'
}
defaultConfig {
- minSdkVersion 14
+ minSdkVersion 16
targetSdkVersion 26
vectorDrawables.useSupportLibrary = true
}
@@ -92,6 +92,10 @@ android {
}
fullUI.dimension "default"
}
+ lintOptions {
+ // don't error-out on missing translations
+ warning 'MissingTranslation'
+ }
}
/* remark inherited from makefile:
diff --git a/bridges/Library_cpp_uno.mk b/bridges/Library_cpp_uno.mk
index eded406d3f35..f8efb498a4b1 100644
--- a/bridges/Library_cpp_uno.mk
+++ b/bridges/Library_cpp_uno.mk
@@ -88,7 +88,7 @@ endif
else ifeq ($(CPUNAME),GODSON)
-ifneq ($(filter ANDROID LINUX,$(OS)),)
+ifneq ($(filter LINUX,$(OS)),)
bridges_SELECTED_BRIDGE := gcc3_linux_mips
bridge_noopt_objects := cpp2uno uno2cpp
bridge_exception_objects := except
@@ -96,7 +96,7 @@ endif
else ifeq ($(CPUNAME),GODSON64)
-ifneq ($(filter ANDROID LINUX,$(OS)),)
+ifneq ($(filter LINUX,$(OS)),)
bridges_SELECTED_BRIDGE := gcc3_linux_mips64
bridge_asm_objects := call
bridge_noopt_objects := cpp2uno uno2cpp
diff --git a/configure.ac b/configure.ac
index 11474b80a891..3dcae0fa9984 100644
--- a/configure.ac
+++ b/configure.ac
@@ -413,64 +413,47 @@ if test -n "$with_android_ndk"; then
11.1.*|12.1.*|13.1.*|14.1.*)
AC_MSG_ERROR([Building for Android is only supported with NDK versions above 16.x.*])
;;
- 16.*)
+ 16.*|17.*|18.*|19.*|20.*)
;;
*)
- 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."
+ AC_MSG_WARN([Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk.])
+ add_warning "Untested Android NDK version $ANDROID_NDK_VERSION, only versions 16.* til 20.* have been used successfully. Proceed at your own risk."
;;
esac
- ANDROID_API_LEVEL=14
+ ANDROID_API_LEVEL=16
android_cpu=$host_cpu
- ANDROID_ARCH=$android_cpu
if test $host_cpu = arm; then
- android_platform_prefix=$android_cpu-linux-androideabi
+ android_platform_prefix=arm-linux-androideabi
android_gnu_prefix=$android_platform_prefix
- LLVM_TRIPLE=armv7-none-linux-androideabi
+ LLVM_TRIPLE=armv7a-linux-androideabi
ANDROID_APP_ABI=armeabi-v7a
ANDROIDCFLAGS="-mthumb -march=armv7-a -mfloat-abi=softfp -mfpu=neon -Wl,--fix-cortex-a8"
elif test $host_cpu = aarch64; then
- android_platform_prefix=$android_cpu-linux-android
+ android_platform_prefix=aarch64-linux-android
android_gnu_prefix=$android_platform_prefix
- LLVM_TRIPLE=aarch64-none-linux-android
+ LLVM_TRIPLE=$android_platform_prefix
# minimum android version that supports aarch64
ANDROID_API_LEVEL=21
ANDROID_APP_ABI=arm64-v8a
- ANDROID_ARCH=arm64
- elif test $host_cpu = mips; then
- android_platform_prefix=mipsel-linux-android
- android_gnu_prefix=$android_platform_prefix
- LLVM_TRIPLE=mipsel-none-linux-android
- ANDROID_APP_ABI=mips
else
# host_cpu is something like "i386" or "i686" I guess, NDK uses
# "x86" in some contexts
android_cpu=x86
android_platform_prefix=$android_cpu
android_gnu_prefix=i686-linux-android
- LLVM_TRIPLE=i686-none-linux-android
+ LLVM_TRIPLE=$android_gnu_prefix
ANDROID_APP_ABI=x86
- ANDROID_ARCH=$android_cpu
- ANDROIDCFLAGS="-march=atom"
fi
case "$with_android_ndk_toolchain_version" in
clang5.0)
ANDROID_GCC_TOOLCHAIN_VERSION=4.9
- ANDROID_BINUTILS_DIR=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION
- ANDROID_COMPILER_DIR=$ANDROID_NDK_HOME/toolchains/llvm
;;
*)
AC_MSG_ERROR([Unrecognized value for the --with-android-ndk-toolchain-version option. Building for Android is only supported with Clang 5.*])
esac
- if test ! -d $ANDROID_BINUTILS_DIR; then
- AC_MSG_ERROR([No directory $ANDROID_BINUTILS_DIR])
- elif test ! -d $ANDROID_COMPILER_DIR; then
- AC_MSG_ERROR([No directory $ANDROID_COMPILER_DIR])
- fi
-
# NDK 15 or later toolchain is 64bit-only, except for Windows that we don't support. Using a 64-bit
# linker is required if you compile large parts of the code with -g. A 32-bit linker just won't
# manage to link the (app-specific) single huge .so that is built for the app in
@@ -479,41 +462,37 @@ if test -n "$with_android_ndk"; then
# all objects have been built with debug information.)
case $build_os in
linux-gnu*)
- ndk_build_os=linux
+ android_HOST_TAG=linux-x86_64
;;
darwin*)
- ndk_build_os=darwin
+ android_HOST_TAG=darwin-x86_64
;;
*)
AC_MSG_ERROR([We only support building for Android from Linux or macOS])
+ # ndk would also support windows and windows-x86_64
;;
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
+ android_TOOLCHAIN=$ANDROID_NDK_HOME/toolchains/llvm/prebuilt/$android_HOST_TAG
+ ANDROID_COMPILER_BIN=$android_TOOLCHAIN/bin
+ dnl TODO: NSS build uses it...
+ ANDROID_BINUTILS_PREBUILT_ROOT=$ANDROID_NDK_HOME/toolchains/$android_platform_prefix-$ANDROID_GCC_TOOLCHAIN_VERSION/prebuilt/$android_HOST_TAG
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
- test -z "$NM" && NM=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-nm
- test -z "$OBJDUMP" && OBJDUMP=$ANDROID_BINUTILS_PREBUILT_ROOT/bin/$android_gnu_prefix-objdump
- 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$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 elsewhere, 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/llvm-libc++/libs/$ANDROID_APP_ABI"
+ test -z "$AR" && AR=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ar
+ test -z "$NM" && NM=$ANDROID_COMPILER_BIN/$android_gnu_prefix-nm
+ test -z "$OBJDUMP" && OBJDUMP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-objdump
+ test -z "$RANLIB" && RANLIB=$ANDROID_COMPILER_BIN/$android_gnu_prefix-ranlib
+ test -z "$STRIP" && STRIP=$ANDROID_COMPILER_BIN/$android_gnu_prefix-strip
+
+ ANDROIDCFLAGS="$ANDROIDCFLAGS -target ${LLVM_TRIPLE}${ANDROID_API_LEVEL}"
+ ANDROIDCFLAGS="$ANDROIDCFLAGS -no-canonical-prefixes -ffunction-sections -fdata-sections -Qunused-arguments"
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/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"
+ ANDROIDCXXFLAGS="$ANDROIDCFLAGS -stdlib=libc++"
if test -z "$CC"; then
CC="$ANDROID_COMPILER_BIN/clang $ANDROIDCFLAGS"
@@ -822,7 +801,7 @@ if test "$_os" = "Android" ; then
# Verify that the NDK and SDK options are proper
if test -z "$with_android_ndk"; then
AC_MSG_ERROR([the --with-android-ndk option is mandatory, unless it is available at external/android-ndk/.])
- elif test ! -f "$ANDROID_NDK_HOME/platforms/android-${ANDROID_API_LEVEL}/arch-${ANDROID_ARCH}/usr/lib/libc.a"; then
+ elif test ! -f "$ANDROID_NDK_HOME/meta/abis.json"; then
AC_MSG_ERROR([the --with-android-ndk option does not point to an Android NDK])
fi
@@ -4536,11 +4515,6 @@ linux-android*)
RTL_ARCH=AARCH64
PLATFORMID=android_aarch64
;;
- mips|mipsel)
- CPUNAME=GODSON # Weird, but maybe that's the LO convention?
- RTL_ARCH=MIPS_EL
- PLATFORMID=android_mips_el
- ;;
i*86)
CPUNAME=INTEL
RTL_ARCH=x86
diff --git a/external/nss/ExternalProject_nss.mk b/external/nss/ExternalProject_nss.mk
index 211fa1d64437..e97756aca831 100644
--- a/external/nss/ExternalProject_nss.mk
+++ b/external/nss/ExternalProject_nss.mk
@@ -52,7 +52,7 @@ $(call gb_ExternalProject_get_state_target,nss,build): $(call gb_ExternalExecuta
COMMA=$(COMMA) \
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) ANDROID_PREFIX=$(HOST_PLATFORM) ANDROID_SYSROOT=$(SYSBASE) ANDROID_TOOLCHAIN=$(ANDROID_BINUTILS_PREBUILT_ROOT)) \
+ $(if $(filter ANDROID,$(OS)),OS_TARGET=Android OS_TARGET_RELEASE=16 ARCHFLAG="" DEFAULT_COMPILER=clang ANDROID_NDK=$(ANDROID_NDK_HOME) ANDROID_TOOLCHAIN_VERSION=$(ANDROID_GCC_TOOLCHAIN_VERSION) ANDROID_PREFIX=$(HOST_PLATFORM) ANDROID_SYSROOT=$(ANDROID_NDK_HOME)/sysroot ANDROID_TOOLCHAIN=$(ANDROID_BINUTILS_PREBUILT_ROOT)) \
NSS_DISABLE_GTESTS=1 \
nss_build_all \
&& rm -f $(call gb_UnpackedTarball_get_dir,nss)/dist/out/lib/*.a \
diff --git a/external/owncloud-android-lib/build.gradle b/external/owncloud-android-lib/build.gradle
index beb627fcc437..9203dc45a549 100644
--- a/external/owncloud-android-lib/build.gradle
+++ b/external/owncloud-android-lib/build.gradle
@@ -2,9 +2,17 @@ apply plugin: 'com.android.library'
buildscript {
repositories {
jcenter()
+ google()
}
dependencies {
- classpath 'com.android.tools.build:gradle:2.3.3'
+ classpath 'com.android.tools.build:gradle:3.1.3'
+ }
+}
+
+allprojects {
+ repositories {
+ jcenter()
+ google()
}
}
@@ -18,11 +26,11 @@ android {
}
compileSdkVersion 26
- buildToolsVersion "26.0.1"
+ buildToolsVersion "27.0.3"
defaultConfig {
- minSdkVersion 14
- targetSdkVersion 24
+ minSdkVersion 16
+ targetSdkVersion 26
}
sourceSets {
diff --git a/solenv/gbuild/platform/ANDROID_GODSON_GCC.mk b/solenv/gbuild/platform/ANDROID_GODSON_GCC.mk
deleted file mode 100644
index 0eb4f0a96e48..000000000000
--- a/solenv/gbuild/platform/ANDROID_GODSON_GCC.mk
+++ /dev/null
@@ -1,17 +0,0 @@
-# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
-#
-# This file is part of the LibreOffice project.
-#
-# This Source Code Form is subject to the terms of the Mozilla Public
-# License, v. 2.0. If a copy of the MPL was not distributed with this
-# file, You can obtain one at http://mozilla.org/MPL/2.0/.
-#
-
-# please make generic modifications to unxgcc.mk or android.mk
-gb_CPUDEFS += -DMIPS
-gb_COMPILEROPTFLAGS := -Os
-
-include $(GBUILDDIR)/platform/unxgcc.mk
-include $(GBUILDDIR)/platform/android.mk
-
-# vim: set noet sw=4:
diff --git a/solenv/gbuild/platform/android.mk b/solenv/gbuild/platform/android.mk
index 572a7c5b1028..3c25314639e1 100644
--- a/solenv/gbuild/platform/android.mk
+++ b/solenv/gbuild/platform/android.mk
@@ -9,14 +9,7 @@
ifeq ($(DISABLE_DYNLOADING),TRUE)
-gb_STDLIBS := \
- -lc++_static \
- -lc++abi \
- -landroid_support \
-
-else
-
-gb_STDLIBS := -lc++_shared
+gb_STDLIBS := -static-libstdc++
endif