| 1 |
# Copyright 1999-2011 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.23 2011/08/02 05:52:04 mattst88 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 motif neXt"
|
| 19 |
|
| 20 |
DEPEND="X? ( motif? ( >=x11-libs/openmotif-2.3 )
|
| 21 |
!motif? ( neXt? ( x11-libs/neXtaw )
|
| 22 |
!neXt? ( Xaw3d? ( x11-libs/libXaw3d ) ) )
|
| 23 |
!app-text/xdvik
|
| 24 |
)
|
| 25 |
!dev-tex/memoir
|
| 26 |
!dev-tex/lineno
|
| 27 |
!dev-tex/SIunits
|
| 28 |
!dev-tex/floatflt
|
| 29 |
!dev-tex/g-brief
|
| 30 |
!dev-tex/koma-script"
|
| 31 |
|
| 32 |
RDEPEND="${DEPEND}"
|
| 33 |
|
| 34 |
tetex-3_pkg_setup() {
|
| 35 |
ewarn
|
| 36 |
ewarn "teTeX 3.0 ebuild will remove config files stored in /usr/share/texmf."
|
| 37 |
ewarn "Please make a backup before upgrading if you changed anything."
|
| 38 |
ewarn
|
| 39 |
|
| 40 |
ebeep
|
| 41 |
epause
|
| 42 |
}
|
| 43 |
|
| 44 |
tetex-3_src_unpack() {
|
| 45 |
|
| 46 |
tetex_src_unpack
|
| 47 |
|
| 48 |
# create update script
|
| 49 |
cat >${T}/texmf-update<<'EOF'
|
| 50 |
#!/bin/bash
|
| 51 |
#
|
| 52 |
# Utility to update Gentoo teTeX distribution configuration files
|
| 53 |
#
|
| 54 |
|
| 55 |
PATH=/bin:/usr/bin
|
| 56 |
|
| 57 |
# Fix for all those with altered umask for root
|
| 58 |
umask 022
|
| 59 |
|
| 60 |
# Make sure we have a correct environment, bug #30432
|
| 61 |
# The list of env. vars is taken from the INSTALL file
|
| 62 |
for texvar in AFMFONTS BIBINPUTS BSTINPUTS DVILJFONTS DVIPSFONTS \
|
| 63 |
DVIPSHEADERS GFFONTS GLYPHFONTS INDEXSTYLE MFBASES MFINPUTS \
|
| 64 |
MFPOOL MFTINPUTS MPINPUTS MPMEMS MPPOOL MPSUPPORT OCPINPUTS \
|
| 65 |
OFMFONTS OPLFONTS OTPINPUTS OVFFONTS OVPFONTS PKFONTS PSHEADERS \
|
| 66 |
T1FONTS T1INPUTS TEXBIB TEXCONFIG TEXDOCS TEXFONTMAPS TEXFONTS \
|
| 67 |
TEXFORMATS TEXINDEXSTYLE TEXINPUTS TEXMFCNF TEXMFDBS TEXMFINI \
|
| 68 |
TEXPICTS TEXPKS TEXPOOL TEXPSHEADERS TEXSOURCES TFMFONTS TRFONTS \
|
| 69 |
VFFONTS XDVIFONTS XDVIVFS ; do
|
| 70 |
|
| 71 |
if [ "${!texvar}" ]; then
|
| 72 |
if ! $(echo ${!texvar} | grep '^:\|::\|:$' &>/dev/null) ; then
|
| 73 |
export ${texvar}="${!texvar}:"
|
| 74 |
fi
|
| 75 |
fi
|
| 76 |
done
|
| 77 |
|
| 78 |
if [ "$TEXINPUTS" ]; then
|
| 79 |
if $(echo ${TEXINPUTS} | grep '/usr/share/texmf' &>/dev/null) ; then
|
| 80 |
export TEXINPUTS=$(echo ${TEXINPUTS} | sed -e 's|/usr/share/texmf/*:\?||g')
|
| 81 |
elif $(echo ${TEXINPUTS} | grep '/var/lib/texmf' &>/dev/null) ; then
|
| 82 |
export TEXINPUTS=$(echo ${TEXINPUTS} | sed -e 's|/var/lib/texmf/*:\?||g')
|
| 83 |
fi
|
| 84 |
fi
|
| 85 |
|
| 86 |
for conf in texmf.cnf fmtutil.cnf updmap.cfg
|
| 87 |
do
|
| 88 |
if [ -d "/etc/texmf/${conf/.*/.d}" ]
|
| 89 |
then
|
| 90 |
echo "Generating /etc/texmf/web2c/${conf} from /etc/texmf/${conf/.*/.d} ..."
|
| 91 |
cat /etc/texmf/${conf/.*/.d}/* > "/etc/texmf/web2c/${conf}"
|
| 92 |
fi
|
| 93 |
done
|
| 94 |
|
| 95 |
# configure
|
| 96 |
echo "Configuring teTeX ..."
|
| 97 |
mktexlsr &>/dev/null
|
| 98 |
texconfig-sys init &>/dev/null
|
| 99 |
texconfig-sys confall &>/dev/null
|
| 100 |
texconfig-sys font rw &>/dev/null
|
| 101 |
texconfig-sys font vardir /var/cache/fonts &>/dev/null
|
| 102 |
updmap-sys &>/dev/null
|
| 103 |
|
| 104 |
# generate
|
| 105 |
echo "Generating format files ..."
|
| 106 |
fmtutil-sys --missing &>/dev/null
|
| 107 |
echo
|
| 108 |
echo "Use 'texconfig font ro' to disable font generation for users"
|
| 109 |
echo
|
| 110 |
EOF
|
| 111 |
|
| 112 |
# need to fix up the hyperref driver, see bug #31967
|
| 113 |
sed -i -e "/providecommand/s/hdvips/hypertex/" \
|
| 114 |
${S}/texmf/tex/latex/hyperref/hyperref.cfg
|
| 115 |
}
|
| 116 |
|
| 117 |
tetex-3_src_compile() {
|
| 118 |
sed -i -e "/mktexlsr/,+3d" \
|
| 119 |
-e "s/\(updmap-sys\)/\1 --nohash/" \
|
| 120 |
Makefile.in || die
|
| 121 |
|
| 122 |
use amd64 && replace-flags "-O3" "-O2"
|
| 123 |
|
| 124 |
if use X ; then
|
| 125 |
if use motif ; then
|
| 126 |
toolkit="motif"
|
| 127 |
elif use neXt ; then
|
| 128 |
toolkit="neXtaw"
|
| 129 |
elif use Xaw3d ; then
|
| 130 |
toolkit="xaw3d"
|
| 131 |
else
|
| 132 |
toolkit="xaw"
|
| 133 |
fi
|
| 134 |
|
| 135 |
TETEX_ECONF="${TETEX_ECONF} --with-xdvi-x-toolkit=${toolkit}"
|
| 136 |
fi
|
| 137 |
|
| 138 |
tetex_src_compile
|
| 139 |
}
|
| 140 |
|
| 141 |
tetex-3_src_install() {
|
| 142 |
|
| 143 |
tetex_src_install
|
| 144 |
|
| 145 |
dodir /etc/env.d
|
| 146 |
echo 'CONFIG_PROTECT_MASK="/etc/texmf/web2c"' > ${D}/etc/env.d/98tetex
|
| 147 |
# populate /etc/texmf
|
| 148 |
keepdir /etc/texmf/web2c
|
| 149 |
cd ${D}/usr/share/texmf # not ${TEXMF_PATH}
|
| 150 |
for d in $(find . -name config -type d | sed -e "s:\./::g") ; do
|
| 151 |
dodir /etc/texmf/${d}
|
| 152 |
for f in $(find ${D}usr/share/texmf/$d -maxdepth 1 -mindepth 1); do
|
| 153 |
mv $f ${D}/etc/texmf/$d || die "mv $f failed"
|
| 154 |
dosym /etc/texmf/$d/$(basename $f) /usr/share/texmf/$d/$(basename $f)
|
| 155 |
done
|
| 156 |
done
|
| 157 |
cd -
|
| 158 |
cd ${D}${TEXMF_PATH}
|
| 159 |
for f in $(find . -name '*.cnf' -o -name '*.cfg' -type f | sed -e "s:\./::g") ; do
|
| 160 |
if [ "${f/config/}" != "${f}" ] ; then
|
| 161 |
continue
|
| 162 |
fi
|
| 163 |
dodir /etc/texmf/$(dirname $f)
|
| 164 |
mv ${D}${TEXMF_PATH}/$f ${D}/etc/texmf/$(dirname $f) || die "mv $f failed."
|
| 165 |
dosym /etc/texmf/$f ${TEXMF_PATH}/$f
|
| 166 |
done
|
| 167 |
|
| 168 |
# take care of updmap.cfg, fmtutil.cnf and texmf.cnf
|
| 169 |
dodir /etc/texmf/{updmap.d,fmtutil.d,texmf.d}
|
| 170 |
#cp ${D}/usr/share/texmf/web2c/updmap.cfg ${D}/etc/texmf/updmap.d/00updmap.cfg
|
| 171 |
dosym /etc/texmf/web2c/updmap.cfg ${TEXMF_PATH}/web2c/updmap.cfg
|
| 172 |
mv ${D}/usr/share/texmf/web2c/updmap.cfg ${D}/etc/texmf/updmap.d/00updmap.cfg
|
| 173 |
mv ${D}/etc/texmf/web2c/fmtutil.cnf ${D}/etc/texmf/fmtutil.d/00fmtutil.cnf
|
| 174 |
mv ${D}/etc/texmf/web2c/texmf.cnf ${D}/etc/texmf/texmf.d/00texmf.cnf
|
| 175 |
|
| 176 |
# xdvi
|
| 177 |
if use X ; then
|
| 178 |
dodir /etc/X11/app-defaults /etc/texmf/xdvi
|
| 179 |
mv ${D}${TEXMF_PATH}/xdvi/XDvi ${D}/etc/X11/app-defaults || die "mv XDvi failed"
|
| 180 |
dosym /etc/X11/app-defaults/XDvi ${TEXMF_PATH}/xdvi/XDvi
|
| 181 |
fi
|
| 182 |
cd -
|
| 183 |
}
|
| 184 |
|
| 185 |
tetex-3_pkg_preinst() {
|
| 186 |
|
| 187 |
ewarn "Removing ${ROOT}usr/share/texmf/web2c"
|
| 188 |
rm -rf "${ROOT}usr/share/texmf/web2c"
|
| 189 |
|
| 190 |
# take care of symlinks problems, see bug 120515
|
| 191 |
# this can be removed when that is not an issue anymore
|
| 192 |
# i.e., all users with problem has got them fixed
|
| 193 |
for conf in updmap.d/00updmap.cfg texmf.d/00texmf.cnf fmtutil.d/00fmtutil.cnf
|
| 194 |
do
|
| 195 |
if [ -L "${ROOT}etc/texmf/${conf}" ]
|
| 196 |
then
|
| 197 |
ewarn "Removing ${ROOT}etc/texmf/${conf}"
|
| 198 |
rm -f "${ROOT}etc/texmf/${conf}"
|
| 199 |
fi
|
| 200 |
done
|
| 201 |
|
| 202 |
# take care of config protection, upgrade from <=tetex-2.0.2-r4
|
| 203 |
for conf in updmap.cfg texmf.cnf fmtutil.cnf
|
| 204 |
do
|
| 205 |
if [ ! -d "${ROOT}etc/texmf/${conf/.*/.d}" -a -f "${ROOT}etc/texmf/${conf}" ]
|
| 206 |
then
|
| 207 |
mkdir "${ROOT}etc/texmf/${conf/.*/.d}"
|
| 208 |
cp "${ROOT}etc/texmf/${conf}" "${ROOT}etc/texmf/00${conf/.*/.d}"
|
| 209 |
fi
|
| 210 |
done
|
| 211 |
}
|
| 212 |
|
| 213 |
tetex-3_pkg_postinst() {
|
| 214 |
tetex_pkg_postinst
|
| 215 |
}
|