Branch libreoffice-5-0-4
[LibreOffice.git] / solenv / gbuild / ExtensionPackage.mk
blobe2c99a4764b6005294cdbb73e8262693bb4ac247
1 # -*- Mode: makefile-gmake; tab-width: 4; indent-tabs-mode: t -*-
3 # This file is part of the LibreOffice project.
5 # This Source Code Form is subject to the terms of the Mozilla Public
6 # License, v. 2.0. If a copy of the MPL was not distributed with this
7 # file, You can obtain one at http://mozilla.org/MPL/2.0/.
10 # ExtensionPackage class
12 # Unpacks a binary .oxt file into the instdir extension directory and
13 # writes a file-list.
15 $(call gb_ExtensionPackage_get_clean_target,%) :
16 $(call gb_Output_announce,$*,$(false),OXP,3)
17 $(call gb_Helper_abbreviate_dirs,\
18 rm -rf $(INSTROOT)/$(LIBO_SHARE_FOLDER)/extensions/$* \
19 $(call gb_ExtensionPackage_get_target,$*))
21 $(call gb_ExtensionPackage_get_preparation_target,%) :
22 mkdir -p $(dir $@) && touch $@
24 $(call gb_ExtensionPackage_get_target,%) :
25 $(call gb_Output_announce,$*,$(true),OXP,3)
26 $(call gb_Helper_abbreviate_dirs,\
27 mkdir -p $(dir $@) \
28 && rm -rf $(INSTROOT)/$(LIBO_SHARE_FOLDER)/extensions/$* \
29 && unzip -q $(ZIPFILE) -d $(INSTROOT)/$(LIBO_SHARE_FOLDER)/extensions/$* \
30 && zipinfo -1 $(ZIPFILE) | grep -v '/$$' \
31 | sed s+^+$(INSTROOT)/$(LIBO_SHARE_FOLDER)/extensions/$*/+ > $@)
33 # call gb_ExtensionPackage_ExtensionPackage_internal,package,oxt
34 define gb_ExtensionPackage_ExtensionPackage_internal
35 $(if $(2),,$(call gb_Output_error,need 2 parameters))
36 $(call gb_ExtensionPackage_get_target,$(1)) : ZIPFILE := $(2)
37 $(call gb_ExtensionPackage_get_target,$(1)) : $(2)
38 $(call gb_ExtensionPackage_get_target,$(1)) :| \
39 $(INSTROOT)/$(LIBO_SHARE_FOLDER)/extensions/.dir
41 endef
43 # call gb_ExtensionPackage_ExtensionPackage,package,oxt
44 define gb_ExtensionPackage_ExtensionPackage
45 $(call gb_ExtensionPackage_ExtensionPackage_internal,$(1),$(2))
46 $(2) : $(call gb_ExtensionPackage_get_preparation_target,$(1))
47 touch $$@
49 $$(eval $$(call gb_Module_register_target,$(call gb_ExtensionPackage_get_target,$(1)),$(call gb_ExtensionPackage_get_clean_target,$(1))))
50 $(call gb_Helper_make_userfriendly_targets,$(1),ExtensionPackage)
52 endef
54 # call gb_ExtensionPackage_use_external_project,package,externalproject
55 define gb_ExtensionPackage_use_external_project
56 $(call gb_ExtensionPackage_get_preparation_target,$(1)) : \
57 $(call gb_ExternalProject_get_target,$(2))
59 endef
61 # ExtensionPackage class
63 # This is less boring than writing a dozen 1-line ExtensionPackage files.
65 $(call gb_ExtensionPackageSet_get_clean_target,%) :
66 $(call gb_Output_announce,$*,$(false),OXS,3)
67 $(call gb_Helper_abbreviate_dirs,\
68 rm -rf $(call gb_ExtensionPackageSet_get_target,$*))
70 $(call gb_ExtensionPackageSet_get_target,%) :
71 $(call gb_Output_announce,$*,$(true),OXS,3)
72 mkdir -p $(dir $@) && touch $@
74 # call gb_ExtensionPackageSet_ExtensionPackageSet,set
75 define gb_ExtensionPackageSet_ExtensionPackageSet
76 $$(eval $$(call gb_Module_register_target,$(call gb_ExtensionPackageSet_get_target,$(1)),$(call gb_ExtensionPackageSet_get_clean_target,$(1))))
77 $(call gb_Helper_make_userfriendly_targets,$(1),ExtensionPackageSet)
79 endef
81 # call gb_ExtensionPackageSet_add_extension,set,package,oxt-filename
82 define gb_ExtensionPackageSet_add_extension
83 $(call gb_ExtensionPackage_ExtensionPackage_internal,$(2),$(TARFILE_LOCATION)/$(3))
85 $(call gb_ExtensionPackageSet_get_target,$(1)) : \
86 $(call gb_ExtensionPackage_get_target,$(2))
87 $(call gb_ExtensionPackageSet_get_clean_target,$(1)) : \
88 $(call gb_ExtensionPackage_get_clean_target,$(2))
90 endef
92 # vim: set noet sw=4 ts=4: