[continued from previous message]
- $(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 -r '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 $(1) = $(2)$$($(1)))
+ $(foreach v,$(DPKG_BUILDFLAGS_LIST),\
+ $(call dpkg_lazy,$(v),$$(dpkg-buildflags_run)))
endif
endif # ifndef /usr/share/dpkg/buildflags.mk_included
diff --git a/scripts/mk/pkg-info.mk b/scripts/mk/pkg-info.mk
index 144c0d758..0eb5e8a4b 100644
--- a/scripts/mk/pkg-info.mk
+++ b/scripts/mk/pkg-info.mk
@@ -12,21 +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.
ifndef /usr/share/dpkg/pkg-info.mk_included
/usr/share/dpkg/pkg-info.mk_included = yes
-dpkg_late_eval ?= $(or $(value DPKG_CACHE_$(1)),$(eval DPKG_CACHE_$(1) := $(shell $(2)))$(value DPKG_CACHE_$(1)))
-
-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]*://')
-DE