c6fada2bfe
Quoting from
commit 128de1949f
Date: Tue Apr 19 15:18:49 2022 +0200
android: Use property instead of ANDROID_NDK_HOME env var
which ported from an obsolete (no longer supported by
current Gradle versions) way of setting the NDK path to a
deprecated but still supported one as an intermediate step
to allow upgrading Gradle:
> Note however, that with this approach of using the `ndk.dir`
> property instead of the suggested `android.ndkVersion`
> (with the latter having the stricter requirement that
> the `ndk` dir would have to be a subdir of the SDK dir),
> doing the actual upgrade to a newer Gradle (plugin) version
> in follow-up commit
> Change-Id Ia982d72d877e229c3006c6d528b830d16c88481f
> "android: Update Android Gradle Plugin to 7.1.3"
> revealed that the use of the `ndk.dir` property
> is deprecated in newer Gradle (plugin) versions as well,
> resulting in this warning.
>
> > > Task :stripStrippedUIDebugDebugSymbols
> > [CXX5106] NDK was located by using ndk.dir property. This method is
> > deprecated and will be removed in a future release. Please delete
> > ndk.dir from local.properties and set android.ndkVersion to
> > [20.0.5594570] in all native modules in the project.
> > https://developer.android.com/r/studio-ui/ndk-dir
>
> It might make sense to address that in a follow-up step,
> but for now, it's an improvement and keeps it working
> after the upgrade without potentially causing any incompatibility
> problems with existing autogen configurations,
> while support for the `ANDROID_NDK_HOME` env var that was
> used so far seems to have been dropped, [...].
The release notes for Android Gradle Plugin version 4.1.0
mention yet another way of setting an explicit NDK path
instead of just a version and that one is still supported
and not deprecated [1]:
> # Set the NDK path
> You can set the path to your local NDK installation using the
> android.ndkPath property in your module's build.gradle file.
>
> android {
> ndkPath "your-custom-ndk-path"
> }
>
> If you use this property together with the android.ndkVersion property,
> then this path must contain an NDK version that matches
> android.ndkVersion.
Therefore, switch to setting the NDK path using the `android.ndkPath`
property in liboSettings.gradle instead of the deprecated `ndk.dir`
in local.properties.
[1] https://developer.android.com/studio/releases/gradle-plugin?buildsystem=ndk-build#ndk-path
Change-Id: I34690ca8e15ff4742bab9a716a58b9ad85fa86e7
Reviewed-on: https://gerrit.libreoffice.org/c/core/+/133197
Tested-by: Jenkins
Reviewed-by: Michael Weghorn <m.weghorn@posteo.de>
117 lines
4.9 KiB
Text
117 lines
4.9 KiB
Text
#
|
|
# Common Makefile pieces for building Java / Android apps.
|
|
#
|
|
|
|
#
|
|
# BOOTSTRAPDIR needs to be set to this directory before starting this
|
|
#
|
|
|
|
# Probably would be best to just stop fooling around with the possibilities to
|
|
# set various stuff with the -env command line parameters (and environment
|
|
# variables?) and in a plethora of rc files, and hardcode construction of
|
|
# *all* required pathnames based on the app installation location for Android
|
|
# (and iOS), etc. We don't really win anything by having so many layers of
|
|
# configurability on platforms like Android and iOS where apps based on LO
|
|
# code are very much self-contained pre-packaged thingies.
|
|
|
|
JNILIBSDIR=$(BUILDDIR)/android/jniLibs
|
|
SODEST=$(JNILIBSDIR)/$(ANDROID_APP_ABI)
|
|
OBJLOCAL=$(BUILDDIR)/android/obj/local/$(ANDROID_APP_ABI)
|
|
|
|
#
|
|
# Helpful rules ...
|
|
#
|
|
|
|
local.properties: $(BUILDDIR)/config_host.mk
|
|
echo sdk.dir=$(ANDROID_SDK_DIR) >local.properties
|
|
|
|
#
|
|
# Build / link the single .so for this app
|
|
#
|
|
|
|
ALL_STATIC_LIBS := $(shell $(SRCDIR)/bin/lo-all-static-libs)
|
|
|
|
LIBS = \
|
|
-Wl,--start-group \
|
|
$(ALL_STATIC_LIBS) \
|
|
-Wl,--end-group
|
|
|
|
NSSLIBS = freebl3 \
|
|
nspr4 \
|
|
nss3 \
|
|
nssckbi \
|
|
nssdbm3 \
|
|
nssutil3 \
|
|
plc4 \
|
|
plds4 \
|
|
smime3 \
|
|
softokn3 \
|
|
sqlite3 \
|
|
ssl3 \
|
|
|
|
WHOLELIBS = \
|
|
-Wl,--whole-archive \
|
|
$(addprefix -l,$(strip \
|
|
$(if $(ENABLE_JAVA),juh) \
|
|
)) \
|
|
-Wl,--no-whole-archive
|
|
|
|
|
|
$(OBJLOCAL)/liblo-native-code.so : native-code.cxx $(ALL_STATIC_LIBS)
|
|
@echo "Linking $@"
|
|
mkdir -p $(OBJLOCAL)
|
|
$(CXX) -fuse-ld=gold -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 $(if $(filter-out arm64-v8a x86_64,$(ANDROID_APP_ABI)),-landroid_support) $(if $(filter armeabi-v7a,$(ANDROID_APP_ABI)),-lunwind) $(addprefix -l,$(NSSLIBS)) -lGLESv2 -landroid -ljnigraphics -llog -lz
|
|
|
|
$(SODEST)/liblo-native-code.so : $(OBJLOCAL)/liblo-native-code.so
|
|
mkdir -p $(SODEST)
|
|
$(STRIP) -o $(SODEST)/liblo-native-code.so $(OBJLOCAL)/liblo-native-code.so
|
|
#to keep some symbols, eg.: $(STRIP) -o $(SODEST)/liblo-native-code.so $(OBJLOCAL)/liblo-native-code.so -w -K 'Java*'
|
|
|
|
$(SODEST)/nss-libraries :
|
|
mkdir -p $(SODEST)
|
|
$(foreach lib,$(NSSLIBS),$(STRIP) -o $(SODEST)/lib$(lib).so $(INSTDIR)/$(LIBO_LIB_FOLDER)/lib$(lib).so;)
|
|
|
|
$(SODEST)/libc++_shared.so : $(ANDROID_NDK_DIR)/sources/cxx-stl/llvm-libc++/libs/$(ANDROID_APP_ABI)/libc++_shared.so
|
|
mkdir -p $(SODEST)
|
|
cp $< $@
|
|
|
|
link-so: $(SODEST)/liblo-native-code.so $(SODEST)/nss-libraries $(SODEST)/libc++_shared.so
|
|
|
|
# If you reinstall an app several times *on the emulator*, even if you
|
|
# uninstall it between, disk space seems to leak that won't get recycled until
|
|
# you stop and start... No idea if this holds for a device, too. (And you
|
|
# can't "stop" a device anyway.)
|
|
|
|
stop-start-cycle:
|
|
$(ANDROID_SDK_DIR)/platform-tools/adb shell stop && $(ANDROID_SDK_DIR)/platform-tools/adb shell start && sleep 10
|
|
|
|
# build-host specific stuff (build paths and the like) to keep build.gradle static
|
|
liboSettings.gradle: $(BUILDDIR)/config_build.mk $(BUILDDIR)/config_host.mk
|
|
@echo "creating $@"
|
|
( \
|
|
echo "// created by Makefile.shared - your changes will be overridden" \
|
|
&& echo "ext {" \
|
|
&& echo " liboSrcRoot = '$(SRC_ROOT)'" \
|
|
&& echo " liboJniLibsdir = '$(JNILIBSDIR)'" \
|
|
&& echo " liboWorkdir = '$(WORKDIR)'" \
|
|
&& echo " liboInstdir = '$(INSTDIR)'" \
|
|
&& echo " liboEtcFolder = '$(LIBO_ETC_FOLDER)'" \
|
|
&& echo " liboUreMiscFolder = '$(LIBO_URE_MISC_FOLDER)'" \
|
|
&& echo " liboSharedResFolder = '$(LIBO_SHARE_RESOURCE_FOLDER)'" \
|
|
&& echo " liboUREJavaFolder = '$(LIBO_URE_SHARE_JAVA_FOLDER)'" \
|
|
&& echo " liboShareJavaFolder = '$(LIBO_SHARE_JAVA_FOLDER)'" \
|
|
&& echo " liboExampleDocument = '$(if $(exampleDocument),$(exampleDocument),$(SRC_ROOT)/android/default-document/example.odt)'" \
|
|
&& echo " liboVersionMajor = '$(LIBO_VERSION_MAJOR)'" \
|
|
&& echo " liboVersionMinor = '$(LIBO_VERSION_MINOR)'" \
|
|
&& echo " liboGitFullCommit = '$(shell cd $(SRCDIR) && git log -1 --format=%H)'" \
|
|
&& echo "}" \
|
|
&& echo "android {" \
|
|
&& echo " ndkPath '$(ANDROID_NDK_DIR)'" \
|
|
&& echo "}" \
|
|
&& echo "android.defaultConfig {" \
|
|
&& echo " applicationId '$(ANDROID_PACKAGE_NAME)'" \
|
|
&& echo " archivesBaseName = 'LibreOfficeViewer'" \
|
|
&& echo " versionCode project.hasProperty('cmdVersionCode') ? cmdVersionCode.toInteger() : $(if $(versionCode),$(versionCode),1)" \
|
|
&& echo " versionName '$(LIBO_VERSION_MAJOR).$(LIBO_VERSION_MINOR).$(LIBO_VERSION_MICRO).$(LIBO_VERSION_PATCH)$(LIBO_VERSION_SUFFIX)$(LIBO_VERSION_SUFFIX_SUFFIX)/$(shell cd $(SRCDIR) && git log -1 --format=%h)/$(OOO_VENDOR)'" \
|
|
&& echo "}" \
|
|
) > $@
|