1 # mktex.opt -- common mktex* options, etc.
2 # Meant to be sourced after $usage, $version, and $MT_TEXMFMAIN have been set.
4 # Originally written by Thomas Esser. Public domain.
5 # $Id: mktex.opt 18383 2010-05-20 18:31:24Z karl $
7 if test "x$1" = x--help || test "x$1" = x-help; then
10 elif test "x$1" = x--version || test "x$1" = x-version; then
11 echo "`basename $0` $version"
14 elif test $# -lt ${mt_min_args-1}; then
15 echo "$0: Missing argument(s)." >&2
16 echo "Try \``basename $0` --help' for more information." >&2
18 elif test $# -gt ${mt_max_args-1}; then
20 while test $# -gt `expr $num - ${mt_max_args-1}`; do shift; done
21 echo "$0: Extra arguments $*." >&2
22 echo "Try \``basename $0` --help' for more information." >&2
26 # MS-DOS and MS-Windows define $COMSPEC or $ComSpec and use `;' to separate
27 # directories in path lists whereas Unix uses `:'. Make an exception for
28 # Cygwin, which pretends to be UNIX.
29 # Create a variable that holds the right character to be used by the scripts.
32 CYGWIN*|Cygwin*|cygwin*) ;;
33 *) if test -n "$COMSPEC" || test -n "$ComSpec"; then DOSISH=yes; fi
35 if test "$DOSISH" = "no"; then SEP=':'; else SEP=';';fi
37 # TEMPDIR needs to be unique to each process because of the possibility of two
38 # people running dvips (or whatever) simultaneously.
39 if test -n "$TMPDIR"; then
40 TEMPDIR="${TMPDIR}/mt$$.tmp"
42 TEMPDIR="/tmp/mt$$.tmp"
45 # We want to output only filenames to standard output, but it's too
46 # error-prone to write the scripts that way, so we direct stdout here.
47 STDOUT="$TEMPDIR/mt$$.out"
49 # We will change search paths to include $KPSE_DOT. This is necessary
50 # since we cd to $TEMPDIR.
51 : ${KPSE_DOT=`pwd`}; export KPSE_DOT
53 # Clean up on normal or abnormal exit.
54 # The "cd /" is for MS-DOS and MS-Windows, where there is a separate
55 # current directory on each drive, and therefore "cd $KPSE_DOT" might
56 # still leave $TMPDIR current directory on its drive, in which case it
58 trap 'rc=$?; cd /; cd "$KPSE_DOT"; test -f "$STDOUT" && cat "$STDOUT"; rm -rf "$TEMPDIR"; exit $rc' \
61 (umask 077 && mkdir "$TEMPDIR") || exit 1
62 cd "$TEMPDIR" || exit 1
64 # The alternative location for fonts. The directory need not exist,
65 # so we use --expand-var here. We also perform a sanity check.
66 : ${MT_VARTEXFONTS=`kpsewhich --expand-var='$VARTEXFONTS' | sed 's%^!!%%'`}
67 if test -z "$MT_VARTEXFONTS"; then
68 echo "$0: VARTEXFONTS is not defined. Defaulting to \`$KPSE_DOT'." >&2
69 MT_VARTEXFONTS='$KPSE_DOT'
72 # The supporting scripts:
73 : ${MT_MKTEXNAM=`kpsewhich --format='web2c files' mktexnam`}
74 test -n "$MT_MKTEXNAM" || MT_MKTEXNAM="$MT_TEXMFMAIN/web2c/mktexnam"
75 : ${MT_MKTEXNAM_OPT=`kpsewhich --format='web2c files' mktexnam.opt`}
76 test -n "$MT_MKTEXNAM_OPT" || MT_MKTEXNAM_OPT="$MT_TEXMFMAIN/web2c/mktexnam.opt"
77 : ${MT_MKTEXDIR=`kpsewhich --format='web2c files' mktexdir`}
78 test -n "$MT_MKTEXDIR" || MT_MKTEXDIR="$MT_TEXMFMAIN/web2c/mktexdir"
79 : ${MT_MKTEXDIR_OPT=`kpsewhich --format='web2c files' mktexdir.opt`}
80 test -n "$MT_MKTEXDIR_OPT" || MT_MKTEXDIR_OPT="$MT_TEXMFMAIN/web2c/mktexdir.opt"
81 : ${MT_MKTEXUPD=`kpsewhich --format='web2c files' mktexupd`}
82 test -n "$MT_MKTEXUPD" || MT_MKTEXUPD="$MT_TEXMFMAIN/web2c/mktexupd"
84 # mktexupd and mktexlsr make sure they're coordinated via this. A copy of
85 # the first string is found in mktexlsr.
86 ls_R_magic='% ls-R -- filename database for kpathsea; do not change this line.'
87 # Old ls-R files should continue to work.
88 old_ls_R_magic='% ls-R -- maintained by MakeTeXls-R; do not change this line.'
90 # Read defaults from mktex.cnf if that file exists. Can be used to
91 # overwrite anything defined below. Please use the same syntax as
92 # given here (e.g. ``: ${MODE=ljfour}'', not just ``MODE=ljfour'', as
93 # this can cause trouble (e.g. when the mode for mktexnam is
94 # already specified on the command line).
95 : ${MT_MKTEX_CNF=`kpsewhich --format='web2c files' mktex.cnf`}
96 test -n "$MT_MKTEX_CNF" && test -r "$MT_MKTEX_CNF" && . "$MT_MKTEX_CNF"
98 # Possible features: appendonlydir dosnames fontmaps nomfdrivers nomode
99 # stripsupplier striptypeface texmfvar varfonts.
100 if test "$DOSISH" = "yes"; then
101 : ${MT_FEATURES=appendonlydir:dosnames}
103 : ${MT_FEATURES=appendonlydir}
109 : ${ps_to_pk=gsftopk} # some prefer ps2pk
111 # Allow fonts to be read and written (especially in case we make
112 # directories) by everyone.
115 # Cache values that may be useful for recursive calls.
116 export MT_MKTEX_OPT MT_MKTEX_CNF
117 export MT_MKTEXNAM MT_MKTEXNAM_OPT
118 export MT_MKTEXDIR MT_MKTEXDIR_OPT
120 export MT_TEXMFMAIN MT_VARTEXFONTS