Use MsLangId::getConfiguredSystemUILanguage()
[LibreOffice.git] / solenv / gbuild / Extension.mk
bloba79d3999d2085bb2a99056f9cfe2e9293dbd37a3
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/.
10 # Extension class
12 # platform
13 # gb_Extension_LICENSEFILE_DEFAULT
15 gb_Extension__get_preparation_target = $(WORKDIR)/Extension/$(1).prepare
17 gb_Extension_ZIPCOMMAND := zip $(if $(findstring s,$(MAKEFLAGS)),-q)
18 gb_Extension_XRMEXDEPS := $(call gb_Executable_get_runtime_dependencies,xrmex)
19 gb_Extension_XRMEXCOMMAND := $(call gb_Executable_get_command,xrmex)
21 gb_Extension_PROPMERGEDEPS := $(call gb_Executable_get_runtime_dependencies,propex)
22 gb_Extension_PROPMERGECOMMAND := $(call gb_Executable_get_command,propex)
24 gb_Extension_TREEXDEPS := $(call gb_Executable_get_runtime_dependencies,treex)
25 gb_Extension_TREEXCOMMAND := $(call gb_Executable_get_command,treex)
27 gb_Extension_HELPEXDEPS := $(call gb_Executable_get_runtime_dependencies,helpex)
28 gb_Extension_HELPEXCOMMAND := $(call gb_Executable_get_command,helpex)
29 gb_Extension_HELPINDEXERDEPS := $(call gb_Executable_get_runtime_dependencies,HelpIndexer)
30 gb_Extension_HELPINDEXERCOMMAND := $(call gb_Executable_get_command,HelpIndexer)
31 gb_Extension_HELPLINKERDEPS := $(call gb_Executable_get_runtime_dependencies,HelpLinker)
32 gb_Extension_HELPLINKERCOMMAND := $(call gb_Executable_get_command,HelpLinker)
33 # does not contain en-US because it is special cased in gb_Extension_Extension
34 gb_Extension_TRANS_LANGS := $(filter-out en-US,$(gb_WITH_LANG))
35 gb_Extension_ALL_LANGS := en-US $(gb_Extension_TRANS_LANGS)
37 # target ensuring delivery of the extension to instdir
38 gb_Extension__get_final_target = $(WORKDIR)/Extension/$(1).final
40 # Substitute platform or copy if no platform has been set
41 define gb_Extension__subst_platform
42 $(if $(PLATFORM),\
43 sed \
44 -e 's/@PLATFORM@/$(PLATFORM)/' \
45 -e 's/@EXEC_EXTENSION@/$(gb_Executable_EXT)/' \
46 -e 's/@SHARED_EXTENSION@/$(gb_Library_DLLEXT)/' \
47 $(1) > $(2),\
48 cp -f $(1) $(2))
49 endef
51 $(call gb_Extension_get_workdir,%)/.dir :
52 $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
54 # remove extension directory in workdir and oxt file in workdir
55 $(call gb_Extension_get_clean_target,%) :
56 $(call gb_Output_announce,$*,$(false),OXT,3)
57 $(call gb_Helper_abbreviate_dirs,\
58 rm -f -r $(call gb_Extension_get_workdir,$*) && \
59 rm -f $(call gb_Extension__get_preparation_target,$*) \
60 $(call gb_Extension_get_target,$*) \
63 $(call gb_Extension__get_final_target,%) :
64 $(call gb_Helper_abbreviate_dirs,\
65 mkdir -p $(dir $@) && touch $@)
67 # preparation target to delay adding files produced by e.g. UnpackedTarball
68 $(call gb_Extension__get_preparation_target,%) :
69 $(call gb_Helper_abbreviate_dirs,\
70 mkdir -p $(dir $@) && touch $@)
72 ifeq ($(strip $(gb_WITH_LANG)),)
73 $(call gb_Extension_get_workdir,%)/description.xml : $(gb_Helper_LANGSTARGET)
74 $(call gb_Output_announce,$*/description.xml,$(true),CPY,3)
75 $(call gb_Trace_StartRange,$*/description.xml,CPY)
76 $(call gb_Helper_abbreviate_dirs,\
77 mkdir -p $(call gb_Extension_get_workdir,$*) && \
78 cp -f $(LOCATION)/description.xml $@)
79 $(call gb_Trace_EndRange,$*/description.xml,CPY)
80 else
81 $(call gb_Extension_get_workdir,%)/description.xml : $(gb_Extension_XRMEXDEPS) $(gb_Helper_LANGSTARGET)
82 $(call gb_Output_announce,$*/description.xml,$(true),XRM,3)
83 $(call gb_Trace_StartRange,$*/description.xml,XRM)
84 MERGEINPUT=$(call var2file,$(shell $(gb_MKTEMP)),100,$(POFILES)) && \
85 $(call gb_Helper_abbreviate_dirs,\
86 mkdir -p $(call gb_Extension_get_workdir,$*) && \
87 $(gb_Extension_XRMEXCOMMAND) \
88 -i $(filter %.xml,$^) \
89 -o $@ \
90 -m $${MERGEINPUT} \
91 -l all) && \
92 rm -rf $${MERGEINPUT}
93 $(call gb_Trace_EndRange,$*/description.xml,XRM)
95 endif
97 # rule to create oxt package in workdir
98 # --filesync makes sure that all files in the oxt package will be removed that no longer are in $(FILES)
99 $(call gb_Extension_get_target,%) : \
100 $(call gb_Extension_get_workdir,%)/description.xml
101 $(call gb_Output_announce,$*,$(true),OXT,3)
102 $(call gb_Trace_StartRange,$*,OXT)
103 $(call gb_Helper_abbreviate_dirs,\
104 mkdir -p $(call gb_Extension_get_rootdir,$*)/META-INF \
105 $(if $(LICENSE),$(call gb_Extension_get_rootdir,$*)/registration) && \
106 $(call gb_Extension__subst_platform,$(call gb_Extension_get_workdir,$*)/description.xml,$(call gb_Extension_get_rootdir,$*)/description.xml) && \
107 $(call gb_Extension__subst_platform,$(LOCATION)/META-INF/manifest.xml,$(call gb_Extension_get_rootdir,$*)/META-INF/manifest.xml) && \
108 $(if $(LICENSE),cp -f $(LICENSE) $(call gb_Extension_get_rootdir,$*)/registration &&) \
109 $(if $(and $(gb_Extension_TRANS_LANGS),$(DESCRIPTION)),cp $(foreach lang,$(gb_Extension_TRANS_LANGS),$(call gb_Extension_get_workdir,$*)/description-$(lang).txt) $(call gb_Extension_get_rootdir,$*) &&) \
110 cd $(call gb_Extension_get_rootdir,$*) && \
111 ZIPFILES=$(call var2file,$(shell $(gb_MKTEMP)),500,$(sort $(FILES))) && \
112 $(gb_Extension_ZIPCOMMAND) -rX --filesync --must-match \
113 $(call gb_Extension_get_target,$*) \
114 `cat $${ZIPFILES} | tr -d '\r'` && rm $${ZIPFILES})
115 $(call gb_Trace_EndRange,$*,OXT)
117 # set file list and location of manifest and description files
118 # register target and clean target
119 # add deliverable
120 # add dependency for outdir target to workdir target (pattern rule for delivery is in Package.mk)
122 # gb_Extension_Extension extension srcdir nodeliver
123 define gb_Extension_Extension
124 $(call gb_Extension_get_target,$(1)) : DESCRIPTION :=
125 $(call gb_Extension_get_target,$(1)) : FILES := META-INF description.xml
126 $(call gb_Extension_get_target,$(1)) : LICENSE :=
127 $(call gb_Extension_get_target,$(1)) : LOCATION := $(SRCDIR)/$(2)
128 $(call gb_Extension_get_target,$(1)) : PLATFORM := $(PLATFORMID)
129 $(call gb_Extension_get_target,$(1)) : $(SRCDIR)/$(2)/META-INF/manifest.xml
130 $(call gb_Extension_get_workdir,$(1))/description.xml : \
131 $(SRCDIR)/$(2)/description.xml
132 $(call gb_Extension_get_workdir,$(1))/description.xml :| \
133 $(call gb_Extension__get_preparation_target,$(1))
134 $(call gb_Extension__get_final_target,$(1)) : $(call gb_Extension_get_target,$(1))
136 $(if $(filter nodeliver,$(3)),,$(call gb_Extension__Extension_deliver,$(1),Extension/$(1)))
138 ifneq ($(strip $(gb_WITH_LANG)),)
139 $(call gb_Extension_get_target,$(1)) : \
140 POFILES := $(wildcard $(foreach lang,$(gb_TRANS_LANGS),$(gb_POLOCATION)/$(lang)/$(2).po))
141 $(call gb_Extension_get_workdir,$(1))/description.xml : \
142 $(wildcard $(foreach lang,$(gb_TRANS_LANGS),$(gb_POLOCATION)/$(lang)/$(2).po))
143 $(foreach lang,$(gb_TRANS_LANGS),$(gb_POLOCATION)/$(lang)/$(2).po) :
144 endif
146 $(foreach lang,$(gb_Extension_ALL_LANGS), \
147 $(call gb_Extension__compile_help_onelang,$(1),$(lang)))
149 $$(eval $$(call gb_Module_register_target,$(call gb_Extension__get_final_target,$(1)),$(call gb_Extension_get_clean_target,$(1))))
150 $(call gb_Helper_make_userfriendly_targets,$(1),Extension,$(call gb_Extension__get_final_target,$(1)))
152 endef
154 # Ensure delivery of the extension to instdir.
156 # gb_Extension__Extension_deliver extension package-name
157 define gb_Extension__Extension_deliver
158 $(call gb_GeneratedPackage_GeneratedPackage,$(2),$(dir $(call gb_Extension_get_rootdir,$(1))))
159 $(call gb_GeneratedPackage_add_dir,$(2),$(INSTROOT)/$(LIBO_SHARE_FOLDER)/extensions/$(1),$(notdir $(call gb_Extension_get_rootdir,$(1))))
161 $(call gb_GeneratedPackage_get_target,$(2)) : $(call gb_Extension_get_target,$(1))
162 $(call gb_Extension__get_final_target,$(1)) : $(call gb_GeneratedPackage_get_target,$(2))
164 endef
166 # adding a file creates a dependency to it
167 # file is copied to $(WORKDIR)
168 define gb_Extension_add_file
169 $(call gb_Extension_get_target,$(1)) : FILES += $(2)
170 $(call gb_Extension_get_target,$(1)) : $(call gb_Extension_get_rootdir,$(1))/$(2)
171 $(3) :| $(call gb_Extension__get_preparation_target,$(1))
172 $(call gb_Extension_get_rootdir,$(1))/$(2) : $(3)
173 mkdir -p $$(dir $$@) && \
174 cp -f $(3) $$@
176 endef
178 # Add several files at once
180 # This function avoids the need to specify each file's name twice. The
181 # files are added directly under specified path in the extension,
182 # without any subpath. If no path is specified, they are added directly
183 # to the root dir of the extension.
184 define gb_Extension_add_files
185 $(foreach file,$(3),$(call gb_Extension_add_file,$(1),$(if $(strip $(2)),$(strip $(2))/)$(notdir $(file)),$(file)))
187 endef
189 # add a library from workdir; DO NOT use gb_Library_get_target
190 define gb_Extension_add_library
191 $(call gb_Extension_add_file,$(1),$(call gb_Library_get_runtime_filename,$(2)),\
192 $(call gb_LinkTarget_get_target,$(call gb_Library_get_linktarget,$(2))))
194 endef
196 define gb_Extension_add_libraries
197 $(foreach lib,$(2),$(call gb_Extension_add_library,$(1),$(lib)))
199 endef
201 # add an executable
202 define gb_Extension_add_executable
203 $(call gb_Extension_add_file,$(1),$(notdir $(call gb_Executable_get_target,$(2))),\
204 $(call gb_Executable_get_target,$(2)))
206 endef
208 define gb_Extension_add_executables
209 $(foreach exe,$(2),$(call gb_Extension_add_executable,$(1),$(exe)))
211 endef
213 # localize .properties file
214 # source file is copied to $(WORKDIR)
215 define gb_Extension_localize_properties
216 $(foreach lang,$(gb_Extension_ALL_LANGS),\
217 $(call gb_Extension__localize_properties_onelang,$(1),$(subst en_US,$(subst -,_,$(lang)),$(2)),$(3),$(lang)))
219 endef
222 # add an .xhp help file, to be localized and compiled
223 # $(1): extension identifier
224 # $(2): absolute path prefix of en-US source file without $(3) (resp. $(4))
225 # suffix
226 # $(3): relative path of (target) .xhp file (e.g.,
227 # com.sun.wiki-publisher/wiki.xhp)
228 # $(4): optional relative path of source .xhp file, when it differs from $(3)
229 # (i.e., if $(4) is empty the en-US source file is $(2)/$(3), otherwise it
230 # is $(2)/$(4))
231 define gb_Extension_add_helpfile
232 $(foreach lang,$(gb_Extension_ALL_LANGS), \
233 $(call gb_Extension__localize_helpfile_onelang,$(1),$(2),$(3),$(4),$(lang)) \
234 $(call gb_Extension__add_compiled_help_dependency_onelang,$(1),$(lang)))
236 endef
238 # add a list of .xhp help files, to be localized and compiled
239 # $(1): extension identifier
240 # $(2): absolute path prefix of en-US source files without $(3) suffixes
241 # $(3): list of relative paths of .xhp files (see gb_Extension_add_helpfile)
242 define gb_Extension_add_helpfiles
243 $(foreach helpfile,$(3), \
244 $(call gb_Extension_add_helpfile,$(1),$(2),$(helpfile),))
246 endef
248 # add a help.tree file, to be localized and compiled
249 # $(1): extension identifier
250 # $(2): absolute path prefix of en-US source file without $(3) (resp. $(4))
251 # suffix
252 # $(3): relative path of (target) help.tree file (e.g.,
253 # com.sun.wiki-publisher/help.tree)
254 # $(4): relative path of source help.tree file
255 # $(5): relative path of localized xhp files (PlatformID included)
256 define gb_Extension_add_helptreefile
257 $(foreach lang,$(gb_Extension_ALL_LANGS), \
258 $(call gb_Extension__localize_helptreefile_onelang,$(1),$(2),$(3),$(4),$(lang),$(5)) \
259 $(call gb_Extension__add_compiled_help_dependency_onelang,$(1),$(lang)))
261 endef
263 # Use the given file as description-en-US.txt
264 define gb_Extension_use_default_description
265 $(call gb_Extension_add_file,$(1),description-en-US.txt,$(SRCDIR)/$(2))
266 $(call gb_Extension_get_target,$(1)) : DESCRIPTION := $(true)
267 ifneq ($(strip $(gb_WITH_LANG)),)
268 $(call gb_Extension_get_target,$(1)) : FILES += $(foreach lang,$(gb_Extension_TRANS_LANGS),description-$(lang).txt)
269 endif
271 endef
273 # Use the default license file
274 define gb_Extension_use_default_license
275 $(call gb_Extension_get_target,$(1)) : FILES += registration
276 $(call gb_Extension_get_target,$(1)) : LICENSE := $(gb_Extension_LICENSEFILE_DEFAULT)
277 $(call gb_Extension_get_target,$(1)) : $(gb_Extension_LICENSEFILE_DEFAULT)
279 endef
281 define gb_Extension_use_unpacked
282 $(call gb_Extension__get_preparation_target,$(1)) \
283 :| $(call gb_UnpackedTarball_get_final_target,$(2))
285 endef
287 # Add a dependency on an ExternalProject.
289 # call gb_Extension_use_external_project,extension,externalproject
290 define gb_Extension_use_external_project
291 $(call gb_Extension__get_preparation_target,$(1)) \
292 :| $(call gb_ExternalProject_get_target,$(2))
294 endef
296 define gb_Extension__localize_properties_onelang
297 $(call gb_Extension_get_target,$(1)) : FILES += $(2)
298 ifneq ($(filter-out en-US,$(4)),)
299 ifneq ($(filter-out qtz,$(4)),)
300 $(call gb_Extension_get_rootdir,$(1))/$(2) : \
301 POFILE := $(gb_POLOCATION)/$(or $(5),$(4))/$(patsubst /%/,%,$(subst $(SRCDIR),,$(dir $(3)))).po
302 $(call gb_Extension_get_rootdir,$(1))/$(2) : \
303 $(gb_POLOCATION)/$(or $(5),$(4))/$(patsubst /%/,%,$(subst $(SRCDIR),,$(dir $(3)))).po
304 $(gb_POLOCATION)/$(or $(5),$(4))/$(patsubst /%/,%,$(subst $(SRCDIR),,$(dir $(3)))).po :
305 endif
306 endif
307 $(call gb_Extension_get_target,$(1)) : $(call gb_Extension_get_rootdir,$(1))/$(2)
308 $(call gb_Extension_get_rootdir,$(1))/$(2) \
309 :| $(call gb_Extension__get_preparation_target,$(1))
310 $(call gb_Extension_get_rootdir,$(1))/$(2) : $(3) \
311 $(gb_Extension_PROPMERGEDEPS)
312 $$(call gb_Output_announce,$(2),$(true),PRP,3)
313 $$(call gb_Trace_StartRange,$(2),PRP)
314 $$(call gb_Helper_abbreviate_dirs, \
315 mkdir -p $$(dir $$@) && \
316 $(if $(filter qtz,$(4)), \
317 $(subst $$,$$$$,$(gb_Extension_PROPMERGECOMMAND)) -i $$< -o $$@ -m -l $(4) \
319 $(if $(filter-out en-US,$(4)), \
320 MERGEINPUT=`$(gb_MKTEMP)` && \
321 echo $$(POFILE) > $$$${MERGEINPUT} && \
322 $(subst $$,$$$$,$(gb_Extension_PROPMERGECOMMAND)) -i $$< -o $$@ -m $$$${MERGEINPUT} -l $(4) && \
323 rm -rf $$$${MERGEINPUT} \
325 cp -f $$< $$@ \
329 $$(call gb_Trace_EndRange,$(2),PRP)
331 endef
333 # localize one .xhp help file for one language; the result is stored as
334 # help/$(4)/$(3) in the extension's workdir; as a special case, if $(4) is
335 # "en-US", the source file is just copied, not passed through helpex
336 # $(1): extension identifier
337 # $(2): absolute path prefix of en-US source file without $(3) (resp. $(4))
338 # suffix
339 # $(3): relative path of (target) .xhp file (see
340 # gb_Extension_add_helpfile)
341 # $(4): optional relative path of source .xhp file (see
342 # gb_Extension_add_helpfile)
343 # $(5): language
344 define gb_Extension__localize_helpfile_onelang
345 $(call gb_Extension_get_rootdir,$(1))/help/$(5).done : HELPFILES += $(3)
346 $(call gb_Extension_get_rootdir,$(1))/help/$(5).done : \
347 $(call gb_Extension_get_workdir,$(1))/help/$(5)/$(3)
348 $(call gb_Extension_get_rootdir,$(1))/help/$(5)-xhp.done : \
349 $(call gb_Extension_get_workdir,$(1))/help/$(5)/$(3)
350 ifneq ($(filter-out en-US,$(5)),)
351 ifneq ($(filter-out qtz,$(5)),)
352 $(call gb_Extension_get_workdir,$(1))/help/$(5)/$(3) : \
353 POFILE := $(gb_POLOCATION)/$(5)$(subst $(SRCDIR),,$(2))$(patsubst %/,/%.po,$(patsubst ./,.po,$(dir $(or $(4),$(3)))))
354 $(call gb_Extension_get_workdir,$(1))/help/$(5)/$(3) : \
355 $(gb_POLOCATION)/$(5)$(subst $(SRCDIR),,$(2))$(patsubst %/,/%.po,$(patsubst ./,.po,$(dir $(or $(4),$(3)))))
356 $(gb_POLOCATION)/$(5)$(subst $(SRCDIR),,$(2))$(patsubst %/,/%.po,$(patsubst ./,.po,$(dir $(or $(4),$(3))))) :
357 endif
358 endif
359 $(call gb_Extension_get_workdir,$(1))/help/$(5)/$(3) : \
360 $(if $(filter-out en-US,$(5)),$(gb_Extension_HELPEXDEPS)) | \
361 $(call gb_Extension_get_workdir,$(1))/help/.dir
362 $(call gb_Extension_get_workdir,$(1))/help/$(5)/$(3) : \
363 $(2)/$(or $(4),$(3))
364 $$(call gb_Output_announce,$(1) $(3) $(5),$(true),XHP,3)
365 $$(call gb_Trace_StartRange,$(1) $(3) $(5),XHP)
366 $$(call gb_Helper_abbreviate_dirs, \
367 mkdir -p $$(dir $$@) && \
368 $(if $(filter qtz,$(5)), \
369 $$(gb_Extension_HELPEXCOMMAND) -i $$< -o $$@ -l $(5) -m \
371 $(if $(filter-out en-US,$(5)), \
372 MERGEINPUT=`$(gb_MKTEMP)` && \
373 echo $$(POFILE) > $$$${MERGEINPUT} && \
374 $$(gb_Extension_HELPEXCOMMAND) -i $$< -o $$@ -l $(5) \
375 -m $$$${MERGEINPUT} && \
376 rm -rf $$$${MERGEINPUT} \
378 cp $$< $$@ \
380 ) && \
381 touch $(call gb_Extension_get_rootdir,$(1))/help/$(5)-xhp.done \
383 $$(call gb_Trace_EndRange,$(1) $(3) $(5),XHP)
385 endef
387 # localize one help.tree for one language; the result is stored as
388 # help/$(4)/$(3) in the extension's workdir;
389 # $(1): extension identifier
390 # $(2): absolute path prefix of en-US source file without $(3) (resp. $(4))
391 # suffix
392 # $(3): relative path of (target) help.tree file (see
393 # gb_Extension_add_helptreefile)
394 # $(4): relative path of source help.tree file (see
395 # gb_Extension_add_helptreefile)
396 # $(5): language
397 # $(6): relative path of localized xhp files (PlatformID included)
398 define gb_Extension__localize_helptreefile_onelang
399 $(call gb_Extension_get_rootdir,$(1))/help/$(5).done : \
400 $(call gb_Extension_get_rootdir,$(1))/help/$(5)/$(3)
401 ifneq ($(filter-out en-US,$(5)),)
402 ifneq ($(filter-out qtz,$(5)),)
403 $(call gb_Extension_get_rootdir,$(1))/help/$(5)/$(3) : \
404 POFILE := $(gb_POLOCATION)/$(5)$(subst $(SRCDIR),,$(2))$(patsubst %/,/%.po,$(patsubst ./,.po,$(dir $(4))))
405 $(call gb_Extension_get_rootdir,$(1))/help/$(5)/$(3) : \
406 $(gb_POLOCATION)/$(5)$(subst $(SRCDIR),,$(2))$(patsubst %/,/%.po,$(patsubst ./,.po,$(dir $(4))))
407 $(gb_POLOCATION)/$(5)$(subst $(SRCDIR),,$(2))$(patsubst %/,/%.po,$(patsubst ./,.po,$(dir $(4)))) :
408 endif
409 endif
410 $(call gb_Extension_get_rootdir,$(1))/help/$(5)/$(3) : \
411 $(call gb_Extension_get_rootdir,$(1))/help/$(5)-xhp.done
412 $(call gb_Extension_get_rootdir,$(1))/help/$(5)/$(3) : \
413 $(gb_Extension_TREEXDEPS) | \
414 $(2)/$(4)
415 $(call gb_Extension_get_rootdir,$(1))/help/$(5)/$(3) : \
416 $(2)/$(or $(4),$(3))
417 $$(call gb_Output_announce,$(1) $(3) $(5),$(true),TRE,3)
418 $$(call gb_Trace_StartRange,$(1) $(3) $(5),TRE)
419 $$(call gb_Helper_abbreviate_dirs, \
420 mkdir -p $$(dir $$@) && \
421 $(if $(filter qtz,$(5)), \
422 $(subst $$,$$$$,$(gb_Extension_TREEXCOMMAND)) -i $$< -o $$@ -l $(5) -m \
423 -r $$(call gb_Extension_get_workdir,$(1))/help/$(5)/$(6) \
425 $(if $(filter-out en-US,$(5)), \
426 MERGEINPUT=`$(gb_MKTEMP)` && \
427 echo $$(POFILE) > $$$${MERGEINPUT} && \
428 $(subst $$,$$$$,$(gb_Extension_TREEXCOMMAND)) -i $$< -o $$@ -l $(5) \
429 -m $$$${MERGEINPUT} \
430 -r $$(call gb_Extension_get_workdir,$(1))/help/$(5)/$(6) && \
431 rm -rf $$$${MERGEINPUT} \
433 $(subst $$,$$$$,$(gb_Extension_TREEXCOMMAND)) -i $$< -o $$@ -l $(5) \
434 -r $$(call gb_Extension_get_workdir,$(1))/help/$(5)/$(6) \
438 $$(call gb_Trace_EndRange,$(1) $(3) $(5),XHP)
440 endef
442 # compile help for one language; the result is stored as help/$(3)/ in the
443 # extension's rootdir and marked for zipping into the .oxt
444 # $(1): extension identifier
445 # $(2): language
446 # Target-specific HELPFILES: list of relative paths of .xhp files (see
447 # gb_Extension_add_helpfile)
448 define gb_Extension__compile_help_onelang
449 $(call gb_Extension_get_rootdir,$(1))/help/$(2).done : \
450 $(gb_Extension_HELPINDEXERDEPS) \
451 $(gb_Extension_HELPLINKERDEPS) \
452 $(SRCDIR)/xmlhelp/util/embed.xsl \
453 $(SRCDIR)/xmlhelp/util/idxcaption.xsl \
454 $(SRCDIR)/xmlhelp/util/idxcontent.xsl | \
455 $(call gb_Extension_get_rootdir,$(1))/help/.dir
456 $$(call gb_Output_announce,$(1) $(2),$(true),XHC,3)
457 $$(call gb_Trace_StartRange,$(1) $(2),XHC)
458 $$(call gb_Helper_abbreviate_dirs, \
459 mkdir -p $$(basename $$@) && \
460 $$(gb_Extension_HELPLINKERCOMMAND) -mod help \
461 -extlangsrc $(call gb_Extension_get_workdir,$(1))/help/$(2) \
462 -sty $(SRCDIR)/xmlhelp/util/embed.xsl \
463 -extlangdest $$(basename $$@) \
464 -idxcaption $(SRCDIR)/xmlhelp/util/idxcaption.xsl \
465 -idxcontent $(SRCDIR)/xmlhelp/util/idxcontent.xsl \
466 $$(HELPFILES) && \
467 (cd $(call gb_Extension_get_workdir,$(1))/help/$(2) && \
468 $$(gb_Extension_ZIPCOMMAND) -r $$(basename $$@)/help.jar \
469 $$(HELPFILES)) && \
470 $$(gb_Extension_HELPINDEXERCOMMAND) -lang $(2) -mod help \
471 -dir $$(basename $$@) && \
472 rm -fr $$(basename $$@)/caption $$(basename $$@)/content && \
473 touch $$@)
474 $$(call gb_Trace_EndRange,$(1) $(2),XHC)
476 endef
478 # establish the dependency that actually causes inclusion of the compiled help
479 # into the .oxt, for one language; in principle, this would only need to be done
480 # once per language iff the extension uses any help -- currently it is done from
481 # each individual gb_Extension_add_helpfile call (and thus requires $strip
482 # to remove duplicates from FILES)
483 # $(1): extension identifier
484 # $(2): language
485 define gb_Extension__add_compiled_help_dependency_onelang
486 $(call gb_Extension_get_target,$(1)) : FILES += help/$(2)
487 $(call gb_Extension_get_target,$(1)) : \
488 $(call gb_Extension_get_rootdir,$(1))/help/$(2).done
489 $(call gb_Extension_get_rootdir,$(1))/help/$(2).done \
490 :| $(call gb_Extension__get_preparation_target,$(1))
492 endef
494 # vim: set noet sw=4 ts=4: