| 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. |
| 4 |
# |
| 5 |
# Originally written by Thomas Esser. Public domain. |
| 6 |
# $Id: mktex.opt 34656 2014-07-18 23:38:50Z karl $ |
| 7 |
|
| 8 |
if test "x$1" = x--help || test "x$1" = x-help; then |
| 9 |
echo "$usage" |
| 10 |
exit 0 |
| 11 |
elif test "x$1" = x--version || test "x$1" = x-version; then |
| 12 |
echo "$0 $version" |
| 13 |
kpsewhich --version |
| 14 |
exit 0 |
| 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 |
| 18 |
exit 1 |
| 19 |
elif test $# -gt ${mt_max_args-1}; then |
| 20 |
num=$# |
| 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 |
| 24 |
exit 1 |
| 25 |
fi |
| 26 |
|
| 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. |
| 31 |
DOSISH=no |
| 32 |
case `uname -s` in |
| 33 |
CYGWIN*|Cygwin*|cygwin*) ;; |
| 34 |
*) if test -n "$COMSPEC" || test -n "$ComSpec"; then DOSISH=yes; fi |
| 35 |
esac |
| 36 |
if test "$DOSISH" = "no"; then SEP=':'; else SEP=';';fi |
| 37 |
|
| 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" |
| 42 |
else |
| 43 |
TEMPDIR="/tmp/mt$$.tmp" |
| 44 |
fi |
| 45 |
|
| 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" |
| 49 |
|
| 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 |
| 53 |
|
| 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 |
| 58 |
# cannot be removed. |
| 59 |
trap 'rc=$?; cd /; cd "$KPSE_DOT"; test -f "$STDOUT" && cat "$STDOUT"; rm -rf "$TEMPDIR"; exit $rc' \ |
| 60 |
0 1 2 3 7 13 15 |
| 61 |
|
| 62 |
(umask 077 && mkdir "$TEMPDIR") || exit 1 |
| 63 |
cd "$TEMPDIR" || exit 1 |
| 64 |
|
| 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' |
| 71 |
fi |
| 72 |
|
| 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" |
| 84 |
|
| 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.' |
| 90 |
|
| 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" |
| 98 |
|
| 99 |
# Possible features: appendonlydir dosnames fontmaps nomfdrivers nomode |
| 100 |
# stripsupplier striptypeface texmfvar varfonts. |
| 101 |
if test "$DOSISH" = "yes"; then |
| 102 |
: ${MT_FEATURES=appendonlydir:dosnames} |
| 103 |
else |
| 104 |
: ${MT_FEATURES=appendonlydir} |
| 105 |
fi |
| 106 |
: ${MODE=ljfour} |
| 107 |
: ${BDPI=600} |
| 108 |
: ${DPI=600} |
| 109 |
: ${MAG=1.0} |
| 110 |
: ${ps_to_pk=gsftopk} # some prefer ps2pk |
| 111 |
|
| 112 |
# Allow fonts to be read and written (especially in case we make |
| 113 |
# directories) by everyone. |
| 114 |
umask 0 |
| 115 |
|
| 116 |
# As of TL24, the --output-directory option sets the |
| 117 |
# TEXMF_OUTPUT_DIRECTORY envvar, so subprograms can see the value. |
| 118 |
# But we want mktexpk and the like to still output in their normal |
| 119 |
# locations (TEXMFVAR-ish), as they always have. |
| 120 |
# |
| 121 |
# Don't try to unset it unless it's set. (Don't worry about it being set |
| 122 |
# to the empty string, which can't do anything useful anyway.) |
| 123 |
test -n "$TEXMF_OUTPUT_DIRECTORY" && unset TEXMF_OUTPUT_DIRECTORY |
| 124 |
|
| 125 |
# Cache values that may be useful for recursive calls. |
| 126 |
export MT_MKTEX_OPT MT_MKTEX_CNF |
| 127 |
export MT_MKTEXNAM MT_MKTEXNAM_OPT |
| 128 |
export MT_MKTEXDIR MT_MKTEXDIR_OPT |
| 129 |
export MT_MKTEXUPD |
| 130 |
export MT_TEXMFMAIN MT_VARTEXFONTS |