summaryrefslogtreecommitdiff
path: root/print/teTeX3-bin/INSTALL
blob: f19132e6b7bb87032dbe71f34e0895eee45ead75 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
# $NetBSD: INSTALL,v 1.4 2006/04/07 16:19:15 minskim Exp $

case "${STAGE}" in
POST-INSTALL)
	${TEST} ! -x ./+TEXCONFIG || ./+TEXCONFIG PAPER 
	${TEST} ! -x ./+TETEX || ./+TETEX ADD
	;;
esac

#
# Generate a +TETEX script that updates the teTeX installation
# based on user-modifiable configuration files.
#
case "${STAGE},$1" in
UNPACK,|UNPACK,+TETEX)
	${CAT} > ./+TETEX << 'EOF'
#!@SH@
#
# +TETEX - teTeX installation update script
#
# Usage: ./+TETEX ADD|REMOVE

CAT="@CAT@"
ECHO="@ECHO@"
GREP="@GREP@"
RM="@RM@"
RMDIR="@RMDIR@"
TEST="@TEST@"
TRUE="@TRUE@"

SELF=$0
ACTION=$1
: ${PKG_PREFIX=@PREFIX@}

TEXFONTS_DIR="@TEXFONTSDIR@"
TEXMF_DISTDATADIR="${PKG_PREFIX}/share/texmf-dist"
TEXMF_DATADIR="${PKG_PREFIX}/share/texmf"
TEXMF_LOCALDATADIR="${PKG_PREFIX}/share/texmf-local"
TEXMF_VARDIR="${PKG_PREFIX}/share/texmf-var"

exitcode=0
case $ACTION in
ADD)
	# Create ls-R databases in all of the usual TeX directories.
	${TEST} ! -x ${PKG_PREFIX}/bin/mktexlsr ||
		${PKG_PREFIX}/bin/mktexlsr

	# Update teTeX installation to support different TeX formats.
	${TEST} ! -x ${PKG_PREFIX}/bin/fmtutil-sys ||
		${PKG_PREFIX}/bin/fmtutil-sys --all
	${TEST} ! -x ${PKG_PREFIX}/bin/texlinks ||
		${PKG_PREFIX}/bin/texlinks

	# Update the font map files for TeX output drivers.
	${TEST} ! -x ${PKG_PREFIX}/bin/updmap-sys ||
		${PKG_PREFIX}/bin/updmap-sys
	;;

REMOVE)
	# Remove the ls-R databases from the usual TeX directories
	# generated by mktexlsr.
	#
	${RM} -f ${TEXFONTS_DIR}/ls-R
	${RM} -f ${TEXMF_DISTDATADIR}/ls-R
	${RM} -f ${TEXMF_DATADIR}/ls-R
	${RM} -f ${TEXMF_LOCALDATADIR}/ls-R
	${RM} -f ${TEXMF_VARDIR}/ls-R

	# We inspect both the user-modified and distributed fmtutil.cnf
	# files because we want to ensure we remove bits corresponding
	# to both files.
	#
	FMTUTIL_CNF=
	for cnf in fmtutil.cnf.dist fmtutil.cnf; do
		file="${TEXMF_DATADIR}/web2c/$cnf"
		${TEST} ! -f "$file" ||
			FMTUTIL_CNF="${FMTUTIL_CNF} $file"
	done
	
	# Remove fmt, mem, and log files generated by fmtutil-sys.
	${TEST} -z "${FMTUTIL_CNF}" ||
	${CAT} ${FMTUTIL_CNF} | ${GREP} "^[^#]" |
	while read format junk; do
		${RM} -f ${TEXMF_VARDIR}/web2c/$format.base
		${RM} -f ${TEXMF_VARDIR}/web2c/$format.fmt
		${RM} -f ${TEXMF_VARDIR}/web2c/$format.log
		${RM} -f ${TEXMF_VARDIR}/web2c/$format.mem
	done

	# Remove engines generated by texlinks.  This is related to the
	# install_link() function in texlinks.
	#
	${TEST} -z "${FMTUTIL_CNF}" ||
	${CAT} ${FMTUTIL_CNF} | ${GREP} "^[^#]" |
	while read format engine junk; do
		case "$format" in
		cont-??|metafun|mptopdf)
			;;
		*)
			 ${TEST} "$format" = "$engine" ||
				${RM} -f ${PKG_PREFIX}/bin/$format
			;;
		esac
	done

	# Remove font map files generated by updmap-sys.  The list of
	# files is taken from the updmap man page and matches the
	# "output files" for updmap.
	#
	${RM} -f ${TEXMF_VARDIR}/fonts/map/dvipdfm/updmap/dvipdfm.map
	${RM} -f ${TEXMF_VARDIR}/fonts/map/dvipdfm/updmap/dvipdfm_dl14.map
	${RM} -f ${TEXMF_VARDIR}/fonts/map/dvipdfm/updmap/dvipdfm_ndl14.map
	${RM} -f ${TEXMF_VARDIR}/fonts/map/dvips/updmap/builtin35.map
	${RM} -f ${TEXMF_VARDIR}/fonts/map/dvips/updmap/download35.map
	${RM} -f ${TEXMF_VARDIR}/fonts/map/dvips/updmap/ps2pk.map
	${RM} -f ${TEXMF_VARDIR}/fonts/map/dvips/updmap/psfonts.map
	${RM} -f ${TEXMF_VARDIR}/fonts/map/dvips/updmap/psfonts_pk.map
	${RM} -f ${TEXMF_VARDIR}/fonts/map/dvips/updmap/psfonts_t1.map
	${RM} -f ${TEXMF_VARDIR}/fonts/map/pdftex/updmap/pdftex.map
	${RM} -f ${TEXMF_VARDIR}/fonts/map/pdftex/updmap/pdftex_dl14.map
	${RM} -f ${TEXMF_VARDIR}/fonts/map/pdftex/updmap/pdftex_ndl14.map
	${RM} -f ${TEXMF_VARDIR}/web2c/updmap.log

	# Remove stray directores.
	for dir in							\
		${TEXMF_VARDIR}/web2c					\
		${TEXMF_VARDIR}/fonts/map/dvipdfm/updmap		\
		${TEXMF_VARDIR}/fonts/map/dvips/updmap			\
		${TEXMF_VARDIR}/fonts/map/pdftex/updmap
	do
		${RMDIR} -p "$dir" 2>/dev/null || ${TRUE}
	done
	;;

*)
	${ECHO} "Usage: ./+TETEX ADD|REMOVE [metadatadir]"
	;;
esac
exit $exitcode
EOF
	${CHMOD} +x ./+TETEX
	;;
esac

#
# Generate a +TEXCONFIG script sets the initial font and papersize
# settings for the teTeX installation.
#
case "${STAGE},$1" in
UNPACK,|UNPACK,+TEXCONFIG)
	${CAT} > ./+TEXCONFIG << 'EOF'
#!@SH@
#
# +TEXCONFIG - default font and papersize settings for teTeX
#
# Usage: ./+TEXCONFIG FONTS [fontdir]
#        ./+TEXCONFIG PAPER [papersize]

ECHO="@ECHO@"
TEST="@TEST@"

SELF=$0
ACTION=$1
: ${PKG_PREFIX=@PREFIX@}

TEXCONFIG="${PKG_PREFIX}/bin/texconfig"

exitcode=0
case $ACTION in
FONTS)
	# Set the default texfonts directory to the specified directory.
	VARTEXFONTS="${2-@VARTEXFONTS@}"
	${TEST} ! -x ${TEXCONFIG} ||
		${TEXCONFIG} font vardir "$VARTEXFONTS"
	${TEST} ! -x ${TEXCONFIG} ||
		${TEXCONFIG} font rw
	;;

PAPER)
	# Set the paper size for dvips and xdvi to the specified papersize.
	PAPERSIZE="${2-@PAPERSIZE@}"
	PAPERSIZE_dvips="$PAPERSIZE"
	PAPERSIZE_xdvi="$PAPERSIZE"
	case "$PAPERSIZE" in
	letter)	PAPERSIZE_xdvi="us" ;;
	us)	PAPERSIZE_dvips="letter" ;;
	esac
	${TEST} ! -x ${TEXCONFIG} ||
		${TEXCONFIG} dvips paper $PAPERSIZE_dvips
	${TEST} ! -x ${TEXCONFIG} ||
		${TEXCONFIG} xdvi paper $PAPERSIZE_xdvi
	;;

*)
	${ECHO} "Usage: ./+TEXCONFIG FONTS [fontdir]"
	${ECHO} "       ./+TEXCONFIG PAPER [papersize]"
	;;
esac
exit $exitcode
EOF
	${CHMOD} +x ./+TEXCONFIG
	;;
esac