/[gentoo-alt]/trunk/prefix/eclass/tetex-3.eclass
Gentoo

Contents of /trunk/prefix/eclass/tetex-3.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 982 - (show annotations) (download)
Thu Feb 2 04:20:17 2006 UTC (13 years, 2 months ago) by kito
File size: 5003 byte(s)
Initial eclass import from gentoo-x86
1 # Copyright 1999-2006 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/tetex-3.eclass,v 1.10 2006/02/01 19:49:49 ehmsen Exp $
4 #
5 # Author: Jaromir Malenko <malenko@email.cz>
6 # Author: Mamoru KOMACHI <usata@gentoo.org>
7 # Author: Martin Ehmsen <ehmsen@gentoo.org>
8 # Author: Alexandre Buisse <nattfodd@gentoo.org>
9 #
10 # A generic eclass to install tetex 3.x distributions.
11
12 TEXMF_PATH=/var/lib/texmf
13
14 inherit tetex
15
16 EXPORT_FUNCTIONS pkg_setup src_unpack src_compile src_install pkg_preinst pkg_postinst
17
18 IUSE="X Xaw3d lesstif motif neXt"
19
20 DEPEND="X? ( motif? ( lesstif? ( x11-libs/lesstif )
21 !lesstif? ( x11-libs/openmotif ) )
22 !motif? ( neXt? ( x11-libs/neXtaw )
23 !neXt? ( Xaw3d? ( x11-libs/Xaw3d ) ) )
24 !app-text/xdvik
25 )
26 !dev-tex/memoir
27 !dev-tex/lineno
28 !dev-tex/SIunits
29 !dev-tex/floatflt
30 !dev-tex/g-brief
31 !dev-tex/pgf
32 !dev-tex/xcolor
33 !dev-tex/xkeyval
34 !dev-tex/latex-beamer
35 !dev-tex/vntex"
36
37 tetex-3_pkg_setup() {
38 tetex_pkg_setup
39
40 ewarn
41 ewarn "teTeX 3.0 ebuild will remove config files stored in /usr/share/texmf."
42 ewarn "Please make a backup before upgrading if you changed anything."
43 ewarn
44
45 ebeep
46 epause
47 }
48
49 tetex-3_src_unpack() {
50
51 tetex_src_unpack
52
53 # create update script
54 cat >${T}/texmf-update<<'EOF'
55 #!/bin/bash
56 #
57 # Utility to update Gentoo teTeX distribution configuration files
58 #
59
60 PATH=/bin:/usr/bin
61
62 for conf in texmf.cnf fmtutil.cnf updmap.cfg
63 do
64 if [ -d "/etc/texmf/${conf/.*/.d}" ]
65 then
66 echo "Generating /etc/texmf/web2c/${conf} from /etc/texmf/${conf/.*/.d} ..."
67 cat /etc/texmf/${conf/.*/.d}/* > "/etc/texmf/web2c/${conf}"
68 fi
69 done
70
71 # configure
72 echo "Configuring teTeX ..."
73 mktexlsr &>/dev/null
74 texconfig-sys init &>/dev/null
75 texconfig-sys confall &>/dev/null
76 texconfig-sys font rw &>/dev/null
77 texconfig-sys font vardir /var/cache/fonts &>/dev/null
78 updmap-sys &>/dev/null
79
80 # generate
81 echo "Generating format files ..."
82 fmtutil-sys --missing &>/dev/null
83 echo
84 echo "Use 'texconfig font ro' to disable font generation for users"
85 echo
86 EOF
87
88 # need to fix up the hyperref driver, see bug #31967
89 sed -i -e "/providecommand/s/hdvips/hypertex/" \
90 ${S}/texmf/tex/latex/hyperref/hyperref.cfg
91 }
92
93 tetex-3_src_compile() {
94 sed -i -e "/mktexlsr/,+3d" \
95 -e "s/\(updmap-sys\)/\1 --nohash/" \
96 Makefile.in || die
97
98 use amd64 && replace-flags "-O3" "-O2"
99
100 if use X ; then
101 if use motif ; then
102 if use lesstif ; then
103 append-ldflags -L/usr/X11R6/lib/lesstif -R/usr/X11R6/lib/lesstif
104 export CPPFLAGS="${CPPFLAGS} -I/usr/X11R6/include/lesstif"
105 fi
106 toolkit="motif"
107 elif use neXt ; then
108 toolkit="neXtaw"
109 elif use Xaw3d ; then
110 toolkit="xaw3d"
111 else
112 toolkit="xaw"
113 fi
114
115 TETEX_ECONF="${TETEX_ECONF} --with-xdvi-x-toolkit=${toolkit}"
116 fi
117
118 tetex_src_compile
119 }
120
121 tetex-3_src_install() {
122
123 tetex_src_install
124
125 dodir /etc/env.d
126 echo 'CONFIG_PROTECT_MASK="/etc/texmf/web2c"' > ${D}/etc/env.d/98tetex
127 # populate /etc/texmf
128 keepdir /etc/texmf/web2c
129 cd ${D}/usr/share/texmf # not ${TEXMF_PATH}
130 for d in $(find . -name config -type d | sed -e "s:\./::g") ; do
131 dodir /etc/texmf/${d}
132 for f in $(find ${D}usr/share/texmf/$d -maxdepth 1 -mindepth 1); do
133 mv $f ${D}/etc/texmf/$d || die "mv $f failed"
134 dosym /etc/texmf/$d/$(basename $f) /usr/share/texmf/$d/$(basename $f)
135 done
136 done
137 cd -
138 cd ${D}${TEXMF_PATH}
139 for f in $(find . -name '*.cnf' -o -name '*.cfg' -type f | sed -e "s:\./::g") ; do
140 if [ "${f/config/}" != "${f}" ] ; then
141 continue
142 fi
143 dodir /etc/texmf/$(dirname $f)
144 mv ${D}${TEXMF_PATH}/$f ${D}/etc/texmf/$(dirname $f) || die "mv $f failed."
145 dosym /etc/texmf/$f ${TEXMF_PATH}/$f
146 done
147
148 # take care of updmap.cfg, fmtutil.cnf and texmf.cnf
149 dodir /etc/texmf/{updmap.d,fmtutil.d,texmf.d}
150 #cp ${D}/usr/share/texmf/web2c/updmap.cfg ${D}/etc/texmf/updmap.d/00updmap.cfg
151 dosym /etc/texmf/web2c/updmap.cfg ${TEXMF_PATH}/web2c/updmap.cfg
152 mv ${D}/usr/share/texmf/web2c/updmap.cfg ${D}/etc/texmf/updmap.d/00updmap.cfg
153 mv ${D}/etc/texmf/web2c/fmtutil.cnf ${D}/etc/texmf/fmtutil.d/00fmtutil.cnf
154 mv ${D}/etc/texmf/web2c/texmf.cnf ${D}/etc/texmf/texmf.d/00texmf.cnf
155
156 # xdvi
157 if useq X ; then
158 dodir /etc/X11/app-defaults /etc/texmf/xdvi
159 mv ${D}${TEXMF_PATH}/xdvi/XDvi ${D}/etc/X11/app-defaults || die "mv XDvi failed"
160 dosym /etc/X11/app-defaults/XDvi ${TEXMF_PATH}/xdvi/XDvi
161 fi
162 cd -
163 }
164
165 tetex-3_pkg_preinst() {
166
167 ewarn "Removing ${ROOT}usr/share/texmf/web2c"
168 rm -rf "${ROOT}usr/share/texmf/web2c"
169
170 # take care of config protection, upgrade from <=tetex-2.0.2-r4
171 for conf in updmap.cfg texmf.cnf fmtutil.cnf
172 do
173 if [ ! -d "${ROOT}etc/texmf/${conf/.*/.d}" -a -f "${ROOT}etc/texmf/${conf}" ]
174 then
175 mkdir "${ROOT}etc/texmf/${conf/.*/.d}"
176 cp "${ROOT}etc/texmf/${conf}" "${ROOT}etc/texmf/00${conf/.*/.d}"
177 fi
178 done
179 }
180
181 tetex-3_pkg_postinst() {
182
183 if [ "$ROOT" = "/" ] ; then
184 /usr/sbin/texmf-update
185 fi
186 einfo
187 einfo "If you have configuration files in /etc/texmf to merge,"
188 einfo "please update them and run /usr/sbin/texmf-update."
189 einfo
190 }

  ViewVC Help
Powered by ViewVC 1.1.20