diff options
author | David Tardon <dtardon@redhat.com> | 2012-08-07 20:07:47 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2012-08-09 07:42:29 +0200 |
commit | 75df7739309ccc5342084e668d9d869620cb3233 (patch) | |
tree | a51ba3c79f767d9344da5e4d1eae8631b0841099 | |
parent | 9b93a2d9db4c245dc96387c0d341652142bd5d44 (diff) |
add support for dictionaries to gbuild
Change-Id: I7d3c066a72c68bdc0b55150714041908bb613f14
-rw-r--r-- | solenv/gbuild/Dictionary.mk | 178 | ||||
-rw-r--r-- | solenv/gbuild/TargetLocations.mk | 4 | ||||
-rw-r--r-- | solenv/gbuild/gbuild.mk | 1 |
3 files changed, 183 insertions, 0 deletions
diff --git a/solenv/gbuild/Dictionary.mk b/solenv/gbuild/Dictionary.mk new file mode 100644 index 000000000000..c40e376ee8fa --- /dev/null +++ b/solenv/gbuild/Dictionary.mk @@ -0,0 +1,178 @@ +# -*- 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/. +# + +# ThesaurusIndexTarget class + +gb_ThesaurusIndexTarget_CHECK_TARGET := $(SRCDIR)/dictionaries/util/th_check.pl +gb_ThesaurusIndexTarget_CHECK_COMMAND := PERL_UNICODE=0 $(PERL) -w $(gb_ThesaurusIndexTarget_CHECK_TARGET) +gb_ThesaurusIndexTarget_INDEX_TARGET := $(call gb_Executable_get_target_for_build,idxdict) +gb_ThesaurusIndexTarget_INDEX_COMMAND := $(gb_Helper_set_ld_path) $(gb_ThesaurusIndexTarget_INDEX_TARGET) + +define gb_ThesaurusIndexTarget__command +$(call gb_Output_announce,$(2),$(true),THI,1) +$(call gb_Helper_abbreviate_dirs,\ + $(gb_ThesaurusIndexTarget_INDEX_COMMAND) -o $(1) < $(THESAURUS_FILE) \ +) +endef + #$(gb_ThesaurusIndexTarget_CHECK_COMMAND) $(THESAURUS_FILE) && \ + +$(dir $(call gb_ThesaurusIndexTarget_get_target,%)).dir : + $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) + +$(dir $(call gb_ThesaurusIndexTarget_get_target,%))%/.dir : + $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) + +$(call gb_ThesaurusIndexTarget_get_target,%) : $(gb_ThesaurusIndexTarget_INDEX_TARGET) | $(gb_ThesaurusIndexTarget_CHECK_TARGET) + $(call gb_ThesaurusIndexTarget__command,$@,$*) + +.PHONY : $(call gb_ThesaurusIndexTarget_get_clean_target,%) +$(call gb_ThesaurusIndexTarget_get_clean_target,%) : + $(call gb_Output_announce,$*,$(false),THI,1) + $(call gb_Helper_abbreviate_dirs,\ + rm -f $(call gb_ThesaurusIndexTarget_get_target,$*) \ + ) + +# Creates an index for a given thesaurus +# +# The thesaurus' file path is relative to $(SRCDIR). +# +# gb_ThesaurusIndexTarget_ThesaurusIndexTarget thesaurus +define gb_ThesaurusIndexTarget_ThesaurusIndexTarget +$(call gb_ThesaurusIndexTarget_get_target,$(1)) : THESAURUS_FILE := $(SRCDIR)/$(1) +$(call gb_ThesaurusIndexTarget_get_target,$(1)) : $(SRCDIR)/$(1) +$(call gb_ThesaurusIndexTarget_get_target,$(1)) :| $(dir $(call gb_ThesaurusIndexTarget_get_target,$(1))).dir + +endef + +# Dictionary class + +# Handles creation and delivery of dictionary extensions. + +gb_Dictionary_CONFIGURATION_FILE := dictionaries.xcu + +gb_Dictionary_extensionname = 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_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)) + +$$(eval $$(call gb_Module_register_target,$(call gb_Dictionary_get_target,$(1)),$(call gb_Dictionary_get_clean_target,$(1)))) + +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)) + +endef + +# Adds several files from $(SRCDIR) to the dictionary at once +# +# The files are put into the chosen directory. +# +# 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))) + +endef + +# Adds an arbitrary file to the dictionary under chosen name +# +# 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)) + +endef + +# Adds several arbitrary files to the dictionary at once +# +# The files are put into the chosen directory. +# +# 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)) + +endef + +# Adds a file to the root dir of the dictionary +# +# gb_Dictionary_add_root_file dictionary file +define gb_Dictionary_add_root_file +$(call gb_Dictionary__add_root_file,$(1),$(SRCDIR)/$(2)) + +endef + +# Adds several files to the root dir of the dictionary +# +# gb_Dictionary_add_root_files dictionary file(s) +define gb_Dictionary_add_root_files +$(foreach file,$(2),$(call gb_Dictionary_add_root_file,$(1),$(file))) + +endef + +# Adds a thesaurus to the dictionary +# +# An index for the thesaurus is generated and added to the dictionary as +# well. +# +# gb_Dictionary_add_thesaurus dictionary thesaurus +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))) + +endef + +# Adds several thesauri to the dictionary at once +# +# Indexes for the thesauri are generated and added to the dictionary as +# well. +# +# gb_Dictionary_add_thesauri dictionary thesauri +define gb_Dictionary_add_thesauri +$(foreach thesaurus,$(2),$(call gb_Dictionary_add_thesaurus,$(1),$(thesaurus))) + +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)) + +endef + +# Adds several .property files to the dictionary at once +# +# The files are put into chosen directory. They are localized automatically. +# +# gb_Dictionary_add_propertyfiles dictionary destdir propertyfile(s) +define gb_Dictionary_add_propertyfiles +$(foreach propertyfile,$(3),$(call gb_Dictionary_add_propertyfile,$(1),$(2)/$(notdir $(propertyfile)),$(propertyfile))) + +endef + +# vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk index 7822e2c9263b..24704d38554e 100644 --- a/solenv/gbuild/TargetLocations.mk +++ b/solenv/gbuild/TargetLocations.mk @@ -29,6 +29,7 @@ # outdir target pattern 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 @@ -143,6 +144,7 @@ gb_SrsTarget_get_target = $(WORKDIR)/SrsTarget/$(1).srs gb_SrsTemplatePartTarget_get_target = $(WORKDIR)/SrsTemplatePartTarget/$(firstword $(subst /, ,$(1)))/$(subst _tmpl,,$(notdir $(1))) 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_UnoApiTarget_get_target = $(WORKDIR)/UnoApiTarget/$(1).rdb gb_UnoApiHeadersTarget_get_bootstrap_dir = $(WORKDIR)/UnoApiHeadersTarget/$(1)/bootstrap$(2) gb_UnoApiHeadersTarget_get_comprehensive_dir = $(WORKDIR)/UnoApiHeadersTarget/$(1)/comprehensive$(2) @@ -215,6 +217,7 @@ $(eval $(call gb_Helper_make_clean_targets,\ SdiTarget \ SrsTarget \ SrsTemplateTarget \ + ThesaurusIndexTarget \ CppunitTest \ CustomTarget \ ExternalLib \ @@ -234,6 +237,7 @@ $(eval $(call gb_Helper_make_clean_targets,\ )) $(eval $(call gb_Helper_make_outdir_clean_targets,\ + Dictionary \ Executable \ Extension \ InstallScript \ diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk index a77f57ed6752..f782409b4d20 100644 --- a/solenv/gbuild/gbuild.mk +++ b/solenv/gbuild/gbuild.mk @@ -321,6 +321,7 @@ include $(foreach class, \ Zip \ Configuration \ ExtensionTarget \ + Dictionary \ Extension \ InstallModuleTarget \ InstallModule \ |