rethink external executable setup
Change-Id: I5293fea9b5404b82e72761407d325c408a2e45ca
This commit is contained in:
parent
2f0e0daf9b
commit
bbf2f41395
@ -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
|
||||
|
||||
|
@ -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 $<
|
||||
|
||||
|
@ -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 $$@) && \
|
||||
|
@ -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)
|
||||
|
@ -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/ \
|
||||
|
@ -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 $@) && \
|
||||
|
@ -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 \
|
||||
|
@ -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 /
|
||||
|
@ -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
|
||||
|
||||
|
@ -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).
|
||||
# === Setup ===
|
||||
#
|
||||
# * 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).
|
||||
# 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
|
||||
#
|
||||
# * 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.
|
||||
# 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:
|
||||
|
@ -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,$@,$*,$?,$^)
|
||||
|
||||
|
@ -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))
|
||||
|
@ -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:
|
||||
|
Loading…
x
Reference in New Issue
Block a user