summaryrefslogtreecommitdiff
path: root/solenv/gbuild
diff options
context:
space:
mode:
authorDavid Tardon <dtardon@redhat.com>2013-04-15 18:51:08 +0200
committerDavid Tardon <dtardon@redhat.com>2013-04-16 13:39:34 +0200
commit0c814ad1b40824376b02f177a9e54437064763fb (patch)
treed8b9fb024bc83db35cb136ce105b4b6e9c038986 /solenv/gbuild
parent2636236a5cbdf51170902b906b8f607c8c4fb1bb (diff)
install dicts using filelists
Change-Id: Ib803d36ce2dfc0821004c4841566880a929a4246
Diffstat (limited to 'solenv/gbuild')
-rw-r--r--solenv/gbuild/Dictionary.mk236
-rw-r--r--solenv/gbuild/TargetLocations.mk8
2 files changed, 221 insertions, 23 deletions
diff --git a/solenv/gbuild/Dictionary.mk b/solenv/gbuild/Dictionary.mk
index dceefe1ee651..a59ba5adf422 100644
--- a/solenv/gbuild/Dictionary.mk
+++ b/solenv/gbuild/Dictionary.mk
@@ -50,37 +50,209 @@ $(call gb_ThesaurusIndexTarget_get_target,$(1)) :| $(dir $(call gb_ThesaurusInde
endef
+# PropertiesTranslateTarget class
+
+# Handles translation of .properties files in dictionaries.
+
+gb_PropertiesTranslateTarget_COMMAND := $(call gb_Executable_get_command,propex)
+gb_PropertiesTranslateTarget_DEPS := $(call gb_Executable_get_runtime_dependencies,propex)
+
+define gb_PropertiesTranslateTarget__command
+$(call gb_Output_announce,$(2),$(true),PRP,1)
+$(call gb_Helper_abbreviate_dirs,\
+ MERGEINPUT=$(call var2file,$(shell $(gb_MKTEMP)),100,$(POFILE)) && \
+ $(gb_PropertiesTranslateTarget_COMMAND) \
+ -i $(PROPERTIES_FILE) \
+ -l $(LANG) \
+ -m $${MERGEINPUT} \
+ -o $(1) && \
+ rm -f $${MERGEINPUT} \
+)
+endef
+
+$(dir $(call gb_PropertiesTranslateTarget_get_target,%)).dir :
+ $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
+
+$(dir $(call gb_PropertiesTranslateTarget_get_target,%))%/.dir :
+ $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
+
+$(call gb_PropertiesTranslateTarget_get_target,%) : $(gb_PropertiesTranslateTarget_DEPS)
+ $(call gb_PropertiesTranslateTarget__command,$@,$*)
+
+.PHONY : $(call gb_PropertiesTranslateTarget_get_clean_target,%)
+$(call gb_PropertiesTranslateTarget_get_clean_target,%) :
+ $(call gb_Output_announce,$*,$(false),PRP,1)
+ rm -f $(call gb_PropertiesTranslateTarget_get_target,$*)
+
+# gb_PropertiesTranslateTarget_PropertiesTranslateTarget target source lang
+define gb_PropertiesTranslateTarget_PropertiesTranslateTarget
+$(call gb_PropertiesTranslateTarget_get_target,$(1)) : LANG := $(3)
+$(call gb_PropertiesTranslateTarget_get_target,$(1)) : POFILE := $(gb_POLOCATION)/$(3)/$(patsubst %/,%,$(dir $(2))).po
+$(call gb_PropertiesTranslateTarget_get_target,$(1)) : PROPERTIES_FILE := $(SRCDIR)/$(2)
+
+$(call gb_PropertiesTranslateTarget_get_target,$(1)) : $(SRCDIR)/$(2)
+$(call gb_PropertiesTranslateTarget_get_target,$(1)) :| $(dir $(call gb_PropertiesTranslateTarget_get_target,$(1))).dir
+
+$(if $(filter-out qtz,$(3)),\
+ $(call gb_PropertiesTranslateTarget__PropertiesTranslateTarget_onelang,$(1),$(gb_POLOCATION)/$(3)/$(patsubst %/,%,$(dir $(2))).po) \
+)
+
+endef
+
+# gb_PropertiesTranslateTarget__PropertiesTranslateTarget_onelang target pofile
+define gb_PropertiesTranslateTarget__PropertiesTranslateTarget_onelang
+$(call gb_PropertiesTranslateTarget_get_target,$(1)) : $(2)
+$(2) :
+
+endef
+
+# DescriptionTranslateTarget class
+
+# Handles translation of description.xml files in dictionaries.
+
+gb_DescriptionTranslateTarget_COMMAND := $(call gb_Executable_get_command,xrmex)
+gb_DescriptionTranslateTarget_DEPS := $(call gb_Executable_get_runtime_dependencies,xrmex)
+
+define gb_DescriptionTranslateTarget__command
+$(call gb_Output_announce,$(2),$(true),XRM,1)
+$(call gb_Helper_abbreviate_dirs,\
+ MERGEINPUT=$(call var2file,$(shell $(gb_MKTEMP)),100,$(POFILES)) && \
+ $(gb_DescriptionTranslateTarget_COMMAND) \
+ -i $(DESCRIPTION_XML) \
+ -l all \
+ -m $${MERGEINPUT} \
+ -o $(1) && \
+ rm -f $${MERGEINPUT} \
+)
+endef
+
+$(dir $(call gb_DescriptionTranslateTarget_get_target,%)).dir :
+ $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
+
+$(dir $(call gb_DescriptionTranslateTarget_get_target,%))%/.dir :
+ $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
+
+$(call gb_DescriptionTranslateTarget_get_target,%) : $(gb_DescriptionTranslateTarget_DEPS)
+ $(call gb_DescriptionTranslateTarget__command,$@,$*)
+
+.PHONY : $(call gb_DescriptionTranslateTarget_get_clean_target,%)
+$(call gb_DescriptionTranslateTarget_get_clean_target,%) :
+ $(call gb_Output_announce,$*,$(false),XRM,1)
+ rm -f $(call gb_DescriptionTranslateTarget_get_target,$*)
+
+# gb_DescriptionTranslateTarget_DescriptionTranslateTarget target source langs
+define gb_DescriptionTranslateTarget_DescriptionTranslateTarget
+$(call gb_DescriptionTranslateTarget_get_target,$(1)) : DESCRIPTION_XML := $(SRCDIR)/$(2)
+$(call gb_DescriptionTranslateTarget_get_target,$(1)) : POFILES :=
+
+$(call gb_DescriptionTranslateTarget_get_target,$(1)) : $(SRCDIR)/$(2)
+$(call gb_DescriptionTranslateTarget_get_target,$(1)) :| $(dir $(call gb_DescriptionTranslateTarget_get_target,$(1))).dir
+
+$(foreach lang,$(3),\
+ $(call gb_DescriptionTranslateTarget__DescriptionTranslateTarget_onelang,$(1),$(patsubst %/,%,$(dir $(2))),$(lang)) \
+)
+
+endef
+
+# gb_DescriptionTranslateTarget__DescriptionTranslateTarget_onelang target pobase lang
+define gb_DescriptionTranslateTarget__DescriptionTranslateTarget_onelang
+$(call gb_DescriptionTranslateTarget_get_target,$(1)) : POFILES += $(gb_POLOCATION)/$(3)/$(2).po
+$(if $(filter-out qtz,$(3)),\
+ $(call gb_DescriptionTranslateTarget__DescriptionTranslateTarget_onelang_podeps,$(1),$(gb_POLOCATION)/$(3)/$(2).po))
+
+endef
+
+# gb_DescriptionTranslateTarget__DescriptionTranslateTarget_onelang_podeps target pofile
+define gb_DescriptionTranslateTarget__DescriptionTranslateTarget_onelang_podeps
+$(call gb_DescriptionTranslateTarget_get_target,$(1)) : $(2)
+$(2) :
+
+endef
+
# Dictionary class
# Handles creation and delivery of dictionary extensions.
+#
+# This class provides a filelist called Dictionary/<name> that contains
+# all installed files of the dictionary.
+
+gb_Dictionary_ALL_LANGS := $(filter-out en-US,$(gb_WITH_LANG))
+gb_Dictionary_INSTDIR := share/extensions
+
+$(dir $(call gb_Dictionary_get_target,%)).dir :
+ $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
-gb_Dictionary_CONFIGURATION_FILE := dictionaries.xcu
+$(dir $(call gb_Dictionary_get_target,%))%/.dir :
+ $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@))
+
+$(call gb_Dictionary_get_target,%) :
+ $(call gb_Output_announce,$*,$(true),DIC,3)
+ touch $@
+
+.PHONY : $(call gb_Dictionary_get_clean_target,%)
+$(call gb_Dictionary_get_clean_target,%) :
+ $(call gb_Output_announce,$*,$(false),DIC,3)
+ rm -f $(call gb_Dictionary_get_target,$*)
-gb_Dictionary_extensionname = Dictionary/$(1)
+gb_Dictionary_get_packagename = Dictionary/$(1)
+gb_Dictionary_get_packagesetname = Dictionary/$(1)
# Creates a dictionary extension
#
# gb_Dictionary_Dictionary dictionary srcdir
define gb_Dictionary_Dictionary
-$(call gb_ExtensionTarget_ExtensionTarget,$(call gb_Dictionary_extensionname,$(1)),$(2))
-$(call gb_Dictionary_add_root_file,$(1),$(2)/$(gb_Dictionary_CONFIGURATION_FILE))
-
-$(call gb_Dictionary_get_target,$(1)) : $(call gb_ExtensionTarget_get_target,$(call gb_Dictionary_extensionname,$(1)))
+$(call gb_Package_Package_internal,$(call gb_Dictionary_get_packagename,$(1)),$(SRCDIR))
+$(call gb_Package_Package_internal,$(call gb_Dictionary_get_packagename,$(1)_generated),$(WORKDIR))
+$(call gb_PackageSet_PackageSet_internal,$(call gb_Dictionary_get_packagesetname,$(1)))
+
+$(call gb_Package_set_outdir,$(call gb_Dictionary_get_packagename,$(1)),$(INSTDIR))
+$(call gb_Package_set_outdir,$(call gb_Dictionary_get_packagename,$(1)_generated),$(INSTDIR))
+$(call gb_PackageSet_add_package,$(call gb_Dictionary_get_packagesetname,$(1)),$(call gb_Dictionary_get_packagename,$(1)))
+
+ifeq (,$(gb_Dictionary_ALL_LANGS))
+$(call gb_Dictionary_add_root_file,$(1),$(2)/description.xml)
+else
+$(call gb_Dictionary__add_description_translations,$(1),$(2)/description.xml)
+endif
+$(call gb_Dictionary_add_root_file,$(1),$(2)/dictionaries.xcu)
+$(call gb_Dictionary_add_file,$(1),META-INF/manifest.xml,$(2)/META-INF/manifest.xml)
+
+$(call gb_Dictionary_get_target,$(1)) : $(call gb_PackageSet_get_target,$(call gb_Dictionary_get_packagesetname,$(1)))
$(call gb_Dictionary_get_target,$(1)) :| $(dir $(call gb_Dictionary_get_target,$(1))).dir
-$(call gb_Dictionary_get_clean_target,$(1)) : $(call gb_ExtensionTarget_get_clean_target,$(call gb_Dictionary_extensionname,$(1)))
-
-$(call gb_Deliver_add_deliverable,$(call gb_Dictionary_get_target,$(1)),$(call gb_ExtensionTarget_get_target,$(call gb_Dictionary_extensionname,$(1))),$(1))
+$(call gb_Dictionary_get_clean_target,$(1)) : $(call gb_PackageSet_get_clean_target,$(call gb_Dictionary_get_packagesetname,$(1)))
$$(eval $$(call gb_Module_register_target,$(call gb_Dictionary_get_target,$(1)),$(call gb_Dictionary_get_clean_target,$(1))))
$(call gb_Helper_make_userfriendly_targets,$(1),Dictionary)
endef
+# gb_Dictionary__add_description_translation_impl dictionary desctarget descxml
+define gb_Dictionary__add_description_translation_impl
+$(call gb_DescriptionTranslateTarget_DescriptionTranslateTarget,$(2),$(3),$(gb_Dictionary_ALL_LANGS))
+$(call gb_Dictionary_add_generated_file,$(1),description.xml,$(call gb_DescriptionTranslateTarget_get_target,$(2)))
+
+$(call gb_Dictionary_get_target,$(1)) : $(call gb_DescriptionTranslateTarget_get_target,$(2))
+$(call gb_Dictionary_get_clean_target,$(1)) : $(call gb_DescriptionTranslateTarget_get_clean_target,$(2))
+
+endef
+
+# gb_Dictionary__add_description_translations dictionary descxml
+define gb_Dictionary__add_description_translations
+$(call gb_Dictionary__add_description_translation_impl,$(1),$(basename $(2)),$(2))
+
+endef
+
+# gb_Dictionary__add_file dictionary package-base destfile sourcefile
+define gb_Dictionary__add_file
+$(call gb_Package_add_file,$(call gb_Dictionary_get_packagename,$(2)),$(gb_Dictionary_INSTDIR)/$(1)/$(3),$(4))
+
+endef
+
# Adds a file from $(SRCDIR) to the dictionary under chosen name
#
# gb_Dictionary_add_file dictionary destfile sourcefile
define gb_Dictionary_add_file
-$(call gb_ExtensionTarget_add_file,$(call gb_Dictionary_extensionname,$(1)),$(2),$(SRCDIR)/$(3))
+$(call gb_Dictionary__add_file,$(1),$(1),$(2),$(3))
endef
@@ -90,7 +262,7 @@ endef
#
# gb_Dictionary_add_files dictionary destdir file(s)
define gb_Dictionary_add_files
-$(call gb_ExtensionTarget_add_files,$(call gb_Dictionary_extensionname,$(1)),$(2),$(addprefix $(SRCDIR)/,$(3)))
+$(foreach file,$(3),$(call gb_Dictionary_add_file,$(1),$(2)/$(notdir $(file)),$(file)))
endef
@@ -98,7 +270,8 @@ endef
#
# gb_Dictionary_add_file dictionary destfile sourcefile
define gb_Dictionary_add_generated_file
-$(call gb_ExtensionTarget_add_file,$(call gb_Dictionary_extensionname,$(1)),$(2),$(3))
+$(call gb_Dictionary__add_file,$(1),$(1)_generated,$(2),$(subst $(WORKDIR)/,,$(3)))
+$(call gb_PackageSet_add_package,$(call gb_Dictionary_get_packagesetname,$(1)),$(call gb_Dictionary_get_packagename,$(1)_generated))
endef
@@ -108,12 +281,7 @@ endef
#
# gb_Dictionary_add_files dictionary destdir file(s)
define gb_Dictionary_add_generated_files
-$(call gb_ExtensionTarget_add_files,$(call gb_Dictionary_extensionname,$(1)),$(2),$(3))
-
-endef
-
-define gb_Dictionary__add_root_file
-$(call gb_ExtensionTarget_add_file,$(call gb_Dictionary_extensionname,$(1)),$(notdir $(2)),$(2))
+$(foreach file,$(3),$(call gb_Dictionary_add_generated_file,$(1),$(2)/$(notdir $(file)),$(file)))
endef
@@ -121,7 +289,7 @@ endef
#
# gb_Dictionary_add_root_file dictionary file
define gb_Dictionary_add_root_file
-$(call gb_Dictionary__add_root_file,$(1),$(SRCDIR)/$(2))
+$(call gb_Dictionary_add_file,$(1),$(notdir $(2)),$(2))
endef
@@ -133,6 +301,12 @@ $(foreach file,$(2),$(call gb_Dictionary_add_root_file,$(1),$(file)))
endef
+define gb_Dictionary__add_thesaurus
+$(call gb_Dictionary__add_file,$(1),$(1)_generated,$(notdir $(3)),$(subst $(WORKDIR)/,,$(3)))
+$(call gb_PackageSet_add_package,$(call gb_Dictionary_get_packagesetname,$(1)),$(call gb_Dictionary_get_packagename,$(1)_generated))
+
+endef
+
# Adds a thesaurus to the dictionary
#
# An index for the thesaurus is generated and added to the dictionary as
@@ -142,7 +316,7 @@ endef
define gb_Dictionary_add_thesaurus
$(call gb_ThesaurusIndexTarget_ThesaurusIndexTarget,$(2))
$(call gb_Dictionary_add_root_file,$(1),$(2))
-$(call gb_Dictionary__add_root_file,$(1),$(call gb_ThesaurusIndexTarget_get_target,$(2)))
+$(call gb_Dictionary__add_thesaurus,$(1),$(2),$(call gb_ThesaurusIndexTarget_get_target,$(2)))
endef
@@ -157,13 +331,33 @@ $(foreach thesaurus,$(2),$(call gb_Dictionary_add_thesaurus,$(1),$(thesaurus)))
endef
+# gb_Dictionary__translate_propertyfile_impl dictionary destfile propertyfile propertyname lang
+define gb_Dictionary__translate_propertyfile_impl
+$(call gb_PropertiesTranslateTarget_PropertiesTranslateTarget,$(4),$(3),$(5))
+$(call gb_Dictionary_add_generated_file,$(1),$(2),$(call gb_PropertiesTranslateTarget_get_target,$(4)))
+
+endef
+
+# gb_Dictionary__translate_propertyfile dictionary destdir propertyfile propertyname lang
+define gb_Dictionary__translate_propertyfile
+$(call gb_Dictionary__translate_propertyfile_impl,$(1),$(2)$(notdir $(4)).properties,$(3),$(4),$(5))
+
+endef
+
+# gb_Dictionary__add_propertyfile_translations dictionary destfile propertyfile
+define gb_Dictionary__add_propertyfile_translations
+$(foreach lang,$(gb_Dictionary_ALL_LANGS),$(call gb_Dictionary__translate_propertyfile,$(1),$(dir $(2)),$(3),$(subst en_US,$(subst -,_,$(lang)),$(basename $(3))),$(lang)))
+
+endef
+
# Adds a .property file to the dictionary under chosen name
#
# The file is localized automatically.
#
# gb_Dictionary_add_propertyfile dictionary destfile propertyfile
define gb_Dictionary_add_propertyfile
-$(call gb_ExtensionTarget_localize_properties,$(call gb_Dictionary_extensionname,$(1)),$(2),$(SRCDIR)/$(3))
+$(call gb_Dictionary__add_file,$(1),$(1),$(2),$(3))
+$(call gb_Dictionary__add_propertyfile_translations,$(1),$(2),$(3))
endef
diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk
index 5338fd37a87b..43c9dc34d296 100644
--- a/solenv/gbuild/TargetLocations.mk
+++ b/solenv/gbuild/TargetLocations.mk
@@ -32,7 +32,6 @@ 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_Dictionary_get_target = $(OUTDIR)/pck/$(1).oxt
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
@@ -105,6 +104,8 @@ gb_CppunitTestFakeExecutable_get_target = \
gb_CustomTarget_get_repo_target = $(WORKDIR)/CustomTarget/$(2)_$(1).done
gb_CustomTarget_get_target = $(WORKDIR)/CustomTarget/$(1).done
gb_CustomTarget_get_workdir = $(WORKDIR)/CustomTarget/$(1)
+gb_DescriptionTranslateTarget_get_target = $(WORKDIR)/DescriptionTranslateTarget/$(1).xml
+gb_Dictionary_get_target = $(WORKDIR)/Dictionary/$(1).done
gb_CxxObject_get_target = $(WORKDIR)/CxxObject/$(1).o
gb_GenCxxObject_get_target = $(WORKDIR)/GenCxxObject/$(1).o
gb_Executable_get_external_headers_target = $(WORKDIR)/ExternalHeaders/Executable/$(1)
@@ -170,6 +171,7 @@ gb_Postprocess_get_target = $(WORKDIR)/Postprocess/$(1)
gb_PrecompiledHeader_get_dep_target = $(WORKDIR)/Dep/PrecompiledHeader/$(gb_PrecompiledHeader_DEBUGDIR)/$(1).hxx.gch.d
gb_PrecompiledHeader_get_target = $(WORKDIR)/PrecompiledHeader/$(gb_PrecompiledHeader_DEBUGDIR)/$(1).hxx.gch
gb_PrecompiledHeader_get_timestamp = $(WORKDIR)/PrecompiledHeader/$(gb_PrecompiledHeader_DEBUGDIR)/Timestamps/$(1)
+gb_PropertiesTranslateTarget_get_target = $(WORKDIR)/PropertiesTranslateTarget/$(1).properties
gb_Pyuno_get_target = $(WORKDIR)/Pyuno/$(1).done
gb_Rdb_get_target = $(WORKDIR)/Rdb/$(1).rdb
gb_ResTarget_get_imagelist_target = $(WORKDIR)/ResTarget/$(1).ilst
@@ -265,6 +267,8 @@ $(eval $(call gb_Helper_make_clean_targets,\
CliNativeLibraryTarget \
CliUnoApiTarget \
ComponentTarget \
+ DescriptionTranslateTarget \
+ Dictionary \
ExternalPackage \
ExtensionTarget \
HelpTarget \
@@ -289,6 +293,7 @@ $(eval $(call gb_Helper_make_clean_targets,\
PackageSet \
Pagein \
PrecompiledHeader \
+ PropertiesTranslateTarget \
Pyuno \
PythonTest \
Rdb \
@@ -329,7 +334,6 @@ $(eval $(call gb_Helper_make_outdir_clean_targets,\
CliLibrary \
CliNativeLibrary \
CliUnoApi \
- Dictionary \
Executable \
Extension \
InstallScript \