[Libreoffice-commits] .: 3 commits - extras/CustomTarget_autocorr.mk filter/Configuration_filter.mk filter/CustomTarget_svg.mk i18npool/CustomTarget_breakiterator.mk i18npool/CustomTarget_localedata.mk officecfg/CustomTarget_registry.mk readlicense_oo/CustomTarget_readme.mk RepositoryExternal.mk Repository.mk solenv/gbuild writerfilter/CustomTarget_source.mk

Libreoffice Gerrit user logerrit at kemper.freedesktop.org
Sat Dec 29 04:04:13 PST 2012


 Repository.mk                          |    4 
 RepositoryExternal.mk                  |   96 ++++++++++++++++--
 extras/CustomTarget_autocorr.mk        |    2 
 filter/Configuration_filter.mk         |    4 
 filter/CustomTarget_svg.mk             |    2 
 i18npool/CustomTarget_breakiterator.mk |   46 +--------
 i18npool/CustomTarget_localedata.mk    |    2 
 officecfg/CustomTarget_registry.mk     |    2 
 readlicense_oo/CustomTarget_readme.mk  |    2 
 solenv/gbuild/ComponentTarget.mk       |    2 
 solenv/gbuild/Configuration.mk         |    2 
 solenv/gbuild/ExternalExecutable.mk    |  167 ++++++++++++++++++++++++---------
 solenv/gbuild/Rdb.mk                   |    2 
 solenv/gbuild/TargetLocations.mk       |    1 
 solenv/gbuild/UnoApiTarget.mk          |    2 
 writerfilter/CustomTarget_source.mk    |    2 
 16 files changed, 235 insertions(+), 103 deletions(-)

New commits:
commit 6306926e038fd7ad49c0089ebce8be0f0f8da3c7
Author: David Tardon <dtardon at redhat.com>
Date:   Sat Dec 29 12:56:24 2012 +0100

    register ICU tools as external executables
    
    Change-Id: Ia6c96d3db5c232cb393832c1dd4e33295827bb99

diff --git a/Repository.mk b/Repository.mk
index 79a56bd..5bf2c36 100755
--- a/Repository.mk
+++ b/Repository.mk
@@ -754,6 +754,10 @@ $(eval $(call gb_Helper_register_jars,OXT, \
 
 # External executables
 $(eval $(call gb_ExternalExecutable_register_executables,\
+	genbrk \
+	genccode \
+	gencmn \
+	gendict \
 	python \
 	ucpp \
 	xmllint \
diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 583ef0b..088a9a7 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -2531,4 +2531,77 @@ endef
 
 endif # SYSTEM_PYTHON
 
+ifneq ($(SYSTEM_GENBRK),)
+
+define gb_ExternalExecutable__register_genbrk
+$(call gb_ExternalExecutable_set_external,genbrk,$(SYSTEM_GENBRK))
+
+endef
+
+else # ! SYSTEM_GENBRK
+
+define gb_ExternalExecutable__register_genbrk
+$(call gb_ExternalExecutable_set_internal,genbrk)
+$(call gb_ExternalExecutable_add_dependencies,genbrk,\
+	$(call gb_Package_get_target_for_build,icu) \
+)
+
+endef
+
+endif
+
+ifneq ($(SYSTEM_GENCCODE),)
+
+define gb_ExternalExecutable__register_genccode
+$(call gb_ExternalExecutable_set_external,genccode,$(SYSTEM_GENCCODE))
+
+endef
+
+else # ! SYSTEM_GENCCODE
+
+define gb_ExternalExecutable__register_genccode
+$(call gb_ExternalExecutable_set_internal,genccode)
+$(call gb_ExternalExecutable_add_dependencies,genccode,\
+	$(call gb_Package_get_target_for_build,icu) \
+)
+
+endef
+
+endif
+
+ifneq ($(SYSTEM_GENCMN),)
+
+define gb_ExternalExecutable__register_gencmn
+$(call gb_ExternalExecutable_set_external,gencmn,$(SYSTEM_GENCMN))
+
+endef
+
+else # ! SYSTEM_GENCMN
+
+define gb_ExternalExecutable__register_gencmn
+$(call gb_ExternalExecutable_set_internal,gencmn)
+$(call gb_ExternalExecutable_add_dependencies,gencmn,\
+	$(call gb_Package_get_target_for_build,icu) \
+)
+
+endef
+
+endif
+
+ifeq ($(SYSTEM_ICU),YES)
+
+gb_ExternalExecutable__register_gendict :=
+
+else
+
+define gb_ExternalExecutable__register_gendict
+$(call gb_ExternalExecutable_set_internal,gendict)
+$(call gb_ExternalExecutable_add_dependencies,gendict,\
+	$(call gb_Package_get_target_for_build,icu) \
+)
+
+endef
+
+endif
+
 # vim: set noet sw=4 ts=4:
diff --git a/i18npool/CustomTarget_breakiterator.mk b/i18npool/CustomTarget_breakiterator.mk
index 28d8596..636406b 100644
--- a/i18npool/CustomTarget_breakiterator.mk
+++ b/i18npool/CustomTarget_breakiterator.mk
@@ -30,46 +30,16 @@ $(eval $(call gb_CustomTarget_CustomTarget,i18npool/breakiterator))
 
 i18npool_BIDIR := $(call gb_CustomTarget_get_workdir,i18npool/breakiterator)
 
-ifeq ($(SYSTEM_ICU),NO)
-i18npool_ICUTARGET := $(call gb_ExternalPackage_get_target,icu)
-else
-i18npool_ICUTARGET :=
-endif
-
 $(call gb_CustomTarget_get_target,i18npool/breakiterator) : \
 	$(i18npool_BIDIR)/dict_ja.cxx $(i18npool_BIDIR)/dict_zh.cxx $(i18npool_BIDIR)/OpenOffice_dat.c
 
 $(i18npool_BIDIR)/dict_%.cxx : \
 		$(SRCDIR)/i18npool/source/breakiterator/data/%.dic \
-		$(call gb_Executable_get_target_for_build,gendict) $(i18npool_ICUTARGET) \
+		$(call gb_ExternalExecutable_get_dependencies,gendict) \
 		| $(i18npool_BIDIR)/.dir
 	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),DIC,1)
 	$(call gb_Helper_abbreviate_dirs,\
-		$(call gb_Helper_execute,gendict) $< $@ $(patsubst $(i18npool_BIDIR)/dict_%.cxx,%,$@))
-
-ifeq ($(SYSTEM_GENBRK),)
-i18npool_GENBRKTARGET := $(call gb_Executable_get_target_for_build,genbrk)
-i18npool_GENBRK := $(call gb_Helper_execute,genbrk)
-else
-i18npool_GENBRKTARGET :=
-i18npool_GENBRK := $(SYSTEM_GENBRK)
-endif
-
-ifeq ($(SYSTEM_GENCCODE),)
-i18npool_GENCCODETARGET := $(call gb_Executable_get_target_for_build,genccode)
-i18npool_GENCCODE := $(call gb_Helper_execute,genccode)
-else
-i18npool_GENCCODETARGET :=
-i18npool_GENCCODE := $(SYSTEM_GENCCODE)
-endif
-
-ifeq ($(SYSTEM_GENCMN),)
-i18npool_GENCMNTARGET := $(call gb_Executable_get_target_for_build,gencmn)
-i18npool_GENCMN := $(call gb_Helper_execute,gencmn)
-else
-i18npool_GENCMNTARGET :=
-i18npool_GENCMN := $(SYSTEM_GENCMN)
-endif
+		$(call gb_ExternalExecutable_get_command,gendict) $< $@ $(patsubst $(i18npool_BIDIR)/dict_%.cxx,%,$@))
 
 i18npool_BRKTXTS := \
     char_in.brk \
@@ -94,28 +64,28 @@ i18npool_BRKTXTS := \
 # Output of gencmn is redirected to OpenOffice_tmp.c with the -t switch.
 $(i18npool_BIDIR)/OpenOffice_dat.c : $(SRCDIR)/i18npool/CustomTarget_breakiterator.mk \
 		$(patsubst %.brk,$(i18npool_BIDIR)/%_brk.c,$(i18npool_BRKTXTS)) \
-		$(i18npool_GENCMNTARGET) $(i18npool_ICUTARGET)
+		$(call gb_ExternalExecutable_get_dependencies,gencmn)
 	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CMN,1)
 	$(call gb_Helper_abbreviate_dirs,\
 		RESPONSEFILE=$(shell $(gb_MKTEMP)) && \
 		$(foreach brk,$(i18npool_BRKTXTS),echo '$(brk)' >> $${RESPONSEFILE} && ) \
-		$(i18npool_GENCMN) -n OpenOffice -t tmp -S -d $(i18npool_BIDIR)/ 0 $${RESPONSEFILE} && \
+		$(call gb_ExternalExecutable_get_command,gencmn) -n OpenOffice -t tmp -S -d $(i18npool_BIDIR)/ 0 $${RESPONSEFILE} && \
 		rm -f $${RESPONSEFILE} && \
 		echo '#ifdef _MSC_VER' > $@ && \
 		echo '#pragma warning( disable : 4229 4668 )' >> $@ && \
 		echo '#endif' >> $@ && \
 		cat $(subst _dat,_tmp,$@) >> $@)
 
-$(i18npool_BIDIR)/%_brk.c : $(i18npool_BIDIR)/%.brk $(i18npool_GENCCODETARGET) $(i18npool_ICUTARGET)
+$(i18npool_BIDIR)/%_brk.c : $(i18npool_BIDIR)/%.brk $(call gb_ExternalExecutable_get_dependencies,genccode)
 	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),CCD,1)
 	$(call gb_Helper_abbreviate_dirs,\
-		$(i18npool_GENCCODE) -n OpenOffice -d $(i18npool_BIDIR)/ $< \
+		$(call gb_ExternalExecutable_get_command,genccode) -n OpenOffice -d $(i18npool_BIDIR)/ $< \
 			$(if $(findstring s,$(MAKEFLAGS)),> /dev/null))
 
-$(i18npool_BIDIR)/%.brk : $(i18npool_BIDIR)/%.txt $(i18npool_GENBRKTARGET) $(i18npool_ICUTARGET)
+$(i18npool_BIDIR)/%.brk : $(i18npool_BIDIR)/%.txt $(call gb_ExternalExecutable_get_dependencies,genbrk)
 	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),BRK,1)
 	$(call gb_Helper_abbreviate_dirs,\
-		$(i18npool_GENBRK) -r $< -o $@ $(if $(findstring s,$(MAKEFLAGS)),> /dev/null))
+		$(call gb_ExternalExecutable_get_command,genbrk) -r $< -o $@ $(if $(findstring s,$(MAKEFLAGS)),> /dev/null))
 
 # fdo#31271 ")" reclassified in more recent Unicode Standards / ICU 4.4
 # * Prepend set empty as of Unicode Version 6.1 / ICU 4.9, which bails out if used.
commit 2e6d024ac589fd1df7f41a30cfdf47a2f1ded932
Author: David Tardon <dtardon at redhat.com>
Date:   Sat Dec 29 10:07:07 2012 +0100

    fix internal python deps on MacOSX
    
    This means we can put python3 back into tail_build, IMO.
    
    Change-Id: I38b43f8fb0a0f91c42acb5acb3066b1e8596ceea

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index ba57b55..583ef0b 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -2521,7 +2521,10 @@ define gb_ExternalExecutable__register_python
 $(call gb_ExternalExecutable_set_internal,python)
 $(call gb_ExternalExecutable_set_precommand,python,$(gb_PYTHON_PRECOMMAND))
 $(call gb_ExternalExecutable_add_dependencies,python,\
-	$(call gb_Package_get_target,python3) \
+	$(if $(filter MACOSX,$(OS)) \
+		,$(call gb_Zip_get_outdir_target_for_build,LibreOfficePython.framework) \
+		,$(call gb_Package_get_target_for_build,python3) \
+	) \
 )
 
 endef
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index 09966d2..d9213ec 100644
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -60,6 +60,7 @@ gb_UnoApiMerge_get_target = $(OUTDIR)/bin/$(1).rdb
 gb_UnoApiMerge_get_target_for_build = $(OUTDIR_FOR_BUILD)/bin/$(1).rdb
 gb_Jar_get_outdir_target = $(OUTDIR)/bin/$(1).jar
 gb_Zip_get_outdir_target = $(OUTDIR)/pck/$(1).zip
+gb_Zip_get_outdir_target_for_build = $(OUTDIR_FOR_BUILD)/pck/$(1).zip
 # outdir targets: $(1) is path
 gb_Configuration_registry = $(OUTDIR)/xml/registry
 gb_XcsTarget_get_outdir_target = \
commit bbf2f413958e7be2bef34c62932fc76f83e7ed18
Author: David Tardon <dtardon at redhat.com>
Date:   Sat Dec 29 10:00:49 2012 +0100

    rethink external executable setup
    
    Change-Id: I5293fea9b5404b82e72761407d325c408a2e45ca

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 57884e8..ba57b55 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -2459,7 +2459,7 @@ gb_ExternalExecutable__register_xmllint :=
 else # ! SYSTEM_LIBXML_FOR_BUILD
 
 define gb_ExternalExecutable__register_xmllint
-gb_ExternalExecutable__xmllint_TARGET := $(call gb_Executable_get_target_for_build,xmllint)
+$(call gb_ExternalExecutable_set_internal,xmllint)
 
 endef
 
@@ -2472,7 +2472,7 @@ gb_ExternalExecutable__register_xsltproc :=
 else # ! SYSTEM_LIBXSLT_FOR_BUILD
 
 define gb_ExternalExecutable__register_xsltproc
-gb_ExternalExecutable__xsltproc_TARGET := $(call gb_Executable_get_target_for_build,xsltproc)
+$(call gb_ExternalExecutable_set_internal,xsltproc)
 
 endef
 
@@ -2485,7 +2485,7 @@ gb_ExternalExecutable__register_ucpp :=
 else # ! SYSTEM_UCPP
 
 define gb_ExternalExecutable__register_ucpp
-gb_ExternalExecutable__ucpp_TARGET := $(call gb_Executable_get_target_for_build,ucpp)
+$(call gb_ExternalExecutable_set_internal,ucpp)
 
 endef
 
@@ -2495,7 +2495,7 @@ endif # SYSTEM_UCPP
 ifeq ($(SYSTEM_PYTHON),YES)
 
 define gb_ExternalExecutable__register_python
-gb_ExternalExecutable__python_COMMAND := $(ICECREAM_RUN) $(PYTHON)
+$(call gb_ExternalExecutable_set_external,python,$(PYTHON))
 
 endef
 
@@ -2505,7 +2505,7 @@ else ifeq ($(OS),MACOSX)
 #gbuild/platform/macosx.mk correctly for mac, e.g. PYTHONPATH and PYTHONHOME
 #dirs for in-tree internal python
 define gb_ExternalExecutable__register_python
-gb_ExternalExecutable__python_COMMAND := $(ICECREAM_RUN) $(PYTHON)
+$(call gb_ExternalExecutable_set_external,python,$(PYTHON))
 
 endef
 
@@ -2518,11 +2518,11 @@ else # ! SYSTEM_PYTHON
 
 # internal python
 define gb_ExternalExecutable__register_python
-gb_ExternalExecutable__python_TARGET := $(call gb_Executable_get_target_for_build,python)
-gb_ExternalExecutable__python_PRECOMMAND := $(gb_PYTHON_PRECOMMAND)
-gb_ExternalExecutable__python_DEPS := \
-	$(call gb_Executable_get_target_for_build,python) \
-	$(call gb_Package_get_target,python3)
+$(call gb_ExternalExecutable_set_internal,python)
+$(call gb_ExternalExecutable_set_precommand,python,$(gb_PYTHON_PRECOMMAND))
+$(call gb_ExternalExecutable_add_dependencies,python,\
+	$(call gb_Package_get_target,python3) \
+)
 
 endef
 
diff --git a/extras/CustomTarget_autocorr.mk b/extras/CustomTarget_autocorr.mk
index 0c6809b..5c6cbfa 100644
--- a/extras/CustomTarget_autocorr.mk
+++ b/extras/CustomTarget_autocorr.mk
@@ -282,7 +282,7 @@ $(call gb_CustomTarget_get_workdir,extras/source/autotext)/%/mimetype : $(SRCDIR
 	cp $< $@
 
 $(call gb_CustomTarget_get_workdir,extras/source/autotext)/%.xml : $(SRCDIR)/extras/source/autotext/lang/%.xml \
-		| $(call gb_ExternalExecutable_get_deps,xsltproc)
+		| $(call gb_ExternalExecutable_get_dependencies,xsltproc)
 	$(call gb_Output_announce,$*.xml,$(true),XSL,1)
 	$(call gb_ExternalExecutable_get_command,xsltproc) -o $@ $(SRCDIR)/extras/util/compact.xsl $<
 
diff --git a/filter/Configuration_filter.mk b/filter/Configuration_filter.mk
index d7fbe1e..df6681b 100644
--- a/filter/Configuration_filter.mk
+++ b/filter/Configuration_filter.mk
@@ -22,7 +22,7 @@
 # semi-integrated with the stuff from Configuration.mk; not exactly pretty...
 
 ifeq ($(SOLAR_JAVA),)
-filter_MERGE_TARGET := $(call gb_ExternalExecutable_get_deps,python) \
+filter_MERGE_TARGET := $(call gb_ExternalExecutable_get_dependencies,python) \
 	$(SRCDIR)/filter/source/config/tools/merge/pyAltFCFGMerge
 filter_MERGE := $(call gb_ExternalExecutable_get_command,python) \
 	$(SRCDIR)/filter/source/config/tools/merge/pyAltFCFGMerge
@@ -230,7 +230,7 @@ $(call gb_Configuration_get_clean_target,fcfg_langpack) : \
 define filter_XcuResTarget__rule
 $$(call filter_XcuResTarget_get_target,$(1)) : \
 		$(filter_XSLT_langfilter) $(filter_XcuFilterUiTarget) \
-		| $(call gb_ExternalExecutable_get_deps,xsltproc)
+		| $(call gb_ExternalExecutable_get_dependencies,xsltproc)
 	$$(call gb_Output_announce,$(1),$(true),XCU,1)
 	$$(call gb_Helper_abbreviate_dirs,\
 		mkdir -p $$(dir $$@) && \
diff --git a/filter/CustomTarget_svg.mk b/filter/CustomTarget_svg.mk
index 461907e..67be7c0 100644
--- a/filter/CustomTarget_svg.mk
+++ b/filter/CustomTarget_svg.mk
@@ -59,7 +59,7 @@ $(filter_GEN_svg_Tokens_cxx) : $(filter_GEN_svg_Tokens_gperf)
 			 > $(filter_GEN_svg_Tokens_cxx))
 
 $(filter_GEN_svg_Script_hxx) : \
-			$(call gb_ExternalExecutable_get_deps,python) \
+			$(call gb_ExternalExecutable_get_dependencies,python) \
 			$(filter_SRC_svg_PresentationEngine) $(filter_SRC_svg_Js2Hxx) \
 			| $(filter_SVGWORK)/.dir
 	$(call gb_Output_announce,$@,build,PY ,1)
diff --git a/i18npool/CustomTarget_localedata.mk b/i18npool/CustomTarget_localedata.mk
index 342dfa3..c56603a 100644
--- a/i18npool/CustomTarget_localedata.mk
+++ b/i18npool/CustomTarget_localedata.mk
@@ -56,7 +56,7 @@ $(i18npool_LDDIR)/localedata_%.cxx : \
 
 $(i18npool_LDDIR)/saxparser.rdb : $(i18npool_LDDIR)/saxparser.input \
 		$(SOLARENV)/bin/packcomponents.xslt \
-		| $(call gb_ExternalExecutable_get_deps,xsltproc)
+	| $(call gb_ExternalExecutable_get_dependencies,xsltproc)
 	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),RDB,1)
 	$(call gb_Helper_abbreviate_dirs, \
 		$(call gb_ExternalExecutable_get_command,xsltproc) --nonet --stringparam prefix $(OUTDIR_FOR_BUILD)/xml/ \
diff --git a/officecfg/CustomTarget_registry.mk b/officecfg/CustomTarget_registry.mk
index c947aa6..565fa84 100644
--- a/officecfg/CustomTarget_registry.mk
+++ b/officecfg/CustomTarget_registry.mk
@@ -47,7 +47,7 @@ officecfg_xsltparams=$(if $(filter-out $(lastword $1),$1),$(call officecfg_xsltp
 $(call gb_CustomTarget_get_workdir,officecfg/registry)/%.hxx: \
             $(SRCDIR)/officecfg/registry/schema/org/openoffice/%.xcs \
             $(SRCDIR)/officecfg/registry/cppheader.xsl\
-	    | $(call gb_ExternalExecutable_get_deps,xsltproc)
+	    | $(call gb_ExternalExecutable_get_dependencies,xsltproc)
 	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),XSL,1)
 	$(call gb_Helper_abbreviate_dirs, \
 	mkdir -p $(dir $@) && \
diff --git a/readlicense_oo/CustomTarget_readme.mk b/readlicense_oo/CustomTarget_readme.mk
index 343823d..f5af682 100644
--- a/readlicense_oo/CustomTarget_readme.mk
+++ b/readlicense_oo/CustomTarget_readme.mk
@@ -56,7 +56,7 @@ $(readlicense_oo_README_PATTERN) : \
 		$(SRCDIR)/readlicense_oo/docs/readme.xsl \
 		$(readlicense_oo_README_XRM) \
 		| $(readlicense_oo_DIR)/.dir \
-		  $(call gb_ExternalExecutable_get_deps,xsltproc)
+		  $(call gb_ExternalExecutable_get_dependencies,xsltproc)
 	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),XSL,1)
 	$(call gb_Helper_abbreviate_dirs, \
 		$(call gb_ExternalExecutable_get_command,xsltproc) --nonet --novalid -o $@.out \
diff --git a/solenv/gbuild/ComponentTarget.mk b/solenv/gbuild/ComponentTarget.mk
index 1b77e0e..866b07d 100644
--- a/solenv/gbuild/ComponentTarget.mk
+++ b/solenv/gbuild/ComponentTarget.mk
@@ -53,7 +53,7 @@ $(call gb_ComponentTarget_get_clean_target,%) :
 
 $(call gb_ComponentTarget_get_target,%) : \
 		$(call gb_ComponentTarget_get_source,%) \
-		| $(call gb_ExternalExecutable_get_deps,xsltproc)
+		| $(call gb_ExternalExecutable_get_dependencies,xsltproc)
 	$(call gb_ComponentTarget__command,$@,$<,$*)
 
 # the .dir is for make 3.81, which ignores trailing /
diff --git a/solenv/gbuild/Configuration.mk b/solenv/gbuild/Configuration.mk
index 59e8a96..db65dc5 100644
--- a/solenv/gbuild/Configuration.mk
+++ b/solenv/gbuild/Configuration.mk
@@ -58,7 +58,7 @@ gb_Configuration__get_source = $(SRCDIR)/$(2)
 gb_Configuration_PRIMARY_REGISTRY_NAME := registry
 
 gb_Configuration_XSLTCOMMAND = $(call gb_ExternalExecutable_get_command,xsltproc)
-gb_Configuration_XSLTCOMMAND_DEPS = $(call gb_ExternalExecutable_get_deps,xsltproc)
+gb_Configuration_XSLTCOMMAND_DEPS = $(call gb_ExternalExecutable_get_dependencies,xsltproc)
 
 # XcsTarget class
 
diff --git a/solenv/gbuild/ExternalExecutable.mk b/solenv/gbuild/ExternalExecutable.mk
index bbdc190..c62b4c6 100644
--- a/solenv/gbuild/ExternalExecutable.mk
+++ b/solenv/gbuild/ExternalExecutable.mk
@@ -12,38 +12,42 @@
 # ExternalExecutable is a little helper for using executables that might
 # either come from system or be built internally.
 #
-# The configuration for an external executable is done in
-# RepositoryExternal.mk by defining function
-# gb_ExternalExecutable__register_EXECUTABLE, which should set up to 4
-# variables. The variables are (presuming the executable is named foo):
-
-# * gb_ExternalExecutable__foo_COMMAND
-#   Defines the complete command for the executable. This must include
-#   shell variables, if required. Defaults to
-#   $(gb_ExternalExecutable__foo_PRECOMMAND) $(ICECREAM_RUN) $(gb_ExternalExecutable__foo_TARGET)
-#   (if gb_ExternalExecutable__foo_TARGET is not defined, plain "foo" is substituted).
-#
-# * gb_ExternalExecutable__foo_DEPS
-#   The complete dependencies needed for running the executable. Only
-#   useful for internally built executables to make sure all data,
-#   config. files etc. are present. Defaults to
-#   $(gb_ExternalExecutable__foo_TARGET).
-#
-# * gb_ExternalExecutable__foo_PRECOMMAND
-#   Any variables that need to be set for running the executable.
-#   Typical example is use of $(gb_Helper_set_ld_path) for internally
-#   built executables.
-#
-# * gb_ExternalExecutable__foo_TARGET
-#   A full path to the executable. Typical definition for internally built
-#   executable is $(call gb_Executable_get_target_for_build,foo).
-#
-# Because of the particular choice of the defaults, there is typically
-# nothing that needs to be set for a system executable. 
+# === Setup ===
+#
+# An ExternalExecutable command consists of 4 parts:
+# * precommand: any command line variables that need to be set
+# * internal: unspecified command(s), possibly including calls of gdb,
+#   valgrind or icerun
+# * executable: the executable, with or without path
+# * arguments: command line arguments that are specific for either
+#   external or internal call, or that are common for _all_ uses of the
+#   executable
+#
+# The configuration is done in RepositoryExternal.mk by defining function
+# gb_ExternalExecutable__register_EXECUTABLE, which can call up to 4
+# functions:
+# * gb_ExternalExecutable_set_external / gb_ExternalExecutable_set_internal
+# * gb_ExternalExecutable_set_precommand
+# * gb_ExternalExecutable_add_dependencies
+# * gb_ExternalExecutable_add_arguments.
+# If neither gb_ExternalExecutable_set_external nor
+# gb_ExternalExecutable_set_internal is used, the executable defaults to
+# the ExternalExecutable's name. Due to that, nothing needs to be set
+# for an external executable in the typical case.
 #
 # All external executables must be registered (by listing the executable
 # name in gb_ExternalExecutable_register_executables call). This is done in
 # Repository.mk .
+#
+# === Usage ===
+#
+# The call site(s) should always use both of the following functions:
+# * gb_ExternalExecutable_get_command: the complete command for the
+#   executable
+# * gb_ExternalExecutable_get_dependencies: all run-time dependencies
+#   needed by the command.
+
+## Infrastructure functions
 
 # The list of registered executables.
 gb_ExternalExecutable_REGISTERED_EXECUTABLES :=
@@ -78,7 +82,9 @@ endef
 #
 # gb_ExternalExecutable_collect_registrations
 define gb_ExternalExecutable_collect_registrations
-$(foreach executable,$(gb_ExternalExecutable_REGISTERED_EXECUTABLES),$(call gb_ExternalExecutable__process_registration,$(executable)))
+$(eval $(foreach executable,$(gb_ExternalExecutable_REGISTERED_EXECUTABLES),\
+	$(call gb_ExternalExecutable__process_registration,$(executable)))
+)
 
 endef
 
@@ -89,13 +95,91 @@ $(if $(filter $(1),$(gb_ExternalExecutable_REGISTERED_EXECUTABLES)),,\
 
 endef
 
+## Setup functions
+
+# Set the executable as external
+#
+# Optionally set a specific executable call to use.
+# Example:
+# 	$(call gb_ExternalExecutable_set_external,python,$(PYTHON))
+#
+# gb_ExternalExecutable_set_external executable call?
+define gb_ExternalExecutable_set_external
+$(if $(2),gb_ExternalExecutable_$(1)_EXECUTABLE := $(2))
+
+endef
+
+define gb_ExternalExecutable__set_internal
+gb_ExternalExecutable_$(1)_EXECUTABLE := $(2)
+gb_ExternalExecutable_$(1)_DEPENDENCIES := $(2)
+gb_ExternalExecutable_$(1)_PRECOMMAND := $(gb_Helper_set_ld_path)
+
+endef
+
+# Set the executable as internal
+#
+# Optionally set a specific executable target to use (if the target
+# returned by gb_Executable_get_target_for_build is not suitable).
+#
+# gb_ExternalExecutable_set_internal executable call?
+define gb_ExternalExecutable_set_internal
+$(call gb_ExternalExecutable__set_internal,$(1),$(if $(strip $(2)),$(2),$(call gb_Executable_get_target_for_build,$(1))))
+
+endef
+
+# Set pre-command for the executable
+#
+# This call should set any command line variables needed for the
+# executable to run.
+#
+# gb_ExternalExecutable_set_precommand executable precommand
+define gb_ExternalExecutable_set_precommand
+gb_ExternalExecutable_$(1)_PRECOMMAND := $(2)
+
+endef
+
+# Add dependencies needed for running the executable
+#
+# Note that the dependencies should in most (if not all) cases be
+# _for_build targets, or there might be problems in cross-compilation
+# Specifically, not using _for_build target would mean either:
+# * the target is built before the command even if it is not necessary
+#   (not really a problem, but might be a nuisance)
+# * the build breaks because the target is not known. This might happen
+#   if there is a difference in configuration between build and host
+#   phases.
+#
+# gb_ExternalExecutable_add_dependencies executable dependencies
+define gb_ExternalExecutable_add_dependencies
+gb_ExternalExecutable_$(1)_DEPENDENCIES += $(2)
+
+endef
+
+# Add arguments needed for running the executable
+#
+# This should only contain arguments that differ between external and
+# internal executable call or that are common for all call sites.
+#
+# gb_ExternalExecutable_add_arguments executable arguments
+define gb_ExternalExecutable_add_arguments
+gb_ExternalExecutable_$(1)_ARGUMENTS += $(2)
+
+endef
+
+## User functions
+
+gb_ExternalExecutable__get_internal := $(ICECREAM_RUN)
+
+define gb_ExternalExecutable__get_executable
+$(if $(gb_ExternalExecutable_$(1)_EXECUTABLE),$(gb_ExternalExecutable_$(1)_EXECUTABLE),$(1))
+endef
+
 define gb_ExternalExecutable__get_command
 $(call gb_ExternalExecutale__check_registration,$(1))
-$(if $(filter undefined,$(origin gb_ExternalExecutable__$(1)_COMMAND)) \
-    ,$(gb_ExternalExecutable__$(1)_PRECOMMAND) $(ICECREAM_RUN) \
-    	$(if $(gb_ExternalExecutable__$(1)_TARGET),$(gb_ExternalExecutable__$(1)_TARGET),$(1)) \
-    ,$(gb_ExternalExecutable__$(1)_COMMAND) \
-)
+$(gb_ExternalExecutable_$(1)_PRECOMMAND) \
+	$(call gb_ExternalExecutable__get_internal,$(1)) \
+	$(call gb_ExternalExecutable__get_executable,$(1)) \
+	$(gb_ExternalExecutable_$(1)_ARGUMENTS)
 endef
 
 # Return the command for running an external executable.
@@ -109,19 +193,16 @@ define gb_ExternalExecutable_get_command
 $(strip $(call gb_ExternalExecutable__get_command,$(1)))
 endef
 
-define gb_ExternalExecutable__get_deps
+define gb_ExternalExecutable__get_dependencies
 $(call gb_ExternalExecutale__check_registration,$(1))
-$(if $(filter undefined,$(origin gb_ExternalExecutable__$(1)_DEPS)) \
-    ,$(gb_ExternalExecutable__$(1)_TARGET) \
-    ,$(gb_ExternalExecutable__$(1)_DEPS) \
-)
+$(gb_ExternalExecutable_$(1)_DEPENDENCIES)
 endef
 
-# Return the deps needed for running an external executable.
+# Return the dependencies needed for running an external executable.
 #
-# gb_ExternalExecutable_get_deps executable
-define gb_ExternalExecutable_get_deps
-$(strip $(call gb_ExternalExecutable__get_deps,$(1)))
+# gb_ExternalExecutable_get_dependencies executable
+define gb_ExternalExecutable_get_dependencies
+$(strip $(call gb_ExternalExecutable__get_dependencies,$(1)))
 endef
 
 # vim: set noet sw=4 ts=4:
diff --git a/solenv/gbuild/Rdb.mk b/solenv/gbuild/Rdb.mk
index 1a6786545..e4df44c 100644
--- a/solenv/gbuild/Rdb.mk
+++ b/solenv/gbuild/Rdb.mk
@@ -37,7 +37,7 @@ $(call gb_Helper_abbreviate_dirs,\
 	rm $(1).input)
 endef
 
-$(call gb_Rdb_get_target,%) :| $(call gb_ExternalExecutable_get_deps,xsltproc)
+$(call gb_Rdb_get_target,%) :| $(call gb_ExternalExecutable_get_dependencies,xsltproc)
 	$(call gb_Output_announce,$*,$(true),RDB,1)
 	$(call gb_Rdb__command,$@,$*,$?,$^)
 
diff --git a/solenv/gbuild/UnoApiTarget.mk b/solenv/gbuild/UnoApiTarget.mk
index 12e592d..4f2f88d 100644
--- a/solenv/gbuild/UnoApiTarget.mk
+++ b/solenv/gbuild/UnoApiTarget.mk
@@ -72,7 +72,7 @@ endef
 # idlc as well so their dummy rule fires if that changes.
 $(call gb_UnoApiPartTarget_get_target,%.done) : \
 		$(gb_UnoApiPartTarget_IDLCTARGET) \
-		| $(call gb_ExternalExecutable_get_deps,ucpp)
+		| $(call gb_ExternalExecutable_get_dependencies,ucpp)
 	$(call gb_UnoApiPartTarget__command,$@,$*,$(filter-out $(gb_UnoApiPartTarget_IDLCTARGET),$(if $(filter $(gb_UnoApiPartTarget_IDLCTARGET),$?),$^,$?)))
 
 ifeq ($(gb_FULLDEPS),$(true))
diff --git a/writerfilter/CustomTarget_source.mk b/writerfilter/CustomTarget_source.mk
index bc0c3bf..0ffd8d9 100644
--- a/writerfilter/CustomTarget_source.mk
+++ b/writerfilter/CustomTarget_source.mk
@@ -204,6 +204,6 @@ $(writerfilter_WORK)/OOXMLFactory%.hxx : $(writerfilter_SRC)/ooxml/factory_ns.xs
 
 $(call gb_CustomTarget_get_target,writerfilter/source) : $(writerfilter_ALL)
 
-$(writerfilter_ALL) :| $(call gb_ExternalExecutable_get_deps,xsltproc) $(writerfilter_WORK)/.dir
+$(writerfilter_ALL) :| $(call gb_ExternalExecutable_get_dependencies,xsltproc) $(writerfilter_WORK)/.dir
 
 # vim: set noet sw=4 ts=4:


More information about the Libreoffice-commits mailing list