diff options
author | David Tardon <dtardon@redhat.com> | 2013-04-18 18:18:39 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2013-04-19 16:38:00 +0200 |
commit | df0c6367285952a44082d1359a9e053b7c7b556b (patch) | |
tree | ebfe58dbf1cd5234261efbd777c70f0a8fb06a15 /solenv | |
parent | gbuild: fix deps for UIConfig packages (diff) | |
download | core-df0c6367285952a44082d1359a9e053b7c7b556b.tar.gz core-df0c6367285952a44082d1359a9e053b7c7b556b.zip |
fdo#63591 pack images referenced by .ui files
Change-Id: Ia7e932a98d3f2c8bca981261406798760b69f8e8
Diffstat (limited to 'solenv')
-rw-r--r-- | solenv/bin/uiimagelist.xsl | 36 | ||||
-rw-r--r-- | solenv/gbuild/TargetLocations.mk | 5 | ||||
-rw-r--r-- | solenv/gbuild/UIConfig.mk | 58 |
3 files changed, 97 insertions, 2 deletions
diff --git a/solenv/bin/uiimagelist.xsl b/solenv/bin/uiimagelist.xsl new file mode 100644 index 000000000000..41aefe3bb3ef --- /dev/null +++ b/solenv/bin/uiimagelist.xsl @@ -0,0 +1,36 @@ +<?xml version="1.0" encoding="UTF-8"?> +<!-- + * This file is part of the LibreOffice project. + * + * This Source Code Form is subject to the terms of the Mozilla Public + * License, v. 2.0. If a copy of the MPL was not distributed with this + * file, You can obtain one at http://mozilla.org/MPL/2.0/. + * +--> + +<xsl:stylesheet version="1.0" xmlns:xsl="http://www.w3.org/1999/XSL/Transform"> + <xsl:output method="text"/> + + <xsl:template match="/|node()"> + <xsl:apply-templates/> + </xsl:template> + + <xsl:template match="@*|text()|processing-instruction()|comment()"/> + + <xsl:template match="property[@name='pixbuf']"> + <xsl:variable name="inpath" select="normalize-space(.)"/> + <xsl:variable name="outpath"> + <xsl:choose> + <xsl:when test="starts-with($inpath,'res/')"> + <xsl:value-of select="concat('%GLOBALRES%/',substring-after($inpath,'res/'))"/> + </xsl:when> + <xsl:otherwise> + <xsl:value-of select="concat('%MODULE%/',$inpath)"/> + </xsl:otherwise> + </xsl:choose> + </xsl:variable> + <xsl:value-of select="$outpath"/> + <xsl:text>
</xsl:text> + </xsl:template> + +</xsl:stylesheet> diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk index 43c9dc34d296..71101ca2ab79 100644 --- a/solenv/gbuild/TargetLocations.mk +++ b/solenv/gbuild/TargetLocations.mk @@ -191,7 +191,9 @@ gb_SrsTemplatePartTarget_get_target = $(WORKDIR)/SrsTemplatePartTarget/$(firstwo gb_SrsTemplateTarget_get_include_dir = $(WORKDIR)/SrsTemplatePartTarget/$(firstword $(subst /, ,$(1))) gb_SrsTemplateTarget_get_target = $(WORKDIR)/SrsTemplateTarget/$(1) gb_ThesaurusIndexTarget_get_target = $(WORKDIR)/ThesaurusIndexTarget/$(basename $(1)).idx -gb_UIConfig_get_target = $(WORKDIR)/UIConfig/$(1) +gb_UIConfig_get_imagelist_target = $(WORKDIR)/UIConfig/$(1).ilst +gb_UIConfig_get_target = $(WORKDIR)/UIConfig/$(1).done +gb_UIImageListTarget_get_target = $(WORKDIR)/UIImageListTarget/$(1).ilst gb_UILocalizeTarget_get_target = $(WORKDIR)/UILocalizeTarget/$(1).done gb_UILocalizeTarget_get_workdir = $(WORKDIR)/UILocalizeTarget/$(1) gb_UIMenubarTarget_get_target = $(WORKDIR)/UIMenubarTarget/$(1).xml @@ -311,6 +313,7 @@ $(eval $(call gb_Helper_make_clean_targets,\ CustomTarget \ ExternalProject \ UIConfig \ + UIImageListTarget \ UILocalizeTarget \ UIMenubarTarget \ UnoApiHeadersTarget \ diff --git a/solenv/gbuild/UIConfig.mk b/solenv/gbuild/UIConfig.mk index 458ceb9fa2fe..52cffe59f1a5 100644 --- a/solenv/gbuild/UIConfig.mk +++ b/solenv/gbuild/UIConfig.mk @@ -111,6 +111,49 @@ $(call gb_UIMenubarTarget_UIMenubarTarget_platform,$(1),$(2)) endef +# class UIImageListTarget + +# Handles creation of image lists for .ui files. + +gb_UIImageListTarget_COMMAND = $(call gb_ExternalExecutable_get_command,xsltproc) +gb_UIImageListTarget_DEPS = $(call gb_ExternalExecutable_get_dependencies,xsltproc) +gb_UIImageListTarget_XSLTFILE := $(SRCDIR)/solenv/bin/uiimagelist.xsl + +# NOTE: for some reason xsltproc does not produce any file if there is +# no output, so we touch the target to make sure it exists. +define gb_UIImageListTarget__command +$(call gb_Output_announce,$(2),$(true),UIL,1) +$(call gb_Helper_abbreviate_dirs,\ + $(gb_UIImageListTarget_COMMAND) -o $@ $(gb_UIImageListTarget_XSLTFILE) $(UIFILE) && \ + touch $@ \ +) +endef + +$(dir $(call gb_UIImageListTarget_get_target,%)).dir : + $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) + +$(dir $(call gb_UIImageListTarget_get_target,%))%/.dir : + $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) + +$(call gb_UIImageListTarget_get_target,%) : $(gb_UIImageListTarget_DEPS) $(gb_UIImageListTarget_XSLTFILE) + $(call gb_UIImageListTarget__command,$@,$*) + +.PHONY : $(call gb_UIImageListTarget_get_clean_target,%) +$(call gb_UIImageListTarget_get_clean_target,%) : + $(call gb_Output_announce,$(2),$(false),UIL,1) + rm -f $(call gb_UIImageListTarget_get_target,$*) + +# Extract list of images referenced in a .ui file. +# +# gb_UIImageListTarget_UIImageListTarget uifile +define gb_UIImageListTarget_UIImageListTarget +$(call gb_UIImageListTarget_get_target,$(1)) : UIFILE := $(SRCDIR)/$(1).ui + +$(call gb_UIImageListTarget_get_target,$(1)) : $(SRCDIR)/$(1).ui +$(call gb_UIImageListTarget_get_target,$(1)) :| $(dir $(call gb_UIImageListTarget_get_target,$(1))).dir + +endef + # class UIConfig # Handles UI configuration files. @@ -134,12 +177,17 @@ $(dir $(call gb_UIConfig_get_target,%)).dir : $(dir $(call gb_UIConfig_get_target,%))%/.dir : $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) -$(call gb_UIConfig_get_target,%) : +$(call gb_UIConfig_get_target,%) : $(call gb_UIConfig_get_imagelist_target,%) $(call gb_Output_announce,$*,$(true),UIC,2) $(call gb_Helper_abbreviate_dirs,\ touch $@ \ ) +$(call gb_UIConfig_get_imagelist_target,%) : + $(call gb_Helper_abbreviate_dirs,\ + sort -u $(UI_IMAGELISTS) /dev/null > $@ \ + ) + .PHONY : $(call gb_UIConfig_get_clean_target,%) $(call gb_UIConfig_get_clean_target,%) : $(call gb_Output_announce,$*,$(false),UIC,2) @@ -155,6 +203,8 @@ gb_UIConfig_get_packagesetname = UIConfig/$(1) # # gb_UIConfig_UIConfig modulename define gb_UIConfig_UIConfig +$(call gb_UIConfig_get_imagelist_target,$(1)) : UI_IMAGELISTS := + $(call gb_PackageSet_PackageSet_internal,$(call gb_UIConfig_get_packagesetname,$(1))) $(call gb_Package_Package_internal,$(call gb_UIConfig_get_packagename,$(1)),$(SRCDIR)) $(call gb_Package_Package_internal,$(call gb_UIConfig_get_packagename,$(1)_generated),$(WORKDIR)) @@ -164,6 +214,7 @@ $(call gb_Package_set_outdir,$(call gb_UIConfig_get_packagename,$(1)_generated), $(call gb_PackageSet_add_package,$(call gb_UIConfig_get_packagesetname,$(1)),$(call gb_UIConfig_get_packagename,$(1))) $(call gb_UIConfig_get_target,$(1)) :| $(dir $(call gb_UIConfig_get_target,$(1))).dir +$(call gb_UIConfig_get_imagelist_target,$(1)) :| $(dir $(call gb_UIConfig_get_imagelist_target,$(1))).dir $(call gb_UIConfig_get_target,$(1)) : $(call gb_PackageSet_get_target,$(call gb_UIConfig_get_packagesetname,$(1))) $(call gb_Postprocess_get_target,AllUIConfigs) : $(call gb_UIConfig_get_target,$(1)) $(call gb_UIConfig_get_clean_target,$(1)) : $(call gb_PackageSet_get_clean_target,$(call gb_UIConfig_get_packagesetname,$(1))) @@ -200,6 +251,11 @@ endef # gb_UIConfig__add_uifile target file define gb_UIConfig__add_uifile $(call gb_UIConfig__package_uifile,$(1),$(call gb_UIConfig_get_packagename,$(1)),$(notdir $(2)).ui,$(2).ui) +$(call gb_UIImageListTarget_UIImageListTarget,$(2)) + +$(call gb_UIConfig_get_imagelist_target,$(1)) : UI_IMAGELISTS += $(call gb_UIImageListTarget_get_target,$(2)) +$(call gb_UIConfig_get_imagelist_target,$(1)) : $(call gb_UIImageListTarget_get_target,$(2)) +$(call gb_UIConfig_get_clean_target,$(1)) : $(call gb_UIImageListTarget_get_clean_target,$(2)) endef |