Patch: turn TEXINPUTS into absolute paths
Alexandre Duret-Lutz <[email protected]>
| Newsgroups | gmane.comp.tex.texinfo.pretest |
|---|---|
| Message-ID | <[email protected]> |
Hi Karl! I'd like to suggest something along the lines of the following patch, to address issues like the one reported in http://mail.gnu.org/pipermail/bug-texinfo/2002-May/005072.html or in the second part of http://mail.gnu.org/pipermail/bug-texinfo/2002-October/005325.html The patch is against texinfo-4.2b. The nice thing is that it will also allow --clean to work when TEXINPUTS contains relative directories. 2002-10-24 Alexandre Duret-Lutz <[email protected]> * util/texi2dvi: Turn relative entries $TEXINPUTS and $INDEXSTYLE into absolute paths. --- util/texi2dvi Tue Oct 15 17:37:49 2002 +++ util/texi2dvi Thu Oct 24 11:51:04 2002 @@ -1,7 +1,7 @@ #! /bin/sh # texi2dvi --- produce DVI (or PDF) files from Texinfo (or LaTeX) sources. # $Id: texi2dvi,v 1.4 2002/10/15 15:37:49 karl Exp $ -# +# # Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, # 2002 Free Software Foundation, Inc. # @@ -105,6 +105,9 @@ path_sep=":" fi +# Pacify verbose cds. +CDPATH=${ZSH_VERSION+.}$path_sep + # Save this so we can construct a new TEXINPUTS path for each file. TEXINPUTS_orig="$TEXINPUTS" # Unfortunately makeindex does not read TEXINPUTS. @@ -346,15 +349,33 @@ # Make all those directories and give up if we can't succeed. mkdir $tmpdir_src $tmpdir_xtr $tmpdir_bak || exit 1 - # Source file might include additional sources. Put `.' and - # directory where source file(s) reside in TEXINPUTS before anything - # else. `.' goes first to ensure that any old .aux, .cps, + # 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=".$path_sep$orig_pwd$path_sep$filename_dir$path_sep$txincludes" - TEXINPUTS="$common$TEXINPUTS_orig:" + common="$orig_pwd$path_sep$filename_dir$path_sep$txincludes" + TEXINPUTS="$common$TEXINPUTS_orig" INDEXSTYLE="$common$INDEXSTYLE_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.) + save_IFS=$IFS + IFS=$path_sep + set x $TEXINPUTS; shift + TEXINPUTS=. + for dir; do + abs=`cd "$dir" && pwd` && TEXINPUTS=$TEXINPUTS$path_sep$abs + done + set x $INDEXSTYLE; shift + INDEXSTYLE=. + for dir; do + abs=`cd "$dir" && pwd` && INDEXSTYLE=$INDEXSTYLE$path_sep$abs + done + IFS=$save_IFS # If the user explicitly specified the language, use that. # Otherwise, if the first line is \input texinfo, assume it's texinfo. -- Alexandre Duret-Lutz