[Libreoffice-commits] .: 2 commits - solenv/gbuild svx/AllLangResTarget_svx.mk svx/Module_svx.mk svx/Package_globlmn_hrc.mk

David Tardon dtardon at kemper.freedesktop.org
Thu Dec 22 04:29:16 PST 2011


 solenv/gbuild/AllLangResTarget.mk |   22 ++++++++++++++++++++
 svx/AllLangResTarget_svx.mk       |   41 ++------------------------------------
 svx/Module_svx.mk                 |    1 
 svx/Package_globlmn_hrc.mk        |   32 +++++++++++++++++++++++++++++
 4 files changed, 58 insertions(+), 38 deletions(-)

New commits:
commit 28cb2ca7956cd79704089ad4ca7cedd3dc0c207f
Author: David Tardon <dtardon at redhat.com>
Date:   Thu Dec 22 13:27:03 2011 +0100

    replace this monstrosity with gb_SrsTarget_add_templates

diff --git a/svx/AllLangResTarget_svx.mk b/svx/AllLangResTarget_svx.mk
index d030b53..50675cf 100644
--- a/svx/AllLangResTarget_svx.mk
+++ b/svx/AllLangResTarget_svx.mk
@@ -39,7 +39,6 @@ $(eval $(call gb_SrsTarget_SrsTarget,svx/res))
 $(eval $(call gb_SrsTarget_set_include,svx/res,\
     $$(INCLUDE) \
     -I$(OUTDIR)/inc \
-    -I$(WORKDIR)/inc \
     -I$(WORKDIR)/inc/svx \
     -I$(realpath $(SRCDIR)/svx/source/inc) \
     -I$(realpath $(SRCDIR)/svx/source/dialog) \
@@ -98,42 +97,8 @@ $(eval $(call gb_SrsTarget_add_files,svx/res,\
     svx/source/unodraw/unodraw.src \
 ))
 
-$(call gb_SrsPartTarget_get_target,svx/source/fmcomp/gridctrl.src) : $(WORKDIR)/inc/svx/globlmn.hrc
-$(call gb_SrsPartTarget_get_target,svx/source/form/fmexpl.src) : $(WORKDIR)/inc/svx/globlmn.hrc
-$(call gb_SrsPartTarget_get_target,svx/source/form/datanavi.src) : $(WORKDIR)/inc/svx/globlmn.hrc
-$(call gb_SrsPartTarget_get_target,svx/source/form/formshell.src) : $(WORKDIR)/inc/svx/globlmn.hrc
-$(call gb_SrsTarget_get_clean_target,svx/res) : $(WORKDIR)/inc/svx/globlmn.hrc_clean
-
-# hack !!!
-# just a temporary - globlmn.hrc about to be removed!
-ifeq ($(strip $(WITH_LANG)),)
-$(WORKDIR)/inc/svx/globlmn.hrc : $(realpath $(SRCDIR)/svx/inc/globlmn_tmpl.hrc)
-	echo copying $@
-	-mkdir -p $(WORKDIR)/inc/svx
-	cp $< $@
-	$(call gb_Deliver_deliver, $@, $(OUTDIR)/inc/svx/globlmn.hrc)
-	rm -f $(WORKDIR)/inc/svx/lastrun.mk
-else
--include $(WORKDIR)/inc/svx/lastrun.mk
-ifneq ($(gb_lastrun_globlmn),MERGED)
-.PHONY : $(WORKDIR)/inc/svx/globlmn.hrc
-endif
-$(WORKDIR)/inc/svx/globlmn.hrc : $(realpath $(SRCDIR)/svx/inc/globlmn_tmpl.hrc) $(realpath $(gb_SrsPartMergeTarget_SDFLOCATION)/svx/inc/localize.sdf)
-	echo merging $@
-	-mkdir -p $(WORKDIR)/inc/svx
-	rm -f $(WORKDIR)/inc/svx/lastrun.mk
-	echo gb_lastrun_globlmn:=MERGED > $(WORKDIR)/inc/svx/lastrun.mk
-	$(call gb_Helper_abbreviate_dirs_native, \
-            $(gb_SrsPartMergeTarget_TRANSEXCOMMAND) \
-            -p svx \
-            -i $< -o $@ -m $(realpath $(gb_SrsPartMergeTarget_SDFLOCATION)/svx/inc/localize.sdf) -l all)
-	$(call gb_Deliver_deliver, $@, $(OUTDIR)/inc/svx/globlmn.hrc)
-endif
-
-.PHONY : $(WORKDIR)/inc/svx/globlmn.hrc_clean
-$(WORKDIR)/inc/svx/globlmn.hrc_clean :
-	rm -f $(WORKDIR)/inc/svx/lastrun.mk \
-            $(WORKDIR)/inc/svx/globlmn.hrc
-
+$(eval $(call gb_SrsTarget_add_templates,svx/res,\
+	svx/inc/globlmn_tmpl.hrc \
+))
 
 # vim: set noet sw=4 ts=4:
diff --git a/svx/Module_svx.mk b/svx/Module_svx.mk
index 9a3091f..ab1b595 100644
--- a/svx/Module_svx.mk
+++ b/svx/Module_svx.mk
@@ -36,6 +36,7 @@ $(eval $(call gb_Module_add_targets,svx,\
     AllLangResTarget_ofa \
     AllLangResTarget_gal \
     AllLangResTarget_textconversiondlgs \
+    Package_globlmn_hrc \
     Package_inc \
     Package_sdi \
 ))
diff --git a/svx/Package_globlmn_hrc.mk b/svx/Package_globlmn_hrc.mk
new file mode 100644
index 0000000..6fa5fa8
--- /dev/null
+++ b/svx/Package_globlmn_hrc.mk
@@ -0,0 +1,32 @@
+# -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
+# Version: MPL 1.1 / GPLv3+ / LGPLv3+
+#
+# The contents of this file are subject to the Mozilla Public License Version
+# 1.1 (the "License"); you may not use this file except in compliance with
+# the License or as specified alternatively below. You may obtain a copy of
+# the License at http://www.mozilla.org/MPL/
+#
+# Software distributed under the License is distributed on an "AS IS" basis,
+# WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License
+# for the specific language governing rights and limitations under the
+# License.
+#
+# Major Contributor(s):
+# Copyright (C) 2010 Red Hat, Inc., David Tardon <dtardon at redhat.com>
+#  (initial developer)
+#
+# All Rights Reserved.
+#
+# For minor contributions see the git repository.
+#
+# Alternatively, the contents of this file may be used under the terms of
+# either the GNU General Public License Version 3 or later (the "GPLv3+"), or
+# the GNU Lesser General Public License Version 3 or later (the "LGPLv3+"),
+# in which case the provisions of the GPLv3+ or the LGPLv3+ are applicable
+# instead of those above.
+
+$(eval $(call gb_Package_Package,svx_globlmn_hrc,$(WORKDIR)/inc/svx))
+
+$(eval $(call gb_Package_add_file,svx_globlmn_hrc,inc/svx/globlmn.hrc,globlmn.hrc))
+
+# vim:set shiftwidth=4 softtabstop=4 expandtab:
commit a6511b9d9a3f13835510a9caffc837829b206d14
Author: David Tardon <dtardon at redhat.com>
Date:   Thu Dec 22 10:08:06 2011 +0100

    add some explanation for gb_SrsTemplateTarget

diff --git a/solenv/gbuild/AllLangResTarget.mk b/solenv/gbuild/AllLangResTarget.mk
index 4600999..1329f2a 100644
--- a/solenv/gbuild/AllLangResTarget.mk
+++ b/solenv/gbuild/AllLangResTarget.mk
@@ -133,6 +133,19 @@ endif
 endef
 
 # SrsTemplateTarget class
+#
+# This class handles src templates.
+#
+# Templates are src files that contain only macros that are then used
+# from other src files, but these macros contain translatable strings.
+# Because the processing of src files is done in two phases: 1/
+# localization and 2/ merging, templates must be translated
+# independently from the src files that include them. Special care must
+# be taken to ensure that the right file (i.e., the localized one) is
+# included; in order to do that, the templates in the source tree are
+# called foo_tmpl.src, but the localization phase produces foo.src, and
+# these names (i.e., without the _tmpl suffix) must be placed in
+# #include statements in other src files.
 
 define gb_SrsTemplateTarget__command
 	$(call gb_Helper_abbreviate_dirs,\
@@ -140,6 +153,15 @@ define gb_SrsTemplateTarget__command
 	    touch $(1))
 endef
 
+# This machinery ensures that templates are regenerated when switching
+# from localized to unlocalized configuration and back.
+#
+# How it works:
+# We let _get_target depend on _get_update_target, so after they are
+# done, _get_target is newer than _get_update_target. If
+# WITH_LANG changes (from nonempty to empty or the other way around),
+# _get_target and _get_update_target are switched, therefore _get_target
+# is now _older_ than _get_update_target and must be regenerated :-)
 gb_SrsTemplateTarget__get_merged_target = $(call gb_SrsTemplateTarget_get_target,$(1))_merged_last
 gb_SrsTemplateTarget__get_unmerged_target = $(call gb_SrsTemplateTarget_get_target,$(1))_unmerged_last
 


More information about the Libreoffice-commits mailing list