groff-commit
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[groff] 16/39: [mm]: Refactor generation of "mmroff" script.


From: G. Branden Robinson
Subject: [groff] 16/39: [mm]: Refactor generation of "mmroff" script.
Date: Sun, 9 Oct 2022 23:53:37 -0400 (EDT)

gbranden pushed a commit to branch master
in repository groff.

commit 53ca8b4141228b5e2069f31608945d680a31e5ef
Author: G. Branden Robinson <g.branden.robinson@gmail.com>
AuthorDate: Sun Oct 9 04:40:51 2022 -0500

    [mm]: Refactor generation of "mmroff" script.
    
    * contrib/mm/mmroff.pl: Replace absolute filespec with `@PERL@`
      replacement token.  This is documentary; the filespec was getting
      replaced anyway.
    
    * contrib/mm/mm.am (mmroff): Use more idiomatic token replacement
      strategy.  Also create target as a .tmp-suffixed file at first since
      it is not initially executable, so that we don't race against anything
      needing to run it in a parallelized build.  (This is a hypothetical
      concern; at present, nothing runs mmroff during the build.)
---
 contrib/mm/ChangeLog | 14 ++++++++++++++
 contrib/mm/mm.am     | 10 ++++++----
 contrib/mm/mmroff.pl |  3 +--
 3 files changed, 21 insertions(+), 6 deletions(-)

diff --git a/contrib/mm/ChangeLog b/contrib/mm/ChangeLog
index 240f3e8ba..66fae64cc 100644
--- a/contrib/mm/ChangeLog
+++ b/contrib/mm/ChangeLog
@@ -1,3 +1,17 @@
+2022-10-09  G. Branden Robinson <g.branden.robinson@gmail.com>
+
+       [mm]: Refactor generation of "mmroff" script.
+
+       * mmroff.pl: Replace absolute filespec with `@PERL@` replacement
+       token.  This is documentary; the filespec was getting replaced
+       anyway.
+       * mm.am (mmroff): Use more idiomatic token replacement strategy.
+       Also create target as a .tmp-suffixed file at first since it is
+       not initially executable, so that we don't race against anything
+       needing to run it in a parallelized build.  (This is a
+       hypothetical concern; at present, nothing runs mmroff during the
+       build.)
+
 2022-10-02  G. Branden Robinson <g.branden.robinson@gmail.com>
 
        * m.tmac (pg@header): Add page length sufficiency check.
diff --git a/contrib/mm/mm.am b/contrib/mm/mm.am
index 13181d27b..fc68ec4fe 100644
--- a/contrib/mm/mm.am
+++ b/contrib/mm/mm.am
@@ -74,10 +74,12 @@ EXTRA_DIST += \
   contrib/mm/tests/artifacts/60657.ref
 
 mmroff: $(mm_srcdir)/mmroff.pl
-       $(AM_V_GEN)$(SED) -e 's;/usr/bin/perl;$(PERL);' \
-           $(mm_srcdir)/mmroff.pl \
-           >$@ \
-       && chmod +x $@
+       $(AM_V_GEN)$(SED) \
+         -e 's;[@]PERL[@];$(PERL);' \
+         $(mm_srcdir)/mmroff.pl \
+         >$@.tmp \
+         && chmod +x $@.tmp \
+         && mv $@.tmp $@
 
 # special installation rules for m.tmac, mse.tmac, mmse.tmac, mm.tmac
 install-data-local: install_mm
diff --git a/contrib/mm/mmroff.pl b/contrib/mm/mmroff.pl
index c6a5d2bf1..9d94a10e4 100644
--- a/contrib/mm/mmroff.pl
+++ b/contrib/mm/mmroff.pl
@@ -1,5 +1,4 @@
-#! /usr/bin/perl
-# -*- Perl -*-
+#!@PERL@
 # Copyright (C) 1989-2020 Free Software Foundation, Inc.
 #
 # This file is part of groff.



reply via email to

[Prev in Thread] Current Thread [Next in Thread]