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