summaryrefslogtreecommitdiffstats
path: root/scripts/mk/vendor.mk
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:45:20 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-05-06 00:45:20 +0000
commit9a08cbfcc1ef900a04580f35afe2a4592d7d6030 (patch)
tree004cc7027bca2f2c0bcb5806527c8e0c48df2d6e /scripts/mk/vendor.mk
parentInitial commit. (diff)
downloaddpkg-9a08cbfcc1ef900a04580f35afe2a4592d7d6030.tar.xz
dpkg-9a08cbfcc1ef900a04580f35afe2a4592d7d6030.zip
Adding upstream version 1.19.8.upstream/1.19.8upstream
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/mk/vendor.mk')
-rw-r--r--scripts/mk/vendor.mk42
1 files changed, 42 insertions, 0 deletions
diff --git a/scripts/mk/vendor.mk b/scripts/mk/vendor.mk
new file mode 100644
index 0000000..f3b1565
--- /dev/null
+++ b/scripts/mk/vendor.mk
@@ -0,0 +1,42 @@
+# Makefile snippet defining the following vendor-related variables:
+#
+# DEB_VENDOR: output of dpkg-vendor --query Vendor
+# DEB_PARENT_VENDOR: output of dpkg-vendor --query Parent (can be empty)
+#
+# This Makefile snippet also defines a set "dpkg_vendor_derives_from"
+# macros that can be used to verify if the current vendor derives from
+# another vendor. The unversioned variant defaults to the v0 version if
+# undefined, which can be defined explicitly to one of the versions or the
+# versioned macros can be used directly. The following are example usages:
+#
+# - dpkg_vendor_derives_from (since dpkg 1.16.1)
+#
+# ifeq ($(shell $(call dpkg_vendor_derives_from,ubuntu)),yes)
+# ...
+# endif
+#
+# - dpkg_vendor_derives_from_v0 (since dpkg 1.19.3)
+#
+# ifeq ($(shell $(call dpkg_vendor_derives_from_v0,ubuntu)),yes)
+# ...
+# endif
+#
+# - dpkg_vendor_derives_from_v1 (since dpkg 1.19.3)
+#
+# dpkg_vendor_derives_from = $(dpkg_vendor_derives_from_v1)
+# ifeq ($(call dpkg_vendor_derives_from,ubuntu),yes)
+# ...
+# endif
+# ifeq ($(call dpkg_vendor_derives_from_v1,ubuntu),yes)
+# ...
+# endif
+
+dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1)))
+
+DEB_VENDOR = $(call dpkg_late_eval,DEB_VENDOR,dpkg-vendor --query Vendor)
+DEB_PARENT_VENDOR = $(call dpkg_late_eval,DEB_PARENT_VENDOR,dpkg-vendor --query Parent)
+
+dpkg_vendor_derives_from_v0 = dpkg-vendor --derives-from $(1) && echo yes || echo no
+dpkg_vendor_derives_from_v1 = $(shell $(dpkg_vendor_derives_from_v0))
+
+dpkg_vendor_derives_from ?= $(dpkg_vendor_derives_from_v0)