summaryrefslogtreecommitdiff
path: root/android/Bootstrap/Makefile
diff options
context:
space:
mode:
authorTor Lillqvist <tlillqvist@suse.com>2011-11-30 21:39:18 +0200
committerTor Lillqvist <tlillqvist@suse.com>2011-11-30 21:52:52 +0200
commit5510127e89d6971a219ce3664e4631d6c6dda2b1 (patch)
tree7e2d7d06892e086700d5b6bddc8a3ec99c476f6b /android/Bootstrap/Makefile
parenta7fe1a0a088b2d3d68e3fc4b0d3e8d5a34f3e203 (diff)
Android code refactorig and hacking
Sorry for the large unstructured commit. But hey, the Android code is experimental so far. Extract the native lo-bootstrap code into a fairly normal library built in sal. (Previously it was the JNI part of the "Bootstrap" app.) Just linkink normally to liblo-bootstrap from C++ code that uses it works fine, no need to do a dlsym lookup. Bootstrap is still a subclass of NativeActivity and can thus still be used as an "app" (to start unit tests, or whatever), but can also be used from some other app's Java code to just get access to the lo-bootstrap native methods. Introduce a new top-level "module", android, for Bootstrap and the experiments with DocumentLoader. Note that the experimental DocumentLoader app still crashes. It can't create the com.sun.star.frame.Desktop instance. I spent lots of time debugging in the painfully inadequate ndk-gdb. (Even the newer gdb build from the "mingw-and-ndk" project is quite crappy in many ways.) I should really experiment with corresponding code on a normal platform first before even trying on Android. Basically, I think that if I just can get the concept of Java code that instantiates and uses LO components *in-process* working on a normal desktop platform, it should work on Android, too.
Diffstat (limited to 'android/Bootstrap/Makefile')
-rw-r--r--android/Bootstrap/Makefile129
1 files changed, 129 insertions, 0 deletions
diff --git a/android/Bootstrap/Makefile b/android/Bootstrap/Makefile
new file mode 100644
index 000000000000..d8a7004579c7
--- /dev/null
+++ b/android/Bootstrap/Makefile
@@ -0,0 +1,129 @@
+# The full path the the app's directory needs to be supplied in a
+# couple of places, unfortunately.
+
+APP_DATA_PATH=/data/data/org.libreoffice.android
+
+NDK_HOME:=$(shell type -p ndk-build)
+NDK_HOME:=$(shell dirname $(NDK_HOME))
+
+SODEST=libs/armeabi-v7a
+OBJLOCAL=obj/local/armeabi-v7a
+
+define COPY
+cp $(1) $(SODEST)$(if $(2),/$(2)) && \
+arm-linux-androideabi-strip --strip-debug $(SODEST)$(if $(2),/$(2),/$(notdir $(1))) && \
+cp $(1) $(OBJLOCAL)$(if $(2),/$(2))
+endef
+
+# The default target just builds.
+
+all: build-ant lo-bootstrap.jar
+
+copy-stuff:
+#
+# Copy shared libraries we need to libs/armeabi-v7a so that ant will
+# include them in the .apk.
+#
+# Copy them to obj/local/armeabi-v7a, too, where gdb will look for
+# them.
+#
+ mkdir -p $(SODEST) $(OBJLOCAL)
+#
+# First the most important one, liblo-bootstrap.so
+ $(call COPY,$(OUTDIR)/lib/liblo-bootstrap.so)
+#
+# Then the cppunittester "program". As all "program"
+# files we build for Android actually is a shared object.
+ $(call COPY,$(OUTDIR)/bin/cppunit/cppunittester,libcppunittester.so)
+#
+# The cppunit library
+ $(call COPY,$(OUTDIR)/lib/libcppunit-1.12.so)
+#
+# cppunit "plug-ins", first ones from sal
+#
+ $(call COPY,../../sal/$(INPATH)/lib/*.so)
+#
+# and ones from other modules. Note that depending on when you try
+# this, these might not have been built yet.
+#
+ for F in $(SRC_ROOT)/cppu/$(INPATH)/lib/qa_*.so; do \
+ $(call COPY,$${F},`basename $${F}`); \
+ done
+#
+ for F in i18npool_test_breakiterator; do \
+ $(call COPY,$(WORKDIR)/LinkTarget/CppunitTest/libtest_$${F}.so); \
+ done
+#
+# Other "programs"
+ $(call COPY,$(OUTDIR)/bin/uno,libunoexe.so)
+#
+# Libs and UNO components that the tests from other modules need.
+#
+ for F in $(strip \
+ comphelpgcc3 \
+ gcc3_uno \
+ i18nisolang1gcc3 \
+ i18nutilgcc3 \
+ icudatalo \
+ icui18nlo \
+ icuuclo \
+ localedata_en \
+ localedata_others \
+ reg \
+ store \
+ ucbhelper4gcc3 \
+ uno_cppu \
+ uno_salhelpergcc3 \
+ uno_cppuhelpergcc3 \
+ unoexceptionprotector \
+ xml2 \
+ xmlreader \
+ bootstrap.uno \
+ i18npool.uno); do \
+ $(call COPY,$(OUTDIR)/lib/lib$${F}.so); \
+ done
+#
+# Then the shared GNU C++ library
+ $(call COPY,$(NDK_HOME)/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libgnustl_shared.so)
+#
+# bridgetest components, not in solver
+ for F in bridgetest constructors cppobj; do \
+ $(call COPY,$(SRC_ROOT)/testtools/$(INPATH)/lib/lib$${F}.uno.so); \
+ done
+#
+# Then other "assets". Let the directory structure under assets mimic
+# that under solver for now.
+ mkdir -p assets/bin assets/lib assets/xml/ure assets/ComponentTarget/i18npool/util
+ cp $(OUTDIR)/bin/udkapi.rdb assets/bin
+ cp $(OUTDIR)/bin/types.rdb assets/bin
+ cp $(OUTDIR)/xml/ure/services.rdb assets/xml/ure
+ cp $(WORKDIR)/ComponentTarget/i18npool/util/i18npool.component assets/ComponentTarget/i18npool/util
+ for F in uno_services uno_types; do \
+ sed -e 's!uri="./!uri="$(APP_DATA_PATH)/lib/!g' <$(SRC_ROOT)/testtools/$(INPATH)/lib/$${F}.rdb >assets/lib/$${F}.rdb; \
+ done
+
+build-ant: copy-stuff
+ unset JAVA_HOME && ant debug
+
+lo-bootstrap.jar: build-ant
+ cd bin/classes && jar cvf ../../lo-bootstrap.jar fi/iki/tml org/libreoffice/android/Bootstrap.class
+
+install: copy-stuff lo-bootstrap.jar
+ cp lo-bootstrap.jar $(OUTDIR)bin
+ unset JAVA_HOME && ant debug install
+ @echo
+ @echo 'Run it with something like what "make run" does (see Makefile)'
+ @echo
+
+run:
+# Note: these are just examples.
+#
+ adb shell am start -n org.libreoffice.android/.Bootstrap -e lo-main-library libcppunittester -e lo-main-cmdline "$(APP_DATA_PATH)/lib/libqa_sal_types.so"
+#
+ sleep 10
+ adb shell am start -n org.libreoffice.android/.Bootstrap -e lo-main-library libcppunittester -e lo-main-cmdline "$(APP_DATA_PATH)/lib/libtest_i18npool_test_breakiterator.so --protector libunoexceptionprotector.so unoexceptionprotector '-env:UNO_TYPES=file:///assets/bin/udkapi.rdb file:///assets/bin/types.rdb' '-env:UNO_SERVICES=file:///assets/xml/ure/services.rdb file:///assets/ComponentTarget/i18npool/util/i18npool.component' -env:LO_LIB_DIR=file://$(APP_DATA_PATH)/lib"
+#
+# adb shell am start -n org.libreoffice.android/.Bootstrap -e lo-main-library libunoexe -e lo-main-cmdline "-ro /assets/lib/uno_services.rdb -ro /assets/lib/uno_types.rdb -s com.sun.star.test.bridge.BridgeTest -- com.sun.star.test.bridge.CppTestObject" -e lo-main-delay 2
+
+clean:
+ rm -rf bin assets