Lines 1-9
Link Here
|
1 |
#! /bin/sh |
1 |
#! /bin/sh |
2 |
# texi2dvi --- produce DVI (or PDF) files from Texinfo (or (La)TeX) sources. |
2 |
# texi2dvi --- produce DVI (or PDF) files from Texinfo (or (La)TeX) sources. |
3 |
# $Id: texi2dvi,v 1.135 2008/09/18 18:46:01 karl Exp $ |
3 |
# $Id: texi2dvi,v 1.158 2010/03/30 23:13:37 karl Exp $ |
4 |
# |
4 |
# |
5 |
# Copyright (C) 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, |
5 |
# Copyright 1992, 1993, 1994, 1995, 1996, 1997, 1998, 1999, 2001, 2002, 2003, |
6 |
# 2002, 2003, 2004, 2005, 2006, 2007, 2008 Free Software Foundation, Inc. |
6 |
# 2004, 2005, 2006, 2007, 2008, 2009 Free Software Foundation, Inc. |
7 |
# |
7 |
# |
8 |
# This program is free software; you can redistribute it and/or modify |
8 |
# This program is free software; you can redistribute it and/or modify |
9 |
# it under the terms of the GNU General Public License as published by |
9 |
# it under the terms of the GNU General Public License as published by |
Lines 18-24
Link Here
|
18 |
# You should have received a copy of the GNU General Public License |
18 |
# You should have received a copy of the GNU General Public License |
19 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
19 |
# along with this program. If not, see <http://www.gnu.org/licenses/>. |
20 |
# |
20 |
# |
21 |
# Original author: Noah Friedman. |
21 |
# Originally written by Noah Friedman. |
22 |
# |
22 |
# |
23 |
# Please send bug reports, etc. to bug-texinfo@gnu.org. |
23 |
# Please send bug reports, etc. to bug-texinfo@gnu.org. |
24 |
# If possible, please send a copy of the output of the script called with |
24 |
# If possible, please send a copy of the output of the script called with |
Lines 32-39
Link Here
|
32 |
# No failure shall remain unpunished. |
32 |
# No failure shall remain unpunished. |
33 |
set -e |
33 |
set -e |
34 |
|
34 |
|
35 |
# This string is expanded by rcs automatically when this file is checked out. |
35 |
# This string is expanded automatically when this file is checked out. |
36 |
rcs_revision='$Revision: 1.135 $' |
36 |
rcs_revision='$Revision: 1.158 $' |
37 |
rcs_version=`set - $rcs_revision; echo $2` |
37 |
rcs_version=`set - $rcs_revision; echo $2` |
38 |
program=`echo $0 | sed -e 's!.*/!!'` |
38 |
program=`echo $0 | sed -e 's!.*/!!'` |
39 |
|
39 |
|
Lines 44-62
Link Here
|
44 |
# Don't use `unset' since old bourne shells don't have this command. |
44 |
# Don't use `unset' since old bourne shells don't have this command. |
45 |
# Instead, assign them an empty value. |
45 |
# Instead, assign them an empty value. |
46 |
action=compile |
46 |
action=compile |
47 |
batch=false # true for batch mode |
47 |
batch=false # interact normally |
|
|
48 |
catcode_special=maybe |
48 |
debug=false |
49 |
debug=false |
49 |
escape="\\" |
50 |
escape="\\" |
50 |
expand= # t for expansion via makeinfo |
51 |
expand=false # true for expansion via makeinfo |
51 |
includes= |
52 |
includes= |
52 |
line_error=true # Pass --file-line-error to TeX. |
53 |
line_error=true # pass --file-line-error to TeX |
53 |
no_line_error=false # absolutely do not pass --file-line-error to TeX |
54 |
max_iters=-1 # keep going forever |
54 |
oname= # --output |
55 |
oname= # --output |
55 |
out_lang=dvi |
56 |
out_lang=dvi |
56 |
quiet=false # by default let the tools' message be displayed |
57 |
quiet=false # let the tools' message be displayed |
57 |
recode=false |
58 |
recode=false |
58 |
set_language= |
59 |
set_language= |
59 |
src_specials= |
60 |
src_specials= |
|
|
61 |
latex2html=hevea # or set to tex4ht |
60 |
textra= # Extra TeX commands to insert in the input file. |
62 |
textra= # Extra TeX commands to insert in the input file. |
61 |
txiprereq=19990129 # minimum texinfo.tex version with macro expansion |
63 |
txiprereq=19990129 # minimum texinfo.tex version with macro expansion |
62 |
verb=false # true for verbose mode |
64 |
verb=false # true for verbose mode |
Lines 160-165
Link Here
|
160 |
} |
162 |
} |
161 |
|
163 |
|
162 |
|
164 |
|
|
|
165 |
# noexit FILE |
166 |
# ----------- |
167 |
# Return FILE with one extension remove. foo.bar.baz -> foo.bar. |
168 |
noext () |
169 |
{ |
170 |
echo "$1" | sed -e 's/\.[^/.][^/.]*$//' |
171 |
} |
172 |
|
173 |
|
163 |
# absolute NAME -> ABS-NAME |
174 |
# absolute NAME -> ABS-NAME |
164 |
# ------------------------- |
175 |
# ------------------------- |
165 |
# Return an absolute path to NAME. |
176 |
# Return an absolute path to NAME. |
Lines 175-186
Link Here
|
175 |
local rel |
186 |
local rel |
176 |
rel=$orig_pwd/`func_dirname "$1"` |
187 |
rel=$orig_pwd/`func_dirname "$1"` |
177 |
if test -d "$rel"; then |
188 |
if test -d "$rel"; then |
178 |
(cd "$rel" 2>/dev/null && |
189 |
(cd "$rel" 2>/dev/null && |
179 |
local n |
190 |
local n |
180 |
n=`pwd`/`basename "$1"`"$slashes" |
191 |
n=`pwd`/`basename "$1"`"$slashes" |
181 |
echo "$n") |
192 |
echo "$n") |
182 |
else |
193 |
else |
183 |
error 1 "not a directory: $rel" |
194 |
error 1 "not a directory: $rel" |
184 |
fi |
195 |
fi |
185 |
;; |
196 |
;; |
186 |
esac |
197 |
esac |
Lines 194-201
Link Here
|
194 |
{ |
205 |
{ |
195 |
for dir |
206 |
for dir |
196 |
do |
207 |
do |
|
|
208 |
# Beware that in parallel builds we may have several concurrent |
209 |
# attempts to create the directory. So fail only if "mkdir" |
210 |
# failed *and* the directory still does not exist. |
197 |
test -d "$dir" \ |
211 |
test -d "$dir" \ |
198 |
|| mkdir "$dir" \ |
212 |
|| mkdir "$dir" \ |
|
|
213 |
|| test -d "$dir" \ |
199 |
|| error 1 "cannot create directory: $dir" |
214 |
|| error 1 "cannot create directory: $dir" |
200 |
done |
215 |
done |
201 |
} |
216 |
} |
Lines 229-240
Link Here
|
229 |
# We have to try this both for $1 and $1.exe. |
244 |
# We have to try this both for $1 and $1.exe. |
230 |
# |
245 |
# |
231 |
# Note: On Cygwin and DJGPP, `test -x' also looks for .exe. On Cygwin, |
246 |
# Note: On Cygwin and DJGPP, `test -x' also looks for .exe. On Cygwin, |
232 |
# also `test -f' has this enhancement, bot not on DJGPP. (Both are |
247 |
# also `test -f' has this enhancement, but not on DJGPP. (Both are |
233 |
# design decisions, so there is little chance to make them consistent.) |
248 |
# design decisions, so there is little chance to make them consistent.) |
234 |
# Thusly, it seems to be difficult to make use of these enhancements. |
249 |
# Thusly, it seems to be difficult to make use of these enhancements. |
235 |
# |
250 |
# |
236 |
if { test -f "$dir/$1" && test -x "$dir/$1"; } || |
251 |
if { test -f "$dir/$1" && test -x "$dir/$1"; } || |
237 |
{ test -f "$dir/$1.exe" && test -x "$dir/$1.exe"; }; then |
252 |
{ test -f "$dir/$1.exe" && test -x "$dir/$1.exe"; }; then |
238 |
return 0 |
253 |
return 0 |
239 |
fi |
254 |
fi |
240 |
done |
255 |
done |
Lines 280-285
Link Here
|
280 |
# where % denotes the eol character. |
295 |
# where % denotes the eol character. |
281 |
cat <<EOF |
296 |
cat <<EOF |
282 |
Usage: $program [OPTION]... FILE... |
297 |
Usage: $program [OPTION]... FILE... |
|
|
298 |
texi2pdf [OPTION]... FILE... |
299 |
pdftexi2dvi [OPTION]... FILE... |
283 |
|
300 |
|
284 |
Run each Texinfo or (La)TeX FILE through TeX in turn until all |
301 |
Run each Texinfo or (La)TeX FILE through TeX in turn until all |
285 |
cross-references are resolved, building all indices. The directory |
302 |
cross-references are resolved, building all indices. The directory |
Lines 292-306
Link Here
|
292 |
\`\\input{FILE}' the actual file to compile |
309 |
\`\\input{FILE}' the actual file to compile |
293 |
\`\\nonstopmode' same as --batch |
310 |
\`\\nonstopmode' same as --batch |
294 |
|
311 |
|
295 |
Makeinfo is used to perform Texinfo macro expansion before running TeX |
312 |
When invoked as \`texi2pdf' or \`pdftexi2dvi', or given the option --pdf |
296 |
when needed. |
313 |
or --dvipdf, generate PDF output. Otherwise, generate DVI. |
297 |
|
314 |
|
298 |
General options: |
315 |
General options: |
299 |
-b, --batch no interaction |
316 |
-b, --batch no interaction |
300 |
-D, --debug turn on shell debugging (set -x) |
317 |
-D, --debug turn on shell debugging (set -x) |
301 |
-h, --help display this help and exit successfully |
318 |
-h, --help display this help and exit successfully |
302 |
-o, --output=OFILE leave output in OFILE (implies --clean); |
319 |
-o, --output=OFILE leave output in OFILE (implies --clean); |
303 |
only one input FILE may be specified in this case |
320 |
only one input FILE may be specified in this case |
304 |
-q, --quiet no output unless errors (implies --batch) |
321 |
-q, --quiet no output unless errors (implies --batch) |
305 |
-s, --silent same as --quiet |
322 |
-s, --silent same as --quiet |
306 |
-v, --version display version information and exit successfully |
323 |
-v, --version display version information and exit successfully |
Lines 308-320
Link Here
|
308 |
|
325 |
|
309 |
TeX tuning: |
326 |
TeX tuning: |
310 |
-@ use @input instead of \input for preloaded Texinfo |
327 |
-@ use @input instead of \input for preloaded Texinfo |
311 |
--dvi output a DVI file [default] |
|
|
312 |
--dvipdf output a PDF file via DVI (using dvipdf) |
313 |
-e, -E, --expand force macro expansion using makeinfo |
328 |
-e, -E, --expand force macro expansion using makeinfo |
314 |
-I DIR search DIR for Texinfo files |
329 |
-I DIR search DIR for Texinfo files |
315 |
-l, --language=LANG specify LANG for FILE, either latex or texinfo |
330 |
-l, --language=LANG specify LANG for FILE, either latex or texinfo |
316 |
--no-line-error do not pass --file-line-error to TeX |
331 |
--no-line-error do not pass --file-line-error to TeX |
317 |
-p, --pdf use pdftex or pdflatex for processing |
|
|
318 |
-r, --recode call recode before TeX to translate input |
332 |
-r, --recode call recode before TeX to translate input |
319 |
--recode-from=ENC recode from ENC to the @documentencoding |
333 |
--recode-from=ENC recode from ENC to the @documentencoding |
320 |
--src-specials pass --src-specials to TeX |
334 |
--src-specials pass --src-specials to TeX |
Lines 322-336
Link Here
|
322 |
or --texinfo=CMD multiple values accumulate |
336 |
or --texinfo=CMD multiple values accumulate |
323 |
--translate-file=FILE use given charset translation file for TeX |
337 |
--translate-file=FILE use given charset translation file for TeX |
324 |
|
338 |
|
|
|
339 |
Output format: |
340 |
--dvi output a DVI file [default] |
341 |
--dvipdf output a PDF file via DVI (using dvipdf) |
342 |
--html output an HTML file. Use HeVeA for LaTeX files |
343 |
--info output an Info file. Use HeVeA for LaTeX files |
344 |
-p, --pdf use pdftex or pdflatex for processing |
345 |
--ps output a PDF file via DVI (using dvips) |
346 |
--text output a plain text file. Use HeVeA for LaTeX files |
347 |
|
325 |
Build modes: |
348 |
Build modes: |
326 |
--build=MODE specify the treatment of auxiliary files [$build_mode] |
349 |
--build=MODE specify the treatment of auxiliary files [$build_mode] |
327 |
--tidy same as --build=tidy |
350 |
--tidy same as --build=tidy |
328 |
-c, --clean same as --build=clean |
351 |
-c, --clean same as --build=clean |
329 |
--build-dir=DIR specify where the tidy compilation is performed; |
352 |
--build-dir=DIR specify where the tidy compilation is performed; |
330 |
implies --tidy; |
353 |
implies --tidy; |
331 |
defaults to TEXI2DVI_BUILD_DIRECTORY [$build_dir] |
354 |
defaults to TEXI2DVI_BUILD_DIRECTORY [$build_dir] |
332 |
--mostly-clean remove the auxiliary files and directories |
355 |
--mostly-clean remove the auxiliary files and directories |
333 |
but not the output |
356 |
but not the output |
|
|
357 |
--max-iterations=N don't process files more than N times |
334 |
|
358 |
|
335 |
The MODE specifies where the TeX compilation takes place, and, as a |
359 |
The MODE specifies where the TeX compilation takes place, and, as a |
336 |
consequence, how auxiliary files are treated. The build mode |
360 |
consequence, how auxiliary files are treated. The build mode |
Lines 338-376
Link Here
|
338 |
|
362 |
|
339 |
Valid MODEs are: |
363 |
Valid MODEs are: |
340 |
\`local' compile in the current directory, leaving all the auxiliary |
364 |
\`local' compile in the current directory, leaving all the auxiliary |
341 |
files around. This is the traditional TeX use. |
365 |
files around. This is the traditional TeX use. |
342 |
\`tidy' compile in a local *.t2d directory, where the auxiliary files |
366 |
\`tidy' compile in a local *.t2d directory, where the auxiliary files |
343 |
are left. Output files are copied back to the original file. |
367 |
are left. Output files are copied back to the original file. |
344 |
\`clean' same as \`tidy', but remove the auxiliary directory afterwards. |
368 |
\`clean' same as \`tidy', but remove the auxiliary directory afterwards. |
345 |
Every compilation therefore requires the full cycle. |
369 |
Every compilation therefore requires the full cycle. |
346 |
|
370 |
|
347 |
Using the \`tidy' mode brings several advantages: |
371 |
Using the \`tidy' mode brings several advantages: |
348 |
- the current directory is not cluttered with plethora of temporary files. |
372 |
- the current directory is not cluttered with plethora of temporary files. |
349 |
- clutter can be even reduced using --build-dir=dir: all the *.t2d |
373 |
- clutter can be even further reduced using --build-dir=dir: all the *.t2d |
350 |
directories are stored there. |
374 |
directories are stored there. |
351 |
- clutter can be reduced to zero using, e.g., --build-dir=/tmp/\$USER.t2d |
375 |
- clutter can be reduced to zero using, e.g., --build-dir=/tmp/\$USER.t2d |
352 |
or --build-dir=\$HOME/.t2d. |
376 |
or --build-dir=\$HOME/.t2d. |
353 |
- the output file is updated after every succesful TeX run, for |
377 |
- the output file is updated after every succesful TeX run, for |
354 |
sake of concurrent visualization of the output. In a \`local' build |
378 |
sake of concurrent visualization of the output. In a \`local' build |
355 |
the viewer stops during the whole TeX run. |
379 |
the viewer stops during the whole TeX run. |
356 |
- if the compilation fails, the previous state of the output file |
380 |
- if the compilation fails, the previous state of the output file |
357 |
is preserved. |
381 |
is preserved. |
358 |
- PDF and DVI compilation are kept in separate subdirectories |
382 |
- PDF and DVI compilation are kept in separate subdirectories |
359 |
preventing any possibility of auxiliary file incompatibility. |
383 |
preventing any possibility of auxiliary file incompatibility. |
360 |
|
384 |
|
361 |
On the other hand, because \`tidy' compilation takes place in another |
385 |
On the other hand, because \`tidy' compilation takes place in another |
362 |
directory, occasionally TeX won't be able to find some files (e.g., when |
386 |
directory, occasionally TeX won't be able to find some files (e.g., when |
363 |
using \\graphicspath): in that case use -I to specify the additional |
387 |
using \\graphicspath): in that case use -I to specify the additional |
364 |
directories to consider. |
388 |
directories to consider. |
365 |
|
389 |
|
366 |
The values of the BIBTEX, LATEX (or PDFLATEX), MAKEINDEX, MAKEINFO, |
390 |
The values of the BIBTEX, DVIPDF, DVIPS, LATEX, MAKEINDEX, MAKEINFO, |
367 |
TEX (or PDFTEX), TEXINDEX, and THUMBPDF environment variables are used |
391 |
PDFLATEX, PDFTEX, TEX, TEXINDEX, and THUMBPDF environment variables are used |
368 |
to run those commands, if they are set. Any CMD strings are added |
392 |
to run those commands, if they are set. Any CMD strings are added after |
369 |
after @setfilename for Texinfo input, in the first line for LaTeX input. |
393 |
@setfilename for Texinfo input, in the first line for LaTeX input. |
370 |
|
394 |
|
371 |
Email bug reports to <bug-texinfo@gnu.org>, |
395 |
Report bugs to bug-texinfo@gnu.org, |
372 |
general questions and discussion to <help-texinfo@gnu.org>. |
396 |
general questions and discussion to help-texinfo@gnu.org. |
373 |
Texinfo home page: http://www.gnu.org/software/texinfo/ |
397 |
GNU Texinfo home page: <http://www.gnu.org/software/texinfo/> |
|
|
398 |
General help using GNU software: <http://www.gnu.org/gethelp/> |
374 |
EOF |
399 |
EOF |
375 |
exit 0 |
400 |
exit 0 |
376 |
} |
401 |
} |
Lines 512-517
Link Here
|
512 |
## Language auxiliary functions. ## |
537 |
## Language auxiliary functions. ## |
513 |
## ------------------------------ ## |
538 |
## ------------------------------ ## |
514 |
|
539 |
|
|
|
540 |
|
541 |
# out_lang_set LANG |
542 |
# ----------------- |
543 |
out_lang_set () |
544 |
{ |
545 |
case $1 in |
546 |
dvi|dvipdf|html|info|pdf|ps|text) out_lang=$1;; |
547 |
*) error 1 "invalid output format: $1";; |
548 |
esac |
549 |
} |
550 |
|
551 |
|
515 |
# out_lang_tex |
552 |
# out_lang_tex |
516 |
# ------------ |
553 |
# ------------ |
517 |
# Return the tex output language (DVI or PDF) for $OUT_LANG. |
554 |
# Return the tex output language (DVI or PDF) for $OUT_LANG. |
Lines 521-527
Link Here
|
521 |
dvi | ps | dvipdf ) echo dvi;; |
558 |
dvi | ps | dvipdf ) echo dvi;; |
522 |
pdf ) echo $out_lang;; |
559 |
pdf ) echo $out_lang;; |
523 |
html | info | text ) echo $out_lang;; |
560 |
html | info | text ) echo $out_lang;; |
524 |
*) error 1 "$0: invalid out_lang: $1";; |
561 |
*) error 1 "invalid out_lang: $1";; |
525 |
esac |
562 |
esac |
526 |
} |
563 |
} |
527 |
|
564 |
|
Lines 534-540
Link Here
|
534 |
case $out_lang in |
571 |
case $out_lang in |
535 |
dvipdf ) echo pdf;; |
572 |
dvipdf ) echo pdf;; |
536 |
dvi | html | info | pdf | ps | text ) echo $out_lang;; |
573 |
dvi | html | info | pdf | ps | text ) echo $out_lang;; |
537 |
*) error 1 "$0: invalid out_lang: $1";; |
574 |
*) error 1 "invalid out_lang: $1";; |
538 |
esac |
575 |
esac |
539 |
} |
576 |
} |
540 |
|
577 |
|
Lines 576-594
Link Here
|
576 |
do |
613 |
do |
577 |
case $dir in |
614 |
case $dir in |
578 |
EMPTY) |
615 |
EMPTY) |
579 |
res=$res$path_sep |
616 |
res=$res$path_sep |
580 |
;; |
617 |
;; |
581 |
*) |
618 |
*) |
582 |
if test -d "$dir"; then |
619 |
if test -d "$dir"; then |
583 |
res=$res$path_sep`absolute "$dir"` |
620 |
res=$res$path_sep`absolute "$dir"` |
584 |
else |
621 |
else |
585 |
# Even if $dir is not a directory, preserve it in the path. |
622 |
# Even if $dir is not a directory, preserve it in the path. |
586 |
# It might contain metacharacters that TeX will expand in |
623 |
# It might contain metacharacters that TeX will expand in |
587 |
# turn, e.g., /some/path/{a,b,c}. This will not get the |
624 |
# turn, e.g., /some/path/{a,b,c}. This will not get the |
588 |
# implicit absolutification of the path, but we can't help that. |
625 |
# implicit absolutification of the path, but we can't help that. |
589 |
res=$res$path_sep$dir |
626 |
res=$res$path_sep$dir |
590 |
fi |
627 |
fi |
591 |
;; |
628 |
;; |
592 |
esac |
629 |
esac |
593 |
done |
630 |
done |
594 |
echo "$res" |
631 |
echo "$res" |
Lines 598-617
Link Here
|
598 |
# output_base_name FILE |
635 |
# output_base_name FILE |
599 |
# --------------------- |
636 |
# --------------------- |
600 |
# The name of FILE, possibly renamed to satisfy --output. |
637 |
# The name of FILE, possibly renamed to satisfy --output. |
|
|
638 |
# FILE is local, there is no directory part. |
601 |
output_base_name () |
639 |
output_base_name () |
602 |
{ |
640 |
{ |
603 |
case $oname in |
641 |
case $oname in |
604 |
'') echo "$1";; |
642 |
'') echo "$1";; |
605 |
*) local out_noext |
643 |
*) local out_noext |
606 |
out_noext=`echo "$oname" | sed 's/\.[^.]*$//'` |
644 |
out_noext=`noext "$oname"` |
607 |
local file_ext |
645 |
local file_ext |
608 |
file_ext=`echo "$1" | sed 's/^.*\.//'` |
646 |
file_ext=`echo "$1" | sed 's/^.*\.//'` |
609 |
echo "$out_noext.$file_ext" |
647 |
echo "$out_noext.$file_ext" |
610 |
;; |
648 |
;; |
611 |
esac |
649 |
esac |
612 |
} |
650 |
} |
613 |
|
651 |
|
614 |
|
652 |
|
|
|
653 |
# destdir |
654 |
# ------- |
655 |
# Return the name of the directory where the output is expected. |
656 |
destdir () |
657 |
{ |
658 |
case $oname in |
659 |
'') echo "$orig_pwd";; |
660 |
*) dirname "$oname";; |
661 |
esac |
662 |
} |
663 |
|
664 |
|
615 |
# move_to_dest FILE... |
665 |
# move_to_dest FILE... |
616 |
# -------------------- |
666 |
# -------------------- |
617 |
# Move FILE to the place where the user expects it. Truly move it, that |
667 |
# Move FILE to the place where the user expects it. Truly move it, that |
Lines 623-629
Link Here
|
623 |
# an auxiliary file with the same base name. |
673 |
# an auxiliary file with the same base name. |
624 |
move_to_dest () |
674 |
move_to_dest () |
625 |
{ |
675 |
{ |
626 |
local dest |
676 |
# If we built in place, there is nothing to install, leave. |
|
|
677 |
case $tidy:$oname in |
678 |
false:) return;; |
679 |
esac |
680 |
|
627 |
local destfile |
681 |
local destfile |
628 |
local destdir |
682 |
local destdir |
629 |
local destbase |
683 |
local destbase |
Lines 632-673
Link Here
|
632 |
|
686 |
|
633 |
for file |
687 |
for file |
634 |
do |
688 |
do |
|
|
689 |
test -f "$file" || |
690 |
error 1 "no such file or directory: $file" |
635 |
case $tidy:$oname in |
691 |
case $tidy:$oname in |
636 |
true:) dest=$orig_pwd;; |
692 |
true:) destdir=$orig_pwd |
637 |
false:) dest=;; |
693 |
destfile=$destdir/$file;; |
638 |
*:*) dest=`output_base_name "$file"`;; |
694 |
*:*) destfile=`output_base_name "$file"` |
|
|
695 |
destdir=`dirname "$destfile"`;; |
639 |
esac |
696 |
esac |
640 |
if test ! -f "$file"; then |
697 |
# We want to compare the source location and the output location, |
641 |
error 1 "no such file or directory: $file" |
698 |
# and if they are different, do the move. But if they are the |
642 |
fi |
699 |
# same, we must preserve the source. Since we can't assume |
643 |
if test -n "$dest"; then |
700 |
# stat(1) or test -ef is available, resort to comparing the |
644 |
# We need to know whether $dest is a directory. |
701 |
# directory names, canonicalized with pwd. We can't use cmp -s |
645 |
if test -d "$dest"; then |
702 |
# since the output file might not actually change from run to run; |
646 |
destdir=$dest |
703 |
# e.g., TeX DVI output is timestamped to only the nearest minute. |
647 |
destfile=$dest/$file |
704 |
destdir=`cd "$destdir" && pwd` |
648 |
else |
705 |
destbase=`basename "$destfile"` |
649 |
destdir="`dirname $dest`" |
706 |
|
650 |
destfile=$dest |
707 |
sourcedir=`dirname "$file"` |
651 |
fi |
708 |
sourcedir=`cd "$sourcedir" && pwd` |
652 |
# We want to compare the source location and the output location, |
709 |
sourcebase=`basename "$file"` |
653 |
# and if they are different, do the move. But if they are the |
710 |
|
654 |
# same, we must preserve the source. Since we can't assume |
711 |
if test "$sourcedir/$sourcebase" != "$destdir/$destbase"; then |
655 |
# stat(1) or test -ef is available, resort to comparing the |
712 |
verbose "Moving $file to $destfile" |
656 |
# directory names, canonicalized with pwd. We can't use cmp -s |
713 |
rm -f "$destfile" |
657 |
# since the output file might not actually change from run to run; |
714 |
mv "$file" "$destfile" |
658 |
# e.g., TeX DVI output is timestamped to only the nearest minute. |
|
|
659 |
destdir=`cd $destdir && pwd` |
660 |
destbase=`basename $destfile` |
661 |
# |
662 |
sourcedir=`dirname $file` |
663 |
sourcedir=`cd $sourcedir && pwd` |
664 |
sourcebase=`basename $file` |
665 |
# |
666 |
if test "$sourcedir/$sourcebase" != "$destdir/$destbase"; then |
667 |
verbose "Moving $file to $destfile" |
668 |
rm -f "$destfile" |
669 |
mv "$file" "$destfile" |
670 |
fi |
671 |
fi |
715 |
fi |
672 |
done |
716 |
done |
673 |
} |
717 |
} |
Lines 679-685
Link Here
|
679 |
|
723 |
|
680 |
# aux_file_p FILE |
724 |
# aux_file_p FILE |
681 |
# --------------- |
725 |
# --------------- |
682 |
# Return with success with FILE is an aux file. |
726 |
# Return with success if FILE is an aux file. |
683 |
aux_file_p () |
727 |
aux_file_p () |
684 |
{ |
728 |
{ |
685 |
test -f "$1" || return 1 |
729 |
test -f "$1" || return 1 |
Lines 691-697
Link Here
|
691 |
|
735 |
|
692 |
# bibaux_file_p FILE |
736 |
# bibaux_file_p FILE |
693 |
# ------------------ |
737 |
# ------------------ |
694 |
# Return with success with FILE is an aux file containing citation |
738 |
# Return with success if FILE is an aux file containing citation |
695 |
# requests. |
739 |
# requests. |
696 |
bibaux_file_p () |
740 |
bibaux_file_p () |
697 |
{ |
741 |
{ |
Lines 711-723
Link Here
|
711 |
|
755 |
|
712 |
# index_file_p FILE |
756 |
# index_file_p FILE |
713 |
# ----------------- |
757 |
# ----------------- |
714 |
# Return with success with FILE is an index file. |
758 |
# Return with success if FILE is an index file. |
715 |
# When index.sty is used, there is a space before the brace. |
|
|
716 |
index_file_p () |
759 |
index_file_p () |
717 |
{ |
760 |
{ |
718 |
test -f "$1" || return 1 |
761 |
test -f "$1" || return 1 |
719 |
case `sed '1q' "$1"` in |
762 |
case $in_lang:$latex2html:`out_lang_tex`:`sed '1q' "$1"` in |
720 |
"\\entry{"*|"\\indexentry{"*|"\\indexentry {"*) return 0;; |
763 |
# When working with TeX4HT, *.idx are created by LaTeX. They must |
|
|
764 |
# be processed to produce *.4ix, *.4dx files. The *.4dx file is |
765 |
# passed to makeindex to produce the *.ind file. This sequence is |
766 |
# handled by run_index, so we are only interested in the *.idx |
767 |
# files, which have each "\indexentry" preceded by a |
768 |
# "\beforeentry". |
769 |
latex:tex4ht:html:"\\beforeentry {"*) return 0;; |
770 |
|
771 |
# When index.sty is used, there is a space before the brace. |
772 |
latex:*:*:"\\indexentry{"*|latex:*:*:"\\indexentry {"*) return 0;; |
773 |
|
774 |
texinfo:*:*:"\\entry{"*) return 0;; |
775 |
|
721 |
*) return 1;; |
776 |
*) return 1;; |
722 |
esac |
777 |
esac |
723 |
} |
778 |
} |
Lines 735-741
Link Here
|
735 |
case `sed '1q' "$1"` in |
790 |
case `sed '1q' "$1"` in |
736 |
"\\input texinfo"*) return 1;; |
791 |
"\\input texinfo"*) return 1;; |
737 |
[\\''@]*) return 0;; |
792 |
[\\''@]*) return 0;; |
738 |
*) return 1;; |
793 |
*) return 1;; |
739 |
esac |
794 |
esac |
740 |
} |
795 |
} |
741 |
|
796 |
|
Lines 762-776
Link Here
|
762 |
echo $file |
817 |
echo $file |
763 |
case $in_lang in |
818 |
case $in_lang in |
764 |
texinfo) |
819 |
texinfo) |
765 |
# texindex: texinfo.cp -> texinfo.cps |
820 |
# texindex: texinfo.cp -> texinfo.cps |
766 |
if index_file_p $file; then |
821 |
if index_file_p $file; then |
767 |
echo ${file}s |
822 |
echo ${file}s |
768 |
fi |
823 |
fi |
769 |
;; |
824 |
;; |
770 |
latex) |
825 |
latex) |
771 |
if aux_file_p $file; then |
826 |
if aux_file_p $file; then |
772 |
# bibtex: *.aux -> *.bbl and *.blg. |
827 |
# bibtex: *.aux -> *.bbl and *.blg. |
773 |
echo $file | sed 's/^\(.*\)\.aux$/\1.bbl/' |
828 |
echo $file | sed 's/^\(.*\)\.aux$/\1.bbl/' |
774 |
echo $file | sed 's/^\(.*\)\.aux$/\1.blg/' |
829 |
echo $file | sed 's/^\(.*\)\.aux$/\1.blg/' |
775 |
# -recorder: .fls |
830 |
# -recorder: .fls |
776 |
echo $file | sed 's/^\(.*\)\.aux$/\1.fls/' |
831 |
echo $file | sed 's/^\(.*\)\.aux$/\1.fls/' |
Lines 845-851
Link Here
|
845 |
if cmp -s "$this_file" "$work_bak/$this_file"; then :; else |
900 |
if cmp -s "$this_file" "$work_bak/$this_file"; then :; else |
846 |
verbose "xref file `echo $this_file | sed 's|\./||g'` differed ..." |
901 |
verbose "xref file `echo $this_file | sed 's|\./||g'` differed ..." |
847 |
if $debug; then |
902 |
if $debug; then |
848 |
diff -u "$work_bak/$this_file" "$this_file" |
903 |
diff -u "$work_bak/$this_file" "$this_file" |
849 |
fi |
904 |
fi |
850 |
return 0 |
905 |
return 0 |
851 |
fi |
906 |
fi |
Lines 868-887
Link Here
|
868 |
# Run TeX as "$tex $in_input", taking care of errors and logs. |
923 |
# Run TeX as "$tex $in_input", taking care of errors and logs. |
869 |
run_tex () |
924 |
run_tex () |
870 |
{ |
925 |
{ |
871 |
case $in_lang:`out_lang_tex` in |
926 |
case $in_lang:$latex2html:`out_lang_tex` in |
872 |
latex:dvi) tex=${LATEX:-latex};; |
927 |
latex:*:dvi|latex:tex4ht:html) |
873 |
latex:pdf) tex=${PDFLATEX:-pdflatex};; |
928 |
tex=${LATEX:-latex};; |
874 |
texinfo:dvi) |
929 |
latex:*:pdf) |
875 |
# MetaPost also uses the TEX environment variable. If the user |
930 |
tex=${PDFLATEX:-pdflatex};; |
876 |
# has set TEX=latex for that reason, don't bomb out. |
931 |
texinfo:*:dvi) |
877 |
case $TEX in |
932 |
# MetaPost also uses the TEX environment variable. If the user |
878 |
*latex) tex=tex;; # don't bother trying to find etex |
933 |
# has set TEX=latex for that reason, don't bomb out. |
879 |
*) tex=$TEX |
934 |
case $TEX in |
880 |
esac;; |
935 |
*latex) tex=tex;; # don't bother trying to find etex |
881 |
texinfo:pdf) tex=$PDFTEX;; |
936 |
*) tex=$TEX |
882 |
|
937 |
esac;; |
883 |
*) error 1 "$0: $out_lang not supported for $in_lang";; |
938 |
texinfo:*:pdf) tex=$PDFTEX;; |
884 |
esac |
939 |
|
|
|
940 |
*) error 1 "$out_lang not supported for $in_lang";; |
941 |
esac |
942 |
|
943 |
# do the special catcode trick for ~ in filenames only for Texinfo, |
944 |
# not LaTeX. |
945 |
if test x"$in_lang" = xtexinfo && test $catcode_special = maybe; then |
946 |
catcode_special=true |
947 |
else |
948 |
catcode_special=false |
949 |
fi |
885 |
|
950 |
|
886 |
# Beware of aux files in subdirectories that require the |
951 |
# Beware of aux files in subdirectories that require the |
887 |
# subdirectory to exist. |
952 |
# subdirectory to exist. |
Lines 891-897
Link Here
|
891 |
sort -u | |
956 |
sort -u | |
892 |
while read d |
957 |
while read d |
893 |
do |
958 |
do |
894 |
ensure_dir "$work_build/$d" |
959 |
ensure_dir "$work_build/$d" |
895 |
done |
960 |
done |
896 |
;; |
961 |
;; |
897 |
esac |
962 |
esac |
Lines 900-917
Link Here
|
900 |
local cmd="$tex" |
965 |
local cmd="$tex" |
901 |
|
966 |
|
902 |
# If possible, make TeX report error locations in GNU format. |
967 |
# If possible, make TeX report error locations in GNU format. |
903 |
if test "${tex_help:+set}" != set; then |
968 |
if $line_error; then |
904 |
# Go to a temporary directory to try --help, since old versions that |
969 |
if test "${tex_help:+set}" != set; then |
905 |
# don't accept --help will generate a texput.log. |
970 |
# Go to a temporary directory to try --help, since old versions that |
906 |
tex_help_dir=$t2ddir/tex_help |
971 |
# don't accept --help will generate a texput.log. |
907 |
ensure_dir "$tex_help_dir" |
972 |
tex_help_dir=$t2ddir/tex_help |
908 |
tex_help=`cd "$tex_help_dir" >&6 && $tex --help </dev/null 2>&1` |
973 |
ensure_dir "$tex_help_dir" |
909 |
fi |
974 |
tex_help=`cd "$tex_help_dir" >&6 && $tex --help </dev/null 2>&1 || true` |
910 |
if $no_line_error; then :; else |
975 |
fi |
911 |
# The mk program and perhaps others want to parse TeX's |
976 |
# The mk program and perhaps others want to parse TeX's |
912 |
# original error messages. |
977 |
# original error messages. |
913 |
case $line_error:$tex_help in |
978 |
case $tex_help in |
914 |
true:*file-line-error*) cmd="$cmd --file-line-error";; |
979 |
*file-line-error*) cmd="$cmd --file-line-error";; |
915 |
esac |
980 |
esac |
916 |
fi |
981 |
fi |
917 |
|
982 |
|
Lines 919-925
Link Here
|
919 |
test -n "$translate_file" && cmd="$cmd --translate-file=$translate_file" |
984 |
test -n "$translate_file" && cmd="$cmd --translate-file=$translate_file" |
920 |
|
985 |
|
921 |
# Tell TeX to make source specials (for backtracking from output to |
986 |
# Tell TeX to make source specials (for backtracking from output to |
922 |
# source, given a sufficiently smart editor), if specifed. |
987 |
# source, given a sufficiently smart editor), if specified. |
923 |
test -n "$src_specials" && cmd="$cmd $src_specials" |
988 |
test -n "$src_specials" && cmd="$cmd $src_specials" |
924 |
|
989 |
|
925 |
# Tell TeX to be batch if requested. |
990 |
# Tell TeX to be batch if requested. |
Lines 927-938
Link Here
|
927 |
# \batchmode does not show terminal output at all, so we don't |
992 |
# \batchmode does not show terminal output at all, so we don't |
928 |
# want that. And even in batch mode, TeX insists on having input |
993 |
# want that. And even in batch mode, TeX insists on having input |
929 |
# from the user. Close its stdin to make it impossible. |
994 |
# from the user. Close its stdin to make it impossible. |
930 |
cmd="$cmd </dev/null '${escape}nonstopmode' '${escape}input'" |
995 |
cmd="$cmd </dev/null '${escape}nonstopmode'" |
931 |
fi |
996 |
fi |
932 |
|
997 |
|
933 |
# we'd like to handle arbitrary input file names, such as a~b.tex. |
998 |
# we'd like to handle arbitrary input file names, especially |
934 |
# This isn't a general way to do it :), though it does work, kind of. |
999 |
# foo~bar/a~b.tex, since Debian likes ~ characters. |
935 |
# cmd="$cmd '${escape}catcode126=12 \input '" |
1000 |
if $catcode_special; then |
|
|
1001 |
# $normaltilde is just to reduce line length in this source file. |
1002 |
# The idea is to define \normaltilde as a catcode other ~ character, |
1003 |
# then make the active ~ be equivalent to that, instead of the plain |
1004 |
# TeX tie. Then when the active ~ appears in the filename, it will |
1005 |
# be expanded to itself, as far as \input will see. (This is the |
1006 |
# same thing that texinfo.tex does in general, BTW.) |
1007 |
normaltilde="${escape}catcode126=12 ${escape}def${escape}normaltilde{~}" |
1008 |
cmd="$cmd '$normaltilde${escape}catcode126=13 ${escape}let~\normaltilde '" |
1009 |
fi |
1010 |
# Other special (non-active) characters could be supported by |
1011 |
# resetting their catcodes to other on the command line and changing |
1012 |
# texinfo.tex to initialize everything to plain catcodes. Maybe someday. |
1013 |
|
1014 |
# append the \input command. |
1015 |
cmd="$cmd '${escape}input'" |
936 |
|
1016 |
|
937 |
# TeX's \input does not (easily or reliably) support whitespace |
1017 |
# TeX's \input does not (easily or reliably) support whitespace |
938 |
# characters or other special characters in file names. Our intensive |
1018 |
# characters or other special characters in file names. Our intensive |
Lines 947-958
Link Here
|
947 |
# harm in making the link. |
1027 |
# harm in making the link. |
948 |
# |
1028 |
# |
949 |
case $tidy:`func_dirname "$in_input"` in |
1029 |
case $tidy:`func_dirname "$in_input"` in |
950 |
true:*["$space$tab$newline\"#\$%\\^_{}"]*) |
1030 |
true:*["$space$tab$newline\"#\$%\\^_{}~"]*) |
951 |
_run_tex_file_name=`basename "$in_input"` |
1031 |
_run_tex_file_name=`basename "$in_input"` |
952 |
if test ! -f "$_run_tex_file_name"; then |
1032 |
if test ! -f "$_run_tex_file_name"; then |
953 |
# It might not be a file, clear it. |
1033 |
# It might not be a file, clear it. |
954 |
run rm -f "$_run_tex_file_name" |
1034 |
run rm -f "$_run_tex_file_name" |
955 |
run ln -s "$in_input" |
1035 |
run ln -s "$in_input" |
956 |
fi |
1036 |
fi |
957 |
cmd="$cmd '$_run_tex_file_name'" |
1037 |
cmd="$cmd '$_run_tex_file_name'" |
958 |
;; |
1038 |
;; |
Lines 1001-1012
Link Here
|
1001 |
# bibtex would never be run. |
1081 |
# bibtex would never be run. |
1002 |
if test -r "$in_noext.aux" \ |
1082 |
if test -r "$in_noext.aux" \ |
1003 |
&& test -r "$in_noext.log" \ |
1083 |
&& test -r "$in_noext.log" \ |
1004 |
&& (grep 'Warning:.*Citation.*undefined' "$in_noext.log" \ |
1084 |
&& ((grep 'Warning:.*Citation.*undefined' "$in_noext.log" \ |
1005 |
|| grep '.*Undefined citation' "$in_noext.log" \ |
1085 |
|| grep '.*Undefined citation' "$in_noext.log" \ |
1006 |
|| grep 'No file .*\.bbl\.' "$in_noext.log") \ |
1086 |
|| grep 'No file .*\.bbl\.' "$in_noext.log") \ |
1007 |
|| (grep 'No \.aux file' "$in_noext.log" \ |
1087 |
|| (grep 'No \.aux file' "$in_noext.log" \ |
1008 |
&& grep '^\\bibdata' "$in_noext.aux") \ |
1088 |
&& grep '^\\bibdata' "$in_noext.aux")) \ |
1009 |
>&6 2>&1; \ |
1089 |
>&6 2>&1; \ |
1010 |
then |
1090 |
then |
1011 |
for f in `generated_files_get "$in_noext" bibaux_file_p` |
1091 |
for f in `generated_files_get "$in_noext" bibaux_file_p` |
1012 |
do |
1092 |
do |
Lines 1017-1036
Link Here
|
1017 |
|
1097 |
|
1018 |
# run_index () |
1098 |
# run_index () |
1019 |
# ------------ |
1099 |
# ------------ |
1020 |
# Run texindex (or makeindex) on current index files. If they already |
1100 |
# Run texindex (or makeindex or texindy) on current index files. If |
1021 |
# exist, and after running TeX a first time the index files don't |
1101 |
# they already exist, and after running TeX a first time the index |
1022 |
# change, then there's no reason to run TeX again. But we won't know |
1102 |
# files don't change, then there's no reason to run TeX again. But we |
1023 |
# that if the index files are out of date or nonexistent. |
1103 |
# won't know that if the index files are out of date or nonexistent. |
1024 |
run_index () |
1104 |
run_index () |
1025 |
{ |
1105 |
{ |
1026 |
case $in_lang in |
1106 |
local index_files=`generated_files_get $in_noext index_file_p` |
1027 |
latex) texindex=${MAKEINDEX:-makeindex};; |
1107 |
test -n "$index_files" || |
1028 |
texinfo) texindex=${TEXINDEX:-texindex};; |
1108 |
return 0 |
|
|
1109 |
|
1110 |
: ${MAKEINDEX:=makeindex} |
1111 |
: ${TEXINDEX:=texindex} |
1112 |
: ${TEXINDY:=texindy} |
1113 |
|
1114 |
local index_file |
1115 |
local index_noext |
1116 |
case $in_lang:$latex2html:`out_lang_tex` in |
1117 |
latex:tex4ht:html) |
1118 |
for index_file in $index_files |
1119 |
do |
1120 |
index_noext=`noext "$index_file"` |
1121 |
run tex \ |
1122 |
'\def\filename{{'"$index_noext"'}{idx}{4dx}{ind}} |
1123 |
\input idxmake.4ht' |
1124 |
run $MAKEINDEX -o $index_noext.ind $index_noext.4dx |
1125 |
done |
1126 |
;; |
1127 |
|
1128 |
latex:*) |
1129 |
if $TEXINDY --version >&6 2>&1; then |
1130 |
run $TEXINDY $index_files |
1131 |
else |
1132 |
run $MAKEINDEX $index_files |
1133 |
fi |
1134 |
;; |
1135 |
|
1136 |
texinfo:*) |
1137 |
run $TEXINDEX $index_files |
1138 |
;; |
1139 |
esac |
1140 |
} |
1141 |
|
1142 |
|
1143 |
# run_tex4ht () |
1144 |
# ------------- |
1145 |
# Run the last two phases of TeX4HT: tex4ht extracts the HTML from the |
1146 |
# instrumented DVI file, and t4ht converts the figures and installs |
1147 |
# the files when given -d. |
1148 |
# |
1149 |
# Because knowing exactly which files are created is complex (in |
1150 |
# addition the names are not simple to compute), which makes it |
1151 |
# difficult to install the output files in a second step, it is much |
1152 |
# simpler to install directly the output files. |
1153 |
run_tex4ht () |
1154 |
{ |
1155 |
case $in_lang:$latex2html:`out_lang_tex` in |
1156 |
latex:tex4ht:html) |
1157 |
: ${TEX4HT=tex4ht} ${T4HT=t4ht} |
1158 |
run "$TEX4HT" "-f/$in_noext" |
1159 |
# Do not remove the / after the destdir. |
1160 |
run "$T4HT" "-d`destdir`/" "-f/$in_noext" |
1161 |
;; |
1029 |
esac |
1162 |
esac |
1030 |
index_files=`generated_files_get $in_noext index_file_p` |
|
|
1031 |
if test -n "$texindex" && test -n "$index_files"; then |
1032 |
run $texindex $index_files |
1033 |
fi |
1034 |
} |
1163 |
} |
1035 |
|
1164 |
|
1036 |
|
1165 |
|
Lines 1049-1055
Link Here
|
1049 |
run_tex |
1178 |
run_tex |
1050 |
else |
1179 |
else |
1051 |
report "$thumbpdf exited with bad status." \ |
1180 |
report "$thumbpdf exited with bad status." \ |
1052 |
"Ignoring its output." |
1181 |
"Ignoring its output." |
1053 |
fi |
1182 |
fi |
1054 |
fi |
1183 |
fi |
1055 |
} |
1184 |
} |
Lines 1065-1071
Link Here
|
1065 |
for i in "$DVIPDF" dvipdfmx dvipdfm dvipdf dvi2pdf dvitopdf; |
1194 |
for i in "$DVIPDF" dvipdfmx dvipdfm dvipdf dvi2pdf dvitopdf; |
1066 |
do |
1195 |
do |
1067 |
if findprog $i; then |
1196 |
if findprog $i; then |
1068 |
dvipdf=$i |
1197 |
dvipdf=$i |
1069 |
fi |
1198 |
fi |
1070 |
done |
1199 |
done |
1071 |
fi |
1200 |
fi |
Lines 1074-1080
Link Here
|
1074 |
# outputting using the expected file name. |
1203 |
# outputting using the expected file name. |
1075 |
run $dvipdf "$1" |
1204 |
run $dvipdf "$1" |
1076 |
if test ! -f `echo "$1" | sed -e 's/\.dvi$/.pdf/'`; then |
1205 |
if test ! -f `echo "$1" | sed -e 's/\.dvi$/.pdf/'`; then |
1077 |
error 1 "$0: cannot find output file" |
1206 |
error 1 "cannot find output file" |
1078 |
fi |
1207 |
fi |
1079 |
} |
1208 |
} |
1080 |
|
1209 |
|
Lines 1093-1098
Link Here
|
1093 |
local cycle=0 |
1222 |
local cycle=0 |
1094 |
|
1223 |
|
1095 |
while :; do |
1224 |
while :; do |
|
|
1225 |
# check for probably LaTeX loop (e.g. varioref) |
1226 |
if test $cycle -eq "$max_iters"; then |
1227 |
error 0 "Maximum of $max_iters cycles exceeded" |
1228 |
break |
1229 |
fi |
1230 |
|
1231 |
# report progress |
1096 |
cycle=`expr $cycle + 1` |
1232 |
cycle=`expr $cycle + 1` |
1097 |
verbose "Cycle $cycle for $command_line_filename" |
1233 |
verbose "Cycle $cycle for $command_line_filename" |
1098 |
|
1234 |
|
Lines 1112-1126
Link Here
|
1112 |
# and TeX one last time. |
1248 |
# and TeX one last time. |
1113 |
run_thumbpdf |
1249 |
run_thumbpdf |
1114 |
|
1250 |
|
|
|
1251 |
# If we are using tex4ht, call it. |
1252 |
run_tex4ht |
1253 |
|
1115 |
# Install the result if we didn't already (i.e., if the output is |
1254 |
# Install the result if we didn't already (i.e., if the output is |
1116 |
# dvipdf or ps). |
1255 |
# dvipdf or ps). |
1117 |
case $out_lang in |
1256 |
case $latex2html:$out_lang in |
1118 |
dvipdf) |
1257 |
*:dvipdf) |
1119 |
run_dvipdf "$in_noext.`out_lang_tex`" |
1258 |
run_dvipdf "$in_noext.`out_lang_tex`" |
1120 |
move_to_dest "$in_noext.`out_lang_ext`" |
1259 |
move_to_dest "$in_noext.`out_lang_ext`" |
1121 |
;; |
1260 |
;; |
1122 |
ps) |
1261 |
*:ps) |
1123 |
dvips -o "$in_noext.`out_lang_ext`" "$in_noext.`out_lang_tex`" |
1262 |
: {DVIPS=dvips} |
|
|
1263 |
$DVIPS -o "$in_noext.`out_lang_ext`" "$in_noext.`out_lang_tex`" |
1124 |
move_to_dest "$in_noext.`out_lang_ext`" |
1264 |
move_to_dest "$in_noext.`out_lang_ext`" |
1125 |
;; |
1265 |
;; |
1126 |
esac |
1266 |
esac |
Lines 1135-1170
Link Here
|
1135 |
|
1275 |
|
1136 |
# A sed script that preprocesses Texinfo sources in order to keep the |
1276 |
# A sed script that preprocesses Texinfo sources in order to keep the |
1137 |
# iftex sections only. We want to remove non TeX sections, and comment |
1277 |
# iftex sections only. We want to remove non TeX sections, and comment |
1138 |
# (with `@c texi2dvi') TeX sections so that makeinfo does not try to |
1278 |
# (with `@c _texi2dvi') TeX sections so that makeinfo does not try to |
1139 |
# parse them. Nevertheless, while commenting TeX sections, don't |
1279 |
# parse them. Nevertheless, while commenting TeX sections, don't |
1140 |
# comment @macro/@end macro so that makeinfo does propagate them. |
1280 |
# comment @macro/@end macro so that makeinfo does propagate them. |
1141 |
# Unfortunately makeinfo --iftex --no-ifinfo doesn't work well enough |
1281 |
# Unfortunately makeinfo --iftex --no-ifinfo doesn't work well enough |
1142 |
# (yet), makeinfo can't parse the TeX commands, so work around with sed. |
1282 |
# (yet), makeinfo can't parse the TeX commands, so work around with sed. |
1143 |
# |
1283 |
# |
|
|
1284 |
# We assume that `@c _texi2dvi' starting a line is not present in the |
1285 |
# document. |
1286 |
# |
1144 |
comment_iftex=\ |
1287 |
comment_iftex=\ |
1145 |
'/^@tex/,/^@end tex/{ |
1288 |
'/^@tex/,/^@end tex/{ |
1146 |
s/^/@c texi2dvi/ |
1289 |
s/^/@c _texi2dvi/ |
1147 |
} |
1290 |
} |
1148 |
/^@iftex/,/^@end iftex/{ |
1291 |
/^@iftex/,/^@end iftex/{ |
1149 |
s/^/@c texi2dvi/ |
1292 |
s/^/@c _texi2dvi/ |
1150 |
/^@c texi2dvi@macro/,/^@c texi2dvi@end macro/{ |
1293 |
/^@c _texi2dvi@macro/,/^@c _texi2dvi@end macro/{ |
1151 |
s/^@c texi2dvi// |
1294 |
s/^@c _texi2dvi// |
1152 |
} |
1295 |
} |
1153 |
} |
1296 |
} |
1154 |
/^@ifnottex/,/^@end ifnottex/{ |
1297 |
/^@ifnottex/,/^@end ifnottex/{ |
1155 |
s/^/@c (texi2dvi)/ |
1298 |
s/^/@c (_texi2dvi)/ |
1156 |
} |
1299 |
} |
1157 |
/^@ifinfo/,/^@end ifinfo/{ |
1300 |
/^@ifinfo/,/^@end ifinfo/{ |
1158 |
/^@node/p |
1301 |
/^@node/p |
1159 |
/^@menu/,/^@end menu/p |
1302 |
/^@menu/,/^@end menu/p |
1160 |
t |
1303 |
t |
1161 |
s/^/@c (texi2dvi)/ |
1304 |
s/^/@c (_texi2dvi)/ |
1162 |
} |
1305 |
} |
1163 |
s/^@ifnotinfo/@c texi2dvi@ifnotinfo/ |
1306 |
s/^@ifnotinfo/@c _texi2dvi@ifnotinfo/ |
1164 |
s/^@end ifnotinfo/@c texi2dvi@end ifnotinfo/' |
1307 |
s/^@end ifnotinfo/@c _texi2dvi@end ifnotinfo/' |
1165 |
|
1308 |
|
1166 |
# Uncommenting is simple: Remove any leading `@c texi2dvi'. |
1309 |
# Uncommenting is simpler: remove any leading `@c texi2dvi'; repeated |
1167 |
uncomment_iftex='s/^@c texi2dvi//' |
1310 |
# copies can sneak in via macro invocations. |
|
|
1311 |
uncomment_iftex='s/^@c _texi2dvi\(@c _texi2dvi\)*//' |
1168 |
|
1312 |
|
1169 |
|
1313 |
|
1170 |
# run_makeinfo () |
1314 |
# run_makeinfo () |
Lines 1180-1186
Link Here
|
1180 |
|
1324 |
|
1181 |
# Unless required by the user, makeinfo expansion is wanted only |
1325 |
# Unless required by the user, makeinfo expansion is wanted only |
1182 |
# if texinfo.tex is too old. |
1326 |
# if texinfo.tex is too old. |
1183 |
if test "$expand" = t; then |
1327 |
if $expand; then |
1184 |
makeinfo=${MAKEINFO:-makeinfo} |
1328 |
makeinfo=${MAKEINFO:-makeinfo} |
1185 |
else |
1329 |
else |
1186 |
# Check if texinfo.tex performs macro expansion by looking for |
1330 |
# Check if texinfo.tex performs macro expansion by looking for |
Lines 1210-1218
Link Here
|
1210 |
else |
1354 |
else |
1211 |
makeinfo=${MAKEINFO:-makeinfo} |
1355 |
makeinfo=${MAKEINFO:-makeinfo} |
1212 |
fi |
1356 |
fi |
1213 |
# As long as we had to run TeX, offer the user this convenience: |
1357 |
# If TeX is preloaded, offer the user this convenience: |
1214 |
if test "$txiformat" = Texinfo; then |
1358 |
if test "$txiformat" = Texinfo; then |
1215 |
escape=@ |
1359 |
escape=@ |
1216 |
fi |
1360 |
fi |
1217 |
fi |
1361 |
fi |
1218 |
|
1362 |
|
Lines 1231-1237
Link Here
|
1231 |
# happens with gettext 0.14.5, at least. |
1375 |
# happens with gettext 0.14.5, at least. |
1232 |
sed "$comment_iftex" "$command_line_filename" \ |
1376 |
sed "$comment_iftex" "$command_line_filename" \ |
1233 |
| eval $makeinfo --footnote-style=end -I "$in_dir" $miincludes \ |
1377 |
| eval $makeinfo --footnote-style=end -I "$in_dir" $miincludes \ |
1234 |
-o /dev/null --macro-expand=- \ |
1378 |
-o /dev/null --macro-expand=- \ |
1235 |
| sed "$uncomment_iftex" >"$in_src" |
1379 |
| sed "$uncomment_iftex" >"$in_src" |
1236 |
# Continue only if everything succeeded. |
1380 |
# Continue only if everything succeeded. |
1237 |
if test $? -ne 0 \ |
1381 |
if test $? -ne 0 \ |
Lines 1248-1270
Link Here
|
1248 |
# Used most commonly for @finalout, @smallbook, etc. |
1392 |
# Used most commonly for @finalout, @smallbook, etc. |
1249 |
insert_commands () |
1393 |
insert_commands () |
1250 |
{ |
1394 |
{ |
1251 |
local textra_cmd |
|
|
1252 |
case $in_lang in |
1253 |
latex) textra_cmd=1i;; |
1254 |
texinfo) textra_cmd='/^@setfilename/a';; |
1255 |
*) error 1 "internal error, unknown language: $in_lang";; |
1256 |
esac |
1257 |
|
1258 |
if test -n "$textra"; then |
1395 |
if test -n "$textra"; then |
1259 |
# _xtr. The file with the user's extra commands. |
1396 |
# _xtr. The file with the user's extra commands. |
1260 |
work_xtr=$workdir/xtr |
1397 |
work_xtr=$workdir/xtr |
1261 |
in_xtr=$work_xtr/$in_base |
1398 |
in_xtr=$work_xtr/$in_base |
1262 |
ensure_dir "$work_xtr" |
1399 |
ensure_dir "$work_xtr" |
1263 |
verbose "Inserting extra commands: $textra" |
1400 |
verbose "Inserting extra commands: $textra" |
|
|
1401 |
local textra_cmd |
1402 |
case $in_lang in |
1403 |
latex) textra_cmd=1i;; |
1404 |
texinfo) textra_cmd='/^@setfilename/a';; |
1405 |
*) error 1 "internal error, unknown language: $in_lang";; |
1406 |
esac |
1264 |
sed "$textra_cmd\\ |
1407 |
sed "$textra_cmd\\ |
1265 |
$textra" "$in_input" >"$in_xtr" |
1408 |
$textra" "$in_input" >"$in_xtr" |
1266 |
in_input=$in_xtr |
1409 |
in_input=$in_xtr |
1267 |
fi |
1410 |
fi |
|
|
1411 |
|
1412 |
case $in_lang:$latex2html:`out_lang_tex` in |
1413 |
latex:tex4ht:html) |
1414 |
# _tex4ht. The file with the added \usepackage{tex4ht}. |
1415 |
work_tex4ht=$workdir/tex4ht |
1416 |
in_tex4ht=$work_tex4ht/$in_base |
1417 |
ensure_dir "$work_tex4ht" |
1418 |
verbose "Inserting \\usepackage{tex4ht}" |
1419 |
perl -pe 's<\\documentclass(?:\[.*\])?{.*}> |
1420 |
<$&\\usepackage[xhtml]{tex4ht}>' \ |
1421 |
"$in_input" >"$in_tex4ht" |
1422 |
in_input=$in_tex4ht |
1423 |
;; |
1424 |
esac |
1268 |
} |
1425 |
} |
1269 |
|
1426 |
|
1270 |
# run_recode () |
1427 |
# run_recode () |
Lines 1278-1295
Link Here
|
1278 |
|
1435 |
|
1279 |
if test $in_lang = texinfo; then |
1436 |
if test $in_lang = texinfo; then |
1280 |
pgm='s/^ *@documentencoding *\([^ ][^ ]*\) *$/\1/ |
1437 |
pgm='s/^ *@documentencoding *\([^ ][^ ]*\) *$/\1/ |
1281 |
t found |
1438 |
t found |
1282 |
d |
1439 |
d |
1283 |
:found |
1440 |
:found |
1284 |
q' |
1441 |
q' |
1285 |
encoding=`sed -e "$pgm" "$in_input"` |
1442 |
encoding=`sed -e "$pgm" "$in_input"` |
1286 |
if $recode && test -n "$encoding" && findprog recode; then |
1443 |
if $recode && test -n "$encoding" && findprog recode; then |
1287 |
if test -n "$recode_from"; then |
1444 |
if test -n "$recode_from"; then |
1288 |
from=$recode_from |
1445 |
from=$recode_from |
1289 |
to=$encoding |
1446 |
to=$encoding |
1290 |
else |
1447 |
else |
1291 |
from=$encoding |
1448 |
from=$encoding |
1292 |
to=$texinfo |
1449 |
to=$texinfo |
1293 |
fi |
1450 |
fi |
1294 |
verbose "Recoding from $from to $to." |
1451 |
verbose "Recoding from $from to $to." |
1295 |
# _rcd. The Texinfo file recoded in 7bit. |
1452 |
# _rcd. The Texinfo file recoded in 7bit. |
Lines 1297-1306
Link Here
|
1297 |
in_rcd=$work_rcd/$in_base |
1454 |
in_rcd=$work_rcd/$in_base |
1298 |
ensure_dir "$work_rcd" |
1455 |
ensure_dir "$work_rcd" |
1299 |
if recode "$encoding..$to" <"$in_input" >"$in_rcd" \ |
1456 |
if recode "$encoding..$to" <"$in_input" >"$in_rcd" \ |
1300 |
&& test -s "$in_rcd"; then |
1457 |
&& test -s "$in_rcd"; then |
1301 |
in_input=$in_rcd |
1458 |
in_input=$in_rcd |
1302 |
else |
1459 |
else |
1303 |
verbose "Recoding failed, using original input." |
1460 |
verbose "Recoding failed, using original input." |
1304 |
fi |
1461 |
fi |
1305 |
fi |
1462 |
fi |
1306 |
fi |
1463 |
fi |
Lines 1371-1377
Link Here
|
1371 |
case $1 in |
1528 |
case $1 in |
1372 |
html|text) move_to_dest "$out_base";; |
1529 |
html|text) move_to_dest "$out_base";; |
1373 |
info) # There can be foo.info-1, foo.info-2 etc. |
1530 |
info) # There can be foo.info-1, foo.info-2 etc. |
1374 |
move_to_dest "$out_base"*;; |
1531 |
move_to_dest "$out_base"*;; |
1375 |
esac |
1532 |
esac |
1376 |
else |
1533 |
else |
1377 |
error 1 "$hevea exited with bad status, quitting." |
1534 |
error 1 "$hevea exited with bad status, quitting." |
Lines 1384-1396
Link Here
|
1384 |
# Run the TeX (or HeVeA). |
1541 |
# Run the TeX (or HeVeA). |
1385 |
run_core_conversion () |
1542 |
run_core_conversion () |
1386 |
{ |
1543 |
{ |
1387 |
case $in_lang:`out_lang_tex` in |
1544 |
case $in_lang:$latex2html:`out_lang_tex` in |
1388 |
*:dvi|*:pdf) |
1545 |
*:dvi|*:pdf|latex:tex4ht:html) |
1389 |
run_tex;; |
1546 |
run_tex;; |
1390 |
latex:html|latex:text|latex:info) |
1547 |
latex:*:html|latex:*:text|latex:*:info) |
1391 |
run_hevea $out_lang;; |
1548 |
run_hevea $out_lang;; |
1392 |
*) |
1549 |
*) |
1393 |
error 1 "invalid input/output combination: $in_lang/$out_lang";; |
1550 |
error 1 "invalid input/output combination: $in_lang/$out_lang";; |
1394 |
esac |
1551 |
esac |
1395 |
} |
1552 |
} |
1396 |
|
1553 |
|
Lines 1407-1415
Link Here
|
1407 |
# `.' goes first to ensure that any old .aux, .cps, |
1564 |
# `.' goes first to ensure that any old .aux, .cps, |
1408 |
# etc. files in ${directory} don't get used in preference to fresher |
1565 |
# etc. files in ${directory} don't get used in preference to fresher |
1409 |
# files in `.'. Include orig_pwd in case we are in clean build mode, where |
1566 |
# files in `.'. Include orig_pwd in case we are in clean build mode, where |
1410 |
# we've cd'd to a temp directory. |
1567 |
# we have cd'd to a temp directory. |
|
|
1568 |
common="$orig_pwd$path_sep$in_dir$path_sep" |
1569 |
# |
1570 |
# If we have any includes, put those at the end. |
1571 |
# Keep a final path_sep to get the default (system) TeX directories included. |
1411 |
txincludes=`list_infix includes $path_sep` |
1572 |
txincludes=`list_infix includes $path_sep` |
1412 |
common="$orig_pwd$path_sep$in_dir$path_sep$txincludes$path_sep" |
1573 |
test -n "$txincludes" && common="$common$txincludes$path_sep" |
|
|
1574 |
# |
1413 |
for var in $tex_envvars; do |
1575 |
for var in $tex_envvars; do |
1414 |
eval val="\$common\$${var}_orig" |
1576 |
eval val="\$common\$${var}_orig" |
1415 |
# Convert relative paths to absolute paths, so we can run in another |
1577 |
# Convert relative paths to absolute paths, so we can run in another |
Lines 1505-1542
Link Here
|
1505 |
;; |
1667 |
;; |
1506 |
esac |
1668 |
esac |
1507 |
|
1669 |
|
1508 |
# This recognizes --quark as --quiet. So what. |
1670 |
# This recognizes --quark as --quiet. Oh well. |
1509 |
case "$1" in |
1671 |
case "$1" in |
1510 |
-@ ) escape=@;; |
1672 |
-@ ) escape=@;; |
|
|
1673 |
-~ ) catcode_special=false;; |
1511 |
# Silently and without documentation accept -b and --b[atch] as synonyms. |
1674 |
# Silently and without documentation accept -b and --b[atch] as synonyms. |
1512 |
-b | --batch) batch=true;; |
1675 |
-b | --batch) batch=true;; |
1513 |
--build) shift; build_mode=$1;; |
1676 |
--build) shift; build_mode=$1;; |
1514 |
--build-dir) shift; build_dir=$1; build_mode=tidy;; |
1677 |
--build-dir) shift; build_dir=$1; build_mode=tidy;; |
1515 |
-c | --clean) build_mode=clean;; |
1678 |
-c | --clean) build_mode=clean;; |
1516 |
-D | --debug) debug=true;; |
1679 |
-D | --debug) debug=true;; |
1517 |
--dvi) out_lang=dvi;; |
1680 |
-e | -E | --expand) expand=true;; |
1518 |
--dvipdf) out_lang=dvipdf;; |
|
|
1519 |
-e | -E | --expand) expand=t;; |
1520 |
-h | --help) usage;; |
1681 |
-h | --help) usage;; |
1521 |
--html) out_lang=html;; |
|
|
1522 |
-I) shift; list_concat_dirs includes "$1";; |
1682 |
-I) shift; list_concat_dirs includes "$1";; |
1523 |
--info) out_lang=info;; |
|
|
1524 |
-l | --lang | --language) shift; set_language=$1;; |
1683 |
-l | --lang | --language) shift; set_language=$1;; |
1525 |
--mostly-clean) action=mostly-clean;; |
1684 |
--mostly-clean) action=mostly-clean;; |
1526 |
--no-line-error) no_line_error=true;; |
1685 |
--no-line-error) line_error=false;; |
|
|
1686 |
--max-iterations) shift; max_iters=$1;; |
1527 |
-o | --out | --output) |
1687 |
-o | --out | --output) |
1528 |
shift |
1688 |
shift |
1529 |
# Make it absolute, just in case we also have --clean, or whatever. |
1689 |
# Make it absolute, just in case we also have --clean, or whatever. |
1530 |
oname=`absolute "$1"`;; |
1690 |
oname=`absolute "$1"`;; |
1531 |
-p | --pdf) out_lang=pdf;; |
1691 |
|
1532 |
--ps) out_lang=ps;; |
1692 |
# Output formats. |
|
|
1693 |
-O|--output-format) shift; out_lang_set "$1";; |
1694 |
--dvi|--dvipdf|--html|--info|--pdf|--ps|--text) |
1695 |
out_lang_set `echo "x$1" | sed 's/^x--//'`;; |
1696 |
|
1697 |
-p) out_lang_set pdf;; |
1533 |
-q | -s | --quiet | --silent) quiet=true; batch=true;; |
1698 |
-q | -s | --quiet | --silent) quiet=true; batch=true;; |
1534 |
-r | --recode) recode=true;; |
1699 |
-r | --recode) recode=true;; |
1535 |
--recode-from) shift; recode=true; recode_from="$1";; |
1700 |
--recode-from) shift; recode=true; recode_from="$1";; |
1536 |
--src-specials) src_specials=--src-specials;; |
1701 |
--src-specials) src_specials=--src-specials;; |
|
|
1702 |
--tex4ht) latex2html=tex4ht;; |
1537 |
-t | --texinfo | --command ) shift; textra="$textra\\ |
1703 |
-t | --texinfo | --command ) shift; textra="$textra\\ |
1538 |
"`echo "$1" | sed 's/\\\\/\\\\\\\\/g'`;; |
1704 |
"`echo "$1" | sed 's/\\\\/\\\\\\\\/g'`;; |
1539 |
--text) out_lang=text;; |
|
|
1540 |
--translate-file ) shift; translate_file="$1";; |
1705 |
--translate-file ) shift; translate_file="$1";; |
1541 |
--tidy) build_mode=tidy;; |
1706 |
--tidy) build_mode=tidy;; |
1542 |
-v | --vers*) version;; |
1707 |
-v | --vers*) version;; |
Lines 1544-1556
Link Here
|
1544 |
--) # What remains are not options. |
1709 |
--) # What remains are not options. |
1545 |
shift |
1710 |
shift |
1546 |
while test x"$1" != x"$arg_sep"; do |
1711 |
while test x"$1" != x"$arg_sep"; do |
1547 |
set dummy ${1+"$@"} "$1"; shift |
1712 |
set dummy ${1+"$@"} "$1"; shift |
1548 |
shift |
1713 |
shift |
1549 |
done |
1714 |
done |
1550 |
break;; |
1715 |
break;; |
1551 |
-*) |
1716 |
-*) |
1552 |
error 1 "Unknown or ambiguous option \`$1'." \ |
1717 |
error 1 "Unknown or ambiguous option \`$1'." \ |
1553 |
"Try \`--help' for more information." |
1718 |
"Try \`--help' for more information." |
1554 |
;; |
1719 |
;; |
1555 |
*) set dummy ${1+"$@"} "$1"; shift;; |
1720 |
*) set dummy ${1+"$@"} "$1"; shift;; |
1556 |
esac |
1721 |
esac |
Lines 1677-1689
Link Here
|
1677 |
# Let AUC-TeX error parser deal with line numbers. |
1842 |
# Let AUC-TeX error parser deal with line numbers. |
1678 |
line_error=false |
1843 |
line_error=false |
1679 |
command_line_filename=`\ |
1844 |
command_line_filename=`\ |
1680 |
expr X"$command_line_filename" : X'.*input{\([^}]*\)}'` |
1845 |
expr X"$command_line_filename" : X'.*input{\([^}]*\)}'` |
1681 |
;; |
1846 |
;; |
1682 |
esac |
1847 |
esac |
1683 |
|
1848 |
|
1684 |
# If the COMMAND_LINE_FILENAME is not absolute (e.g., --debug.tex), |
1849 |
# If the COMMAND_LINE_FILENAME is not absolute (e.g., --debug.tex), |
1685 |
# prepend `./' in order to avoid that the tools take it as an option. |
1850 |
# prepend `./' in order to avoid that the tools take it as an option. |
1686 |
echo "$command_line_filename" | $EGREP '^(/|[A-z]:/)' >&6 \ |
1851 |
echo "$command_line_filename" | $EGREP '^(/|[A-Za-z]:/)' >&6 \ |
1687 |
|| command_line_filename="./$command_line_filename" |
1852 |
|| command_line_filename="./$command_line_filename" |
1688 |
|
1853 |
|
1689 |
# See if the file exists. If it doesn't we're in trouble since, even |
1854 |
# See if the file exists. If it doesn't we're in trouble since, even |
Lines 1704-1710
Link Here
|
1704 |
# Strip directory part but leave extension. |
1869 |
# Strip directory part but leave extension. |
1705 |
in_base=`basename "$command_line_filename"` |
1870 |
in_base=`basename "$command_line_filename"` |
1706 |
# Strip extension. |
1871 |
# Strip extension. |
1707 |
in_noext=`echo "$in_base" | sed 's/\.[^.]*$//'` |
1872 |
in_noext=`noext "$in_base"` |
1708 |
|
1873 |
|
1709 |
# The normalized file name to compile. Must always point to the |
1874 |
# The normalized file name to compile. Must always point to the |
1710 |
# file to actually compile (in case of recoding, macro-expansion etc.). |
1875 |
# file to actually compile (in case of recoding, macro-expansion etc.). |
Lines 1720-1726
Link Here
|
1720 |
out_dir=`func_dirname "$out_name"` |
1885 |
out_dir=`func_dirname "$out_name"` |
1721 |
out_dir_abs=`absolute "$out_dir"` |
1886 |
out_dir_abs=`absolute "$out_dir"` |
1722 |
out_base=`basename "$out_name"` |
1887 |
out_base=`basename "$out_name"` |
1723 |
out_noext=`echo "$out_base" | sed 's/\.[^.]*$//'` |
1888 |
out_noext=`noext "$out_base"` |
1724 |
} |
1889 |
} |
1725 |
|
1890 |
|
1726 |
|
1891 |
|
Lines 1742-1752
Link Here
|
1742 |
case $build_dir in |
1907 |
case $build_dir in |
1743 |
'' | . ) t2ddir=$out_noext.t2d ;; |
1908 |
'' | . ) t2ddir=$out_noext.t2d ;; |
1744 |
*) # Avoid collisions between multiple occurrences of the same |
1909 |
*) # Avoid collisions between multiple occurrences of the same |
1745 |
# file. The sed expression is fragile if the cwd has |
1910 |
# file, so depend on the output path. Remove leading `./', |
1746 |
# active characters. |
1911 |
# at least to avoid creating a file starting with `.!', i.e., |
1747 |
t2ddir=$build_dir/`echo "$out_dir_abs/$out_noext.t2d" | |
1912 |
# an invisible file. The sed expression is fragile if the cwd |
1748 |
sed "s,^$orig_pwd/,," | |
1913 |
# has active characters. Transform / into ! so that we don't |
1749 |
sed 's,/,!,g'` |
1914 |
# need `mkdir -p'. It might be something to reconsider. |
|
|
1915 |
t2ddir=$build_dir/`echo "$out_dir_abs/$out_noext.t2d" | |
1916 |
sed "s,^$orig_pwd/,,;s,^\./,,;s,/,!,g"` |
1750 |
esac |
1917 |
esac |
1751 |
# Remove it at exit if clean mode. |
1918 |
# Remove it at exit if clean mode. |
1752 |
trap "cleanup" 0 1 2 15 |
1919 |
trap "cleanup" 0 1 2 15 |