automake-commit
[Top][All Lists]
Advanced

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

[automake-commit] branch master updated: texi: assume .texi.in generates


From: Karl Berry
Subject: [automake-commit] branch master updated: texi: assume .texi.in generates .texi.
Date: Thu, 13 Jul 2023 18:32:49 -0400

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

karl pushed a commit to branch master
in repository automake.

View the commit online:
https://git.savannah.gnu.org/gitweb/?p=automake.git;a=commitdiff;h=5c85a9d31830a61facc298fa7d7d82f5651f1a6c

The following commit(s) were added to refs/heads/master by this push:
     new 5c85a9d31 texi: assume .texi.in generates .texi.
5c85a9d31 is described below

commit 5c85a9d31830a61facc298fa7d7d82f5651f1a6c
Author: Bogdan <bogdro_rep@gmx.us>
AuthorDate: Thu Jul 13 15:32:34 2023 -0700

    texi: assume .texi.in generates .texi.
    
    This change refines the fix for https://bugs.gnu.org/54063.
    
    * bin/automake.in (scan_texinfo_file): if .texi doesn't exist,
    but .texi.in exists, read the latter for the Texinfo source.
    Use the @setfilename argument, if present, to generate rules.
    * t/txinfo-no-texi-but-texi-in.sh: new test.
    * t/list-of-tests.mk (handwritten_tests): add it.
    
    * doc/automake.texi (Texinfo): document this.
    * NEWS: mention this.  (Doc changes written by Karl.)
---
 NEWS                            |  6 ++++
 bin/automake.in                 | 37 ++++++++++++++++++++----
 doc/automake.texi               | 32 +++++++++++++++++----
 t/list-of-tests.mk              |  1 +
 t/txinfo-no-texi-but-texi-in.sh | 63 +++++++++++++++++++++++++++++++++++++++++
 5 files changed, 128 insertions(+), 11 deletions(-)

diff --git a/NEWS b/NEWS
index 23b2cc50a..c64d4ef15 100644
--- a/NEWS
+++ b/NEWS
@@ -21,6 +21,12 @@ New in 1.17:
   - Variables using escaped \# will trigger portability warnings, but be
     retained when appended.  GNU Make & BSD Makes are known to support it.
 
+  - For Texinfo documents, if a .texi.in file exists, but no .texi, the
+    .texi.in will be read. Texinfo source files need not be present at
+    all, and if present, need not contain @setfilename. Then the file name
+    as given in the Makefile.am will be used.  If @setfilename is present,
+    it should be the basename of the Texinfo file, extended with .info.
+
 * Bugs fixed
 
   - Generated file timestamp checks now handle filesystems with sub-second
diff --git a/bin/automake.in b/bin/automake.in
index 1c13a3187..369a47fa2 100644
--- a/bin/automake.in
+++ b/bin/automake.in
@@ -3061,11 +3061,24 @@ sub handle_scripts ()
 sub scan_texinfo_file
 {
   my ($filename) = @_;
+  my $orig_filename = $filename;
 
   # If the source file doesn't exist, we'll fall back below.
-  my $source = -e $filename ? $filename : "/dev/null";
-  my $texi = new Automake::XFile "< $source";
-  verb "reading $filename";
+  if (! -e $filename)
+    {
+      if (-e ($filename . '.in'))
+        {
+          # $filename.texi.in exists: assume $filename.texi is generated
+          # and parse $filename.texi.in as the real input.
+          $filename .= '.in';
+        }
+      else
+        {
+          $filename = '/dev/null';
+        }
+    }
+  my $texi = new Automake::XFile "< $filename";
+  verb "reading texinfo_file $filename";
 
   my ($outfile, $vfile);
   while ($_ = $texi->getline)
@@ -3077,6 +3090,18 @@ sub scan_texinfo_file
          # to use @setfilename...)
          next if $outfile;
 
+         # Although we notice the @setfilename, and the rules are
+         # adjusted to sort of use it, they don't actually work.
+         # Specifically, if foo.texi contains @setfilename bar.info,
+         # the generated .texi.info suffix rule will not run.
+         #
+         # Also, although we change the .info target to be bar.info,
+         # the HTML(S) variable/etc. is not changed.
+         #
+         # Since @setfilename is optional nowadays, doesn't seem worth
+         # the trouble to handle (which looks to be nontrivial).
+         # https://bugs.gnu.org/54063
+         
          $outfile = $1;
          if (index ($outfile, '.') < 0)
            {
@@ -3100,8 +3125,10 @@ sub scan_texinfo_file
 
   if (! $outfile)
     {
-      # Replace a .texi extension with .info
-      $outfile = basename($filename);
+      # If no explicit @setfilename, use the original filename as passed
+      # (not foo.texi.in or /dev/null) in the generated rules, while
+      # replacing any extension (presumably .texi) with .info.
+      $outfile = basename ($orig_filename);
       $outfile =~ s/\.[^.]+$//;
       $outfile .= '.info';
     }
diff --git a/doc/automake.texi b/doc/automake.texi
index 1bf74cd73..4561d1948 100644
--- a/doc/automake.texi
+++ b/doc/automake.texi
@@ -8036,6 +8036,7 @@ Currently Automake provides support for Texinfo and man 
pages.
 @node Texinfo
 @section Texinfo
 
+@cindex Texinfo support
 @cindex @code{_TEXINFOS} primary, defined
 @cindex @code{TEXINFOS} primary, defined
 @cindex Primary variable, @code{TEXINFOS}
@@ -8069,7 +8070,25 @@ rather than in the @code{builddir}.  This can be changed 
with the
 If the Texinfo sources are in a subdirectory relative to the Makefile, then
 @code{-I} flags for the subdirectory, both in the source directory and in the
 build directory, will automatically be added.  There is no need to specify
-these in @samp{$(MAKEINFO)}, @samp{$(MAKEINFOFLAGS)}, etc...
+these in @samp{$(MAKEINFO)}, @samp{$(MAKEINFOFLAGS)}, etc.
+
+@cindex @samp{@@setfilename} Texinfo directive
+If a Texinfo source file contains an @samp{@@setfilename} directive,
+and its argument has extension @samp{.info} (or no extension, but this
+is discouraged), that argument should be the same as the basename of
+the Texinfo file, extended with @samp{.info}.  The Make rules
+generated by Automake assume this, and will not work if the
+@samp{@@setfilename} is for some other name.
+
+@cindex @file{.texi.in} file, read
+If a Texinfo source @samp{foo.texi} is not present, but
+@file{foo.texi.in} exists, Texinfo will read that @file{.texi.in} file
+for @code{@@setfilename} and @code{@@include version.texi} (described
+below).
+
+Texinfo source files need not be present at all, and if present, need
+not contain @code{@@setfilename}.  Then the file name given in the
+Makefile.am will be used.
 
 @trindex dvi
 @trindex html
@@ -8102,11 +8121,12 @@ All of these targets can be extended using 
@samp{-local} rules
 
 @cindex @file{mdate-sh}
 
-If the @file{.texi} file @code{@@include}s @file{version.texi}, then
-that file will be automatically generated.  The file @file{version.texi}
-defines four Texinfo flags you can reference using
-@code{@@value@{EDITION@}}, @code{@@value@{VERSION@}},
-@code{@@value@{UPDATED@}}, and @code{@@value@{UPDATED-MONTH@}}.
+If a @file{.texi} file @code{@@include}s @file{version.texi} (actually
+any file named @file{vers...texi}, then that file will be
+automatically generated.  The file @file{version.texi} defines four
+Texinfo flags you can reference using @code{@@value@{EDITION@}},
+@code{@@value@{VERSION@}}, @code{@@value@{UPDATED@}}, and
+@code{@@value@{UPDATED-MONTH@}}.
 
 @table @code
 @item EDITION
diff --git a/t/list-of-tests.mk b/t/list-of-tests.mk
index 6f25f0494..94781d9b0 100644
--- a/t/list-of-tests.mk
+++ b/t/list-of-tests.mk
@@ -1232,6 +1232,7 @@ t/txinfo-no-installinfo.sh \
 t/txinfo-no-repeated-targets.sh \
 t/txinfo-no-setfilename.sh \
 t/txinfo-no-setfilename-no-inputs.sh \
+t/txinfo-no-texi-but-texi-in.sh \
 t/txinfo-other-suffixes.sh \
 t/txinfo-override-infodeps.sh \
 t/txinfo-override-texinfo-tex.sh \
diff --git a/t/txinfo-no-texi-but-texi-in.sh b/t/txinfo-no-texi-but-texi-in.sh
new file mode 100644
index 000000000..7975d4b01
--- /dev/null
+++ b/t/txinfo-no-texi-but-texi-in.sh
@@ -0,0 +1,63 @@
+#! /bin/sh
+# Copyright (C) 2023 Free Software Foundation, Inc.
+#
+# This program is free software; you can redistribute it and/or modify
+# it under the terms of the GNU General Public License as published by
+# the Free Software Foundation; either version 2, or (at your option)
+# any later version.
+#
+# This program is distributed in the hope that it will be useful,
+# but WITHOUT ANY WARRANTY; without even the implied warranty of
+# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.  See the
+# GNU General Public License for more details.
+#
+# You should have received a copy of the GNU General Public License
+# along with this program.  If not, see <https://www.gnu.org/licenses/>.
+
+# Check if Automake doesn't exit with an error for Texinfo output files
+# without a direct input file, but with a matching input file processed
+# by 'configure' (file.texi.in). 
+# https://debbugs.gnu.org/cgi/bugreport.cgi?bug=54063#41
+# 
+# This also tests an @setfilename that is different from the file name,
+# and the lack of any @setfilename, in the case of using .texi.in.
+# (See scan_texinfo_file in automake.)
+
+. test-init.sh
+
+echo AC_OUTPUT >> configure.ac
+
+cat > Makefile.am << 'END'
+info_TEXINFOS = main.texi
+END
+
+cat > main.texi.in << 'END'
+\input texinfo
+@setfilename main.info
+@settitle main
+@node Top
+Hello world.
+@bye
+END
+
+$ACLOCAL
+$AUTOMAKE --add-missing
+
+grep '/main.info:' Makefile.in
+
+# Recreate the test document without @setfilename.
+cat > main.texi.in << 'END'
+\input texinfo
+@settitle main
+@node Top
+Hello world.
+@bye
+END
+
+$ACLOCAL
+$AUTOMAKE
+
+# The result should use main.info (from the .texi file name).
+grep '/main.info:' Makefile.in
+
+:



reply via email to

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