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
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
|
include ../../../config_host.mk
# The package of this app
APP_PACKAGE=org.libreoffice.android.examples
# We can't keep assuming APP_DATA_PATH like this, surely this can vary with
# Android versions and whatnot, this is temporary and works at least with the
# SDK 16 emulator...
# 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.
APP_DATA_PATH=/data/data/$(APP_PACKAGE)
SODEST=libs/$(ANDROID_APP_ABI)
OBJLOCAL=obj/local/$(ANDROID_APP_ABI)
define COPYJAR
cp $(1) libs
endef
LIBS = \
-Wl,--start-group \
$(addprefix -l,$(strip \
ascii_expat_xmlparse \
avmedialo \
basebmp \
basegfxlo \
bootstrap.uno \
canvastoolslo \
cdrlib \
collator_data \
comphelpgcc3 \
configmgr.uno \
cppcanvaslo \
crypto \
dbaxmllo \
dbtoolslo \
deploymentmisclo \
dict_ja \
dict_zh \
drawinglayerlo \
editenglo \
expat_xmlparse \
expat_xmltok \
expwrap.uno \
fastsax.uno \
filterconfiglo \
fontconfig \
forlo \
foruilo \
freetype \
frmlo \
fsstorage.uno \
fwelo \
fwilo \
fwklo \
gcc3_uno \
hwplo \
i18nisolang1gcc3 \
i18npool.uno \
i18nregexplo \
i18nsearch.uno \
i18nutilgcc3 \
icudata \
icui18n \
icule \
icutu \
icuuc \
index_data \
introspection.uno \
java_uno \
jpeg \
jvmaccessgcc3 \
jvmfwk \
lcms2 \
libotouchlo \
lnglo \
lo-bootstrap \
localedata_en \
localedata_es \
localedata_euro \
localedata_others \
loglo \
log_uno_uno \
lpsolve55 \
lwpftlo \
msfilterlo \
mspublib \
mswordlo \
ooxlo \
orcus \
package2 \
reflection.uno \
reg \
saxlo \
sax_shared \
sblo \
sclo \
scdlo \
scfiltlo \
sddlo \
sdfiltlo \
sdlo \
sfxlo \
smdlo \
smlo \
sotlo \
spllo \
stocservices.uno \
store \
svgfilterlo \
svllo \
svtlo \
svxcorelo \
svxlo \
swdlo \
swlo \
t602filterlo \
textconv_dict \
textconversiondlgslo \
textfdlo \
textinstream.uno \
textoutstream.uno \
tklo \
tllo \
ucb1 \
ucbhelper4gcc3 \
ucpfile1 \
ucppkg1 \
uno_cppu \
uno_cppuhelpergcc3 \
uno_sal \
uno_salhelpergcc3 \
uno_cppuhelpergcc3 \
unordflo \
unoxmllo \
utllo \
uuilo \
vbahelperlo \
vbaswobj.uno \
vcllo \
visiolib \
wpdlib \
wpftdrawlo \
wpftwriterlo \
wpglib \
wpslib \
writerfilterlo \
writerperfect \
xml2 \
xmlfalo \
xmlfdlo \
xmlreader \
xmlscriptlo \
xmlsecurity \
xoflo \
xolo \
xsec_fw \
xslt \
xsltdlglo \
xsltfilterlo \
xstor \
)) \
-Wl,--end-group
WHOLELIBS = \
-Wl,--whole-archive \
$(addprefix -l,$(strip \
juh \
)) \
-Wl,--no-whole-archive
# The default target just builds.
all: build-ant
properties:
echo sdk.dir=$(ANDROID_SDK_HOME) >local.properties
echo sdk.dir=$(ANDROID_SDK_HOME) >../../Bootstrap/local.properties
echo "# File needed by ndk-gdb" >jni/Application.mk
echo "APP_ABI := $(ANDROID_APP_ABI)" >>jni/Application.mk
echo "APP_PLATFORM := android-14" >>jni/Application.mk
link-so:
# Build the single .so for this app
mkdir -p $(OBJLOCAL)
$(CXX) -Wl,--stats -Wl,--no-keep-files-mapped -Wl,--no-undefined -DANDROID -DDISABLE_DYNLOADING -shared -o $(OBJLOCAL)/liblo-native-code.so -I$(OUTDIR)/inc native-code.cxx -L$(OUTDIR)/lib $(WHOLELIBS) $(LIBS) -lgnustl_static -landroid -llog -lz
mkdir -p $(SODEST)
cp $(OBJLOCAL)/liblo-native-code.so $(SODEST)
$(STRIP) --strip-debug $(SODEST)/liblo-native-code.so
copy-stuff:
# Then "assets". Let the directory structure under assets mimic
# that under solver for now.
#
# Please note that I have no idea what all of this is really necessary and for
# much of this stuff being copied, no idea whether it makes any sense at all.
# Much of this is copy-pasted from android/qa/sc/Makefile (where a couple of
# unit tests for sc are built, and those do seem to mostly work) and
# android/qa/desktop/Makefile (mmeeks's desktop demo, also works to some
# extent).
#
mkdir -p assets/bin/ure assets/lib assets/program assets/xml/ure assets/ComponentTarget/i18npool/util
cp $(OUTDIR)/bin/udkapi.rdb assets/bin
cp $(OUTDIR)/bin/types.rdb assets/bin
cp $(OUTDIR)/bin/ure/types.rdb assets/bin/ure
# For some reason the vnd.sun.star.expand:$LO_LIB_DIR doesn't seem to work, it expands to empty!?
# So just hardcode the known APP_DATA_PATH for now...
for F in xml/services xml/ure/services; do \
sed -e 's!uri="vnd.sun.star.expand:$$LO_LIB_DIR/!uri="file://$(APP_DATA_PATH)/lib/!g' <$(OUTDIR)/$$F.rdb >assets/$$F.rdb; \
done
cp $(SRC_ROOT)/odk/examples/java/DocumentHandling/test/test1.odt \
$(SRC_ROOT)/sc/qa/unit/data/xls/border.xls \
$(SRC_ROOT)/sw/qa/core/data/odt/test.odt \
$(SRC_ROOT)/sw/qa/core/data/doc/testVba.doc \
assets
cp $(WORKDIR)/ComponentTarget/i18npool/util/i18npool.component assets/ComponentTarget/i18npool/util
#
mkdir -p assets/ure/share/misc assets/share/registry/res assets/share/config/soffice.cfg
cp -R $(OUTDIR)/xml/*.xcd assets/share/registry
mv assets/share/registry/fcfg_langpack_en-US.xcd assets/share/registry/res
cp -R $(OUTDIR)/xml/uiconfig/* assets/share/config/soffice.cfg
cp -R $(OUTDIR)/xml/registry/* assets/share/registry
#
# Set up rc, the "inifile". See BootstrapMap::getBaseIni(). As this app
# doesn't use soffice_main() (at least I think it shouldn't), the
# rtl::Bootstrap::setIniFilename() call there that hardcodes
# /assets/program/lofficerc isn't executed. Instead the hardcoding of
# /assets/rc in BootstrapMap::getBaseIni() gets used.
echo '[Bootstrap]' > assets/rc
echo 'Logo=1' >> assets/rc
echo 'NativeProgress=1' >> assets/rc
echo 'URE_BOOTSTRAP=file:///assets/program/fundamentalrc' >> assets/rc
# echo 'RTL_LOGFILE=file:///dev/log/main' >> assets/rc
echo "HOME=$(APP_DATA_PATH)/cache" >> assets/rc
echo "OSL_SOCKET_PATH=$(APP_DATA_PATH)/cache" >> assets/rc
#
# Set up fundamentalrc
echo '[Bootstrap]' > assets/program/fundamentalrc
echo "LO_LIB_DIR=file:$(APP_DATA_PATH)/lib/" >> assets/program/fundamentalrc
echo "URE_LIB_DIR=file://$(APP_DATA_PATH)/lib/" >> assets/program/fundamentalrc # checkme - is this used to find configs ?
echo 'BRAND_BASE_DIR=file:///assets' >> assets/program/fundamentalrc
echo 'CONFIGURATION_LAYERS=xcsxcu:$${BRAND_BASE_DIR}/share/registry module:$${BRAND_BASE_DIR}/share/registry/modules res:$${BRAND_BASE_DIR}/share/registry' >> assets/program/fundamentalrc
echo 'URE_BIN_DIR=file:///assets/ure/bin/dir/not-here/can-we/exec-anyway' >> assets/program/fundamentalrc
echo 'URE_MORE_TYPES=file:///assets/bin/ure/types.rdb file:///assets/bin/types.rdb' >> assets/program/fundamentalrc
echo 'URE_MORE_SERVICES=file:///assets/xml/services.rdb <$$BRAND_BASE_DIR/program/services>*' >> assets/program/fundamentalrc
#
# Set up unorc
echo '[Bootstrap]' > assets/program/unorc
echo "URE_INTERNAL_LIB_DIR=file://$(APP_DATA_PATH)/lib/" >> assets/program/unorc
echo 'UNO_TYPES=file:///assets/bin/ure/types.rdb file:///assets/bin/types.rdb $${URE_MORE_TYPES}' >> assets/program/unorc
echo 'UNO_SERVICES=file:///assets/xml/ure/services.rdb $${URE_MORE_SERVICES}' >> assets/program/unorc
#
# Set up bootstraprc
echo '[Bootstrap]' > assets/program/bootstraprc
echo 'InstallMode=<installmode>' >> assets/program/bootstraprc
echo 'ProductKey=LibreOffice 3.6' >> assets/program/bootstraprc
echo "UserInstallation=file://$(APP_DATA_PATH)" >> assets/program/bootstraprc
#
# Set up versionrc
echo '[Version]' > assets/program/versionrc
echo 'AllLanguages=en-US' >> assets/program/versionrc
echo 'BuildVersion=' >> assets/program/versionrc
echo 'buildid=dead-beef' >> assets/program/versionrc
echo 'ProductBuildid=3' >> assets/program/versionrc
echo 'ProductMajor=360' >> assets/program/versionrc
echo 'ProductMinor=1' >> assets/program/versionrc
echo 'ProductSource=OOO350' >> assets/program/versionrc
echo 'ReferenceOOoMajorMinor=3.6' >> assets/program/versionrc
#
# .res files
mkdir -p assets/program/resource
cp $(OUTDIR)/bin/*en-US.res assets/program/resource
#
# Assets that are unpacked at run-time into the app's data directory. These
# are files read by non-LO code, fontconfig and freetype for now, that doesn't
# understand "/assets" paths.
mkdir -p assets/unpack/etc/fonts
cp fonts.conf assets/unpack/etc/fonts
mkdir -p assets/unpack/user/fonts
# $UserInstallation/user/fonts is added to the fontconfig path in
# vcl/generic/fontmanager/helper.cxx: psp::getFontPath(). UserInstallation is
# set to the app's data dir above.
cp $(OUTDIR)/pck/Liberation*.ttf assets/unpack/user/fonts
cp $(OUTDIR)/pck/Gen*.ttf assets/unpack/user/fonts
cp $(OUTDIR)/pck/opens___.ttf assets/unpack/user/fonts
#
# Then gdbserver and gdb.setup so that we can debug with ndk-gdb.
#
mkdir -p $(SODEST)
cp $(ANDROID_NDK_GDBSERVER) $(SODEST)
echo set solib-search-path ./obj/local/$(ANDROID_APP_ABI) >$(SODEST)/gdb.setup
build-ant: copy-stuff link-so properties
#
# Copy jar files we need
#
for F in $(strip \
java_uno \
juh \
jurt \
ridl \
unoil \
unoloader \
); do \
$(call COPYJAR,$(OUTDIR)/bin/$${F}.jar); \
done
#
unset JAVA_HOME && $(ANT) debug
install: build-ant
unset JAVA_HOME && $(ANT) debug install
@echo
@echo 'Run it with "make run"'
@echo
uninstall:
$(ANDROID_SDK_HOME)/platform-tools/adb uninstall $(APP_PACKAGE)
run:
# /data/local/tmp/sample-document.odt
adb shell am start -n org.libreoffice.android.examples/.DocumentLoader -e input /assets/test1.odt
clean: properties
$(ANT) clean
rm -rf assets libs $(SODEST) $(OBJLOCAL)
|