texinfo-commits
[Top][All Lists]
Advanced

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

texinfo update (Thu Jun 9 18:22:01 EDT 2005)


From: Karl Berry
Subject: texinfo update (Thu Jun 9 18:22:01 EDT 2005)
Date: Thu, 09 Jun 2005 18:22:10 -0400

Index: ChangeLog
===================================================================
RCS file: /cvsroot/texinfo/texinfo/ChangeLog,v
retrieving revision 1.508
retrieving revision 1.509
diff -c -r1.508 -r1.509
*** ChangeLog   5 Jun 2005 15:06:17 -0000       1.508
--- ChangeLog   9 Jun 2005 22:07:13 -0000       1.509
***************
*** 1,3 ****
--- 1,53 ----
+ 2005-06-09  Akim Demaille  <address@hidden>
+ 
+       * util/texi2dvi: Support --tidy, a new build mode which lets all the
+         compilations happen in a local directory.  This is
+         similar to using --clean, but the files are preserved.  The
+       benefits are:
+       - the output is updated when each tex compilation is completed:
+         - to allow interactive viewing
+         - to preserve the previous output is the compilation fails
+       - if the compilation fails, the previous state is preserved.
+       - a fixed set of files to clean in this end (this directory)
+       - complete independence between DVI and PDF compilations.
+ 
+       (comment_iftex_sed, uncomment_iftex_sed): No
+       longer external files, but simple strings named...
+       (comment_iftex, uncomment_iftex): like this.
+       (utildir): Remove.
+ 
+       Make the structure clearer by introducing auxiliary functions.
+       * util/texi2dvi (run_bibtex, run_index, insert_commands)
+       (run_recode, run_thumpdf): New.
+       Extracted from the main loop.
+ 
+       Simplify some variable handling.
+       * util/texi2dvi (clean, debug): Now true/false Booleans.
+       Adjust dependencies.
+ 
+       Introduce a cycle counter.
+       * util/texi2dvi (cycle): New, to inform the user about the number
+       of compilation cycles.  That's also a nice tool to help debugging:
+       look for "cycle" in the trace to go from cycle to cycle.
+ 
+       Introduce the work dir, and use it.
+       * util/texi2dvi (ensure_dir, workdir): New.
+       (tmpdir_src, tmpdir_xtr, tmpdir_rcd, tmpdir_bak): Replace with...
+       (work_src, work_xtr, work_rcd, work_bak): these.
+       Adjust dependencies.
+       (filename_src, filename_xtr, filename_rcd, filename_bak): these.
+       (run_tex): Update the output.
+       Remove this task from the core of the loop.
+       (get_xref_files): Simplify by considering all the files around,
+       instead of try to select only those that correspond to a given
+       pattern.
+       Also, there's no reason to build the string result and then echo
+       it, just directly echo all the components.
+       (get_index_files): New.
+       (build_mode): New.
+       Adjust all dependencies (tex_help, command line parsing, clean,
+       tidy).
+ 
  2005-06-05  Karl Berry  <address@hidden>  (tiny change)
  
        * doc/texinfo.txi: typos from Christian von Schultz,
Index: NEWS
===================================================================
RCS file: /cvsroot/texinfo/texinfo/NEWS,v
retrieving revision 1.114
retrieving revision 1.115
diff -c -r1.114 -r1.115
*** NEWS        3 Jun 2005 23:53:20 -0000       1.114
--- NEWS        9 Jun 2005 22:07:13 -0000       1.115
***************
*** 1,4 ****
! $Id: NEWS,v 1.114 2005/06/03 23:53:20 karl Exp $
  This NEWS file records noteworthy changes, very tersely.
  See the manual for detailed information.
  
--- 1,4 ----
! $Id: NEWS,v 1.115 2005/06/09 22:07:13 karl Exp $
  This NEWS file records noteworthy changes, very tersely.
  See the manual for detailed information.
  
***************
*** 25,30 ****
--- 25,33 ----
  * Language:
    . new command @allowcodebreaks to control breaks at _ and - within @code.
    . new command @frenchspacing to control spacing after sentences.
+ * texi2dvi:
+   . new mode --build=tidy which supports compilation in a separate
+     directory, where intermediate files are preserved.
  * texinfo.tex:
    . section names with \ characters work properly in pdf outlines.
    . .toc files use @ as the escape character, instead of \.
Index: util/texi2dvi
===================================================================
RCS file: /cvsroot/texinfo/texinfo/util/texi2dvi,v
retrieving revision 1.52
retrieving revision 1.53
diff -c -r1.52 -r1.53
*** util/texi2dvi       25 May 2005 09:13:24 -0000      1.52
--- util/texi2dvi       9 Jun 2005 22:07:13 -0000       1.53
***************
*** 1,6 ****
  #! /bin/sh
  # texi2dvi --- produce DVI (or PDF) files from Texinfo (or LaTeX) sources.
! # $Id: texi2dvi,v 1.52 2005/05/25 09:13:24 kasal Exp $
  #
  # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001,
  # 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
--- 1,6 ----
  #! /bin/sh
  # texi2dvi --- produce DVI (or PDF) files from Texinfo (or LaTeX) sources.
! # $Id: texi2dvi,v 1.53 2005/06/09 22:07:13 karl Exp $
  #
  # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001,
  # 2002, 2003, 2004, 2005 Free Software Foundation, Inc.
***************
*** 32,38 ****
  unset RUNNING_KSH
  
  # This string is expanded by rcs automatically when this file is checked out.
! rcs_revision='$Revision: 1.52 $'
  rcs_version=`set - $rcs_revision; echo $2`
  program=`echo $0 | sed -e 's!.*/!!'`
  version="texi2dvi (GNU Texinfo 4.8) $rcs_version
--- 32,38 ----
  unset RUNNING_KSH
  
  # This string is expanded by rcs automatically when this file is checked out.
! rcs_revision='$Revision: 1.53 $'
  rcs_version=`set - $rcs_revision; echo $2`
  program=`echo $0 | sed -e 's!.*/!!'`
  version="texi2dvi (GNU Texinfo 4.8) $rcs_version
***************
*** 42,47 ****
--- 42,49 ----
  under the terms of the GNU General Public License.
  For more information about these matters, see the files named COPYING."
  
+ build_mode=${TEXI2DVI_BUILD_MODE:-local}
+ 
  usage="Usage: $program [OPTION]... FILE...
  
  Run each Texinfo or LaTeX FILE through TeX in turn until all
***************
*** 54,60 ****
  
  Operation modes:
    -b, --batch         no interaction
-   -c, --clean         remove all auxiliary files
    -D, --debug         turn on shell debugging (set -x)
    -h, --help          display this help and exit successfully
    -o, --output=OFILE  leave output in OFILE (implies --clean);
--- 56,61 ----
***************
*** 74,79 ****
--- 75,111 ----
    -t, --command=CMD    insert CMD in copy of input file
     or --texinfo=CMD    multiple values accumulate
  
+ Build modes:
+   --build=MODE  specify the treatment of auxialiary files [$build_mode]
+       --tidy    same as --build=tidy
+   -c, --clean   same as --build=clean
+ 
+ The MODE specifies where the TeX compilation takes place, and, as a
+ consequence, how auxiliary files are treated.  The default build mode
+ can also be set using the environment variable TEXI2DVI_BUILD_MODE.
+ 
+ Valid MODEs are:
+   \`local'  compile in the current directory, leaving all the auxiliary
+              files around.  This is the default.
+   \`tidy'   compile in a local *.t2d directory, where the auxiliary files
+              are left.  Output files are copied back to the original file.
+   \`clean'  same as \`tidy', but remove the auxiliary directory afterwards.
+              Every compilation therefore requires the full cycle.
+ 
+ Using the \`tidy' mode brings several advantages:
+   - the output file is updated after every succesful TeX run, for
+     sake of concurrent visualization of the output.  In a \`local' build
+     the viewer stops during the whole TeX run.
+   - if the compilation fails, the previous state of the output file
+     is preserved.
+   - PDF and DVI compilation are kept in separate subdirectories
+     preventing any possibility of auxiliary file incompatibility.
+ 
+ On the other, because \`tidy' compilation takes place in another
+ directory, occasionally TeX won't be able to find some files (e.g., when
+ using \\graphicspath): in that case use -I to specify the additional
+ directories to consider.
+ 
  The values of the BIBTEX, LATEX (or PDFLATEX), MAKEINDEX, MAKEINFO,
  TEX (or PDFTEX), TEXINDEX, and THUMBPDF environment variables are used
  to run those commands, if they are set.  Any CMD strings are added
***************
*** 86,95 ****
  # Initialize variables for option overriding and otherwise.
  # Don't use `unset' since old bourne shells don't have this command.
  # Instead, assign them an empty value.
! batch=false     # eval for batch mode
! clean=
! debug=
! escape='\'
  expand=         # t for expansion via makeinfo
  miincludes=     # makeinfo include path
  oformat=dvi
--- 118,126 ----
  # Initialize variables for option overriding and otherwise.
  # Don't use `unset' since old bourne shells don't have this command.
  # Instead, assign them an empty value.
! batch=false     # true for batch mode
! debug=false
! escape="\\"
  expand=         # t for expansion via makeinfo
  miincludes=     # makeinfo include path
  oformat=dvi
***************
*** 99,105 ****
  set_language=
  textra=         # Extra TeX commands to insert in the input file.
  textra_cmd=     # sed command to insert TEXTRA where appropriate
- tmpdir=${TMPDIR:-/tmp}/t2d$$  # avoid collisions on 8.3 filesystems.
  txincludes=     # TEXINPUTS extensions, with trailing colon
  txiprereq=19990129 # minimum texinfo.tex version with macro expansion
  verb=false      # echo for verbose mode
--- 130,135 ----
***************
*** 121,126 ****
--- 151,161 ----
  # In case someone crazy insists on using grep -E.
  : ${EGREP=egrep}
  
+ 
+ ## --------------------- ##
+ ## Auxiliary functions.  ##
+ ## --------------------- ##
+ 
  # return true if program $1 is somewhere in PATH, else false.
  #
  findprog ()
***************
*** 149,155 ****
    $foundprog
  }
  
! # Report some information.
  report ()
  {
    for i in "$@"
--- 184,192 ----
    $foundprog
  }
  
! # report LINE1 LINE2...
! # ---------------------
! # Report some information on stderr.
  report ()
  {
    for i in "$@"
***************
*** 164,169 ****
--- 201,208 ----
    $verb >&2 "$0: $@"
  }
  
+ # fatal EXIT_STATUS LINE1 LINE2...
+ # --------------------------------
  # Report an error and exit with failure.
  fatal ()
  {
***************
*** 173,178 ****
--- 212,235 ----
    exit $s
  }
  
+ # ensure_dir DIR1 DIR2...
+ # -----------------------
+ # Make sure the directories exist.
+ ensure_dir ()
+ {
+   for dir
+   do
+     test -d "$dir" \
+       || mkdir "$dir" \
+       || fatal 1 "cannot create directory: $dir"
+   done
+ }
+ 
+ 
+ ## ------------------------- ##
+ ## TeX auxiliary functions.  ##
+ ## ------------------------- ##
+ 
  # Save TEXINPUTS so we can construct a new TEXINPUTS path for each file.
  # Likewise for bibtex and makeindex.
  tex_envvars="BIBINPUTS BSTINPUTS INDEXSTYLE TEXINPUTS"
***************
*** 182,187 ****
--- 239,572 ----
  done
  
  
+ # get_xref_files FILENAME-NOEXT
+ # -----------------------------
+ # Compute the list of xref files (indexes, tables and lists).
+ get_xref_files ()
+ {
+   if $tidy; then
+     # In a tidy build, all the files around as actual outputs.
+     ls * 2>/dev/null
+   else
+     # Find all files having root filename with a two-letter extension,
+     # saves the ones that are really Texinfo-related files.
+     # - .?o?
+     #   .toc, .log, LaTeX tables and lists, FiXme's .lox, maybe more.
+     # - bu[0-9]*.aux
+     #   Sub bibliography when using the LaTeX bibunits package.
+     ls "$1".?o? "$1".aux bu[0-9]*.aux "$1".?? "$1".idx 2>/dev/null
+   fi |
+   while read file; do
+     # If the file is not suitable to be an index or xref file, don't
+     # process it.  It's suitable if the first character is a
+     # backslash or right quote or at, as long as the first line isn't
+     # \input texinfo.
+     case `sed '1q' $file` in
+       "\\input texinfo"*) ;;
+       [\\''@]*) echo "./$file";;
+     esac
+   done
+ }
+ 
+ 
+ # get_index_files FILE1 FILE2...
+ # ------------------------------
+ # Select the files that are indexes to run texindex/makeindex onto.
+ get_index_files ()
+ {
+   for file
+   do
+     case `sed '1q' $file` in
+       "\\entry{"*|"\\indexentry{"*) echo "$file";;
+     esac
+   done
+ }
+ 
+ 
+ # Convert relative paths to absolute paths, so we can run in another
+ # directory (e.g., in tidy build mode, or during the macro-support
+ # detection).
+ #
+ # Empty path components are meaningful to tex.  We rewrite them
+ # as `EMPTY' so they don't get lost when we split on $path_sep.
+ # Hopefully no one will have an actual directory named EMPTY.
+ absolute_filenames ()
+ {
+   replace_empty="-e 's/^$path_sep/EMPTY$path_sep/g' \
+                  -e 's/$path_sep\$/${path_sep}EMPTY/g' \
+                  -e 's/$path_sep$path_sep/${path_sep}EMPTY:/g'"
+   _res=`echo "$1" | eval sed $replace_empty`
+   save_IFS=$IFS
+   IFS=$path_sep
+   set x $_res; shift
+   _res=.
+   for dir
+   do
+     case $dir in
+       EMPTY)
+         _res=$_res$path_sep
+         ;;
+       [\\/]* | ?:[\\/]*)        # Absolute paths don't need to be expanded.
+         test -d $dir && _res=$_res$path_sep$dir
+         ;;
+       *)
+         test -d $dir && abs=`cd "$dir" && pwd` && _res=$_res$path_sep$abs
+         ;;
+     esac
+   done
+   echo "$_res"
+ }
+ 
+ 
+ ## ----------------------- ##
+ ## Running the TeX suite.  ##
+ ## ----------------------- ##
+ 
+ # run_tex ()
+ # ----------
+ # Run TeX as "$tex $tex_args $filename_input", taking care of errors
+ # and logs.
+ run_tex ()
+ {
+   # Note that this will be used via an eval: quote properly.
+   cmd=$tex
+ 
+   # If possible, make TeX report error locations in GNU format.
+   tex_args=
+   case $tex_help in
+     *file-line-error*) cmd="$cmd --file-line-error";;
+   esac
+ 
+   # Tell TeX to be batch if requested.
+   if $batch; then
+     # \batchmode does not show terminal output at all, so we don't
+     # want that.  And even in batch mode, TeX insists on having input
+     # from the user.  Close its stdin to make it impossible.
+     cmd="$cmd </dev/null '${escape}nonstopmode' '${escape}input'"
+   fi
+ 
+   cmd="$cmd '$filename_input'"
+ 
+   verbose "Running $cmd ..."
+   if eval "$cmd" >&5; then
+     if $tidy; then
+       # Update the actual output.
+       case $oname in
+       '') dest=$orig_pwd;;
+        *) dest=$oname;;
+       esac
+       verbose "Copying $oformat file from `pwd` to $dest"
+       cp -p "./$filename_noext.$oformat" "$dest"
+     fi
+   else
+     $tidy &&
+       cp "$filename_noext.log" "$orig_pwd"
+     fatal 1 "$tex exited with bad status, quitting." \
+             "see $filename_noext.log for errors."
+   fi
+ }
+ 
+ # run_bibtex ()
+ # -------------
+ # Run bibtex on current file.
+ # - If its input (AUX) exists.
+ # - If some citations are missing (LOG contains `Citation').
+ #   or the LOG complains of a missing .bbl
+ #
+ # We run bibtex first, because I can see reasons for the indexes
+ # to change after bibtex is run, but I see no reason for the
+ # converse.
+ #
+ # Don't try to be too smart:
+ #
+ # 1. Running bibtex only if the bbl file exists and is older than
+ # the LaTeX file is wrong, since the document might include files
+ # that have changed.
+ #
+ # 3. Because there can be several AUX (if there are \include's),
+ # but a single LOG, looking for missing citations in LOG is
+ # easier, though we take the risk to match false messages.
+ run_bibtex ()
+ {
+   if test -n "$bibtex" \
+      && test -r "$filename_noext.aux" \
+      && test -r "$filename_noext.log" \
+      && (grep 'Warning:.*Citation.*undefined' "$filename_noext.log" \
+           || grep 'No file .*\.bbl\.' "$filename_noext.log") \
+         >&6 2>&1; \
+   then
+     # If using the bibunits package, we might have to run bibtex
+     # on subfiles.
+     for f in "$filename_noext".aux bu[0-9]*.aux
+     do
+       if test -s "$f" && \
+          (grep '^\\bibstyle[{]' "$f"   \
+           && grep '^\\bibdata[{]' "$f" \
+           && grep '^\\citation[{]' "$f") >&6 2>&1; then
+         verbose "Running $bibtex $f ..."
+         $bibtex "$f" >&5 ||
+           fatal 1 "$bibtex exited with bad status, quitting."
+       fi
+     done
+   fi
+ }
+ 
+ # run_index ()
+ # ------------
+ # Run texindex (or makeindex) on current index files.  If they already
+ # exist, and after running TeX a first time the index files don't
+ # change, then there's no reason to run TeX again.  But we won't know
+ # that if the index files are out of date or nonexistent.
+ run_index ()
+ {
+   index_files=`get_index_files $orig_xref_files`
+   if test -n "$texindex" && test -n "$index_files"; then
+     verbose "Running $texindex $index_files ..."
+     $texindex $index_files 2>&5 1>&2 ||
+        fatal 1 "$texindex exited with bad status, quitting."
+   fi
+ }
+ 
+ 
+ # run_thumbpdf ()
+ # ---------------
+ run_thumbpdf ()
+ {
+   if test $oformat = pdf \
+      && test -r "$filename_noext.log" \
+      && grep 'thumbpdf\.sty'  "$filename_noext.log" >&6 2>&1; \
+   then
+     thumbpdf=${THUMBPDF:-thumbpdf}
+     verbose "Running $thumbpdf $filename_noext ..."
+     if $thumbpdf "$filename_noext" >&5; then
+       run_tex
+     else
+       report "$thumbpdf exited with bad status." \
+            "Ignoring its output."
+     fi
+   fi
+ }
+ 
+ 
+ ## -------------------------------- ##
+ ## TeX processing auxiliary tools.  ##
+ ## -------------------------------- ##
+ 
+ 
+ # A sed script that preprocesses Texinfo sources in order to keep the
+ # iftex sections only.  We want to remove non TeX sections, and comment
+ # (with address@hidden texi2dvi') TeX sections so that makeinfo does not try 
to
+ # parse them.  Nevertheless, while commenting TeX sections, don't
+ # comment @macro/@end macro so that makeinfo does propagate them.
+ # Unfortunately makeinfo --iftex --no-ifinfo doesn't work well enough
+ # (yet), makeinfo can't parse the TeX commands, so work around with sed.
+ #
+ comment_iftex=\
+ '/address@hidden/,/address@hidden tex/{
+   s/^/@c texi2dvi/
+ }
+ /address@hidden/,/address@hidden iftex/{
+   s/^/@c texi2dvi/
+   /address@hidden address@hidden/,/address@hidden address@hidden macro/{
+     s/address@hidden texi2dvi//
+   }
+ }
+ /address@hidden/,/address@hidden ifnottex/{
+   s/^/@c (texi2dvi)/
+ }
+ /address@hidden/,/address@hidden ifinfo/{
+   /address@hidden/p
+   /address@hidden/,/address@hidden menu/p
+   t
+   s/^/@c (texi2dvi)/
+ }
+ s/address@hidden/@c address@hidden/
+ s/address@hidden ifnotinfo/@c address@hidden ifnotinfo/'
+ 
+ # Uncommenting is simple: Remove any leading address@hidden texi2dvi'.
+ uncomment_iftex='s/address@hidden texi2dvi//'
+ 
+ 
+ # run_makeinfo ()
+ # ---------------
+ # Expand macro commands in the original source file using Makeinfo.
+ # Always use `end' footnote style, since the `separate' style
+ # generates different output (arguably this is a bug in -E).  Discard
+ # main info output, the user asked to run TeX, not makeinfo.
+ run_makeinfo ()
+ {
+   if test -n "$makeinfo"; then
+     # filename_src: the file with macros expanded.
+     # Use the same basename to generate the same aux file names.
+     work_src=$workdir/src
+     ensure_dir "$work_src"
+     filename_src=$work_src/$filename_noext.$ext
+ 
+     verbose "Macro-expanding $command_line_filename to $filename_src ..."
+     sed "$comment_iftex" "$command_line_filename" \
+       | $makeinfo --footnote-style=end -I "$filename_dir" $miincludes \
+         -o /dev/null --macro-expand=- \
+       | sed "$uncomment_iftex" >"$filename_src"
+     # Continue only if everything succeeded.
+     if test $? -ne 0 \
+        || test ! -r "$filename_src"; then
+       verbose "Expansion failed, ignored...";
+     else
+       filename_input=$filename_src
+     fi
+   fi
+ }
+ 
+ # insert_commands ()
+ # ------------------
+ # Used most commonly for @finalout, @smallbook, etc.
+ insert_commands ()
+ {
+   if test -n "$textra"; then
+     # _xtr.  The file with the user's extra commands.
+     work_xtr=$workdir/xtr
+     filename_xtr=$work_xtr/$filename_noext.$ext
+     ensure_dir $work_xtr
+     verbose "Inserting extra commands: $textra"
+     sed "$textra_cmd\\
+ $textra" "$filename_input" >"$filename_xtr"
+     filename_input=$filename_xtr
+   fi
+ }
+ 
+ # run_recode ()
+ # -------------
+ # If this is a Texinfo file with a specified input encoding, and
+ # recode is available, then recode to plain 7 bit Texinfo.
+ run_recode ()
+ {
+   if test $language = texinfo; then
+     pgm='s/^ address@hidden  *\([^ ][^ ]*\) *$/\1/
+       t found
+       d
+       :found
+       q'
+     encoding=`sed -e "$pgm" "$filename_input"`
+     if $recode && test -n "$encoding" && findprog recode; then
+       verbose "Recoding from $encoding to Texinfo."
+       # _rcd.  The Texinfo file recoded in 7bit.
+       work_rcd=$workdir/rcd
+       filename_rcd=$work_rcd/$filename_noext.$ext
+       ensure_dir $work_rcd
+       if recode "$encoding"..texinfo <"$filename_input" >"$filename_rcd" \
+          && test -s "$filename_rcd"; then
+         filename_input=$filename_rcd
+       else
+         verbose "Recoding failed, using original input."
+       fi
+     fi
+   fi
+ }
+ 
+ ## ---------------------- ##
+ ## Command line parsing.  ##
+ ## ---------------------- ##
+ 
  # Push a token among the arguments that will be used to notice when we
  # ended options/arguments parsing.
  # Use "set dummy ...; shift" rather than 'set - ..." because on
***************
*** 211,218 ****
      -@ ) escape=@;;
      # Silently and without documentation accept -b and --b[atch] as synonyms.
      -b | --b*) batch=true;;
!     -c | --c*) clean=t;;
!     -D | --d*) debug=t;;
      -e | -E | --e*) expand=t;;
      -h | --h*) echo "$usage"; exit 0;;
      -I | --I*)
--- 596,603 ----
      -@ ) escape=@;;
      # Silently and without documentation accept -b and --b[atch] as synonyms.
      -b | --b*) batch=true;;
!     -c | --c*) build_mode=clean;;
!     -D | --d*) debug=true;;
      -e | -E | --e*) expand=t;;
      -h | --h*) echo "$usage"; exit 0;;
      -I | --I*)
***************
*** 223,229 ****
      -l | --l*) shift; set_language=$1;;
      -o | --o*)
        shift
!       # just in case we also have --clean, or whatever.
        case "$1" in
          /* | ?:/*) oname=$1;;
                  *) oname="$orig_pwd/$1";;
--- 608,614 ----
      -l | --l*) shift; set_language=$1;;
      -o | --o*)
        shift
!       # Make it absolute, just in case we also have --clean, or whatever.
        case "$1" in
          /* | ?:/*) oname=$1;;
                  *) oname="$orig_pwd/$1";;
***************
*** 233,238 ****
--- 618,624 ----
      -r | --r*) recode=true;;
      -t | --tex* | --com* ) shift; textra="$textra\\
  "`echo "$1" | sed 's/\\\\/\\\\\\\\/g'`;;
+     --tidy) build_mode=tidy;;
      -v | --vers*) echo "$version"; exit 0;;
      -V | --verb*) verb=echo;;
      --) # What remains are not options.
***************
*** 253,258 ****
--- 639,651 ----
  # Pop the token
  shift
  
+ case $build_mode in
+   local) clean=true;  tidy=false;;
+   tidy)  clean=false; tidy=true;;
+   clean) clean=true;  tidy=true;;
+       *) fatal 1 "invalid build mode: $build_mode";;
+ esac
+ 
  # Interpret remaining command line args as filenames.
  case $# in
   0)
***************
*** 299,455 ****
  fi
  
  
- # Prepare the temporary directory.  Remove it at exit, unless debugging.
- if test -z "$debug"; then
-   trap "cd / && rm -rf $tmpdir" 0 1 2 15
- fi
- 
- # Create the temporary directory with strict rights
- (umask 077 && mkdir $tmpdir) || exit 1
- 
- # Prepare the tools we might need.  This may be extra work in some
- # cases, but improves the readability of the script.
- utildir=$tmpdir/utils
- mkdir $utildir || exit 1
- 
- # A sed script that preprocesses Texinfo sources in order to keep the
- # iftex sections only.  We want to remove non TeX sections, and comment
- # (with address@hidden texi2dvi') TeX sections so that makeinfo does not try 
to
- # parse them.  Nevertheless, while commenting TeX sections, don't
- # comment @macro/@end macro so that makeinfo does propagate them.
- # Unfortunately makeinfo --iftex --no-ifinfo doesn't work well enough
- # (yet), makeinfo can't parse the TeX commands, so work around with sed.
- #
- comment_iftex_sed=$utildir/comment.sed
- cat <<EOF >$comment_iftex_sed
- /address@hidden/,/address@hidden tex/{
-   s/^/@c texi2dvi/
- }
- /address@hidden/,/address@hidden iftex/{
-   s/^/@c texi2dvi/
-   /address@hidden address@hidden/,/address@hidden address@hidden macro/{
-     s/address@hidden texi2dvi//
-   }
- }
- /address@hidden/,/address@hidden ifnottex/{
-   s/^/@c (texi2dvi)/
- }
- /address@hidden/,/address@hidden ifinfo/{
-   /address@hidden/p
-   /address@hidden/,/address@hidden menu/p
-   t
-   s/^/@c (texi2dvi)/
- }
- s/address@hidden/@c address@hidden/
- s/address@hidden ifnotinfo/@c address@hidden ifnotinfo/
- EOF
- # Uncommenting is simple: Remove any leading address@hidden texi2dvi'.
- uncomment_iftex_sed=$utildir/uncomment.sed
- cat <<EOF >$uncomment_iftex_sed
- s/address@hidden texi2dvi//
- EOF
- 
- 
- # get_xref_files FILENAME-NOEXT
- # -----------------------------
- # Get list of xref files (indexes, tables and lists).
- # Takes the filename (without extension) of which we look for xref
- # files as argument.  The index files must be reported last.
- get_xref_files ()
- {
-   # Find all files having root filename with a two-letter extension,
-   # saves the ones that are really Texinfo-related files.
-   # - .?o?
-   #   .toc, .log, LaTeX tables and lists, FiXme's .lox, maybe more.
-   # - bu[0-9]*.aux
-   #   Sub bibliography when using the LaTeX bibunits package.
-   for this_file in "$1".?o? "$1".aux bu[0-9]*.aux "$1".?? "$1".idx
-   do
-     # If file is empty, skip it.
-     test -s "$this_file" || continue
-     # If the file is not suitable to be an index or xref file, don't
-     # process it.  It's suitable if the first character is a
-     # backslash or right quote or at, as long as the first line isn't
-     # \input texinfo.
-     first_character=`sed -n '1s/^\(.\).*$/\1/p;q' $this_file`
-     if (test "x$first_character" = "x\\" \
-         && sed 1q $this_file | grep -v '^\\input *texinfo' >&6) \
-        || test "x$first_character" = "x'" \
-        || test "x$first_character" = "x@"; then
-       xref_files="$xref_files ./$this_file"
-     fi
-   done
-   echo "$xref_files"
- }
- 
- # Convert relative paths to absolute paths, so we can run in another
- # directory (e.g., in --clean mode, or during the macro-support detection.)
- #
- # Empty path components are meaningful to tex.  We rewrite them
- # as `EMPTY' so they don't get lost when we split on $path_sep.
- # Hopefully no one will have an actual directory named EMPTY.
- absolute_filenames ()
- {
-   replace_empty="-e 's/^$path_sep/EMPTY$path_sep/g' \
-                  -e 's/$path_sep\$/${path_sep}EMPTY/g' \
-                  -e 's/$path_sep$path_sep/${path_sep}EMPTY:/g'"
-   _res=`echo "$1" | eval sed $replace_empty`
-   save_IFS=$IFS
-   IFS=$path_sep
-   set x $_res; shift
-   _res=.
-   for dir
-   do
-     case $dir in
-       EMPTY)
-         _res=$_res$path_sep
-         ;;
-       [\\/]* | ?:[\\/]*)        # Absolute paths don't need to be expanded.
-         test -d $dir && _res=$_res$path_sep$dir
-         ;;
-       *)
-         test -d $dir && abs=`cd "$dir" && pwd` && _res=$_res$path_sep$abs
-         ;;
-     esac
-   done
-   echo "$_res"
- }
- 
- 
- # run_tex ()
- # ----------
- # Run TeX as "$tex $tex_args $filename_input", taking care of errors
- # and logs.
- run_tex ()
- {
-   # Note that this will be used via an eval: quote properly.
-   cmd=$tex
- 
-   # If possible, make TeX report error locations in GNU format.
-   tex_args=
-   case $tex_help in
-     *file-line-error*) cmd="$cmd --file-line-error";;
-   esac
- 
-   # Tell TeX to be batch if requested.
-   if $batch; then
-     # \batchmode does not show terminal output at all, so we don't
-     # want that.  And even in batch mode, TeX insists on having input
-     # from the user.  Close its stdin to make it impossible.
-     cmd="$cmd </dev/null '${escape}nonstopmode' '${escape}input'"
-   fi
- 
-   cmd="$cmd '$filename_input'"
- 
-   verbose "Running $cmd ..."
-   if eval "$cmd" >&5; then :; else
-     test "$clean" = t \
-         && cp "$filename_noext.log" "$orig_pwd"
-     fatal 1 "$tex exited with bad status, quitting." \
-             "see $filename_noext.log for errors."
-   fi
- }
- 
  # File descriptor usage:
  # 0 standard input
  # 1 standard output (--verbose messages)
--- 692,697 ----
***************
*** 476,482 ****
  # away.  But sometimes it is convenient to see that output (e.g., from
  # a grep) to aid debugging.  Especially debugging at distance, via the
  # user.
! if test "$debug" = t; then
    exec 6>&1
    set -x
  else
--- 718,724 ----
  # away.  But sometimes it is convenient to see that output (e.g., from
  # a grep) to aid debugging.  Especially debugging at distance, via the
  # user.
! if $debug; then
    exec 6>&1
    set -x
  else
***************
*** 484,490 ****
  fi
  
  # 
! # TeXify files.
  
  for command_line_filename in ${1+"$@"}; do
    verbose "Processing $command_line_filename ..."
--- 726,735 ----
  fi
  
  # 
! 
! ## -------------- ##
! ## TeXify files.  ##
! ## -------------- ##
  
  for command_line_filename in ${1+"$@"}; do
    verbose "Processing $command_line_filename ..."
***************
*** 504,510 ****
    fi
  
    # Get the name of the current directory.  We want the full path
!   # because in clean mode we are in tmp, in which case a relative
    # path has no meaning.
    filename_dir=`echo $command_line_filename | sed 's!/[^/]*$!!;s!^$!.!'`
    filename_dir=`cd "$filename_dir" >&6 && pwd`
--- 749,755 ----
    fi
  
    # Get the name of the current directory.  We want the full path
!   # because in clean build mode we are in tmp, in which case a relative
    # path has no meaning.
    filename_dir=`echo $command_line_filename | sed 's!/[^/]*$!!;s!^$!.!'`
    filename_dir=`cd "$filename_dir" >&6 && pwd`
***************
*** 515,553 ****
    filename_noext=`echo "$filename_ext" | sed 's/\.[^.]*$//'`
    ext=`echo "$filename_ext" | sed 's/^.*\.//'`
  
!   # _src.  Use same basename since we want to generate aux files with
!   # the same basename as the manual.  If --expand, then output the
!   # macro-expanded file to here, else copy the original file.
!   tmpdir_src=$tmpdir/src
!   filename_src=$tmpdir_src/$filename_noext.$ext
! 
!   # _xtr.  The file with the user's extra commands.
!   tmpdir_xtr=$tmpdir/xtr
!   filename_xtr=$tmpdir_xtr/$filename_noext.$ext
! 
!   # _rcd.  The Texinfo file recoded in 7bit.
!   tmpdir_rcd=$tmpdir/rcd
!   filename_rcd=$tmpdir_rcd/$filename_noext.$ext
! 
!   # _bak.  Copies of the previous xref files (another round is run if
!   # they differ from the new one).
!   tmpdir_bak=$tmpdir/bak
  
!   # Make all those directories and give up if we can't succeed.
!   mkdir $tmpdir_src $tmpdir_xtr $tmpdir_rcd $tmpdir_bak || exit 1
  
    # Source file might include additional sources.
    # We want `.:$orig_pwd' before anything else.  (We'll add `.:' later
    # after all other directories have been turned into absolute paths.)
    # `.' goes first to ensure that any old .aux, .cps,
    # etc. files in ${directory} don't get used in preference to fresher
!   # files in `.'.  Include orig_pwd in case we are in clean mode, where
    # we've cd'd to a temp directory.
    common="$orig_pwd$path_sep$filename_dir$path_sep$txincludes"
    for var in $tex_envvars; do
      eval val="\$common\$${var}_orig"
      # Convert relative paths to absolute paths, so we can run in another
!     # directory (e.g., in --clean mode, or during the macro-support 
detection.)
      val=`absolute_filenames "$val"`
      eval export $var=$val
      eval verbose "$var=\'\$${var}\'"
--- 760,813 ----
    filename_noext=`echo "$filename_ext" | sed 's/\.[^.]*$//'`
    ext=`echo "$filename_ext" | sed 's/^.*\.//'`
  
!   # The normalized file name to compile.  Must always point to the
!   # file to actually compile (in case of recoding, macro-expansion etc.).
!   filename_input=$filename_dir/$filename_ext
! 
!   # An auxiliary directory used for all the auxiliary tasks involved
!   # in compiling this document.
!   t2ddir=`$clean && echo ${TMPDIR:-/tmp}/`$filename_noext.t2d
!   # Remove it at exit if clean mode.
!   $clean &&
!     trap "cd / && rm -rf $t2ddir" 0 1 2 15
! 
!   ensure_dir "$t2ddir"
! 
!   # We will change directory, better work with an absolute path...
!   t2ddir=`cd "$t2ddir" && pwd`
!   # Sometimes there are incompatibilities between auxiliary files for
!   # DVI and PDF.  The contents can also change whether we work on PDF
!   # and/or DVI.  So keep separate spaces for each.
!   workdir=$t2ddir/$oformat
!   ensure_dir "$workdir"
! 
!   # _build.  In a tidy build, where the auxiliary files are output.
!   if $tidy; then
!     work_build=$workdir/build
!   else
!     work_build=.
!   fi
! 
!   # _bak.  Copies of the previous auxiliary files (another round is
!   # run if they differ from the new ones).
!   work_bak=$workdir/bak
  
!   # Make those directories.
!   ensure_dir $work_build $work_bak
  
    # Source file might include additional sources.
    # We want `.:$orig_pwd' before anything else.  (We'll add `.:' later
    # after all other directories have been turned into absolute paths.)
    # `.' goes first to ensure that any old .aux, .cps,
    # etc. files in ${directory} don't get used in preference to fresher
!   # files in `.'.  Include orig_pwd in case we are in clean build mode, where
    # we've cd'd to a temp directory.
    common="$orig_pwd$path_sep$filename_dir$path_sep$txincludes"
    for var in $tex_envvars; do
      eval val="\$common\$${var}_orig"
      # Convert relative paths to absolute paths, so we can run in another
!     # directory (e.g., in clean build mode, or during the macro-support
!     # detection).
      val=`absolute_filenames "$val"`
      eval export $var=$val
      eval verbose "$var=\'\$${var}\'"
***************
*** 580,586 ****
        else
          tex=${PDFLATEX:-pdflatex}
        fi
-       thumbpdf=${THUMBPDF:-thumbpdf}
        ;;
  
      *)
--- 840,845 ----
***************
*** 610,629 ****
          # We don't need to use [0-9] to match the digits since anyway
          # the comparison with $txiprereq, a number, will fail with non
          # digits.
!         # Run in the tmpdir to avoid leaving files.
        (
!            cd $tmpdir
           echo '\input texinfo.tex @bye' >txiversion.tex
           # Be sure that if tex wants to fail, it is not interactive:
           # close stdin.
!            $tex txiversion.tex </dev/null
!       ) >$tmpdir/txiversion.out 2>$tmpdir/txiversion.err
        if test $? != 0; then
!         cat $tmpdir/txiversion.out
!         cat $tmpdir/txiversion.err >&2
          fatal 1 "texinfo.tex appears to be broken, quitting."
          fi
!       eval `sed -n 's/^.*\[\(.*\)version 
\(....\)-\(..\)-\(..\).*$/txiformat=\1 txiversion="\2\3\4"/p' 
$tmpdir/txiversion.out`
          verbose "texinfo.tex preloaded as \`$txiformat', version is 
\`$txiversion' ..."
          if test "$txiprereq" -le "$txiversion" >&6 2>&1; then
            makeinfo=
--- 869,890 ----
          # We don't need to use [0-9] to match the digits since anyway
          # the comparison with $txiprereq, a number, will fail with non
          # digits.
!         # Run in a temporary directory to avoid leaving files.
!       version_test_dir=$t2ddir/version_test
!       ensure_dir $version_test_dir
        (
!            cd $version_test_dir
           echo '\input texinfo.tex @bye' >txiversion.tex
           # Be sure that if tex wants to fail, it is not interactive:
           # close stdin.
!            $tex txiversion.tex </dev/null >txiversion.out 2>txiversion.err
!       )
        if test $? != 0; then
!         cat $version_test_dir/txiversion.out
!         cat $version_test_dir/txiversion.err >&2
          fatal 1 "texinfo.tex appears to be broken, quitting."
          fi
!       eval `sed -n 's/^.*\[\(.*\)version 
\(....\)-\(..\)-\(..\).*$/txiformat=\1 txiversion="\2\3\4"/p' 
$version_test_dir/txiversion.out`
          verbose "texinfo.tex preloaded as \`$txiformat', version is 
\`$txiversion' ..."
          if test "$txiprereq" -le "$txiversion" >&6 2>&1; then
            makeinfo=
***************
*** 633,848 ****
          # As long as we had to run TeX, offer the user this convenience:
          test "$txiformat" = Texinfo && escape=@
        fi
-       thumbpdf=${THUMBPDF:-thumbpdf}
        ;;
    esac
  
!   # Go to $tmpdir to try --help, since old versions that don't accept
!   # --help will generate a texput.log.
!   tex_help=`cd $tmpdir >&6 && $tex --help </dev/null 2>&1`
! 
!   # Expand macro commands in the original source file using Makeinfo.
!   # Always use `end' footnote style, since the `separate' style
!   #   generates different output (arguably this is a bug in -E).
!   # Discard main info output, the user asked to run TeX, not makeinfo.
!   if test -n "$makeinfo"; then
!     verbose "Macro-expanding $command_line_filename to $filename_src ..."
!     sed -f $comment_iftex_sed "$command_line_filename" \
!       | $makeinfo --footnote-style=end -I "$filename_dir" $miincludes \
!         -o /dev/null --macro-expand=- \
!       | sed -f $uncomment_iftex_sed >"$filename_src"
!     filename_input=$filename_src
!   fi
! 
!   # If makeinfo failed (or was not even run), use the original file as input.
!   if test $? -ne 0 \
!      || test ! -r "$filename_src"; then
!     verbose "Reverting to $command_line_filename ..."
!     filename_input=$filename_dir/$filename_ext
!   fi
! 
!   # Used most commonly for @finalout, @smallbook, etc.
!   if test -n "$textra"; then
!     verbose "Inserting extra commands: $textra"
!     sed "$textra_cmd\\
! $textra" "$filename_input" >"$filename_xtr"
!     filename_input=$filename_xtr
!   fi
! 
!   # If this is a Texinfo file with a specified input encoding, and
!   # recode is available, then recode to plain 7 bit Texinfo.
!   if test $language = texinfo; then
!     pgm='s/^ address@hidden  *\([^ ][^ ]*\) *$/\1/
!       t found
!       d
!       :found
!       q'
!     encoding=`sed -e "$pgm" "$filename_input"`
!     if $recode && test -n "$encoding" && findprog recode; then
!       verbose "Recoding from $encoding to Texinfo."
!       if recode "$encoding"..texinfo <"$filename_input" >"$filename_rcd" \
!          && test -s "$filename_rcd"; then
!         filename_input=$filename_rcd
!       else
!         verbose "Recoding failed, using original input."
!       fi
!     fi
!   fi
! 
!   # If clean mode was specified, then move to the temporary directory.
!   if test "$clean" = t; then
!     verbose "cd $tmpdir_src"
!     cd "$tmpdir_src" || exit 1
    fi
  
    while :; do # will break out of loop below
!     orig_xref_files=`get_xref_files "$filename_noext"`
  
!     # Save copies of originals for later comparison.
      if test -n "$orig_xref_files"; then
!       verbose "Backing up xref files: `echo $orig_xref_files | sed 
's|\./||g'`"
!       cp $orig_xref_files $tmpdir_bak
!     fi
! 
!     # Run bibtex on current file.
!     # - If its input (AUX) exists.
!     # - If some citations are missing (LOG contains `Citation').
!     #   or the LOG complains of a missing .bbl
!     #
!     # We run bibtex first, because I can see reasons for the indexes
!     # to change after bibtex is run, but I see no reason for the
!     # converse.
!     #
!     # Don't try to be too smart:
!     #
!     # 1. Running bibtex only if the bbl file exists and is older than
!     # the LaTeX file is wrong, since the document might include files
!     # that have changed.
!     #
!     # 3. Because there can be several AUX (if there are \include's),
!     # but a single LOG, looking for missing citations in LOG is
!     # easier, though we take the risk to match false messages.
!     if test -n "$bibtex" \
!        && test -r "$filename_noext.aux" \
!        && test -r "$filename_noext.log" \
!        && (grep 'Warning:.*Citation.*undefined' "$filename_noext.log" \
!             || grep 'No file .*\.bbl\.' "$filename_noext.log") \
!           >&6 2>&1; \
!     then
!       # If using the bibunits package, we might have to run bibtex
!       # on subfiles.
!       for f in "$filename_noext".aux bu[0-9]*.aux
!       do
!       if test -s "$f" && \
!          (grep '^\\bibstyle[{]' "$f"   \
!           && grep '^\\bibdata[{]' "$f" \
!           && grep '^\\citation[{]' "$f") >&6 2>&1; then
!           verbose "Running $bibtex $f ..."
!           $bibtex "$f" >&5 ||
!             fatal 1 "$bibtex exited with bad status, quitting."
!       fi
!       done
      fi
  
!     # What we'll run texindex on -- exclude non-index files.
!     # Since we know index files are last, it is correct to remove everything
!     # before .aux and .?o?.  But don't really do <anything>o<anything>
!     # -- don't match whitespace as <anything>.
!     # Otherwise, if orig_xref_files contains something like
!     #   foo.xo foo.whatever
!     # the space after the o will get matched.
!     index_files=`echo "$orig_xref_files" \
!                  | sed "s!.*\.aux!!g;
!                         s!./$filename_noext\.[^ ]o[^ ]!!g;
!                         s/^[ ]*//;s/[ ]*$//"`
!     # Run texindex (or makeindex) on current index files.  If they
!     # already exist, and after running TeX a first time the index
!     # files don't change, then there's no reason to run TeX again.
!     # But we won't know that if the index files are out of date or
!     # nonexistent.
!     if test -n "$texindex" && test -n "$index_files"; then
!       verbose "Running $texindex $index_files ..."
!       $texindex $index_files 2>&5 1>&2 ||
!          fatal 1 "$texindex exited with bad status, quitting."
!     fi
! 
!     # Finally, run TeX.
      run_tex
  
-     # Decide if looping again is needed.
-     finished=t
- 
      # LaTeX (and the package changebar) report in the LOG file if it
      # should be rerun.  This is needed for files included from
      # subdirs, since texi2dvi does not try to compare xref files in
      # subdirs.  Performing xref files test is still good since LaTeX
      # does not report changes in xref files.
!     if grep "Rerun to get" "$filename_noext.log" >&6 2>&1; then
!       finished=
!     fi
! 
!     # Check if xref files changed.
!     new_xref_files=`get_xref_files "$filename_noext"`
!     verbose "Original xref files = `echo $orig_xref_files | sed 's|\./||g'`"
!     verbose "New xref files      = `echo $new_xref_files | sed 's|\./||g'`"
  
      # If old and new lists don't at least have the same file list,
      # then one file or another has definitely changed.
!     test "x$orig_xref_files" != "x$new_xref_files" && finished=
! 
!     # File list is the same.  We must compare each file until we find
!     # a difference.
!     if test -n "$finished"; then
!       for this_file in $new_xref_files; do
!         verbose "Comparing xref file `echo $this_file | sed 's|\./||g'` ..."
!         # cmp -s returns nonzero exit status if files differ.
!         if cmp -s "$this_file" "$tmpdir_bak/$this_file"; then :; else
!           # We only need to keep comparing until we find one that
!           # differs, because we'll have to run texindex & tex again no
!           # matter how many more there might be.
!           finished=
!           verbose "xref file `echo $this_file | sed 's|\./||g'` differed ..."
!           test "$debug" = t && diff -c "$tmpdir_bak/$this_file" "$this_file"
!           break
!         fi
!       done
!     fi
  
!     # If finished, exit the loop, else rerun the loop.
!     test -n "$finished" && break
    done # while :;
  
    # If we were using thumbpdf and producing PDF, then run thumbpdf
    # and TeX one last time.
!   if test $oformat = pdf \
!      && test -r "$filename_noext.log" \
!      && grep 'thumbpdf\.sty'  "$filename_noext.log" >&6 2>&1; \
!   then
!     verbose "Running $thumbpdf $filename_noext ..."
!     if $thumbpdf "$filename_noext" >&5; then
!       run_tex
!     else
!       report "$thumbpdf exited with bad status." \
!            "Ignoring its output."
!     fi
!   fi
! 
!   # Honor the actual output destination.
!   case $clean:$oname in
!     :) dest=;;
! 
!     t:)  # If we were in clean mode, compilation was in a tmp
!        # directory.  Copy the DVI (or PDF) file into the directory
!        # where the compilation has been done.  (The temp dir is
!        # about to get removed anyway.)
!        dest=$orig_pwd;;
! 
!     *:*) dest=$oname;;
!   esac
!   if test -n "$dest"; then
!     verbose "Copying $oformat file from `pwd` to $dest"
!     cp -p "./$filename_noext.$oformat" "$dest"
!   fi
  
    # Return to the original directory so that
    # - the next file is processed in correct conditions
--- 894,975 ----
          # As long as we had to run TeX, offer the user this convenience:
          test "$txiformat" = Texinfo && escape=@
        fi
        ;;
    esac
  
!   # Go to a temporary directory to try --help, since old versions that
!   # don't accept --help will generate a texput.log.
!   tex_help_dir=$t2ddir/tex_help
!   ensure_dir $tex_help_dir
!   tex_help=`cd $tex_help_dir >&6 && $tex --help </dev/null 2>&1`
! 
!   # --expand
!   run_makeinfo
! 
!   # --command, --texinfo
!   insert_commands
! 
!   # --recode
!   run_recode
! 
!   # Count the number of cycles.
!   cycle=0
! 
!   # Move to the working directory.
!   if $tidy; then
!     verbose "cd $work_build"
!     cd "$work_build" || exit 1
    fi
  
    while :; do # will break out of loop below
!     cycle=`expr $cycle + 1`
!     verbose "Cycle $cycle for $command_line_filename"
  
!     # Save copies of auxiliary files for later comparison.
!     orig_xref_files=`get_xref_files  "$filename_noext"`
      if test -n "$orig_xref_files"; then
!       verbose "Backing up xref files: $orig_xref_files"
!       cp $orig_xref_files $work_bak
      fi
  
!     run_bibtex
!     run_index
      run_tex
  
      # LaTeX (and the package changebar) report in the LOG file if it
      # should be rerun.  This is needed for files included from
      # subdirs, since texi2dvi does not try to compare xref files in
      # subdirs.  Performing xref files test is still good since LaTeX
      # does not report changes in xref files.
!     grep "Rerun to get" "$filename_noext.log" >&6 2>&1 &&
!       continue
  
      # If old and new lists don't at least have the same file list,
      # then one file or another has definitely changed.
!     new_xref_files=`get_xref_files  "$filename_noext"`
!     verbose "Original xref files = $orig_xref_files"
!     verbose "New xref files      = $new_xref_files"
!     test "x$orig_xref_files" != "x$new_xref_files" &&
!       continue
! 
!     # Compare each file until we find a difference.
!     for this_file in $new_xref_files; do
!       verbose "Comparing xref file `echo $this_file | sed 's|\./||g'` ..."
!       # cmp -s returns nonzero exit status if files differ.
!       if cmp -s "$this_file" "$work_bak/$this_file"; then :; else
!         verbose "xref file `echo $this_file | sed 's|\./||g'` differed ..."
!         $debug && diff -u "$work_bak/$this_file" "$this_file"
!         continue 2
!       fi
!     done
  
!     # We're done.
!     break
    done # while :;
  
    # If we were using thumbpdf and producing PDF, then run thumbpdf
    # and TeX one last time.
!   run_thumbpdf
  
    # Return to the original directory so that
    # - the next file is processed in correct conditions
***************
*** 851,860 ****
    cd $orig_pwd || exit 1
  
    # Remove temporary files.
!   if test "x$debug" = "x"; then
!     verbose "Removing $tmpdir_src $tmpdir_xtr $tmpdir_bak ..."
      cd /
!     rm -rf $tmpdir_src $tmpdir_xtr $tmpdir_bak
    fi
  done
  
--- 978,987 ----
    cd $orig_pwd || exit 1
  
    # Remove temporary files.
!   if $clean; then
!     verbose "Removing $t2ddir"
      cd /
!     rm -rf "$t2ddir"
    fi
  done
  
P ChangeLog
P NEWS
P util/texi2dvi


reply via email to

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