This is an automated email from the git hooks/post-receive script.

guillem pushed a commit to branch main
in repository dpkg.

View the commit online:
https://git.dpkg.org/cgit/dpkg/dpkg.git/commit/?id=d8ff5ef854c5fd3f6e9e5fa24a9e394a9b295276

commit d8ff5ef854c5fd3f6e9e5fa24a9e394a9b295276
Author: Nicolas Boulenguez <[email protected]>
AuthorDate: Tue Jul 2 11:54:55 2024 +0200

    scripts/mk: Stop hard-coding dpkg_datadir
    
    This path differ during tests and after installation. Instead of
    rewriting the file with a hardcoded path, compute it within Make.
    
    Signed-off-by: Guillem Jover <[email protected]>
---
 build-aux/subst.am       |  8 --------
 scripts/mk/Makefile.am   | 10 ----------
 scripts/mk/buildtools.mk |  2 +-
 scripts/mk/default.mk    |  3 ++-
 scripts/mk/vendor.mk     |  2 +-
 5 files changed, 4 insertions(+), 21 deletions(-)

diff --git a/build-aux/subst.am b/build-aux/subst.am
index 7785e4af7..9c96e5ce0 100644
--- a/build-aux/subst.am
+++ b/build-aux/subst.am
@@ -45,11 +45,3 @@ SUFFIXES += .pl
        @test -d `dirname $@` || $(MKDIR_P) `dirname $@`
        $(AM_V_GEN) $(subst_perl_filter) <$< >$@
        $(AM_V_at) chmod +x $@
-
-# Makefile support.
-
-subst_make_rules = "\
-       s{dpkg_datadir\s*=\s*[^\s]*}{dpkg_datadir = $(pkgdatadir)}; \
-       "
-
-subst_make_file = $(PERL) -i -p -e $(subst_make_rules)
diff --git a/scripts/mk/Makefile.am b/scripts/mk/Makefile.am
index be6076b2c..6e85e17b9 100644
--- a/scripts/mk/Makefile.am
+++ b/scripts/mk/Makefile.am
@@ -10,13 +10,3 @@ dist_pkgdata_DATA = \
        pkg-info.mk \
        vendor.mk \
        # EOL
-
-SUFFIXES =
-
-include $(top_srcdir)/build-aux/subst.am
-
-install-data-hook:
-       $(subst_make_file) $(DESTDIR)$(pkgdatadir)/default.mk
-       $(subst_make_file) $(DESTDIR)$(pkgdatadir)/buildtools.mk
-       $(subst_make_file) $(DESTDIR)$(pkgdatadir)/pkg-info.mk
-       $(subst_make_file) $(DESTDIR)$(pkgdatadir)/vendor.mk
diff --git a/scripts/mk/buildtools.mk b/scripts/mk/buildtools.mk
index 6ce9642cd..1f63beede 100644
--- a/scripts/mk/buildtools.mk
+++ b/scripts/mk/buildtools.mk
@@ -28,7 +28,7 @@
 ifndef dpkg_buildtools_mk_included
 dpkg_buildtools_mk_included = yes
 
-dpkg_datadir = $(srcdir)/mk
+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
diff --git a/scripts/mk/default.mk b/scripts/mk/default.mk
index c4e408b01..14e5be0cd 100644
--- a/scripts/mk/default.mk
+++ b/scripts/mk/default.mk
@@ -4,7 +4,8 @@
 ifndef dpkg_default_mk_included
 dpkg_default_mk_included = yes
 
-dpkg_datadir = $(srcdir)/mk
+dpkg_datadir := $(dir $(lastword $(MAKEFILE_LIST)))
+
 include $(dpkg_datadir)/architecture.mk
 include $(dpkg_datadir)/buildapi.mk
 ifeq ($(call dpkg_build_api_ge,1),yes)
diff --git a/scripts/mk/vendor.mk b/scripts/mk/vendor.mk
index 746503a33..43898d956 100644
--- a/scripts/mk/vendor.mk
+++ b/scripts/mk/vendor.mk
@@ -36,7 +36,7 @@
 ifndef dpkg_vendor_mk_included
 dpkg_vendor_mk_included = yes
 
-dpkg_datadir = $(srcdir)/mk
+dpkg_datadir ?= $(dir $(lastword $(MAKEFILE_LIST)))
 include $(dpkg_datadir)/buildapi.mk
 
 dpkg_lazy_eval ?= $(eval $(1) = $(2)$$($(1)))

-- 
Dpkg.Org's dpkg

Reply via email to