OSDN Git Service

2000-08-31 J. David Anglin <dave@hiauly1.hia.nrc.ca>
[pf3gnuchains/gcc-fork.git] / texinfo / util / fixfonts
1 #!/bin/sh
2 # Make links named `lcircle10' for all TFM and GF/PK files, if no
3 # lcircle10 files already exist.
4
5 # Don't override definition of prefix and/or libdir if they are
6 # already defined in the environment. 
7 if test "z${prefix}" = "z" ; then
8   prefix=/usr/local
9 else
10   # prefix may contain references to other variables, thanks to make.
11   eval prefix=\""${prefix}"\"
12 fi
13
14 if test "z${libdir}" = "z" ; then
15   libdir="${prefix}/lib/tex"
16 else
17   # libdir may contain references to other variables, thanks to make.
18   eval libdir=\""${libdir}"\"
19 fi
20
21 texlibdir="${libdir}"
22 texfontdir="${texlibdir}/fonts"
23
24 # Directories for the different font formats, in case they're not all
25 # stored in one place.
26 textfmdir="${textfmdir-${texfontdir}}"
27 texpkdir="${texpkdir-${texfontdir}}"
28 texgfdir="${texgfdir-${texfontdir}}"
29
30 test "z${TMPDIR}" = "z" && TMPDIR="/tmp"
31
32 tempfile="${TMPDIR}/circ$$"
33 tempfile2="${TMPDIR}/circ2$$"
34
35 # EXIT SIGHUP SIGINT SIGQUIT SIGTERM
36 #trap 'rm -f "${tempfile}" "${tempfile2}"' 0 1 2 3 15
37
38 # Find all the fonts with names that include `circle'.
39 (cd "${texfontdir}"; find . -name '*circle*' -print > "${tempfile}")
40
41 # If they have lcircle10.tfm, assume everything is there, and quit.
42 if grep 'lcircle10\.tfm' "${tempfile}" > /dev/null 2>&1 ; then
43   echo "Found lcircle10.tfm."
44   exit 0
45 fi
46
47 # No TFM file for lcircle.  Make a link to circle10.tfm if it exists,
48 # and then make a link to the bitmap files.
49 grep 'circle10\.tfm' "${tempfile}" > "${tempfile2}" \
50  || {
51   echo "I can't find any circle fonts in ${texfontdir}.
52 If it isn't installed somewhere else, you need to get the Metafont sources
53 from somewhere, e.g., labrea.stanford.edu:pub/tex/latex/circle10.mf, and
54 run Metafont on them."
55   exit 1
56  }
57
58 # We have circle10.tfm.  (If we have it more than once, take the first
59 # one.)  Make the link.
60 tempfile2_line1="`sed -ne '1p;q' \"${tempfile2}\"`"
61 ln "${tempfile2_line1}" "${textfmdir}/lcircle10.tfm"
62 echo "Linked to ${tempfile2_line1}."
63
64 # Now make a link for the PK files, if any.
65 (cd "${texpkdir}"
66  for f in `grep 'circle10.*pk' "${tempfile}"` ; do
67     set - `echo "$f" \
68             | sed -ne '/\//!s/^/.\//;s/\(.*\)\/\([^\/][^\/]*\)$/\1 \2/;p'`
69     ln "$f" "${1}/l${2}"
70     echo "Linked to $f."
71  done
72 )
73
74 # And finally for the GF files.
75 (cd "${texgfdir}"
76  for f in `grep 'circle10.*gf' "${tempfile}"` ; do
77     set - `echo "$f" \
78             | sed -ne '/\//!s/^/.\//;s/\(.*\)\/\([^\/][^\/]*\)$/\1 \2/;p'`
79     ln "$f" "${1}/l${2}"
80     echo "Linked to $f."
81  done
82 )
83
84 # eof