diff options
author | David Tardon <dtardon@redhat.com> | 2012-08-20 16:39:34 +0200 |
---|---|---|
committer | David Tardon <dtardon@redhat.com> | 2012-08-24 13:22:05 +0200 |
commit | 20f06e3cd3e50ddb34a7985f196a08c98a3f5cb6 (patch) | |
tree | b6b7c21426116b1f813a8e56ffe06138f569ac81 | |
parent | b4687fe20c3d51e817fe2cbe2eca7e0f86e78db0 (diff) |
add AllLangZip gbuild class
Change-Id: I1b0ebafac55bdfb41c5e6e64ded637313e47bae4
-rw-r--r-- | solenv/gbuild/AllLangZip.mk | 99 | ||||
-rw-r--r-- | solenv/gbuild/TargetLocations.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/Zip.mk | 11 | ||||
-rw-r--r-- | solenv/gbuild/gbuild.mk | 1 |
4 files changed, 111 insertions, 2 deletions
diff --git a/solenv/gbuild/AllLangZip.mk b/solenv/gbuild/AllLangZip.mk new file mode 100644 index 000000000000..6534a985aea8 --- /dev/null +++ b/solenv/gbuild/AllLangZip.mk @@ -0,0 +1,99 @@ +# -*- 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/. +# + +# AllLangZip class + +# Handles creation of a bunch of zip files with content dependent on +# language + +gb_AllLangZip_LANGS := $(gb_WITH_LANG) + +$(dir $(call gb_AllLangZip_get_target,%)).dir : + $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) + +$(call gb_AllLangZip_get_target,%) : + $(call gb_Output_announce,$*,$(true),ALZ,4) + touch $@ + +.PHONY : $(call gb_AllLangZip_get_clean_target,%) +$(call gb_AllLangZip_get_clean_target,%) : + $(call gb_Output_announce,$*,$(true),ALZ,4) + rm -f $(call gb_AllLangZip_get_target,$*) + +# Define a new zip group +# +# NOTE: we cannot add dependencies on the child zips here: Zip fails if +# the source directory does not exist and we cannot test its existence +# because the directory might be generated. So we postpone the +# dependency creation to gb_AllLangZip_add_file. +# +# gb_AllLangZip_AllLangZip group srcdir +define gb_AllLangZip_AllLangZip +$(foreach lang,$(gb_AllLangZip_LANGS),$(call gb_Zip_Zip_internal,$(1)_$(lang),$(2)/$(lang))) + +$(call gb_AllLangZip_get_target,$(1)) :| $(dir $(call gb_AllLangZip_get_target,$(1))).dir + +$$(eval $$(call gb_Module_register_target,$(call gb_AllLangZip_get_target,$(1)),$(call gb_AllLangZip_get_clean_target,$(1)))) + +endef + +define gb_AllLangZip__add_to_zip +$(call gb_Zip_add_file,$(2),$(3)) +$(call gb_AllLangZip_get_target,$(1)) : $(call gb_Zip_get_outdir_target,$(2)) +$(call gb_AllLangZip_get_clean_target,$(1)) : $(call gb_Zip_get_clean_target,$(2)) + +endef + +define gb_AllLangZip__add_file_impl +$(if $(filter $(2),$(gb_AllLangZip_LANGS)),$(call gb_AllLangZip__add_to_zip,$(1),$(1)_$(2),$(3))) + +endef + +define gb_AllLangZip__add_file +$(call gb_AllLangZip__add_file_impl,$(1),$(firstword $(2)),$(subst $() $(),/,$(wordlist 2,$(words $(2)),$(2)))) + +endef + +# Add a file to one of the child zips +# +# The language is taken from the first component of the file name. The +# file is only added if there is a zip defined for the language (i.e., +# if we are building with the language). +# +# gb_AllLangZip_add_file target file +define gb_AllLangZip_add_file +$(call gb_AllLangZip__add_file,$(1),$(subst /, ,$(2))) + +endef + +# Add several files to the child zips at once +# +# gb_AllLangZip_add_files target file(s) +define gb_AllLangZip_add_files +$(foreach file,$(2),$(call gb_AllLangZip_add_file,$(1),$(file))) + +endef + +# Add extra dependency that must exist before the archives can be created +# +# gb_AllLangZip_add_dependency target dep +define gb_AllLangZip_add_dependency +$(foreach lang,$(gb_AllLangZip_LANGS),$(call gb_Zip_add_dependency,$(1)_$(lang),$(2))) + +endef + +# Add extra dependencies that must exist before the archives can be created +# +# gb_AllLangZip_add_dependencies target dep(s) +define gb_AllLangZip_add_dependencies +$(foreach dependency,$(2),$(call gb_AllLangZip_add_dependency,$(1),$(dependency))) + +endef + +# vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk index e06e481cc0ac..d24c76825b4d 100644 --- a/solenv/gbuild/TargetLocations.mk +++ b/solenv/gbuild/TargetLocations.mk @@ -76,6 +76,7 @@ endef # workdir target patterns gb_AllLangResTarget_get_target = $(WORKDIR)/AllLangRes/$(1) +gb_AllLangZip_get_target = $(WORKDIR)/AllLangZip/$(1) gb_AsmObject_get_target = $(WORKDIR)/AsmObject/$(1).o gb_CObject_get_target = $(WORKDIR)/CObject/$(1).o gb_GenCObject_get_target = $(WORKDIR)/GenCObject/$(1).o @@ -197,6 +198,7 @@ endef $(eval $(call gb_Helper_make_clean_targets,\ AllLangResTarget \ + AllLangZip \ ComponentTarget \ ComponentsTarget \ ExtensionTarget \ diff --git a/solenv/gbuild/Zip.mk b/solenv/gbuild/Zip.mk index f6d84f5d0d7e..a7239cd6477f 100644 --- a/solenv/gbuild/Zip.mk +++ b/solenv/gbuild/Zip.mk @@ -69,18 +69,25 @@ $(call gb_Zip__get_preparation_target,%) : # the zip package target requires that all added files have a common root directory (package location) # names of added files are relative to it; the zip will store them with their complete relative path name # the location can't be stored in a scoped variable as it is needed in the add_file macro (see rule above) -define gb_Zip_Zip +define gb_Zip_Zip_internal $(call gb_Zip_get_target,$(1)) : FILES := $(call gb_Zip_get_target,$(1)) : LOCATION := $(2) $(call gb_Zip_get_clean_target,$(1)) : CLEAR_LOCATION := gb_Package_Location_$(1) := $(2) -$(eval $(call gb_Module_register_target,$(call gb_Zip_get_final_target,$(1)),$(call gb_Zip_get_clean_target,$(1)))) + $(call gb_Deliver_add_deliverable,$(call gb_Zip_get_outdir_target,$(1)),$(call gb_Zip_get_target,$(1)),$(1)) $(call gb_Zip_get_outdir_target,$(1)) : $(call gb_Zip_get_target,$(1)) \ | $(dir $(call gb_Zip_get_outdir_target,$(1))).dir endef +define gb_Zip_Zip +$(call gb_Zip_Zip_internal,$(1),$(2)) + +$(eval $(call gb_Module_register_target,$(call gb_Zip_get_final_target,$(1)),$(call gb_Zip_get_clean_target,$(1)))) + +endef + # adding a file creates a dependency to it # the full path name of the file needs access to the package location # as scoped variables only exist in rules, we use a postfixed name to refer to the location diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk index b4b3cdb39a26..e1be999bbeea 100644 --- a/solenv/gbuild/gbuild.mk +++ b/solenv/gbuild/gbuild.mk @@ -320,6 +320,7 @@ include $(foreach class, \ UnpackedTarball \ InternalUnoApi \ Zip \ + AllLangZip \ Configuration \ ExtensionTarget \ Dictionary \ |