| 1 |
aballier |
1.1 |
# Copyright 1999-2004 Gentoo Foundation
|
| 2 |
|
|
# Distributed under the terms of the GNU General Public License v2
|
| 3 |
aballier |
1.7 |
# $Header: /var/cvsroot/gentoo-x86/eclass/texlive-module.eclass,v 1.6 2007/12/02 22:47:10 aballier Exp $
|
| 4 |
aballier |
1.1 |
|
| 5 |
|
|
#
|
| 6 |
|
|
# Original Author: Alexis Ballier <aballier@gentoo.org>
|
| 7 |
|
|
# Purpose: Provide generic install functions so that modular texlive's texmf ebuilds will
|
| 8 |
|
|
# only have to inherit this eclass.
|
| 9 |
|
|
# Ebuilds have to provide TEXLIVE_MODULE_CONTENTS variable that contains the list
|
| 10 |
|
|
# of packages that it will install.
|
| 11 |
|
|
# TEXLIVE_MODULE_CONTENTS will be expanded to SRC_URI :
|
| 12 |
|
|
# foo -> texlive-module-foo-${PV}.zip
|
| 13 |
|
|
# What is assumed is that it unpacks texmf and texmf-dist directories to
|
| 14 |
|
|
# ${WORKDIR}.
|
| 15 |
|
|
#
|
| 16 |
|
|
|
| 17 |
|
|
inherit texlive-common
|
| 18 |
|
|
|
| 19 |
|
|
HOMEPAGE="http://www.tug.org/texlive/"
|
| 20 |
|
|
|
| 21 |
|
|
for i in ${TEXLIVE_MODULE_CONTENTS}; do
|
| 22 |
|
|
SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.zip"
|
| 23 |
|
|
done
|
| 24 |
|
|
|
| 25 |
|
|
COMMON_DEPEND=">=app-text/texlive-core-${PV}
|
| 26 |
|
|
${TEXLIVE_MODULES_DEPS}"
|
| 27 |
|
|
|
| 28 |
|
|
DEPEND="${COMMON_DEPEND}
|
| 29 |
|
|
app-arch/unzip"
|
| 30 |
|
|
|
| 31 |
|
|
RDEPEND="${COMMON_DEPEND}"
|
| 32 |
|
|
|
| 33 |
|
|
IUSE="doc"
|
| 34 |
|
|
|
| 35 |
|
|
S="${WORKDIR}"
|
| 36 |
|
|
|
| 37 |
|
|
# src_compile, exported function:
|
| 38 |
|
|
# Will look for format.foo.cnf and build foo format files using fmtutil
|
| 39 |
|
|
# (provided by texlive-core). The compiled format files will be sent to
|
| 40 |
|
|
# texmf-var/web2c, like fmtutil defaults to but with some trick to stay in the
|
| 41 |
|
|
# sandbox
|
| 42 |
|
|
# The next step is to generate config files that are to be installed in
|
| 43 |
|
|
# /etc/texmf; texmf-update script will take care of merging the different config
|
| 44 |
|
|
# files for different packages in a single one used by the whole tex installation.
|
| 45 |
|
|
|
| 46 |
|
|
texlive-module_src_compile() {
|
| 47 |
|
|
# Build format files
|
| 48 |
|
|
for i in texmf/fmtutil/format*.cnf; do
|
| 49 |
|
|
if [ -f "${i}" ]; then
|
| 50 |
|
|
einfo "Building format ${i}"
|
| 51 |
|
|
TEXMFHOME="${S}/texmf:${S}/texmf-dist"\
|
| 52 |
|
|
fmtutil --cnffile "${i}" --fmtdir "${S}/texmf-var/web2c" --all\
|
| 53 |
|
|
|| die "failed to build format ${i}"
|
| 54 |
|
|
fi
|
| 55 |
|
|
done
|
| 56 |
|
|
|
| 57 |
|
|
# Generate config files
|
| 58 |
|
|
for i in "${S}"/texmf/lists/*;
|
| 59 |
|
|
do
|
| 60 |
|
|
grep '^!' "${i}" | tr ' ' '=' |sort|uniq >> "${T}/jobs"
|
| 61 |
|
|
done
|
| 62 |
|
|
|
| 63 |
|
|
for j in $(<"${T}/jobs");
|
| 64 |
|
|
do
|
| 65 |
|
|
command=$(echo ${j} | sed 's/.\(.*\)=.*/\1/')
|
| 66 |
|
|
parameter=$(echo ${j} | sed 's/.*=\(.*\)/\1/')
|
| 67 |
|
|
case "${command}" in
|
| 68 |
|
|
addMap)
|
| 69 |
|
|
echo "Map ${parameter}" >> "${S}/${PN}.cfg";;
|
| 70 |
|
|
addMixedMap)
|
| 71 |
|
|
echo "MixedMap ${parameter}" >> "${S}/${PN}.cfg";;
|
| 72 |
|
|
addDvipsMap)
|
| 73 |
|
|
echo "p +${parameter}" >> "${S}/${PN}-config.ps";;
|
| 74 |
|
|
addDvipdfmMap)
|
| 75 |
|
|
echo "f ${parameter}" >> "${S}/${PN}-config";;
|
| 76 |
|
|
esac
|
| 77 |
|
|
done
|
| 78 |
|
|
}
|
| 79 |
|
|
|
| 80 |
|
|
# src_install, exported function:
|
| 81 |
|
|
# Install texmf and config files to the system
|
| 82 |
|
|
|
| 83 |
|
|
texlive-module_src_install() {
|
| 84 |
aballier |
1.3 |
for i in texmf/fmtutil/format*.cnf; do
|
| 85 |
|
|
[ -f "${i}" ] && etexlinks "${i}"
|
| 86 |
|
|
done
|
| 87 |
|
|
|
| 88 |
aballier |
1.1 |
insinto /usr/share
|
| 89 |
aballier |
1.4 |
if use doc; then
|
| 90 |
|
|
[ -d texmf-doc ] && doins -r texmf-doc
|
| 91 |
|
|
else
|
| 92 |
|
|
[ -d texmf/doc ] && rm -rf texmf/doc
|
| 93 |
|
|
[ -d texmf-dist/doc ] && rm -rf texmf-dist/doc
|
| 94 |
|
|
fi
|
| 95 |
|
|
|
| 96 |
aballier |
1.1 |
[ -d texmf ] && doins -r texmf
|
| 97 |
|
|
[ -d texmf-dist ] && doins -r texmf-dist
|
| 98 |
aballier |
1.4 |
|
| 99 |
aballier |
1.5 |
insinto /var/lib/texmf
|
| 100 |
aballier |
1.2 |
[ -d texmf-var ] && doins -r texmf-var/*
|
| 101 |
aballier |
1.1 |
|
| 102 |
|
|
insinto /etc/texmf/updmap.d
|
| 103 |
|
|
[ -f "${S}/${PN}.cfg" ] && doins "${S}/${PN}.cfg"
|
| 104 |
aballier |
1.6 |
insinto /etc/texmf/dvips.d
|
| 105 |
aballier |
1.1 |
[ -f "${S}/${PN}-config.ps" ] && doins "${S}/${PN}-config.ps"
|
| 106 |
|
|
insinto /etc/texmf/dvipdfm/config
|
| 107 |
|
|
[ -f "${S}/${PN}-config" ] && doins "${S}/${PN}-config"
|
| 108 |
|
|
|
| 109 |
|
|
texlive-common_handle_config_files
|
| 110 |
|
|
}
|
| 111 |
|
|
|
| 112 |
|
|
# pkg_postinst and pkg_postrm, exported functions:
|
| 113 |
|
|
# run texmf-update to ensure the tex installation is consistent with the
|
| 114 |
|
|
# installed texmf trees.
|
| 115 |
|
|
|
| 116 |
|
|
texlive-module_pkg_postinst() {
|
| 117 |
aballier |
1.7 |
if [ "$ROOT" = "/" ] && [ -x /usr/sbin/texmf-update ] ; then
|
| 118 |
aballier |
1.1 |
/usr/sbin/texmf-update
|
| 119 |
aballier |
1.7 |
else
|
| 120 |
|
|
ewarn "Cannot run texmf-update for some reason."
|
| 121 |
|
|
ewarn "Your texmf tree might be inconsistent with your configuration"
|
| 122 |
|
|
ewarn "Please try to figure what has happened"
|
| 123 |
aballier |
1.1 |
fi
|
| 124 |
|
|
}
|
| 125 |
|
|
|
| 126 |
|
|
texlive-module_pkg_postrm() {
|
| 127 |
aballier |
1.7 |
if [ "$ROOT" = "/" ] && [ -x /usr/sbin/texmf-update ] ; then
|
| 128 |
aballier |
1.1 |
/usr/sbin/texmf-update
|
| 129 |
aballier |
1.7 |
else
|
| 130 |
|
|
ewarn "Cannot run texmf-update for some reason."
|
| 131 |
|
|
ewarn "Your texmf tree might be inconsistent with your configuration"
|
| 132 |
|
|
ewarn "Please try to figure what has happened"
|
| 133 |
aballier |
1.1 |
fi
|
| 134 |
|
|
}
|
| 135 |
|
|
|
| 136 |
|
|
EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm
|