summaryrefslogtreecommitdiffstats
path: root/scripts/mk
diff options
context:
space:
mode:
authorDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:30:08 +0000
committerDaniel Baumann <daniel.baumann@progress-linux.org>2024-08-07 13:30:08 +0000
commit44cf9c6d2d274eac37502e835155f7e985f1b8e6 (patch)
tree9576ba968924c5b9a55ba9e14f4f26184c62c7d4 /scripts/mk
parentAdding upstream version 1.22.6. (diff)
downloaddpkg-44cf9c6d2d274eac37502e835155f7e985f1b8e6.tar.xz
dpkg-44cf9c6d2d274eac37502e835155f7e985f1b8e6.zip
Adding upstream version 1.22.7.upstream/1.22.7
Signed-off-by: Daniel Baumann <daniel.baumann@progress-linux.org>
Diffstat (limited to 'scripts/mk')
-rw-r--r--scripts/mk/Makefile.am21
-rw-r--r--scripts/mk/Makefile.in97
-rw-r--r--scripts/mk/architecture.mk18
-rw-r--r--scripts/mk/buildapi.mk11
-rw-r--r--scripts/mk/buildflags.mk56
-rw-r--r--scripts/mk/buildopts.mk13
-rw-r--r--scripts/mk/buildtools.mk23
-rw-r--r--scripts/mk/default.mk8
-rw-r--r--scripts/mk/pkg-info.mk36
-rw-r--r--scripts/mk/vendor.mk15
10 files changed, 135 insertions, 163 deletions
diff --git a/scripts/mk/Makefile.am b/scripts/mk/Makefile.am
index 257ba52..6e85e17 100644
--- a/scripts/mk/Makefile.am
+++ b/scripts/mk/Makefile.am
@@ -10,24 +10,3 @@ dist_pkgdata_DATA = \
pkg-info.mk \
vendor.mk \
# EOL
-
-SUFFIXES =
-
-include $(top_srcdir)/build-aux/subst.am
-
-# Ideally we'd use '$(SED) -i', but unfortunately that's not portable.
-install-data-hook:
- $(do_make_subst) <$(DESTDIR)$(pkgdatadir)/default.mk \
- >$(DESTDIR)$(pkgdatadir)/default.mk.new
- mv $(DESTDIR)$(pkgdatadir)/default.mk.new \
- $(DESTDIR)$(pkgdatadir)/default.mk
-
- $(do_make_subst) <$(DESTDIR)$(pkgdatadir)/buildtools.mk \
- >$(DESTDIR)$(pkgdatadir)/buildtools.mk.new
- mv $(DESTDIR)$(pkgdatadir)/buildtools.mk.new \
- $(DESTDIR)$(pkgdatadir)/buildtools.mk
-
- $(do_make_subst) <$(DESTDIR)$(pkgdatadir)/vendor.mk \
- >$(DESTDIR)$(pkgdatadir)/vendor.mk.new
- mv $(DESTDIR)$(pkgdatadir)/vendor.mk.new \
- $(DESTDIR)$(pkgdatadir)/vendor.mk
diff --git a/scripts/mk/Makefile.in b/scripts/mk/Makefile.in
index 65e8fd5..5b78c79 100644
--- a/scripts/mk/Makefile.in
+++ b/scripts/mk/Makefile.in
@@ -14,12 +14,6 @@
@SET_MAKE@
-#
-# Build time variable substitution for generated files.
-#
-
-# Shell support.
-
VPATH = @srcdir@
am__is_gnu_make = { \
if test -z '$(MAKELEVEL)'; then \
@@ -96,8 +90,8 @@ build_triplet = @build@
host_triplet = @host@
subdir = scripts/mk
ACLOCAL_M4 = $(top_srcdir)/aclocal.m4
-am__aclocal_m4_deps = $(top_srcdir)/m4/dpkg-arch.m4 \
- $(top_srcdir)/m4/dpkg-build.m4 \
+am__aclocal_m4_deps = $(top_srcdir)/m4/build-to-host.m4 \
+ $(top_srcdir)/m4/dpkg-arch.m4 $(top_srcdir)/m4/dpkg-build.m4 \
$(top_srcdir)/m4/dpkg-compiler.m4 \
$(top_srcdir)/m4/dpkg-coverage.m4 \
$(top_srcdir)/m4/dpkg-funcs.m4 \
@@ -170,8 +164,7 @@ am__uninstall_files_from_dir = { \
am__installdirs = "$(DESTDIR)$(pkgdatadir)"
DATA = $(dist_pkgdata_DATA)
am__tagged_files = $(HEADERS) $(SOURCES) $(TAGS_FILES) $(LISP)
-am__DIST_COMMON = $(srcdir)/Makefile.in \
- $(top_srcdir)/build-aux/subst.am
+am__DIST_COMMON = $(srcdir)/Makefile.in
DISTFILES = $(DIST_COMMON) $(DIST_SOURCES) $(TEXINFOS) $(EXTRA_DIST)
ACLOCAL = @ACLOCAL@
AMTAR = @AMTAR@
@@ -270,6 +263,7 @@ PACKAGE_RELEASE_DATE = @PACKAGE_RELEASE_DATE@
PACKAGE_STRING = @PACKAGE_STRING@
PACKAGE_TARNAME = @PACKAGE_TARNAME@
PACKAGE_URL = @PACKAGE_URL@
+PACKAGE_VCS_ID = @PACKAGE_VCS_ID@
PACKAGE_VCS_TYPE = @PACKAGE_VCS_TYPE@
PACKAGE_VCS_URL = @PACKAGE_VCS_URL@
PACKAGE_VCS_WEB = @PACKAGE_VCS_WEB@
@@ -351,6 +345,8 @@ install_sh = @install_sh@
libdir = @libdir@
libexecdir = @libexecdir@
localedir = @localedir@
+localedir_c = @localedir_c@
+localedir_c_make = @localedir_c_make@
localstatedir = @localstatedir@
logdir = @logdir@
mandir = @mandir@
@@ -386,40 +382,10 @@ dist_pkgdata_DATA = \
vendor.mk \
# EOL
-SUFFIXES = .sh .pl
-do_shell_subst = $(AM_V_GEN) $(SED) \
- -e "s:^ADMINDIR=.*$$:ADMINDIR='$(admindir)':" \
- -e "s:^BACKUPSDIR=.*$$:BACKUPSDIR='$(backupsdir)':" \
- -e "s:^PKGDATADIR_DEFAULT=.*$$:PKGDATADIR_DEFAULT='$(pkgdatadir)':" \
- -e "s:^version=['\"][^'\"]*[\"']:version=\"$(PACKAGE_VERSION)\":" \
- -e "s:^TAR=.*$$:TAR='$(TAR)':" \
- # EOL
-
-
-# Perl support.
-do_perl_subst = $(AM_V_GEN) $(SED) \
- -e "s:^\#![[:space:]]*/usr/bin/perl:\#!$(PERL):" \
- -e "s:our \$$CONFDIR = .*;:our \$$CONFDIR = '$(pkgconfdir)';:" \
- -e "s:our \$$ADMINDIR = .*;:our \$$ADMINDIR = '$(admindir)';:" \
- -e "s:our \$$LIBDIR = .*;:our \$$LIBDIR = '$(pkglibexecdir)';:" \
- -e "s:our \$$DATADIR = .*;:our \$$DATADIR = '$(pkgdatadir)';:" \
- -e "s:our \$$PROGMAKE = .*;:our \$$PROGMAKE = '$(MAKE)';:" \
- -e "s:our \$$PROGTAR = .*;:our \$$PROGTAR = '$(TAR)';:" \
- -e "s:our \$$PROGPATCH = .*;:our \$$PROGPATCH = '$(PATCH)';:" \
- -e "s:our \$$PROGVERSION = .*;:our \$$PROGVERSION = '$(PACKAGE_VERSION)';:" \
- # EOL
-
-
-# Makefile support.
-do_make_subst = $(AM_V_GEN) $(SED) \
- -e "s:dpkg_datadir[[:space:]]*=[[:space:]]*[^[:space:]]*:dpkg_datadir = $(pkgdatadir):" \
- # EOL
-
all: all-am
.SUFFIXES:
-.SUFFIXES: .sh .pl
-$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(top_srcdir)/build-aux/subst.am $(am__configure_deps)
+$(srcdir)/Makefile.in: $(srcdir)/Makefile.am $(am__configure_deps)
@for dep in $?; do \
case '$(am__configure_deps)' in \
*$$dep*) \
@@ -439,7 +405,6 @@ Makefile: $(srcdir)/Makefile.in $(top_builddir)/config.status
echo ' cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles)'; \
cd $(top_builddir) && $(SHELL) ./config.status $(subdir)/$@ $(am__maybe_remake_depfiles);; \
esac;
-$(top_srcdir)/build-aux/subst.am $(am__empty):
$(top_builddir)/config.status: $(top_srcdir)/configure $(CONFIG_STATUS_DEPENDENCIES)
cd $(top_builddir) && $(MAKE) $(AM_MAKEFLAGS) am--refresh
@@ -573,8 +538,7 @@ info: info-am
info-am:
install-data-am: install-dist_pkgdataDATA
- @$(NORMAL_INSTALL)
- $(MAKE) $(AM_MAKEFLAGS) install-data-hook
+
install-dvi: install-dvi-am
install-dvi-am:
@@ -619,51 +583,24 @@ ps-am:
uninstall-am: uninstall-dist_pkgdataDATA
-.MAKE: install-am install-data-am install-strip
+.MAKE: install-am install-strip
.PHONY: all all-am check check-am clean clean-generic clean-libtool \
cscopelist-am ctags-am distclean distclean-generic \
distclean-libtool distdir dvi dvi-am html html-am info info-am \
install install-am install-data install-data-am \
- install-data-hook install-dist_pkgdataDATA install-dvi \
- install-dvi-am install-exec install-exec-am install-html \
- install-html-am install-info install-info-am install-man \
- install-pdf install-pdf-am install-ps install-ps-am \
- install-strip installcheck installcheck-am installdirs \
- maintainer-clean maintainer-clean-generic mostlyclean \
- mostlyclean-generic mostlyclean-libtool pdf pdf-am ps ps-am \
- tags-am uninstall uninstall-am uninstall-dist_pkgdataDATA
+ install-dist_pkgdataDATA install-dvi install-dvi-am \
+ install-exec install-exec-am install-html install-html-am \
+ install-info install-info-am install-man install-pdf \
+ install-pdf-am install-ps install-ps-am install-strip \
+ installcheck installcheck-am installdirs maintainer-clean \
+ maintainer-clean-generic mostlyclean mostlyclean-generic \
+ mostlyclean-libtool pdf pdf-am ps ps-am tags-am uninstall \
+ uninstall-am uninstall-dist_pkgdataDATA
.PRECIOUS: Makefile
-.sh: Makefile
- @test -d `dirname $@` || $(MKDIR_P) `dirname $@`
- $(do_shell_subst) <$< >$@
- $(AM_V_at) chmod +x $@
-
-.pl: Makefile
- @test -d `dirname $@` || $(MKDIR_P) `dirname $@`
- $(do_perl_subst) <$< >$@
- $(AM_V_at) chmod +x $@
-
-# Ideally we'd use '$(SED) -i', but unfortunately that's not portable.
-install-data-hook:
- $(do_make_subst) <$(DESTDIR)$(pkgdatadir)/default.mk \
- >$(DESTDIR)$(pkgdatadir)/default.mk.new
- mv $(DESTDIR)$(pkgdatadir)/default.mk.new \
- $(DESTDIR)$(pkgdatadir)/default.mk
-
- $(do_make_subst) <$(DESTDIR)$(pkgdatadir)/buildtools.mk \
- >$(DESTDIR)$(pkgdatadir)/buildtools.mk.new
- mv $(DESTDIR)$(pkgdatadir)/buildtools.mk.new \
- $(DESTDIR)$(pkgdatadir)/buildtools.mk
-
- $(do_make_subst) <$(DESTDIR)$(pkgdatadir)/vendor.mk \
- >$(DESTDIR)$(pkgdatadir)/vendor.mk.new
- mv $(DESTDIR)$(pkgdatadir)/vendor.mk.new \
- $(DESTDIR)$(pkgdatadir)/vendor.mk
-
# Tell versions [3.59,3.63) of GNU make to not export all variables.
# Otherwise a system limit (for SysV at least) may be exceeded.
.NOEXPORT:
diff --git a/scripts/mk/architecture.mk b/scripts/mk/architecture.mk
index c11cada..4f0559c 100644
--- a/scripts/mk/architecture.mk
+++ b/scripts/mk/architecture.mk
@@ -1,11 +1,21 @@
# This Makefile fragment (since dpkg 1.16.1) defines all the DEB_HOST_* and
# DEB_BUILD_* variables that dpkg-architecture can return. Existing values
# of those variables are preserved as per policy.
+# All variables are exported.
-dpkg_lazy_eval ?= $$(or $$(value DPKG_CACHE_$(1)),$$(eval DPKG_CACHE_$(1) := $$(shell $(2)))$$(value DPKG_CACHE_$(1)))
-
-dpkg_architecture_setvar = export $(1) ?= $(call dpkg_lazy_eval,$(1),dpkg-architecture -q$(1))
+ifndef dpkg_architecture_mk_included
+dpkg_architecture_mk_included = yes
+dpkg_architecture_vars = \
$(foreach machine,BUILD HOST TARGET,\
$(foreach var,ARCH ARCH_ABI ARCH_LIBC ARCH_OS ARCH_CPU ARCH_BITS ARCH_ENDIAN GNU_CPU GNU_SYSTEM GNU_TYPE MULTIARCH,\
- $(eval $(call dpkg_architecture_setvar,DEB_$(machine)_$(var)))))
+ DEB_$(machine)_$(var)))
+
+# dpkg-buildpackage sets all variables. Optimize this frequent case.
+ifneq (,$(strip $(foreach v,$(dpkg_architecture_vars),$(if $(value $(v)),,1))))
+ $(foreach line,$(subst =,?=,$(shell dpkg-architecture)),$(eval $(line)))
+endif
+
+export $(dpkg_architecture_vars)
+
+endif # dpkg_architecture_mk_included
diff --git a/scripts/mk/buildapi.mk b/scripts/mk/buildapi.mk
index 668e325..6b665f3 100644
--- a/scripts/mk/buildapi.mk
+++ b/scripts/mk/buildapi.mk
@@ -1,9 +1,18 @@
# This Makefile fragment (since dpkg 1.22.0) handles the build API.
+ifndef dpkg_buildapi_mk_included
+dpkg_buildapi_mk_included = yes
+
# Default API level when not set.
-DPKG_BUILD_API ?= $(shell dpkg-buildapi)
+ifndef DPKG_BUILD_API
+ dpkg_lazy_eval ?= $(eval $(1) = $(2)$$($(1)))
+ dpkg_lazy_set ?= $(call dpkg_lazy_eval,$(1),$$(eval $(1) := $(2)))
+ $(call dpkg_lazy_set,DPKG_BUILD_API,$$(shell dpkg-buildapi))
+endif
# We could use only built-in GNU make functions, but that seems too much
# complexity given no integer operators, given that we currently have to
# fetch the build API level anyway.
dpkg_build_api_ge = $(shell test "$(DPKG_BUILD_API)" -ge "$(1)" && echo yes)
+
+endif # dpkg_buildapi_mk_included
diff --git a/scripts/mk/buildflags.mk b/scripts/mk/buildflags.mk
index 4b8a3d8..a8eac9e 100644
--- a/scripts/mk/buildflags.mk
+++ b/scripts/mk/buildflags.mk
@@ -28,52 +28,46 @@
# You can also export them in the environment by setting
# DPKG_EXPORT_BUILDFLAGS to a non-empty value.
#
+
+ifndef dpkg_buildflags_mk_included
+dpkg_buildflags_mk_included = yes
+
# This list is kept in sync with the default set of flags returned
# by dpkg-buildflags.
-dpkg_lazy_eval ?= $$(or $$(value DPKG_CACHE_$(1)),$$(eval DPKG_CACHE_$(1) := $$(shell $(2)))$$(value DPKG_CACHE_$(1)))
-
-DPKG_BUILDFLAGS_LIST = \
+DPKG_BUILDFLAGS_LIST := $(foreach var,\
ASFLAGS \
- ASFLAGS_FOR_BUILD \
CFLAGS \
- CFLAGS_FOR_BUILD \
CPPFLAGS \
- CPPFLAGS_FOR_BUILD \
CXXFLAGS \
- CXXFLAGS_FOR_BUILD \
OBJCFLAGS \
- OBJCFLAGS_FOR_BUILD \
OBJCXXFLAGS \
- OBJCXXFLAGS_FOR_BUILD \
DFLAGS \
- DFLAGS_FOR_BUILD \
FFLAGS \
- FFLAGS_FOR_BUILD \
FCFLAGS \
- FCFLAGS_FOR_BUILD \
LDFLAGS \
- LDFLAGS_FOR_BUILD \
- # EOL
-
-define dpkg_buildflags_export_envvar
- ifdef $(1)
- DPKG_BUILDFLAGS_EXPORT_ENVVAR += $(1)="$$(value $(1))"
- endif
-endef
+ ,$(var) $(var)_FOR_BUILD)
-$(eval $(call dpkg_buildflags_export_envvar,DEB_BUILD_OPTIONS))
-$(eval $(call dpkg_buildflags_export_envvar,DEB_BUILD_MAINT_OPTIONS))
-$(eval $(call dpkg_buildflags_export_envvar,DEB_BUILD_PATH))
-$(foreach flag,$(DPKG_BUILDFLAGS_LIST),\
- $(foreach operation,SET STRIP APPEND PREPEND,\
- $(eval $(call dpkg_buildflags_export_envvar,DEB_$(flag)_MAINT_$(operation)))))
-
-dpkg_buildflags_setvar = $(1) = $(call dpkg_lazy_eval,$(1),$(DPKG_BUILDFLAGS_EXPORT_ENVVAR) dpkg-buildflags --get $(1))
-
-$(foreach flag,$(DPKG_BUILDFLAGS_LIST),\
- $(eval $(call dpkg_buildflags_setvar,$(flag))))
+dpkg_buildflags_run = $(eval $(shell \
+ $(foreach exported,\
+ DEB_BUILD_OPTIONS \
+ DEB_BUILD_MAINT_OPTIONS \
+ DEB_BUILD_PATH \
+ $(foreach flag,$(DPKG_BUILDFLAGS_LIST),\
+ $(foreach operation,SET STRIP APPEND PREPEND,\
+ DEB_$(flag)_MAINT_$(operation))),\
+ $(if $(value $(exported)),\
+ $(exported)="$(value $(exported))"))\
+ dpkg-buildflags | sed 's/\([^=]*\)\(.*\)/$$(eval \1:\2)/'))
ifdef DPKG_EXPORT_BUILDFLAGS
+ # We need to compute the values right now.
+ $(dpkg_buildflags_run)
export $(DPKG_BUILDFLAGS_LIST)
+else
+ dpkg_lazy_eval ?= $(eval $(1) = $(2)$$($(1)))
+ $(foreach v,$(DPKG_BUILDFLAGS_LIST),\
+ $(call dpkg_lazy_eval,$(v),$$(dpkg_buildflags_run)))
endif
+
+endif # dpkg_buildflags_mk_included
diff --git a/scripts/mk/buildopts.mk b/scripts/mk/buildopts.mk
index c957777..734d55e 100644
--- a/scripts/mk/buildopts.mk
+++ b/scripts/mk/buildopts.mk
@@ -4,7 +4,16 @@
# Defines the following variables:
#
# DEB_BUILD_OPTION_PARALLEL: the argument for the parallel=N option.
+# $(DEB_BUILD_OPTIONS) "parallel=2" "parallel=" ""
+# $(DEB_BUILD_OPTION_PARALLEL) "2" "" unset
+# $(DEB_BUILD_OPTION_PARALLEL:%=-j%) "-j2" "" ""
-ifneq (,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
- DEB_BUILD_OPTION_PARALLEL = $(patsubst parallel=%,%,$(filter parallel=%,$(DEB_BUILD_OPTIONS)))
+ifndef dpkg_buildopts_mk_included
+dpkg_buildopts_mk_included = yes
+
+dpkg_buildopts_parallel := $(filter parallel=%,$(DEB_BUILD_OPTIONS))
+ifdef dpkg_buildopts_parallel
+ DEB_BUILD_OPTION_PARALLEL = $(patsubst parallel=%,%,$(dpkg_buildopts_parallel))
endif
+
+endif # dpkg_buildopts_mk_included
diff --git a/scripts/mk/buildtools.mk b/scripts/mk/buildtools.mk
index 933fdcf..1f63bee 100644
--- a/scripts/mk/buildtools.mk
+++ b/scripts/mk/buildtools.mk
@@ -25,7 +25,10 @@
# The variables are not exported by default. This can be changed by
# defining DPKG_EXPORT_BUILDTOOLS.
-dpkg_datadir = $(srcdir)/mk
+ifndef dpkg_buildtools_mk_included
+dpkg_buildtools_mk_included = yes
+
+dpkg_datadir ?= $(dir $(lastword $(MAKEFILE_LIST)))
include $(dpkg_datadir)/architecture.mk
# We set the TOOL_FOR_BUILD variables to the specified value, and the TOOL
@@ -33,18 +36,18 @@ include $(dpkg_datadir)/architecture.mk
# not defined or contain the make built-in defaults. On native builds if
# TOOL is defined and TOOL_FOR_BUILD is not, we fallback to use TOOL.
define dpkg_buildtool_setvar
- ifeq (,$(findstring $(3),$(DEB_BUILD_OPTIONS)))
- ifeq ($(origin $(1)),default)
+ ifeq (,$(filter $(3),$(DEB_BUILD_OPTIONS)))
+ ifneq (,$(filter default undefined,$(origin $(1))))
$(1) = $(DEB_HOST_GNU_TYPE)-$(2)
- else
- $(1) ?= $(DEB_HOST_GNU_TYPE)-$(2)
endif
# On native build fallback to use TOOL if that's defined.
- ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
- $(1)_FOR_BUILD ?= $$($(1))
- else
- $(1)_FOR_BUILD ?= $(DEB_BUILD_GNU_TYPE)-$(2)
+ ifeq (undefined,$(origin $(1)_FOR_BUILD))
+ ifeq ($(DEB_BUILD_GNU_TYPE),$(DEB_HOST_GNU_TYPE))
+ $(1)_FOR_BUILD = $$($(1))
+ else
+ $(1)_FOR_BUILD = $(DEB_BUILD_GNU_TYPE)-$(2)
+ endif
endif
else
$(1) = :
@@ -74,3 +77,5 @@ $(eval $(call dpkg_buildtool_setvar,AR,ar))
$(eval $(call dpkg_buildtool_setvar,RANLIB,ranlib))
$(eval $(call dpkg_buildtool_setvar,PKG_CONFIG,pkgconf))
$(eval $(call dpkg_buildtool_setvar,QMAKE,qmake))
+
+endif # dpkg_buildtools_mk_included
diff --git a/scripts/mk/default.mk b/scripts/mk/default.mk
index 0b2fd4a..14e5be0 100644
--- a/scripts/mk/default.mk
+++ b/scripts/mk/default.mk
@@ -1,7 +1,11 @@
# This Makefile fragment (since dpkg 1.16.1) includes all the Makefile
# fragments that define variables that can be useful within debian/rules.
-dpkg_datadir = $(srcdir)/mk
+ifndef dpkg_default_mk_included
+dpkg_default_mk_included = yes
+
+dpkg_datadir := $(dir $(lastword $(MAKEFILE_LIST)))
+
include $(dpkg_datadir)/architecture.mk
include $(dpkg_datadir)/buildapi.mk
ifeq ($(call dpkg_build_api_ge,1),yes)
@@ -11,3 +15,5 @@ include $(dpkg_datadir)/buildflags.mk
include $(dpkg_datadir)/buildopts.mk
include $(dpkg_datadir)/pkg-info.mk
include $(dpkg_datadir)/vendor.mk
+
+endif # dpkg_default_mk_included
diff --git a/scripts/mk/pkg-info.mk b/scripts/mk/pkg-info.mk
index bccde23..ddda4f7 100644
--- a/scripts/mk/pkg-info.mk
+++ b/scripts/mk/pkg-info.mk
@@ -12,16 +12,34 @@
# SOURCE_DATE_EPOCH: source release date as seconds since the epoch, as
# specified by <https://reproducible-builds.org/specs/source-date-epoch/>
# (since dpkg 1.18.8).
+# If it is undefined, the date of the latest changelog entry is used.
+# In both cases, the value is exported.
-dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1)))
+ifndef dpkg_pkg_info_mk_included
+dpkg_pkg_info_mk_included = yes
-DEB_SOURCE = $(call dpkg_late_eval,DEB_SOURCE,dpkg-parsechangelog -SSource)
-DEB_VERSION = $(call dpkg_late_eval,DEB_VERSION,dpkg-parsechangelog -SVersion)
-DEB_VERSION_EPOCH_UPSTREAM = $(call dpkg_late_eval,DEB_VERSION_EPOCH_UPSTREAM,echo '$(DEB_VERSION)' | sed -e 's/-[^-]*$$//')
-DEB_VERSION_UPSTREAM_REVISION = $(call dpkg_late_eval,DEB_VERSION_UPSTREAM_REVISION,echo '$(DEB_VERSION)' | sed -e 's/^[0-9]*://')
-DEB_VERSION_UPSTREAM = $(call dpkg_late_eval,DEB_VERSION_UPSTREAM,echo '$(DEB_VERSION_EPOCH_UPSTREAM)' | sed -e 's/^[0-9]*://')
-DEB_DISTRIBUTION = $(call dpkg_late_eval,DEB_DISTRIBUTION,dpkg-parsechangelog -SDistribution)
-
-SOURCE_DATE_EPOCH ?= $(call dpkg_late_eval,SOURCE_DATE_EPOCH,dpkg-parsechangelog -STimestamp)
+dpkg_parsechangelog_run = $(eval $(shell dpkg-parsechangelog | sed -n '\
+ s/^Distribution: \(.*\)/$$(eval DEB_DISTRIBUTION:=\1)/p;\
+ s/^Source: \(.*\)/$$(eval DEB_SOURCE:=\1)/p;\
+ s/^Version: \([0-9]*:\)\{0,1\}\([^-]*\)\(\(.*\)-[^-]*\)\{0,1\}$$/\
+ $$(eval DEB_VERSION:=\1\2\3)\
+ $$(eval DEB_VERSION_EPOCH_UPSTREAM:=\1\2\4)\
+ $$(eval DEB_VERSION_UPSTREAM_REVISION:=\2\3)\
+ $$(eval DEB_VERSION_UPSTREAM:=\2\4)/p;\
+ s/^Timestamp: \(.*\)/$$(eval SOURCE_DATE_EPOCH?=\1)/p'))
+ifdef SOURCE_DATE_EPOCH
+ dpkg_lazy_eval ?= $(eval $(1) = $(2)$$($(1)))
+ $(call dpkg_lazy_eval,DEB_DISTRIBUTION,$$(dpkg_parsechangelog_run))
+ $(call dpkg_lazy_eval,DEB_SOURCE,$$(dpkg_parsechangelog_run))
+ $(call dpkg_lazy_eval,DEB_VERSION,$$(dpkg_parsechangelog_run))
+ $(call dpkg_lazy_eval,DEB_VERSION_EPOCH_UPSTREAM,$$(dpkg_parsechangelog_run))
+ $(call dpkg_lazy_eval,DEB_VERSION_UPSTREAM,$$(dpkg_parsechangelog_run))
+ $(call dpkg_lazy_eval,DEB_UPSTREAM_REVISION,$$(dpkg_parsechangelog_run))
+else
+ # We need to compute the values right now.
+ $(dpkg_parsechangelog_run)
+endif
export SOURCE_DATE_EPOCH
+
+endif # dpkg_pkg_info_mk_included
diff --git a/scripts/mk/vendor.mk b/scripts/mk/vendor.mk
index f3241a5..43898d9 100644
--- a/scripts/mk/vendor.mk
+++ b/scripts/mk/vendor.mk
@@ -33,13 +33,16 @@
# ...
# endif
-dpkg_datadir = $(srcdir)/mk
-include $(dpkg_datadir)/buildapi.mk
+ifndef dpkg_vendor_mk_included
+dpkg_vendor_mk_included = yes
-dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1)))
+dpkg_datadir ?= $(dir $(lastword $(MAKEFILE_LIST)))
+include $(dpkg_datadir)/buildapi.mk
-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_lazy_eval ?= $(eval $(1) = $(2)$$($(1)))
+dpkg_lazy_set ?= $(call dpkg_lazy_eval,$(1),$$(eval $(1) := $(2)))
+$(call dpkg_lazy_set,DEB_VENDOR,$$(shell dpkg-vendor --query Vendor))
+$(call dpkg_lazy_set,DEB_PARENT_VENDOR,$$(shell 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))
@@ -49,3 +52,5 @@ dpkg_vendor_derives_from ?= $(dpkg_vendor_derives_from_v1)
else
dpkg_vendor_derives_from ?= $(dpkg_vendor_derives_from_v0)
endif
+
+endif # dpkg_vendor_mk_included