Version 6.4.0.0.beta1, tag libreoffice-6.4.0.0.beta1
[LibreOffice.git] / android / Bootstrap / Makefile.shared
blob7126e9a2f506115692b298a68cb23c207baa8b5e
2 # Common Makefile pieces for building Java / Android apps.
6 # BOOTSTRAPDIR needs to be set to this directory before starting this
9 # Probably would be best to just stop fooling around with the possibilities to
10 # set various stuff with the -env command line parameters (and environment
11 # variables?) and in a plethora of rc files, and hardcode construction of
12 # *all* required pathnames based on the app installation location for Android
13 # (and iOS), etc. We don't really win anything by having so many layers of
14 # configurability on platforms like Android and iOS where apps based on LO
15 # code are very much self-contained pre-packaged thingies.
17 SODEST=jniLibs/$(ANDROID_APP_ABI)
18 OBJLOCAL=obj/local/$(ANDROID_APP_ABI)
21 # Helpful rules ...
24 local.properties: $(BUILDDIR)/config_host.mk
25         echo sdk.dir=$(ANDROID_SDK_HOME) >local.properties
28 # Build / link the single .so for this app
31 ALL_STATIC_LIBS := $(shell $(SRCDIR)/bin/lo-all-static-libs)
33 LIBS = \
34   -Wl,--start-group \
35   $(ALL_STATIC_LIBS) \
36   -Wl,--end-group
38 NSSLIBS = freebl3 \
39         nspr4 \
40         nss3 \
41         nssckbi \
42         nssdbm3 \
43         nssutil3 \
44         plc4 \
45         plds4 \
46         smime3 \
47         softokn3 \
48         sqlite3 \
49         ssl3 \
51 WHOLELIBS = \
52   -Wl,--whole-archive \
53   $(addprefix -l,$(strip \
54         juh \
55   )) \
56   -Wl,--no-whole-archive
59 $(OBJLOCAL)/liblo-native-code.so : native-code.cxx $(ALL_STATIC_LIBS)
60         @echo "Linking $@"
61         mkdir -p $(OBJLOCAL)
62         $(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
64 $(SODEST)/liblo-native-code.so : $(OBJLOCAL)/liblo-native-code.so
65         mkdir -p $(SODEST)
66         $(STRIP) -o $(SODEST)/liblo-native-code.so $(OBJLOCAL)/liblo-native-code.so
67         #to keep some symbols, eg.: $(STRIP) -o $(SODEST)/liblo-native-code.so $(OBJLOCAL)/liblo-native-code.so -w -K 'Java*'
69 $(SODEST)/nss-libraries : 
70         mkdir -p $(SODEST)
71         $(foreach lib,$(NSSLIBS),$(STRIP) -o $(SODEST)/lib$(lib).so $(INSTDIR)/$(LIBO_LIB_FOLDER)/lib$(lib).so;)
73 $(SODEST)/libc++_shared.so : $(ANDROID_NDK_HOME)/sources/cxx-stl/llvm-libc++/libs/$(ANDROID_APP_ABI)/libc++_shared.so
74         cp $< $@
76 link-so: $(SODEST)/liblo-native-code.so $(SODEST)/nss-libraries $(SODEST)/libc++_shared.so
78 # If you reinstall an app several times *on the emulator*, even if you
79 # uninstall it between, disk space seems to leak that won't get recycled until
80 # you stop and start... No idea if this holds for a device, too. (And you
81 # can't "stop" a device anyway.)
83 stop-start-cycle:
84         $(ANDROID_SDK_HOME)/platform-tools/adb shell stop && $(ANDROID_SDK_HOME)/platform-tools/adb shell start && sleep 10
86 # build-host specific stuff (build paths and the like) to keep build.gradle static
87 liboSettings.gradle: $(BUILDDIR)/config_build.mk $(BUILDDIR)/config_host.mk
88         @echo "creating $@"
89         ( \
90                 echo "// created by Makefile.shared - your changes will be overridden" \
91                 && echo "ext {" \
92                 && echo "    liboSrcRoot         = '$(SRC_ROOT)'" \
93                 && echo "    liboWorkdir         = '$(WORKDIR)'" \
94                 && echo "    liboInstdir         = '$(INSTDIR)'" \
95                 && echo "    liboEtcFolder       = '$(LIBO_ETC_FOLDER)'" \
96                 && echo "    liboUreMiscFolder   = '$(LIBO_URE_MISC_FOLDER)'" \
97                 && echo "    liboSharedResFolder = '$(LIBO_SHARE_RESOURCE_FOLDER)'" \
98                 && echo "    liboUREJavaFolder   = '$(LIBO_URE_SHARE_JAVA_FOLDER)'" \
99                 && echo "    liboShareJavaFolder = '$(LIBO_SHARE_JAVA_FOLDER)'" \
100                 && echo "    liboExampleDocument = '$(if $(exampleDocument),$(exampleDocument),$(SRC_ROOT)/android/default-document/example.odt)'" \
101                 && echo "    liboVersionMajor    = '$(LIBO_VERSION_MAJOR)'" \
102                 && echo "    liboVersionMinor    = '$(LIBO_VERSION_MINOR)'" \
103                 && echo "    liboGitFullCommit   = '$(shell cd $(SRCDIR) && git log -1 --format=%H)'" \
104                 && echo "}" \
105                 && echo "android.defaultConfig {" \
106                 && echo "    applicationId '$(ANDROID_PACKAGE_NAME)'" \
107                 && echo "    versionCode project.hasProperty('cmdVersionCode') ? cmdVersionCode.toInteger() : $(if $(versionCode),$(versionCode),1)" \
108                 && 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)'" \
109                 && echo "}" \
110         ) > $@