[Libreoffice-commits] core.git: Branch 'feature/gengal' - 2 commits - extras/Gallery_test.mk RepositoryExternal.mk solenv/gbuild

David Tardon dtardon at redhat.com
Wed May 8 06:04:29 PDT 2013


 RepositoryExternal.mk                      |   14 +
 extras/Gallery_test.mk                     |   11 -
 solenv/gbuild/Gallery.mk                   |  225 +++++++++++++++++------------
 solenv/gbuild/TargetLocations.mk           |    2 
 solenv/gbuild/extensions/pre_BuildTools.mk |    1 
 5 files changed, 159 insertions(+), 94 deletions(-)

New commits:
commit 8b9e4257782d5bfeac247f4baa4cb6d9ebfd6ae7
Author: David Tardon <dtardon at redhat.com>
Date:   Tue May 7 20:41:41 2013 +0200

    gbuild: make Gallery work
    
    Change-Id: Ia2914e24f03cdb3f24df30bf203a09d18f4a8fd4

diff --git a/RepositoryExternal.mk b/RepositoryExternal.mk
index 9a22c69..68aa4fb 100644
--- a/RepositoryExternal.mk
+++ b/RepositoryExternal.mk
@@ -2863,6 +2863,20 @@ $(call gb_Executable_add_runtime_dependencies,climaker,\
 )
 endef
 
+define gb_Executable__register_gengal.bin
+$(call gb_Executable_add_runtime_dependencies,gengal.bin,\
+	$(call gb_AllLangResTarget_get_target,ofa) \
+	$(call gb_Configuration_get_target,registry) \
+	$(call gb_Configuration_get_target,fcfg_langpack) \
+	$(call gb_Library_get_target,$(gb_CPPU_ENV)_uno) \
+	$(call gb_Library_get_target,vclplug_svp) \
+	$(call gb_Package_get_target_for_build,cppuhelper_unorc) \
+	$(call gb_Rdb_get_outdir_target_for_build,ure/services) \
+	$(call gb_UnoApi_get_target,offapi) \
+	$(call gb_UnoApi_get_target,udkapi) \
+)
+endef
+
 ifneq ($(SYSTEM_ICU),YES)
 
 define gb_Executable__register_gendict
diff --git a/extras/Gallery_test.mk b/extras/Gallery_test.mk
index c82d03c..67c8e91 100644
--- a/extras/Gallery_test.mk
+++ b/extras/Gallery_test.mk
@@ -7,12 +7,13 @@
 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
 #
 
-$(eval $(call gb_Gallery_Gallery,extras/source/gallery,gallery,Fun Gallery))
+$(eval $(call gb_Gallery_Gallery,test,extras/source/gallery,Fun Gallery))
 
-$(eval $(call gb_Gallery_add_files,extras/source/gallery, \
+$(eval $(call gb_Gallery_add_files,test,\
+	extras/source/gallery/apples.gif \
 	extras/source/gallery/bigapple.gif \
-	extras/source/gallery/sky.gif      \
-	extras/source/gallery/flower.gif   \
-	extras/source/gallery/apples.gif ))
+	extras/source/gallery/flower.gif \
+	extras/source/gallery/sky.gif \
+))
 
 # vim: set noet sw=4 ts=4:
diff --git a/solenv/gbuild/Gallery.mk b/solenv/gbuild/Gallery.mk
index 8508622..eae9b68 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:
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index 5497d57..1757e84 100644
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -32,6 +32,7 @@ gb_CliLibrary_get_target = $(gb_Helper_OUTDIRLIBDIR)/$(1)$(gb_CliLibrary_EXT)
 gb_CliNativeLibrary_get_target = $(gb_Helper_OUTDIRLIBDIR)/$(1)$(gb_CliNativeLibrary_EXT)
 gb_CliUnoApi_get_target = $(gb_Helper_OUTDIRLIBDIR)/$(1)$(gb_CliUnoApi_EXT)
 gb_ComponentTarget_get_outdir_target = $(OUTDIR)/xml/component/$(1).component
+gb_ComponentTarget_get_outdir_target_for_build = $(OUTDIR_FOR_BUILD)/xml/component/$(1).component
 gb_Executable_get_target = $(OUTDIR)/bin/$(1)$(gb_Executable_EXT)
 gb_Executable_get_target_for_build = $(OUTDIR_FOR_BUILD)/bin/$(1)$(gb_Executable_EXT_for_build)
 gb_Extension_get_target = $(OUTDIR)/bin/$(1).oxt
@@ -119,6 +120,7 @@ gb_ExternalProject_get_preparation_target = $(WORKDIR)/ExternalProject/$(1).prep
 gb_ExternalProject_get_state_target = $(WORKDIR)/ExternalProject/$(1)/$(2)
 gb_ExternalProject_get_target = $(WORKDIR)/ExternalProject/$(1).done
 gb_Gallery_get_target = $(WORKDIR)/Gallery/$(1).done
+gb_Gallery_get_workdir = $(WORKDIR)/Gallery/$(1)
 gb_GeneratedPackage_get_target = $(WORKDIR)/GeneratedPackage/$(1).filelist
 gb_HelpIndexTarget_get_target = $(WORKDIR)/HelpIndexTarget/$(1).done
 gb_HelpJarTarget_get_target = $(WORKDIR)/HelpJarTarget/$(1).done
diff --git a/solenv/gbuild/extensions/pre_BuildTools.mk b/solenv/gbuild/extensions/pre_BuildTools.mk
index 5232573..eea1bbb 100644
--- a/solenv/gbuild/extensions/pre_BuildTools.mk
+++ b/solenv/gbuild/extensions/pre_BuildTools.mk
@@ -38,6 +38,7 @@ gb_BUILD_TOOLS = \
 		ulfex \
 		xrmex \
 		$(call gb_Helper_optional_for_host,DESKTOP, \
+			gengal.bin \
 			HelpIndexer \
 			HelpLinker \
 		) \
commit 07548009bdee312fb9c825cc6d43988809a332e7
Author: David Tardon <dtardon at redhat.com>
Date:   Tue May 7 19:35:56 2013 +0200

    add license header

diff --git a/solenv/gbuild/Gallery.mk b/solenv/gbuild/Gallery.mk
index 58477bf..8508622 100644
--- a/solenv/gbuild/Gallery.mk
+++ b/solenv/gbuild/Gallery.mk
@@ -1,3 +1,12 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+#
+# 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/.
+#
+
 .PHONY : $(call gb_Gallery_get_clean_target,%)
 $(call gb_Gallery_get_clean_target,%) :
 	$(call gb_Helper_abbreviate_dirs,\
@@ -109,3 +118,5 @@ endef
 define gb_Gallery_add_files
 $(foreach fname,$(2),$(call gb_Gallery__add_file,$(1),$(fname)))
 endef
+
+# vim: set noet sw=4 ts=4:


More information about the Libreoffice-commits mailing list