summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--solenv/gbuild/ExternalPackage.mk49
-rw-r--r--solenv/gbuild/Library.mk6
2 files changed, 52 insertions, 3 deletions
diff --git a/solenv/gbuild/ExternalPackage.mk b/solenv/gbuild/ExternalPackage.mk
index 9e0a019bc6b5..858367ddf4f9 100644
--- a/solenv/gbuild/ExternalPackage.mk
+++ b/solenv/gbuild/ExternalPackage.mk
@@ -36,6 +36,9 @@ $(call gb_ExternalPackage_get_clean_target,%) :
$(call gb_Output_announce,$*,$(false),EPK,2)
rm -f $(call gb_ExternalPackage_get_target,$*)
+# Get name of the Package used for delivering files for install to $(INSTDIR).
+gb_ExternalPackage_get_packagename = ExternalPackage/$(1)
+
# Create and register a new ExternalPackage
#
# The base directory of the package is the directory of the unpacked
@@ -60,6 +63,10 @@ define gb_ExternalPackage_ExternalPackage_internal
$(call gb_Package_Package_internal,$(1),$(call gb_UnpackedTarball_get_dir,$(2)))
$(call gb_Package_use_unpacked,$(1),$(2))
+ifneq ($(gb_RUNNABLE_INSTDIR),)
+$(call gb_ExternalPackage__ExternalPackage_package,$(1),$(call gb_ExternalPackage_get_packagename,$(1)),$(2))
+endif
+
$(call gb_ExternalPackage_get_target,$(1)) : $(call gb_Package_get_target,$(1))
$(call gb_ExternalPackage_get_target,$(1)) :| $(dir $(call gb_ExternalPackage_get_target,$(1))).dir
$(call gb_ExternalPackage_get_clean_target,$(1)) : $(call gb_Package_get_clean_target,$(1))
@@ -68,6 +75,14 @@ gb_ExternalPackage_UNPACKED_$(1) := $(2)
endef
+# gb_ExternalPackage__ExternalPackage_package package inst-package unpacked
+define gb_ExternalPackage__ExternalPackage_package
+$(call gb_Package_Package_internal,$(2),$(call gb_UnpackedTarball_get_dir,$(3)))
+$(call gb_Package_set_outdir,$(2),$(INSTDIR))
+$(call gb_Package_use_unpacked,$(2),$(3))
+
+endef
+
# Set output dir for the package's files.
#
# Default is $(OUTDIR).
@@ -183,9 +198,43 @@ endef
# gb_ExternalPackage_use_external_project package external
define gb_ExternalPackage_use_external_project
$(call gb_Package_use_external_project,$(1),$(2))
+
+ifneq ($(gb_RUNNABLE_INSTDIR),)
+$(call gb_Package_use_external_project,$(call gb_ExternalPackage_get_packagename,$(1)),$(2))
+endif
+
$(if $(gb_ExternalPackage_PROJECT_$(1)),$(call gb_Output_error,gb_ExternalPackage_use_external_project: only one project allowed))
gb_ExternalPackage_PROJECT_$(1) := $(2)
endef
+# Add a (dynamic) library that is a part of the installation.
+#
+# This function is very similar to gb_ExternalPackage_add_file, except
+# that it also allows to deliver the library to its proper place in
+# $(INSTDIR).
+#
+# The last argument is the name under which the library was registered.
+# It is used to determine layer, if the library is not in layer OOO.
+#
+# gb_ExternalPackage_add_library_for_install package dest src library?
+define gb_ExternalPackage_add_library_for_install
+$(call gb_ExternalPackage_add_file,$(1),$(2),$(3))
+
+ifneq ($(gb_RUNNABLE_INSTDIR),)
+$(call gb_ExternalPackage_add_file,$(call gb_ExternalPackage_get_packagename,$(1)),$(if $(4),$(call gb_Library_get_instdir,$(4)),program)/$(notdir $(2)),$(3))
+$(call gb_ExternalPackage_get_target,$(1)) : $(call gb_Package_get_target,$(call gb_ExternalPackage_get_packagename,$(1)))
+$(call gb_ExternalPackage_get_clean_target,$(1)) : $(call gb_Package_get_clean_target,$(call gb_ExternalPackage_get_packagename,$(1)))
+endif
+
+endef
+
+# Add several libraries for install at once.
+#
+# gb_ExternalPackage_add_libraries_for_install package destdir file(s)
+define gb_ExternalPackage_add_libraries_for_install
+$(foreach file,$(3),$(call gb_ExternalPackage_add_library_for_install,$(1),$(2)/$(notdir $(file)),$(file)))
+
+endef
+
# vim: set noet sw=4 ts=4:
diff --git a/solenv/gbuild/Library.mk b/solenv/gbuild/Library.mk
index 643073c2666d..aa92d85fb356 100644
--- a/solenv/gbuild/Library.mk
+++ b/solenv/gbuild/Library.mk
@@ -55,7 +55,7 @@ $(WORKDIR)/Clean/OutDir/lib/%$(gb_Library_PLAINEXT) :
gb_Library_get_packagename = Library/$(1)
gb_Library__get_dir_for_layer = $(patsubst $(1):%,%,$(filter $(1):%,$(gb_Library_LAYER_DIRS)))
-gb_Library__get_instdir = $(call gb_Library__get_dir_for_layer,$(call gb_Library_get_layer,$(1)))
+gb_Library_get_instdir = $(call gb_Library__get_dir_for_layer,$(call gb_Library_get_layer,$(1)))
define gb_Library_Library
$(call gb_Postprocess_get_target,AllLibraries) : $(call gb_Library_get_target,$(1))
@@ -98,7 +98,7 @@ endef
define gb_Library__Library_package
$(call gb_Package_Package_internal,$(2),$(gb_Helper_OUTDIRLIBDIR))
$(call gb_Package_set_outdir,$(2),$(INSTDIR))
-$(call gb_Package_add_file,$(2),$(call gb_Library__get_instdir,$(1))/$(3),$(3))
+$(call gb_Package_add_file,$(2),$(call gb_Library_get_instdir,$(1))/$(3),$(3))
$(call gb_Library__get_final_target,$(1)) : $(call gb_Package_get_target,$(2))
$(call gb_Package_get_target,$(2)) : $(call gb_Library_get_target,$(1))
@@ -127,7 +127,7 @@ endef
define gb_Library__add_soversion_link
$(call gb_Library_add_auxtarget,$(1),$(3))
ifneq ($(gb_RUNNABLE_INSTDIR),)
-$(call gb_Package_add_file,$(2),$(call gb_Library__get_instdir,$(1))/$(notdir $(3)),$(notdir $(3)))
+$(call gb_Package_add_file,$(2),$(call gb_Library_get_instdir,$(1))/$(notdir $(3)),$(notdir $(3)))
endif
endef