diff options
author | David Tardon <dtardon@redhat.com> | 2013-05-07 20:41:41 +0200 |
---|---|---|
committer | Michael Meeks <michael.meeks@suse.com> | 2013-05-15 09:37:38 +0100 |
commit | 1546c2935c50ba37692d551fa26c9c95e14a1363 (patch) | |
tree | ce1d920db0b5d51a13f67a9716d91380a2da5dbf /solenv/gbuild/Gallery.mk | |
parent | 95fe3df714fa2064d93c779a8a206af9bc244fe7 (diff) |
gbuild: make Gallery work
Change-Id: Ia2914e24f03cdb3f24df30bf203a09d18f4a8fd4
Diffstat (limited to 'solenv/gbuild/Gallery.mk')
-rw-r--r-- | solenv/gbuild/Gallery.mk | 208 |
1 files changed, 122 insertions, 86 deletions
diff --git a/solenv/gbuild/Gallery.mk b/solenv/gbuild/Gallery.mk index 850862210fb2..eae9b680926b 100644 --- a/solenv/gbuild/Gallery.mk +++ b/solenv/gbuild/Gallery.mk @@ -7,116 +7,152 @@ # file, You can obtain one at http://mozilla.org/MPL/2.0/. # -.PHONY : $(call gb_Gallery_get_clean_target,%) -$(call gb_Gallery_get_clean_target,%) : - $(call gb_Helper_abbreviate_dirs,\ - rm -f $(call gb_Gallery_get_target,$*) $(call gb_Gallery_get_target,$*).log) +# class Gallery + +# Handles creation of image galleries. + +gb_Gallery__UNO_COMPONENTS := \ + comphelper/util/comphelp \ + configmgr/source/configmgr \ + fileaccess/source/fileacc \ + framework/util/fwk \ + i18npool/util/i18npool \ + package/source/xstor/xstor \ + package/util/package2 \ + sfx2/util/sfx \ + svx/util/svx \ + svx/util/svxcore \ + ucb/source/core/ucb1 \ + ucb/source/ucp/file/ucpfile1 \ + unoxml/source/service/unoxml + +gb_Gallery__UNO_TYPES := \ + offapi \ + udkapi + +# TODO: this should be in RepositoryExternal.mk, but it would lead to +# duplication. Fix. +gb_Gallery_EXTRA_DEPENCENCIES := \ + $(foreach component,$(gb_Gallery__UNO_COMPONENTS),$(call gb_ComponentTarget_get_outdir_target_for_build,$(component))) \ + $(foreach api,$(gb_Gallery__UNO_TYPES),$(call gb_UnoApi_get_target,$(api))) + +gb_Gallery_INSTDIR := share/gallery + +# BRAND_BASE_DIR is for resource files +define gb_Gallery__make_env_args +"-env:BRAND_BASE_DIR=$(call gb_Helper_make_url,$(OUTDIR_FOR_BUILD)/unittest/install)" \ +"-env:CONFIGURATION_LAYERS=xcsxcu:$(call gb_Helper_make_url,$(gb_Configuration_registry)) \ + module:$(call gb_Helper_make_url,$(gb_Configuration_registry)/spool)" \ +"-env:UNO_SERVICES=$(call gb_Helper_make_url,$(call gb_Rdb_get_outdir_target_for_build,ure/services)) \ + $(foreach item,$(gb_Gallery__UNO_COMPONENTS),\ + $(call gb_Helper_make_url,$(call gb_ComponentTarget_get_outdir_target_for_build,$(item))))" \ +"-env:UNO_TYPES=$(foreach item,$(gb_Gallery__UNO_TYPES),\ + $(call gb_Helper_make_url,$(call gb_UnoApi_get_target,$(item))))" \ +$(foreach dir,URE_INTERNAL_LIB_DIR LO_LIB_DIR,\ + -env:$(dir)=$(call gb_Helper_make_url,$(gb_Helper_OUTDIRLIBDIR))) +endef -.PHONY : $(call gb_Gallery_get_target,%) -$(call gb_Gallery_get_target,%) :| $(call gb_Gallery_get_target,$(1))/$(2).thm - @echo "foo" +define gb_Gallery__command +$(call gb_Output_announce,$(2),$(true),GAL,1) +$(call gb_Helper_abbreviate_dirs,\ + rm -f $(call gb_Gallery_get_workdir,$(2))/* && \ + SAL_USE_VCLPLUGIN=svp \ + $(call gb_Executable_get_command,gengal.bin) \ + $(call gb_Gallery__make_env_args) \ + --destdir $(GALLERY_BASEDIR) \ + --name "$(GALLERY_NAME)" \ + --path $(call gb_Gallery_get_workdir,$(2))) \ + $(GALLERY_FILES) && \ + touch $@ +endef +gb_Gallery__get_final_target = $(WORKDIR)/Gallery/$(1).final -define gb_Gallery_Gallery +$(dir $(call gb_Gallery_get_target,$(1))).dir : + $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) -$(call gb_Gallery_get_target,$(1)) : CONFIGURATION_LAYERS := -$(call gb_Gallery_get_target,$(1)) : URE := $(false) -$(call gb_Gallery_get_target,$(1)) : UNO_SERVICES := -$(call gb_Gallery_get_target,$(1)) : UNO_TYPES := -$(call gb_Gallery_get_target,$(1)) : IMAGE_FILES := +$(dir $(call gb_Gallery_get_target,$(1)))%/.dir : + $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) -$(call gb_Gallery_get_target,$(1)) :| $(dir $(call gb_Gallery_get_target,$(1))).dir +$(call gb_Gallery_get_target,%) : \ + $(call gb_Executable_get_runtime_dependencies,gengal.bin) \ + $(gb_Gallery_EXTRA_DEPENCENCIES) + $(call gb_Gallery__command,$@,$*) -$(dir $(call gb_Gallery_get_target,$(1))).dir : - mkdir -p $(dir $(call gb_Gallery_get_target,$(1))) - touch $(dir $(call gb_Gallery_get_target,$(1))).dir - -$(eval $(call gb_Module_register_target,$(call gb_Gallery_get_target,$(1)),$(call gb_Gallery_get_clean_target,$(1)))) -$(call gb_Helper_make_userfriendly_targets,$(1),Gallery) - -$(eval $(call gb_Gallery_use_components,$(1), \ - comphelper/util/comphelp \ - configmgr/source/configmgr \ - fileaccess/source/fileacc \ - i18npool/util/i18npool \ - package/source/xstor/xstor \ - package/util/package2 \ - sfx2/util/sfx \ - svx/util/svx \ - svx/util/svxcore \ - ucb/source/core/ucb1 \ - ucb/source/ucp/file/ucpfile1 \ - unoxml/source/service/unoxml \ -)) - -# setup URE -$(eval $(call gb_Gallery__use_configuration,$(1),xcsxcu,$(gb_Configuration_registry))) -$(eval $(call gb_Gallery__use_configuration,$(1),module,$(gb_Configuration_registry)/spool)) -$(eval $(call gb_Gallery__use_configuration,$(1)/,xcsxcu,$(OUTDIR)/unittest/registry)) -$(eval $(call gb_Gallery__use_api,$(1),udkapi)) -$(eval $(call gb_Gallery__use_api,$(1),offapi)) - -$(call gb_Gallery_get_target,$(1)) : \ - $(call gb_Gallery_get_target,$(1))/$(2).thm - -# main gallery build rule -$(call gb_Gallery_get_target,$(1))/$(2).thm : \ - $(call gb_Executable_get_runtime_dependencies,gengal) - $(call gb_Output_announce,building gallery: $*,$(true),MOD,1) - $(call gb_Helper_abbreviate_dirs, \ - $(call gb_Executable_get_command,gengal) \ - $(call gb_Gallery_make_args) \ - --name "$(3)" \ - --path $(call gb_Gallery_get_target,$(1))) \ - $(foreach item,$(IMAGE_FILES),$(item)) && \ - mv -f $(call gb_Gallery_get_target,$(1))/001.thm $(call gb_Gallery_get_target,$(1))/$(2).thm +$(call gb_Gallery__get_final_target,%) : + touch $@ -endef +.PHONY : $(call gb_Gallery_get_clean_target,%) +$(call gb_Gallery_get_clean_target,%) : + $(call gb_Output_announce,$*,$(false),GAL,1) + $(call gb_Helper_abbreviate_dirs,\ + rm -rf \ + $(call gb_Gallery__get_final_target,$*) \ + $(call gb_Gallery_get_target,$*) \ + $(call gb_Gallery_get_workdir,$*) \ + ) -# horrendous cut/paste from CppunitTest +$(WORKDIR)/Gallery/%.sdv : + touch $@ -define gb_Gallery_use_component -$(call gb_Gallery_get_target,$(1)) : \ - $(call gb_ComponentTarget_get_outdir_target,$(2)) -$(call gb_Gallery_get_target,$(1)) : \ - UNO_SERVICES += $(call gb_ComponentTarget_get_outdir_target,$(2)) +$(WORKDIR)/Gallery/%.thm : + touch $@ -endef +gb_Gallery_get_packagename = Gallery/$(1) -define gb_Gallery__use_api -$(call gb_Gallery_get_target,$(1)) : $(call gb_UnoApi_get_target,$(2)) -$(call gb_Gallery_get_target,$(1)) : UNO_TYPES += $(call gb_UnoApi_get_target,$(2)) +# Create a gallery. +# +# basedir will be stripped from paths of the files when they are +# inserted into the gallery. +# +# gb_Gallery_Gallery gallery basedir name +define gb_Gallery_Gallery +$(call gb_Gallery__Gallery_impl,$(1),$(call gb_Gallery_get_packagename,$(1)),$(2),$(3)) endef -define gb_Gallery__use_configuration -$(call gb_Gallery_get_target,$(1)) : CONFIGURATION_LAYERS += $(2):$(call gb_Helper_make_url,$(3)) +# gb_Gallery__Gallery_impl gallery package basedir name +define gb_Gallery__Gallery_impl +$(call gb_Package_Package_internal,$(2),$(call gb_Gallery_get_workdir,$(1))) +$(call gb_Package_set_outdir,$(2),$(INSTDIR)) +$(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).sdv,sg1.sdv) +$(call gb_Package_add_file,$(2),$(gb_Gallery_INSTDIR)/$(1).thm,sg1.thm) -endef +$(call gb_Gallery_get_target,$(1)) : GALLERY_BASEDIR := $(SRCDIR)/$(3) +$(call gb_Gallery_get_target,$(1)) : GALLERY_FILES := +$(call gb_Gallery_get_target,$(1)) : GALLERY_NAME := $(4) -define gb_Gallery_use_components -$(foreach component,$(call gb_CppunitTest__filter_not_built_components,$(2)),$(call gb_Gallery_use_component,$(1),$(component))) +$(call gb_Gallery_get_workdir,$(1))/sg1.sdv \ +$(call gb_Gallery_get_workdir,$(1))/sg1.thm : $(call gb_Gallery_get_target,$(1)) +$(call gb_Gallery__get_final_target,$(1)) : $(call gb_Package_get_target,$(2)) +$(call gb_Gallery_get_clean_target,$(1)) : $(call gb_Package_get_clean_target,$(2)) +$(call gb_Gallery_get_target,$(1)) :| $(dir $(call gb_Gallery_get_target,$(1))).dir \ + $(call gb_Gallery_get_workdir,$(1))/.dir -endef +$$(eval $$(call gb_Module_register_target,$(call gb_Gallery__get_final_target,$(1)),$(call gb_Gallery_get_clean_target,$(1)))) +$(call gb_Helper_make_userfriendly_targets,$(1),Gallery,$(call gb_Gallery__get_final_target,$(1))) -define gb_Gallery_make_args - --build-tree \ - $(if $(strip $(UNO_SERVICES)),\ - "-env:UNO_SERVICES=$(foreach item,$(UNO_SERVICES),$(call gb_Helper_make_url,$(item)))") \ - $(if $(strip $(CONFIGURATION_LAYERS)),\ - "-env:CONFIGURATION_LAYERS=$(strip $(CONFIGURATION_LAYERS))") \ - $(if $(strip $(UNO_TYPES)),\ - "-env:UNO_TYPES=$(foreach item,$(UNO_TYPES),$(call gb_Helper_make_url,$(item)))") \ - $(foreach dir,URE_INTERNAL_LIB_DIR LO_LIB_DIR,\ - -env:$(dir)=$(call gb_Helper_make_url,$(gb_Helper_OUTDIRLIBDIR))) endef +# Add a file to the gallery. +# +# The file is given by path relative to $(SRCDIR). +# +# gb_Gallery_add_file gallery file define gb_Gallery_add_file -$(call gb_Gallery_get_target,$(1)) : IMAGE_FILES += $(call gb_Helper_make_url,$(2)) +$(call gb_Gallery_get_target,$(1)) : $(SRCDIR)/$(2) +$(call gb_Gallery_get_target,$(1)) : GALLERY_FILES += $(call gb_Helper_make_url,$(SRCDIR)/$(2)) + endef +# Add several files to the gallery at once. +# +# The files are given by path relative to $(SRCDIR). +# +# gb_Gallery_add_files gallery file(s) define gb_Gallery_add_files -$(foreach fname,$(2),$(call gb_Gallery__add_file,$(1),$(fname))) +$(foreach fname,$(2),$(call gb_Gallery_add_file,$(1),$(fname))) + endef # vim: set noet sw=4 ts=4: |