[Libreoffice-commits] core.git: 2 commits - postprocess/CustomTarget_images.mk solenv/bin solenv/gbuild

David Tardon dtardon at redhat.com
Fri Apr 19 07:38:22 PDT 2013


 postprocess/CustomTarget_images.mk |    9 ++++-
 solenv/bin/uiimagelist.xsl         |   36 +++++++++++++++++++++
 solenv/gbuild/TargetLocations.mk   |    5 ++
 solenv/gbuild/UIConfig.mk          |   63 +++++++++++++++++++++++++++++++++++--
 4 files changed, 107 insertions(+), 6 deletions(-)

New commits:
commit df0c6367285952a44082d1359a9e053b7c7b556b
Author: David Tardon <dtardon at redhat.com>
Date:   Thu Apr 18 18:18:39 2013 +0200

    fdo#63591 pack images referenced by .ui files
    
    Change-Id: Ia7e932a98d3f2c8bca981261406798760b69f8e8

diff --git a/postprocess/CustomTarget_images.mk b/postprocess/CustomTarget_images.mk
index 1533fd56..ce3b25f 100644
--- a/postprocess/CustomTarget_images.mk
+++ b/postprocess/CustomTarget_images.mk
@@ -47,13 +47,18 @@ $(packimages_DIR)/images.zip : \
 		$(packimages_DIR)/sorted.lst \
 		$(packimages_DIR)/commandimagelist.ilst \
 		$(call gb_Helper_optional,HELP,$(helpimages_DIR)/helpimg.ilst) \
-		$(call gb_Postprocess_get_target,AllResources)
+		$(call gb_Postprocess_get_target,AllResources) \
+		$(call gb_Postprocess_get_target,AllUIConfigs)
 	$(call gb_Output_announce,$(subst $(WORKDIR)/,,$@),$(true),PRL,2)
 	$(call gb_Helper_abbreviate_dirs, \
 		$(PERL) $(SOLARENV)/bin/packimages.pl -g $(SRCDIR)/icon-themes/galaxy \
 			-m $(SRCDIR)/icon-themes/galaxy -c $(packimages_DIR) \
 			$(call gb_Helper_optional,HELP,-l $(helpimages_DIR) ) \
-			-l $(packimages_DIR) -l $(dir $(call gb_ResTarget_get_imagelist_target)) -s $< -o $@ \
+			-l $(packimages_DIR) \
+			-l $(dir $(call gb_ResTarget_get_imagelist_target)) \
+			-l $(dir $(call gb_UIConfig_get_imagelist_target)) \
+			-l $(dir $(call gb_UIConfig_get_imagelist_target,modules/)) \
+			-s $< -o $@ \
 			$(if $(findstring s,$(MAKEFLAGS)),> /dev/null))
 
 $(packimages_DIR)/images_%.zip : \
diff --git a/solenv/bin/uiimagelist.xsl b/solenv/bin/uiimagelist.xsl
new file mode 100644
index 0000000..41aefe3
--- /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>&#xA;</xsl:text>
+    </xsl:template>
+
+</xsl:stylesheet>
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index 43c9dc3..71101ca 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 458ceb9..52cffe5 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
 
commit a47fa9ca7c1fef29da50cf9699d76eb98ac33a14
Author: David Tardon <dtardon at redhat.com>
Date:   Fri Apr 19 16:26:05 2013 +0200

    gbuild: fix deps for UIConfig packages
    
    Change-Id: I18c270cbcde82c315fd7cf1ba8dfc37ebe1a81aa

diff --git a/solenv/gbuild/UIConfig.mk b/solenv/gbuild/UIConfig.mk
index 466bb52..458ceb9 100644
--- a/solenv/gbuild/UIConfig.mk
+++ b/solenv/gbuild/UIConfig.mk
@@ -208,6 +208,7 @@ endef
 # gb_UIConfig__add_uifile_for_lang target file lang
 define gb_UIConfig__add_uifile_for_lang
 $(call gb_UIConfig__package_uifile,$(1),$(call gb_UIConfig_get_packagename_for_lang,$(1),$(3)),res/$(3)/$(notdir $(2)),$(2)/$(3).ui)
+$(call gb_Package_get_preparation_target,$(call gb_UIConfig_get_packagename_for_lang,$(1),$(3))) : $(call gb_UILocalizeTarget_get_target,$(2))
 
 endef
 
@@ -218,8 +219,8 @@ endef
 # gb_UIConfig__add_uifile_for_real_lang target file lang
 define gb_UIConfig__add_uifile_for_real_lang
 $(if $(filter qtz,$(3)),$(call gb_Output_error,gb_UIConfig__add_uifile_for_real_lang called with qtz))
-$(call gb_Package_get_preparation_target,$(call gb_UIConfig_get_packagename_for_lang,$(1),$(lang))) : $(call gb_UILocalizeTarget_get_target,$(2))
-$(call gb_UIConfig__add_uifile_for_lang,$(1),$(2),$(lang))
+$(call gb_UIConfig__add_uifile_for_lang,$(1),$(2),$(3))
+
 endef
 
 # gb_UIConfig__add_translations_impl target uifile langs


More information about the Libreoffice-commits mailing list