diff options
-rw-r--r-- | Makefile.in | 1 | ||||
-rw-r--r-- | instsetoo_native/util/openoffice.lst.in | 8 | ||||
-rw-r--r-- | solenv/gbuild/GeneratedPackage.mk | 111 | ||||
-rw-r--r-- | solenv/gbuild/TargetLocations.mk | 2 | ||||
-rw-r--r-- | solenv/gbuild/gbuild.mk | 1 |
5 files changed, 119 insertions, 4 deletions
diff --git a/Makefile.in b/Makefile.in index 892a369bdae5..74b53aa521a1 100644 --- a/Makefile.in +++ b/Makefile.in @@ -108,6 +108,7 @@ gbuild_TARGETS := AllLangHelp \ Extension \ ExternalPackage \ ExternalProject \ + GeneratedPackage \ InstallModule \ InstallScript \ InternalUnoApi \ diff --git a/instsetoo_native/util/openoffice.lst.in b/instsetoo_native/util/openoffice.lst.in index ffef5c7d4ae1..52e9c2aafac1 100644 --- a/instsetoo_native/util/openoffice.lst.in +++ b/instsetoo_native/util/openoffice.lst.in @@ -82,7 +82,7 @@ LibreOffice downloadname LibreOffice_{productversion}_{os}_install_{languages} langpackdownloadname LibreOffice_{productversion}_languagepack_{os}_install_{languages} helppackdownloadname LibreOffice_{productversion}_helppack_{os}_install_{languages} - include {solarenvpath}/{os}/loader2,.,{localpath}/bin,{solarpath}/bin.{minor}/ooowoure,{solarpath}/bin.{minor}/osl,{solarpath}/bin.{minor}/desktop-integration/{pkgtype},{solarpath}/bin.{minor},{solarpath}/lib.{minor},{solarpath}/pck.{minor}/openoffice,{solarpath}/pck.{minor},{solarpath}/xml.{minor}/office/instance,{solarpath}/xml.{minor},../../external/common,{solarenvpath}/{os}/OOo_external,{filelistpath}/PackageSet,{filelistpath}/Package + include {solarenvpath}/{os}/loader2,.,{localpath}/bin,{solarpath}/bin.{minor}/ooowoure,{solarpath}/bin.{minor}/osl,{solarpath}/bin.{minor}/desktop-integration/{pkgtype},{solarpath}/bin.{minor},{solarpath}/lib.{minor},{solarpath}/pck.{minor}/openoffice,{solarpath}/pck.{minor},{solarpath}/xml.{minor}/office/instance,{solarpath}/xml.{minor},../../external/common,{solarenvpath}/{os}/OOo_external,{filelistpath}/PackageSet,{filelistpath}/Package,{filelistpath}/GeneratedPackage } } @@ -138,7 +138,7 @@ LibreOffice_Dev downloadname LibreOfficeDev_{productversion}_{os}_install_{languages} langpackdownloadname LibreOfficeDev_{productversion}_languagepack_{os}_install_{languages} helppackdownloadname LibreOfficeDev_{productversion}_helppack_{os}_install_{languages} - include {solarenvpath}/{os}/loader2,.,{localpath}/bin/dev,{localpath}/bin,{solarpath}/bin.{minor}/osl,{solarpath}/bin.{minor}/desktop-integration/{pkgtype},{solarpath}/bin.{minor},{solarpath}/lib.{minor},{solarpath}/pck.{minor}/openoffice_dev,{solarpath}/pck.{minor}/openoffice,{solarpath}/pck.{minor},{solarpath}/xml.{minor}/office/instance,{solarpath}/xml.{minor},../../external/common,{solarenvpath}/{os}/OOo_external,{filelistpath}/PackageSet,{filelistpath}/Package + include {solarenvpath}/{os}/loader2,.,{localpath}/bin/dev,{localpath}/bin,{solarpath}/bin.{minor}/osl,{solarpath}/bin.{minor}/desktop-integration/{pkgtype},{solarpath}/bin.{minor},{solarpath}/lib.{minor},{solarpath}/pck.{minor}/openoffice_dev,{solarpath}/pck.{minor}/openoffice,{solarpath}/pck.{minor},{solarpath}/xml.{minor}/office/instance,{solarpath}/xml.{minor},../../external/common,{solarenvpath}/{os}/OOo_external,{filelistpath}/PackageSet,{filelistpath}/Package,{filelistpath}/GeneratedPackage } } @@ -177,7 +177,7 @@ LibreOffice_SDK active 1 compression 5 script sdkoo - include {solarenvpath}/{os}/loader2,{solarpath}/bin.{minor}/sdkoo,{solarpath}/bin.{minor}/osl,{solarpath}/bin.{minor},{solarpath}/filelists.{minor},{solarpath}/lib.{minor},{solarpath}/pck.{minor},{solarenvpath}/{os}/MS,{filelistpath}/PackageSet,{filelistpath}/Package + include {solarenvpath}/{os}/loader2,{solarpath}/bin.{minor}/sdkoo,{solarpath}/bin.{minor}/osl,{solarpath}/bin.{minor},{solarpath}/filelists.{minor},{solarpath}/lib.{minor},{solarpath}/pck.{minor},{solarenvpath}/{os}/MS,{filelistpath}/PackageSet,{filelistpath}/Package,{filelistpath}/GeneratedPackage } } @@ -223,7 +223,7 @@ LibreOffice_Dev_SDK active 1 compression 5 script sdkoo - include {solarenvpath}/{os}/loader2,{solarpath}/bin.{minor}/sdkoo,{solarpath}/bin.{minor}/osl,{solarpath}/bin.{minor},{solarpath}/filelists.{minor},{solarpath}/lib.{minor},{solarpath}/pck.{minor},{solarenvpath}/{os}/MS,{filelistpath}/PackageSet,{filelistpath}/Package + include {solarenvpath}/{os}/loader2,{solarpath}/bin.{minor}/sdkoo,{solarpath}/bin.{minor}/osl,{solarpath}/bin.{minor},{solarpath}/filelists.{minor},{solarpath}/lib.{minor},{solarpath}/pck.{minor},{solarenvpath}/{os}/MS,{filelistpath}/PackageSet,{filelistpath}/Package,{filelistpath}/GeneratedPackage } } diff --git a/solenv/gbuild/GeneratedPackage.mk b/solenv/gbuild/GeneratedPackage.mk new file mode 100644 index 000000000000..91714e9b7387 --- /dev/null +++ b/solenv/gbuild/GeneratedPackage.mk @@ -0,0 +1,111 @@ +# -*- 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/. +# + +# class GeneratedPackage + +# Enables to deliver whole directories (of generated files) to $(INSTDIR). +# +# GeneratedPackage shall be used as a substitution for Package when the +# names of the produced files are not known in advance (in older times, +# we used Zip in these places). It shall only be used to deliver files +# for installation. +# +# If you know the filenames in advance, use Package. Laziness is not an +# excuse. + +gb_GeneratedPackage__get_srcdir = $(lastword $(subst :, ,$(1))) +gb_GeneratedPackage__get_destdir = $(firstword $(subst :, ,$(1))) + +define gb_GeneratedPackage__command_cp +mkdir -p $(dir $(INSTDIR)/$(2)) && \ +cp -r $(PACKAGE_SOURCEDIR)/$(1) $(INSTDIR)/$(2) +endef + +define gb_GeneratedPackage__command +$(call gb_Output_announce,$(2),$(true),GPK,2) +$(call gb_Helper_abbreviate_dirs,\ + rm -rf $(addprefix $(INSTDIR)/,$(foreach pair,$(PACKAGE_DIRS),$(call gb_GeneratedPackage__get_destdir,$(pair)))) && \ + $(foreach pair,$(PACKAGE_DIRS),\ + $(call gb_GeneratedPackage__command_cp,$(call gb_GeneratedPackage__get_srcdir,$(pair)),$(call gb_GeneratedPackage__get_destdir,$(pair))) &&) \ + find \ + $(addprefix $(INSTDIR)/,$(foreach pair,$(PACKAGE_DIRS),$(call gb_GeneratedPackage__get_destdir,$(pair)))) \ + \( -type f -o -type l \) -print \ + > $(1) \ +) +endef + +define gb_GeneratedPackage__check_dirs +$(if $(PACKAGE_DIRS),,$(call gb_Ouput_error,no dirs were added)) +$(foreach pair,$(PACKAGE_DIRS),\ + $(if $(wildcard $(PACKAGE_SOURCEDIR)/$(call gb_GeneratedPackage__get_srcdir,$(pair))),,\ + $(call gb_Output_error,source dir $(call gb_GeneratedPackage__get_srcdir,$(pair)) does not exist) \ + ) \ +) + +endef + +$(dir $(call gb_GeneratedPackage_get_target,%)).dir : + $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) + +$(dir $(call gb_GeneratedPackage_get_target,%))%.dir : + $(if $(wildcard $(dir $@)),,mkdir -p $(dir $@)) + +$(call gb_GeneratedPackage_get_target,%) : + $(call gb_GeneratedPackage__check_dirs,$*) + $(call gb_GeneratedPackage__command,$@,$*) + +.PHONY : $(call gb_GeneratedPackage_get_clean_target,%) +$(call gb_GeneratedPackage_get_clean_target,%) : + $(call gb_Output_announce,$*,$(false),GPK,2) + rm -rf $(call gb_GeneratedPackage_get_target,$*) $(addprefix $(INSTDIR)/,$(PACKAGE_DIRS)) + +# Create a generated package. +# +# gb_GeneratedPackage_GeneratedPackage package srcdir +define gb_GeneratedPackage_GeneratedPackage +$(call gb_GeneratedPackage_get_target,$(1)) : PACKAGE_DIRS := +$(call gb_GeneratedPackage_get_target,$(1)) : PACKAGE_SOURCEDIR := $(2) +$(call gb_GeneratedPackage_get_clean_target,$(1)) : PACKAGE_DIRS := + +$(call gb_GeneratedPackage_get_target,$(1)) : $(gb_Module_CURRENTMAKEFILE) +$(call gb_GeneratedPackage_get_target,$(1)) :| $(dir $(call gb_GeneratedPackage_get_target,$(1))).dir + +$$(eval $$(call gb_Module_register_target,$(call gb_GeneratedPackage_get_target,$(1)),$(call gb_GeneratedPackage_get_clean_target,$(1)))) +$(call gb_Helper_make_userfriendly_targets,$(1),GeneratedPackage) + +endef + +# Depend on a custom target. +# +# gb_GeneratedPackage_use_customtarget package custom-target +define gb_GeneratedPackage_use_customtarget +$(call gb_GeneratedPackage_get_target,$(1)) : $(call gb_CustomTarget_get_target,$(2)) + +endef + +# Depend on an unpacked tarball. +# +# gb_GeneratedPackage_use_unpacked package unpacked +define gb_GeneratedPackage_use_unpacked +$(call gb_GeneratedPackage_get_target,$(1)) : $(call gb_UnpackedTarball_get_target,$(2)) + +endef + +# Add a dir to the package. +# +# The srcdir will be copied to $(INSTDIR) as destdir. +# +# gb_GeneratedPackage_add_dir package destdir srcdir +define gb_GeneratedPackage_add_dir +$(call gb_GeneratedPackage_get_target,$(1)) : PACKAGE_DIRS += $(strip $(2)):$(strip $(3)) +$(call gb_GeneratedPackage_get_clean_target,$(1)) : PACKAGE_DIRS += $(2) + +endef + +# vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/TargetLocations.mk b/solenv/gbuild/TargetLocations.mk index 727e5828a0e9..a66e11e020b5 100644 --- a/solenv/gbuild/TargetLocations.mk +++ b/solenv/gbuild/TargetLocations.mk @@ -117,6 +117,7 @@ gb_ExternalProject_get_statedir = $(WORKDIR)/ExternalProject/$(1) gb_ExternalProject_get_preparation_target = $(WORKDIR)/ExternalProject/$(1).prepare gb_ExternalProject_get_state_target = $(WORKDIR)/ExternalProject/$(1)/$(2) gb_ExternalProject_get_target = $(WORKDIR)/ExternalProject/$(1).done +gb_GeneratedPackage_get_target = $(WORKDIR)/GeneratedPackage/$(1).filelist gb_HelpIndexTarget_get_target = $(WORKDIR)/HelpIndexTarget/$(1).done gb_HelpJarTarget_get_target = $(WORKDIR)/HelpJarTarget/$(1).done gb_HelpLinkTarget_get_preparation_target = $(WORKDIR)/HelpLinkTarget/$(1).prepare @@ -269,6 +270,7 @@ $(eval $(call gb_Helper_make_clean_targets,\ Dictionary \ ExternalPackage \ ExtensionTarget \ + GeneratedPackage \ HelpTarget \ HelpIndexTarget \ HelpJarTarget \ diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk index 50bba7223a2d..a72591a788a8 100644 --- a/solenv/gbuild/gbuild.mk +++ b/solenv/gbuild/gbuild.mk @@ -346,6 +346,7 @@ include $(foreach class, \ AutoInstallLibs \ Postprocess \ PackageSet \ + GeneratedPackage \ ,$(GBUILDDIR)/$(class).mk) $(eval $(call gb_Helper_process_executable_registrations)) |