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=981d5acb840dc50a66fc1f00e42d1830c1916b00 commit 981d5acb840dc50a66fc1f00e42d1830c1916b00 Author: Guillem Jover <[email protected]> AuthorDate: Fri Dec 17 04:46:32 2021 +0100 build: Factor out installation variable substitution into a new subst.am file This will help reduce duplication. --- build-aux/subst.am | 46 +++++++++++++++++++++++++++++++++++++++++++++ dselect/methods/Makefile.am | 19 ++----------------- scripts/Makefile.am | 31 ++---------------------------- scripts/mk/Makefile.am | 6 +++--- 4 files changed, 53 insertions(+), 49 deletions(-) diff --git a/build-aux/subst.am b/build-aux/subst.am new file mode 100644 index 000000000..74a40bf0b --- /dev/null +++ b/build-aux/subst.am @@ -0,0 +1,46 @@ +# +# Build time variable substitution for generated files. +# + +# Shell support. + +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)\":" \ + # EOL + +SUFFIXES += .sh + +.sh: Makefile + @test -d `dirname $@` || $(MKDIR_P) `dirname $@` + $(do_shell_subst) <$< >$@ + $(AM_V_at) chmod +x $@ + +# 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 + +SUFFIXES += .pl + +.pl: Makefile + @test -d `dirname $@` || $(MKDIR_P) `dirname $@` + $(do_perl_subst) <$< >$@ + $(AM_V_at) chmod +x $@ + +# Makefile support. + +do_make_subst = $(AM_V_GEN) $(SED) \ + -e "s:dpkg_datadir[[:space:]]*=[[:space:]]*[^[:space:]]*:dpkg_datadir = $(pkgdatadir):" \ + # EOL diff --git a/dselect/methods/Makefile.am b/dselect/methods/Makefile.am index 0d42caf01..026c06e13 100644 --- a/dselect/methods/Makefile.am +++ b/dselect/methods/Makefile.am @@ -45,24 +45,9 @@ CLEANFILES = \ $(nobase_methods_SCRIPTS) \ # EOL -do_perl_subst = $(AM_V_GEN) $(SED) \ - -e "s:^\#![[:space:]]*/usr/bin/perl:\#!$(PERL):" \ - # EOL - -SUFFIXES = .pl .sh - -.pl: - @test -d `dirname $@` || $(MKDIR_P) `dirname $@` - $(do_perl_subst) <$< >$@ - $(AM_V_at) chmod +x $@ - -do_shell_subst = $(AM_V_GEN) \ - cat +SUFFIXES = -.sh: Makefile - @test -d `dirname $@` || $(MKDIR_P) `dirname $@` - $(do_shell_subst) <$< >$@ - $(AM_V_at) chmod +x $@ +include $(top_srcdir)/build-aux/subst.am install-data-local: $(MKDIR_P) $(DESTDIR)$(admindir)/methods/mnt diff --git a/scripts/Makefile.am b/scripts/Makefile.am index bfca2a0c9..f17af7027 100644 --- a/scripts/Makefile.am +++ b/scripts/Makefile.am @@ -160,36 +160,9 @@ man3_MANS = man_perl_section = 3perl -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 - -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)\":" \ - # EOL - -SUFFIXES = .pl .sh - -.pl: - @test -d `dirname $@` || $(MKDIR_P) `dirname $@` - $(do_perl_subst) <$< >$@ - $(AM_V_at) chmod +x $@ +SUFFIXES = -.sh: - @test -d `dirname $@` || $(MKDIR_P) `dirname $@` - $(do_shell_subst) <$< >$@ - $(AM_V_at) chmod +x $@ +include $(top_srcdir)/build-aux/subst.am install-data-local: if BUILD_POD_DOC diff --git a/scripts/mk/Makefile.am b/scripts/mk/Makefile.am index 05c585040..62d8592d2 100644 --- a/scripts/mk/Makefile.am +++ b/scripts/mk/Makefile.am @@ -10,9 +10,9 @@ dist_pkgdata_DATA = \ vendor.mk \ # EOL -do_make_subst = $(AM_V_GEN) $(SED) \ - -e "s:dpkg_datadir[[:space:]]*=[[:space:]]*[^[:space:]]*:dpkg_datadir = $(pkgdatadir):" \ - # EOL +SUFFIXES = + +include $(top_srcdir)/build-aux/subst.am install-data-hook: mv $(DESTDIR)$(pkgdatadir)/default.mk \ -- Dpkg.Org's dpkg

