summaryrefslogtreecommitdiff
path: root/android/experiments/DocumentLoader/Makefile
blob: 7db82ae1a43aa9883861818b0652055e4dfe7d14 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
NDK_HOME:=$(shell type -p ndk-build)
NDK_HOME:=$(shell dirname $(NDK_HOME))

SODEST=libs/armeabi-v7a
OBJLOCAL=obj/local/armeabi-v7a

define COPYSO
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

define COPYJAR
cp $(1) libs
endef

# The default target just builds.

all: build-ant

copy-stuff:
# First always clean 
	rm -rf libs $(OBJLOCAL)
	mkdir -p $(SODEST) $(OBJLOCAL)
#
# Copy jar files we need, and even construct one.
#
	for F in $(strip \
		   java_uno \
		   juh \
		   jurt \
		   ridl \
		   unoloader \
		  ); do \
	    $(call COPYJAR,$(OUTDIR)/bin/$${F}.jar); \
	done
#
# lo-bootstrap.jar from ../../Bootstrap
#
	cp ../../Bootstrap/lo-bootstrap.jar libs
#
# com.sun.star.frame.XComponentLoader is not in any jar
#
	cd libs && \
	    LD_LIBRARY_PATH=$(OUTDIR_FOR_BUILD)/lib \
	    DYLD_LIBRARY_PATH=$(OUTDIR_FOR_BUILD)/lib \
	    $(OUTDIR_FOR_BUILD)/bin/javamaker -BUCR -nD \
		$(OUTDIR)/bin/udkapi.rdb $(OUTDIR)/bin/offapi.rdb \
		-Tcom.sun.star.frame.XComponentLoader && \
	    jar cvf more.jar com
#
# Copy shared libraries (including UNO components) 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.
#
	for F in $(strip \
		   comphelpgcc3 \
		   gcc3_uno \
		   i18nisolang1gcc3 \
		   i18nutilgcc3 \
		   icudatalo \
		   icui18nlo \
		   icuuclo \
		   java_uno \
		   juh \
		   juhx \
		   jvmaccessgcc3 \
		   lo-bootstrap \
		   localedata_en \
		   localedata_others \
		   reg \
		   sal_textenc \
		   store \
		   ucbhelper4gcc3 \
		   uno_cppu \
		   uno_sal \
		   uno_salhelpergcc3 \
		   uno_cppuhelpergcc3 \
		   xml2 \
		   xmlreader \
		   bootstrap.uno \
		   i18npool.uno \
		  ); do \
	    $(call COPYSO,$(OUTDIR)/lib/lib$${F}.so); \
	done
#
# Then the shared GNU C++ library
	$(call COPYSO,$(NDK_HOME)/sources/cxx-stl/gnu-libstdc++/libs/armeabi-v7a/libgnustl_shared.so)
#
# 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)/bin/uno.ini assets
	cp $(OUTDIR)/xml/ure/services.rdb assets/xml/ure
	cp $(SRC_ROOT)/odk/examples/java/DocumentHandling/test/test1.odt assets
	cp $(WORKDIR)/ComponentTarget/i18npool/util/i18npool.component assets/ComponentTarget/i18npool/util
#
# Then gdbserver and gdb.setup so that we can debug with ndk-gdb.
#
	cp $(NDK_HOME)/toolchains/arm-linux-androideabi-4.4.3/prebuilt/gdbserver $(SODEST)
	echo set solib-search-path ./obj/local/armeabi-v7a >$(SODEST)/gdb.setup

build-ant: copy-stuff
	unset JAVA_HOME && ant debug

install: copy-stuff
	unset JAVA_HOME && ant debug install
	@echo
	@echo 'Run it with something like what "make run" does (see Makefile)'
	@echo

run: install
	adb shell am start -n org.libreoffice.android.examples/.DocumentLoader -e input /assets/test1.odt

clean:
	rm -rf bin assets