automake-patches
[Top][All Lists]
Advanced

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

[PATCH] texi: require Texinfo >= 4.9, related enhancements


From: Stefano Lattarini
Subject: [PATCH] texi: require Texinfo >= 4.9, related enhancements
Date: Sun, 17 Jun 2012 13:53:59 +0200

We start passing the '--build-dir' option (with a proper argument!) to
the texi2dvi and texi2pdf invocations done in our Texinfo-related rules.
Since this options has been only supported since Texinfo 4.9, we lose
compatibility with all older Texinfo versions.

But we also get some real improvements.  First, the '--build-dir' option
implies the '--tidy' option; this, like the '--clean' option that we were
formerly using, prevents cluttering of the build directory with all the
TeX and Texinfo auxiliary files and build by-products, but, differently
from '--clean', keeps them around for later re-runs to use; this shortens
the rebuild times considerably.

The use of '--build-dir' also allows us to specify different build
directories for the PDF and DVI output, preventing the rules building
them from stomping on each other's feet when run in parallel.  This is
demonstrated by the test case XXX, which before this change failed if
run with MAKE="make -j2", but now succeeds even in that case.

* NEWS: Update.
* lib/am/texibuilds.am: Do not try to avoid texi2dvi/texi2pdf option
'-o'; it has been supported since Texinfo 4.1, and we now require
Texinfo >= 4.9.  Remove an obsolete comment.  Modify calls to texi2dvi
and texi2pdf to use the '--build-dir' option, so that TeX auxiliary
files and build by-products for a 'foo.texi' input will be placed in
a 'foo.t2d' directory (for texi2dvi) or in a 'foo.t2p' directory (for
texi2pdf).
* automake.in (scan_texinfo_file): Greatly simplify the implementation,
since we don't need anymore to keep track of the TeX auxiliary files and
build by-products to clean.  Drop the '@CLEAN_FILES' part of the return
value.
(handle_texinfo_helper): Adjust the 'scan_texinfo_file()' call to its
new signature.  Append the "work directories" now created by texi2dvi
and texi2pdf invocation to the list of files/directories removed upon
"make mostlyclean".
* lib/am/texinfos.am: Update the cleaning rules (and comments)
accordingly.
* t/txinfo-no-clutter.sh: Minimal adjustment to avoid spurious failures.
* .gitignore: Update.

Signed-off-by: Stefano Lattarini <address@hidden>
---

 I plan to push this by tomorrow.  I'm also CC:ing to the Automake-NG
 list because this change might be relevant to some of the on-going
 work on Texinfo support that is taking place there.

 Regards,
   Stefano

 .gitignore             |    2 ++
 NEWS                   |   10 ++++++++++
 automake.in            |   49 +++++++-----------------------------------------
 lib/am/texibuild.am    |   22 ++++++++++------------
 lib/am/texinfos.am     |   11 ++++++-----
 t/txinfo-no-clutter.sh |    3 ++-
 6 files changed, 37 insertions(+), 60 deletions(-)

diff --git a/.gitignore b/.gitignore
index 130b390..df004ba 100644
--- a/.gitignore
+++ b/.gitignore
@@ -18,6 +18,8 @@
 /doc/automake*.dvi
 /doc/automake*.pdf
 /doc/automake*.ps
+/doc/automake*.t2d/
+/doc/automake*.t2p/
 /doc/automake*.1
 /doc/aclocal*.1
 /doc/stamp-vti
diff --git a/NEWS b/NEWS
index 33812db..6df5fcd 100644
--- a/NEWS
+++ b/NEWS
@@ -4,6 +4,9 @@ New in 1.13:
 
   - Autoconf 2.65 or greater is required.
 
+  - The rules to build PDF and DVI output from Texinfo input now
+    requires Texinfo 4.9 or later.
+
 * Obsolete features removed:
 
   - Use of the long-deprecated two- and three-arguments invocation forms
@@ -56,6 +59,13 @@ New in 1.13:
     backward-compatibility only.  In particular, its use does not disable
     the warnings in the 'portability-recursive' category anymore.
 
+* Texinfo Support:
+
+  - The rules to build PDF and DVI files from Texinfo input now use the
+    ' --build-dir' option, to keep the auxiliary files used by texi2dvi
+    and texi2pdf around without cluttering the build directory, and to
+    make it possible to run the "dvi" and "pdf" recipes in parallel.
+
 ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
 
 New in 1.12.2:
diff --git a/automake.in b/automake.in
index 3f869b2..11e750d 100644
--- a/automake.in
+++ b/automake.in
@@ -2975,35 +2975,15 @@ sub handle_scripts
 ## Handling Texinfo files.  ##
 ## ------------------------ ##
 
-# ($OUTFILE, $VFILE, @CLEAN_FILES)
+# ($OUTFILE, $VFILE)
 # &scan_texinfo_file ($FILENAME)
 # ------------------------------
 # $OUTFILE     - name of the info file produced by $FILENAME.
 # $VFILE       - name of the version.texi file used (undef if none).
-# @CLEAN_FILES - list of byproducts (indexes etc.)
 sub scan_texinfo_file ($)
 {
   my ($filename) = @_;
 
-  # Some of the following extensions are always created, no matter
-  # whether indexes are used or not.  Other (like cps, fns, ... pgs)
-  # are only created when they are used.  We used to scan $FILENAME
-  # for their use, but that is not enough: they could be used in
-  # included files.  We can't scan included files because we don't
-  # know the include path.  Therefore we always erase these files, no
-  # matter whether they are used or not.
-  #
-  # (tmp is only created if an @macro is used and a certain e-TeX
-  # feature is not available.)
-  my %clean_suffixes =
-    map { $_ => 1 } (qw(aux log toc tmp
-                       cp cps
-                       fn fns
-                       ky kys
-                       vr vrs
-                       tp tps
-                       pg pgs)); # grep 'new.*index' texinfo.tex
-
   my $texi = new Automake::XFile "< $filename";
   verb "reading $filename";
 
@@ -3031,23 +3011,6 @@ sub scan_texinfo_file ($)
        {
          $vfile = $1;
        }
-
-      # Try to find new or unused indexes.
-
-      # Creating a new category of index.
-      elsif (/address@hidden(code)?index (\w+)/)
-       {
-         $clean_suffixes{$2} = 1;
-         $clean_suffixes{"$2s"} = 1;
-       }
-
-      # Merging an index into an another.
-      elsif (/address@hidden(code)?index (\w+) (\w+)/)
-       {
-         delete $clean_suffixes{"$2s"};
-         $clean_suffixes{"$3s"} = 1;
-       }
-
     }
 
   if (! $outfile)
@@ -3058,8 +3021,7 @@ sub scan_texinfo_file ($)
 
   my $infobase = basename ($filename);
   $infobase =~ s/\.te?xi(nfo)?$//;
-  return ($outfile, $vfile,
-         map { "$infobase.$_" } (sort keys %clean_suffixes));
+  return ($outfile, $vfile);
 }
 
 
@@ -3199,10 +3161,13 @@ sub handle_texinfo_helper ($)
 
       # If 'version.texi' is referenced by input file, then include
       # automatic versioning capability.
-      my ($out_file, $vtexi, @clean_files) =
+      my ($out_file, $vtexi) =
        scan_texinfo_file ("$relative_dir/$texi")
        or next;
-      push (@mostly_cleans, @clean_files);
+      # Directory of auxiliary files and build by-products used by texi2dvi
+      # and texi2pdf.
+      push @mostly_cleans, "$relative_dir/$infobase.t2d";
+      push @mostly_cleans, "$relative_dir/$infobase.t2p";
 
       # If the Texinfo source is in a subdirectory, create the
       # resulting info in this subdirectory.  If it is in the current
diff --git a/lib/am/texibuild.am b/lib/am/texibuild.am
index f77748a..0eb62b1 100644
--- a/lib/am/texibuild.am
+++ b/lib/am/texibuild.am
@@ -65,14 +65,13 @@ INFO_DEPS += %DEST_INFO_PREFIX%%DEST_SUFFIX%
 ## Must set MAKEINFO like this so that version.texi will be found even
 ## if it is in srcdir (-I $(srcdir) is set in %MAKEINFOFLAGS%).
        MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) 
%MAKEINFOFLAGS%' \
-## Do not use '-o' unless necessary: it is only supported since Texinfo 4.1.
 ## texi2dvi doesn't silence everything with -q, redirect to /dev/null instead.
 ## We still want -q (%TEXIQUIET%) because it turns on batch mode.
-## Use '--clean' to avoid leaving auxiliary files behind cluttering the build
-## directory (see automake bug#11146).  We should start using '--tidy' when we
-## can assume Texinf 4.9 or later.
-?GENERIC?      $(TEXI2DVI) %TEXIQUIET% --clean %SOURCE% %TEXIDEVNULL%
-?!GENERIC?     $(TEXI2DVI) %TEXIQUIET% --clean -o $@ `test -f '%SOURCE%' || 
echo '$(srcdir)/'`%SOURCE% %TEXIDEVNULL%
+## Use '--tidy' to avoid leaving auxiliary files behind cluttering the build
+## directory (see automake bug#11146).
+       $(TEXI2DVI) %TEXIQUIET% --build-dir=$(@:.dvi=.t2d) -o $@ %TEXIDEVNULL% \
+?GENERIC?      %SOURCE%
+?!GENERIC?     `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
 
 ?GENERIC?%SOURCE_SUFFIX%.pdf:
 ?!GENERIC?%DEST_PREFIX%.pdf: %SOURCE% %DEPS% %DIRSTAMP%
@@ -80,14 +79,13 @@ INFO_DEPS += %DEST_INFO_PREFIX%%DEST_SUFFIX%
 ## Must set MAKEINFO like this so that version.texi will be found even
 ## if it is in srcdir (-I $(srcdir) is set in %MAKEINFOFLAGS%).
        MAKEINFO='$(MAKEINFO) $(AM_MAKEINFOFLAGS) $(MAKEINFOFLAGS) 
%MAKEINFOFLAGS%' \
-## Do not use '-o' unless necessary: it is only supported since Texinfo 4.1.
 ## texi2pdf doesn't silence everything with -q, redirect to /dev/null instead.
 ## We still want -q (%TEXIQUIET%) because it turns on batch mode.
-## Use '--clean' to avoid leaving auxiliary files behind cluttering the build
-## directory (see automake bug#11146).  We should start using '--tidy' when we
-## can assume Texinf 4.9 or later.
-?GENERIC?      $(TEXI2PDF) %TEXIQUIET% --clean %SOURCE% %TEXIDEVNULL%
-?!GENERIC?     $(TEXI2PDF) %TEXIQUIET% --clean -o $@ `test -f '%SOURCE%' || 
echo '$(srcdir)/'`%SOURCE% %TEXIDEVNULL%
+## Use '--tidy' to avoid leaving auxiliary files behind cluttering the build
+## directory (see automake bug#11146).
+       $(TEXI2PDF) %TEXIQUIET% --build-dir=$(@:.pdf=.t2p) -o $@ %TEXIDEVNULL% \
+?GENERIC?      %SOURCE%
+?!GENERIC?     `test -f '%SOURCE%' || echo '$(srcdir)/'`%SOURCE%
 
 ?GENERIC?%SOURCE_SUFFIX%.html:
 ?!GENERIC?%DEST_PREFIX%.html: %SOURCE% %DEPS% %DIRSTAMP%
diff --git a/lib/am/texinfos.am b/lib/am/texinfos.am
index e78cded..6d45c95 100644
--- a/lib/am/texinfos.am
+++ b/lib/am/texinfos.am
@@ -386,13 +386,14 @@ if %?LOCAL-TEXIS%
 .PHONY: mostlyclean-aminfo
 mostlyclean-aminfo:
 ## Use '-rf', not just '-f', because the %*CLEAN% substitutions can also
-## contain any directory created by "makeinfo --html".
+## contain any directory created by "makeinfo --html", as well as the
+## '*.t2d' and '*.t2p' directories used by texi2dvi and texi2pdf.
        -rm -rf %MOSTLYCLEAN%
 
 .PHONY clean-am: clean-aminfo
 clean-aminfo:
-## Use '-rf', not just '-f', because the %*CLEAN% substitutions can also
-## contain any directory created by "makeinfo --html".
+## Use '-rf', not just '-f'; see comments in 'mostlyclean-aminfo'
+## above for details.
 ?TEXICLEAN?    -test -z "%TEXICLEAN%" \
 ?TEXICLEAN?    || rm -rf %TEXICLEAN%
 
@@ -404,8 +405,8 @@ maintainer-clean-aminfo:
          echo " rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] 
$$i_i[0-9][0-9]"; \
          rm -f $$i $$i-[0-9] $$i-[0-9][0-9] $$i_i[0-9] $$i_i[0-9][0-9]; \
        done
-## Use '-rf', not just '-f', because the %*CLEAN% substitutions can also
-## contain any directory created by "makeinfo --html".
+## Use '-rf', not just '-f'; see comments in 'mostlyclean-aminfo'
+## above for details.
 ?MAINTCLEAN?   -test -z "%MAINTCLEAN%" \
 ?MAINTCLEAN?   || rm -rf %MAINTCLEAN%
 
diff --git a/t/txinfo-no-clutter.sh b/t/txinfo-no-clutter.sh
index ae5e9f2..7c7856f 100755
--- a/t/txinfo-no-clutter.sh
+++ b/t/txinfo-no-clutter.sh
@@ -93,7 +93,8 @@ for fmt in info pdf ps dvi html all; do
   $MAKE $fmt
   ls -l . sub # For debugging.
   ls -d foo* baz* sub/bar* > lst
-  $EGREP -v '^(foo|sub/bar|baz)\.(texi|dvi|ps|pdf|html|info)$' lst && Exit 1
+  $EGREP -v '^(foo|sub/bar|baz)\.(texi|dvi|ps|pdf|html|info|t2[dp])$' \
+    lst && Exit 1
   $MAKE clean
 done
 
-- 
1.7.9.5




reply via email to

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