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.
16 APP_DATA_PATH=/data/data/$(APP_PACKAGE)
18 SODEST=libs/$(ANDROID_APP_ABI)
19 OBJLOCAL=obj/local/$(ANDROID_APP_ABI)
22 $(error COPYSO should not be used now with DISABLE_DYNLOADING)
26 mkdir -p libs && cp $(1) libs
34 # The Android SDK recommends you copy/paste some big -package-resources
35 # rule in order to not pack certain kinds of resources. Unfortunately this
36 # rule interacts with the rest of the ant code in horrible ways such that
37 # upgrading your SDK auto-breaks everything.
41 $(BOOTSTRAPDIR)/no-resource-compress.xml : $(ANDROID_SDK_HOME)/tools/ant/build.xml
43 android_sdk_ver=`grep 'Pkg.Revision' $(ANDROID_SDK_HOME)/tools/source.properties | sed 's/^.*=//' | sed 's/\..*//'` ; \
44 cp $(BOOTSTRAPDIR)/no-resource-compress-$$android_sdk_ver.xml $(BOOTSTRAPDIR)/no-resource-compress.xml ; \
45 if ! test -f $(BOOTSTRAPDIR)/no-resource-compress.xml; then \
46 echo "Unknown Android SDK version: $$android_sdk_ver"; \
51 android_version_setup : $(BOOTSTRAPDIR)/no-resource-compress.xml
54 echo sdk.dir=$(ANDROID_SDK_HOME) >local.properties
55 echo sdk.dir=$(ANDROID_SDK_HOME) >../../Bootstrap/local.properties
56 echo "# File needed by ndk-gdb" >jni/Application.mk
57 echo "APP_ABI := $(ANDROID_APP_ABI)" > jni/Application.mk
58 echo "APP_PLATFORM := android-14" >> jni/Application.mk
61 unset JAVA_HOME && $(ANT) -quiet debug install
63 @echo 'Run it with "make run"'
67 $(ANDROID_SDK_HOME)/platform-tools/adb uninstall $(APP_PACKAGE)
69 clean: android_version_setup properties
70 $(ANT) -quiet -keep-going clean
71 rm -rf assets libs $(SODEST) $(OBJLOCAL) $(BOOTSTRAPDIR)/no-resource-compress.xml
74 # Build / link the single .so for this app
77 # Sigh, it's sad that now with solver dying we have to list the
78 # locations of each needed bundled 3rd-party lib like this. Maybe we
79 # really should try to make these experimental Android apps (and the
80 # iOS one) buildable with gbuild.
84 $(wildcard $(INSTDIR)/$(LIBO_LIB_FOLDER)/lib*.a) \
85 $(wildcard $(WORKDIR)/LinkTarget/StaticLibrary/lib*.a) \
92 $(wildcard $(WORKDIR)/UnpackedTarball/curl/lib/.libs/*.a) \
93 $(wildcard $(WORKDIR)/UnpackedTarball/fontconfig/src/.libs/libfontconfig.a) \
94 $(wildcard $(WORKDIR)/UnpackedTarball/freetype/objs/.libs/libfreetype.a) \
95 $(wildcard $(WORKDIR)/UnpackedTarball/icu/source/lib/*.a) \
96 $(wildcard $(WORKDIR)/UnpackedTarball/lcms2/src/.libs/*.a) \
97 $(wildcard $(WORKDIR)/UnpackedTarball/libcdr/src/lib/.libs/*.a) \
98 $(wildcard $(WORKDIR)/UnpackedTarball/libmspub/src/lib/.libs/*.a) \
99 $(wildcard $(WORKDIR)/UnpackedTarball/libmwaw/src/lib/.libs/*.a) \
100 $(wildcard $(WORKDIR)/UnpackedTarball/libodfgen/src/.libs/*.a) \
101 $(wildcard $(WORKDIR)/UnpackedTarball/liborcus/src/*/.libs/*.a) \
102 $(wildcard $(WORKDIR)/UnpackedTarball/libvisio/src/lib/.libs/*.a) \
103 $(wildcard $(WORKDIR)/UnpackedTarball/libwp?/src/lib/.libs/*.a) \
104 $(wildcard $(WORKDIR)/UnpackedTarball/lpsolve/lpsolve55/*.a) \
105 $(wildcard $(WORKDIR)/UnpackedTarball/openssl/*.a) \
106 $(wildcard $(WORKDIR)/UnpackedTarball/raptor/src/.libs/*.a) \
107 $(wildcard $(WORKDIR)/UnpackedTarball/rasqal/src/.libs/*.a) \
108 $(wildcard $(WORKDIR)/UnpackedTarball/redland/src/.libs/*.a) \
109 $(wildcard $(WORKDIR)/UnpackedTarball/xml2/.libs/*.a) \
110 $(wildcard $(WORKDIR)/UnpackedTarball/xslt/libxslt/.libs/*.a) \
114 -Wl,--whole-archive \
115 $(addprefix -l,$(strip \
118 -Wl,--no-whole-archive
121 $(OBJLOCAL)/liblo-native-code.so : native-code.cxx dummies.cxx
123 $(CXX) -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 dummies.cxx -L$(INSTDIR)/$(LIBO_LIB_FOLDER) $(WHOLELIBS) $(LIBS) -lgnustl_static -landroid -ljnigraphics -llog -lz
125 $(SODEST)/liblo-native-code.so : $(OBJLOCAL)/liblo-native-code.so
127 $(STRIP) -o $(SODEST)/liblo-native-code.so $(OBJLOCAL)/liblo-native-code.so
129 # shrinkme $(STRIP) -o $(SODEST)/liblo-native-code.so $(OBJLOCAL)/liblo-native-code.so
131 link-so: $(SODEST)/liblo-native-code.so
133 # If you reinstall an app several times *on the emulator*, even if you
134 # uninstall it between, disk space seems to leak that won't get recycled until
135 # you stop and start... No idea if this holds for a device, too. (And you
136 # can't "stop" a device anyway.)
139 $(ANDROID_SDK_HOME)/platform-tools/adb shell stop && $(ANDROID_SDK_HOME)/platform-tools/adb shell start && sleep 10