avoid exceeding commandline limits
[LibreOffice.git] / ios / CustomTarget_LibreOffice_app.mk
blob719ff0905bb724bd7d21eda320a6dee32c7bfb20
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
9 $(eval $(call gb_CustomTarget_CustomTarget,ios/LibreOffice_app))
11 # We distinguish between builds for the simulator and device by
12 # looking for the "iarmv7" or "i386" in the -arch option that is part
13 # of $(CC)
15 ifneq ($(filter arm64,$(CC)),)
16 xcode_sdk=iphoneos
17 xcode_arch=arm64
18 else ifneq ($(filter i386,$(CC)),)
19 xcode_sdk=iphonesimulator
20 xcode_arch=i386
21 else
22 xcode_sdk=iphoneos
23 xcode_arch=armv7
24 endif
26 # If run from Xcode, check that its configuration (device or
27 # simulator) matches that of gbuild. We detect being run from Xcode by
28 # looking for $(SCRIPT_OUTPUT_FILE_0). The Run Script build phase in
29 # our project has as its (single) output file the location of the app
30 # executable in its app bundle.
32 ifneq ($(SCRIPT_OUTPUT_FILE_0),)
34 export CCACHE_CPP2=y
36 ifneq ($(CURRENT_ARCH),$(xcode_arch))
37 $(error Xcode platform ($(CURRENT_ARCH)) does not match that of this build tree ($(xcode_arch)))
38 endif
40 endif
42 ifneq ($(SCRIPT_OUTPUT_FILE_0),)
43 ifeq ($(EXECUTABLE_NAME),LibreOffice)
44 # When run from Xcode, we move the LibreOffice executable from solver into
45 # the LibreOffice.app directory that Xcode uses. We also set up/copy all
46 # the run-time configuration etc files that the app needs.
47 $(call gb_CustomTarget_get_target,ios/LibreOffice_app) : $(SCRIPT_OUTPUT_FILE_0)
49 appdir=$(dir $(SCRIPT_OUTPUT_FILE_0))
50 buildid=$(shell cd $(SRCDIR) && git log -1 --format=%H)
52 $(SCRIPT_OUTPUT_FILE_0) : $(call gb_Executable_get_target,LibreOffice)
53 $(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),APP,2)
54 mkdir -p $(appdir)/ure
55 mv $(call gb_Executable_get_target,LibreOffice) $(SCRIPT_OUTPUT_FILE_0)
57 # Copy rdb files
59 cp $(INSTDIR)/ure/share/misc/types.rdb $(appdir)
60 cp $(INSTDIR)/program/types/offapi.rdb $(appdir)
61 cp $(INSTDIR)/program/types/oovbaapi.rdb $(appdir)
62 cp $(INSTDIR)/program/services/services.rdb $(appdir)
63 cp $(INSTDIR)/ure/share/misc/services.rdb $(appdir)/ure
65 # Copy .res files
67 # program/resource is hardcoded in tools/source/rc/resmgr.cxx. Sure,
68 # we could set STAR_RESOURCE_PATH instead. sigh...
70 mkdir -p $(appdir)/program/resource
71 cp $(INSTDIR)/$(LIBO_SHARE_RESOURCE_FOLDER)/*en-US.res $(appdir)/program/resource
73 # Artwork
75 mkdir -p $(appdir)/share/config
76 cp -R $(INSTDIR)/$(LIBO_SHARE_FOLDER)/config/images_tango.zip $(appdir)/share/config/images.zip
78 # soffice.cfg
80 cp -R $(INSTROOT)/share/config/soffice.cfg $(appdir)/share/config
82 # "registry"
84 cp -R $(INSTROOT)/$(LIBO_SHARE_FOLDER)/registry $(appdir)/share
86 # Set up rc, the "inifile". See getIniFileName_Impl().
88 ( \
89 echo '[Bootstrap]' && \
90 echo 'URE_BOOTSTRAP=file://$$APP_DATA_DIR/fundamentalrc' && \
91 echo 'HOME=$$APP_DATA_DIR/tmp' && \
92 : ) > $(appdir)/rc
94 # Set up fundamentalrc, unorc, bootstraprc and versionrc.
96 # Do we really need all these?
98 ( \
99 echo '[Bootstrap]' && \
100 echo 'BRAND_BASE_DIR=file://$$APP_DATA_DIR' && \
101 echo 'CONFIGURATION_LAYERS=xcsxcu:$${BRAND_BASE_DIR}/share/registry res:$${BRAND_BASE_DIR}/share/registry' && \
102 : ) > $(appdir)/fundamentalrc
105 echo '[Bootstrap]' && \
106 : UNO_TYPES and UNO_SERVICES are set up in lo-viewer.mm, is that sane? && \
107 : ) > $(appdir)/unorc
109 # bootstraprc must be in $BRAND_BASE_DIR/program
111 mkdir -p $(appdir)/program
113 echo '[Bootstrap]' && \
114 echo 'InstallMode=<installmode>' && \
115 echo 'ProductKey=LibreOffice $(PRODUCTVERSION)' && \
116 echo 'UserInstallation=file://$$APP_DATA_DIR/../Library/Application%20Support' && \
117 : ) > $(appdir)/program/bootstraprc
119 # Is this really needed?
122 echo '[Version]' && \
123 echo 'AllLanguages=en-US' && \
124 echo 'BuildVersion=' && \
125 echo 'buildid=$(buildid)' && \
126 echo 'ProductMajor=360' && \
127 echo 'ProductMinor=1' && \
128 : ) > $(appdir)/program/versionrc
130 # Copy a sample document... good old test1.odt...
132 cp $(SRC_ROOT)/odk/examples/java/DocumentHandling/test/test1.odt $(appdir)
133 endif
134 else
135 # When run just from the command line, we don't have any app bundle to
136 # copy or move the executable to. So do nothing. Except one trick:
137 # Copy the Xcode project to BUILDDIR if SRCDIR!=BUILDDIR, so that one
138 # can then open it from there in Xcode.
139 $(call gb_CustomTarget_get_target,ios/LibreOffice_app) : $(gb_Helper_PHONY)
140 if test $(SRCDIR) != $(BUILDDIR); then \
141 (cd $(SRCDIR) && tar cf - ios/experimental/LibreOffice/LibreOffice.xcodeproj/project.pbxproj) | (cd $(BUILDDIR) && tar xf -); \
144 $(call gb_CustomTarget_get_clean_target,ios/LibreOffice_app) :
145 $(call gb_Output_announce,$(subst $(WORKDIR)/Clean/,,$@),$(false),APP,2)
146 # Here we just assume that Xcode's settings are default, or something
147 rm -rf experimental/LibreOffice/build
149 endif
151 # vim: set noet sw=4 ts=4: