summaryrefslogtreecommitdiffstats
path: root/solenv/gbuild/Zip.mk
diff options
context:
space:
mode:
authorMathias Bauer <mba@openoffice.org>2011-02-22 09:33:11 +0100
committerBjoern Michaelsen <bjoern.michaelsen@canonical.com>2011-06-16 10:00:45 +0200
commitafa6e26ab15a351d4ab6d379e72f48d498cfec9b (patch)
treef9c5a7ec8110f25887f9d62f3c67e98fca0d5b50 /solenv/gbuild/Zip.mk
parentDEV300 (diff)
downloadcore-afa6e26ab15a351d4ab6d379e72f48d498cfec9b.tar.gz
core-afa6e26ab15a351d4ab6d379e72f48d498cfec9b.zip
CWS gnumake4: add support for zip and jar files
Diffstat (limited to 'solenv/gbuild/Zip.mk')
-rw-r--r--solenv/gbuild/Zip.mk77
1 files changed, 77 insertions, 0 deletions
diff --git a/solenv/gbuild/Zip.mk b/solenv/gbuild/Zip.mk
new file mode 100644
index 000000000000..6f677c181af1
--- /dev/null
+++ b/solenv/gbuild/Zip.mk
@@ -0,0 +1,77 @@
+#*************************************************************************
+#
+# DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS FILE HEADER.
+#
+# Copyright 2000, 2011 Oracle and/or its affiliates.
+#
+# 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
+# <http://www.openoffice.org/license.html>
+# for a copy of the LGPLv3 License.
+#
+#*************************************************************************
+
+# Zip class
+
+gb_Zip_ZIPCOMMAND := zip
+
+# remove zip file in workdir and outdir
+$(call gb_Zip_get_clean_target,%) :
+ $(call gb_Output_announce,$*,$(false),ZIP,3)
+ $(call gb_Helper_abbreviate_dirs,\
+ rm -f $(call gb_Zip_get_target,$*) && \
+ rm -f $(call gb_Zip_get_final_target,$*) && \
+ rm -f $(call gb_Zip_get_outdir_target,$*))
+
+# clear file list, set location (zipping uses relative paths)
+# register target and clean target
+# add deliverable
+define gb_Zip_Zip
+
+$(call gb_Zip_get_target,$(1)) : FILES :=
+$(call gb_Zip_get_target,$(1)) : LOCATION := $(2)
+gb_Package_Location_$(1) := $(2)
+
+$(call gb_Zip_get_final_target,$(1)) : $(call gb_Zip_get_outdir_target,$(1))
+ touch $$@
+
+$(call gb_Zip_get_outdir_target,$(1)) : $(call gb_Zip_get_target,$(1))
+ $(call gb_Helper_abbreviate_dirs,\
+ $$(call gb_Deliver_deliver,$$<,$$@))
+
+$(eval $(call gb_Module_register_target,$(call gb_Zip_get_final_target,$(1)),$(call gb_Zip_get_clean_target,$(1))))
+
+$(call gb_Zip_get_target,$(1)) :
+ $(call gb_Helper_abbreviate_dirs_native,\
+ mkdir -p $$(dir $$(call gb_Zip_get_target,$(1))) && \
+ cd $$(LOCATION) && $$(gb_Zip_ZIPCOMMAND) -rX -FS $$(call gb_Zip_get_target,$(1)) $$(FILES) )
+
+$(call gb_Deliver_add_deliverable,$(call gb_Zip_get_outdir_target,$(1)),$(call gb_Zip_get_target,$(1)))
+
+endef
+
+define gb_Zip_add_file
+$(call gb_Zip_get_target,$(1)) : FILES += $(2)
+$(call gb_Zip_get_target,$(1)) : $(gb_Package_Location_$(1))/$(2)
+
+endef
+
+define gb_Zip_add_files
+$(foreach file,$(2),$(call gb_Zip_add_file,$(1),$(file)))
+endef
+
+# vim: set noet sw=4 ts=4: