From 034f941e5564cf0bcf080de86d52e134d0c5224a Mon Sep 17 00:00:00 2001 From: Bjoern Michaelsen Date: Sun, 21 Nov 2010 15:09:32 +0100 Subject: [PATCH] gnumake2: packmodule extension --- solenv/bin/packmodule | 2 +- solenv/gbuild/Deliver.mk | 3 +- solenv/gbuild/extensions/PackModule.mk | 56 ++++++++++++++++++++++++++ solenv/gbuild/gbuild.mk | 5 +++ solenv/gbuild/processdelivered.awk | 1 - 5 files changed, 64 insertions(+), 3 deletions(-) create mode 100644 solenv/gbuild/extensions/PackModule.mk diff --git a/solenv/bin/packmodule b/solenv/bin/packmodule index 0a5769f219ae..6261bd25754f 100755 --- a/solenv/bin/packmodule +++ b/solenv/bin/packmodule @@ -52,7 +52,7 @@ def main(args): [packedmodule.write(path) for path in stripped_paths_to_pack(deliverlog)] packedmodule.close() -if __name__ == "__main__": +if __name__ == "__main__": main(sys.argv) # vim:set et sw=4 ts=4 filetype=python: diff --git a/solenv/gbuild/Deliver.mk b/solenv/gbuild/Deliver.mk index 5786e4ab7089..ad52b98e928c 100644 --- a/solenv/gbuild/Deliver.mk +++ b/solenv/gbuild/Deliver.mk @@ -58,11 +58,12 @@ define gb_Deliver_deliver $(call gb_Deliver__deliverprefix,$(2)) $(gb_Deliver_GNUCOPY) -f $(1) $(2) endef +# we need the trailing whitespace so that the newline of echo does not become part of the last record define gb_Deliver_setdeliverlogcommand ifeq ($$(words $(gb_Module_ALLMODULES)),1) $$(eval $$(call gb_Output_announce,$$(strip $$(gb_Module_ALLMODULES)),$$(true),LOG,1)) deliverlog : COMMAND := mkdir -p $$(OUTDIR)/inc/$$(strip $$(gb_Module_ALLMODULES)) && -deliverlog : COMMAND += echo "$$(strip $$(call gb_Deliver_DELIVERABLES))" | awk -f $$(GBUILDDIR)/processdelivered.awk > $$(OUTDIR)/inc/$$(strip $(gb_Module_ALLMODULES))/deliver.log +deliverlog : COMMAND += echo "$$(strip $$(call gb_Deliver_DELIVERABLES)) " | awk -f $$(GBUILDDIR)/processdelivered.awk > $$(OUTDIR)/inc/$$(strip $(gb_Module_ALLMODULES))/deliver.log else $$(eval $$(call gb_Output_announce,more than one module - creating no deliver.log,$$(true),LOG,1)) deliverlog : COMMAND := true diff --git a/solenv/gbuild/extensions/PackModule.mk b/solenv/gbuild/extensions/PackModule.mk new file mode 100644 index 000000000000..95a557a7126b --- /dev/null +++ b/solenv/gbuild/extensions/PackModule.mk @@ -0,0 +1,56 @@ +#************************************************************************* +# +# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER. +# +# Copyright 2009 by Sun Microsystems, Inc. +# +# OpenOffice.org - a multi-platform office productivity suite +# +# This file is part of OpenOffice.org. +# +# OpenOffice.org is free software: you can redistribute it and/or modify +# it under the terms of the GNU Lesser General Public License version 3 +# only, as published by the Free Software Foundation. +# +# OpenOffice.org is distributed in the hope that it will be useful, +# but WITHOUT ANY WARRANTY; without even the implied warranty of +# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +# GNU Lesser General Public License version 3 for more details +# (a copy is included in the LICENSE file that accompanied this code). +# +# You should have received a copy of the GNU Lesser General Public License +# version 3 along with OpenOffice.org. If not, see +# +# for a copy of the LGPLv3 License. +# +#************************************************************************* + +# this is an optional extension to gbuild +# it depends on scripts outside the gbuild directory +# nothing in the gbuild core should ever depend on it + +define gb_PackModule_setpackmodulecommand +ifeq ($$(words $(gb_Module_ALLMODULES)),1) +$$(eval $$(call gb_Output_announce,$$(strip $$(gb_Module_ALLMODULES)),$$(true),ZIP,5)) +packmodule : COMMAND := $$(SOLARENV)/bin/packmodule $$(OUTDIR) $$(strip $$(gb_Module_ALLMODULES)) $$(UPDMINOR) +else +$$(eval $$(call gb_Output_announce,more than one module - creating no zipped package,$$(true),ZIP,5)) +packmodule : COMMAND := true +endif +endef + +.PHONY : packmodule cleanpackmodule +packmodule : all + $(eval $(call gb_PackModule_setpackmodulecommand)) + $(COMMAND) + +# TODO: implement cleanpackmodule +# Should cleanpackmodule depend on clean and thus remove the build too? That +# would be consistent with the current behaviour of packmodule. Or should it +# only remove the packed module, but nothing else? Or should packmodule have +# an order only dependency on all? Then one could either pack whats there with +# "packmodule" (might fail on an incomplete build) or make sure everything is +# up-to-date with "packmodule all". + + +# vim: set noet ts=4 sw=4: diff --git a/solenv/gbuild/gbuild.mk b/solenv/gbuild/gbuild.mk index e99ac91b5ba3..0cc6e74260c9 100755 --- a/solenv/gbuild/gbuild.mk +++ b/solenv/gbuild/gbuild.mk @@ -207,4 +207,9 @@ include $(foreach class, \ Module \ ,$(GBUILDDIR)/$(class).mk) +# optional extensions that should never be essential +ifneq ($(wildcard $(GBUILDDIR)/extensions/*.mk),) +include $(wildcard $(GBUILDDIR)/extensions/*.mk) +endif + # vim: set noet sw=4 ts=4: diff --git a/solenv/gbuild/processdelivered.awk b/solenv/gbuild/processdelivered.awk index fa37ed98d9af..90e12bf7c7a1 100644 --- a/solenv/gbuild/processdelivered.awk +++ b/solenv/gbuild/processdelivered.awk @@ -33,4 +33,3 @@ BEGIN { NF == 2 { print "COPY " $1 " " $2; } -