gbuild: add Package equiv. for copying whole dirs

This is in preparation for using doxygen to generate IDL docs. Because
the file names generated by doxygen are essentially random, it is not
possible to use a Package to deliver them. And we really do not want to
go back to using Zip, as unpacking slows the installation down.

Change-Id: I5f4aa6bf10c6aab30a5b1870e04dca723c123317
Reviewed-on: https://gerrit.libreoffice.org/3774
Reviewed-by: David Tardon <dtardon@redhat.com>
Tested-by: David Tardon <dtardon@redhat.com>
This commit is contained in:
David Tardon 2013-05-04 13:21:33 +02:00
parent 06da9114c9
commit 0fd330ec4d
5 changed files with 119 additions and 4 deletions

View file

@ -108,6 +108,7 @@ gbuild_TARGETS := AllLangHelp \
Extension \
ExternalPackage \
ExternalProject \
GeneratedPackage \
InstallModule \
InstallScript \
InternalUnoApi \

View file

@ -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
}
}

View file

@ -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:

View file

@ -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 \

View file

@ -346,6 +346,7 @@ include $(foreach class, \
AutoInstallLibs \
Postprocess \
PackageSet \
GeneratedPackage \
,$(GBUILDDIR)/$(class).mk)
$(eval $(call gb_Helper_process_executable_registrations))