| 1 |
aballier |
1.1 |
# Copyright 1999-2004 Gentoo Foundation |
| 2 |
|
|
# Distributed under the terms of the GNU General Public License v2 |
| 3 |
aballier |
1.4 |
# $Header: /var/cvsroot/gentoo-x86/eclass/texlive-module.eclass,v 1.3 2007/10/20 12:51:25 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.2 |
TEXMFSYSVAR="$(kpsewhich -var-value=TEXMFSYSVAR)" |
| 100 |
|
|
insinto "${TEXMFSYSVAR}" |
| 101 |
|
|
[ -d texmf-var ] && doins -r texmf-var/* |
| 102 |
aballier |
1.1 |
|
| 103 |
|
|
insinto /etc/texmf/updmap.d |
| 104 |
|
|
[ -f "${S}/${PN}.cfg" ] && doins "${S}/${PN}.cfg" |
| 105 |
|
|
insinto /etc/texmf/dvips/config |
| 106 |
|
|
[ -f "${S}/${PN}-config.ps" ] && doins "${S}/${PN}-config.ps" |
| 107 |
|
|
insinto /etc/texmf/dvipdfm/config |
| 108 |
|
|
[ -f "${S}/${PN}-config" ] && doins "${S}/${PN}-config" |
| 109 |
|
|
|
| 110 |
|
|
texlive-common_handle_config_files |
| 111 |
|
|
} |
| 112 |
|
|
|
| 113 |
|
|
# pkg_postinst and pkg_postrm, exported functions: |
| 114 |
|
|
# run texmf-update to ensure the tex installation is consistent with the |
| 115 |
|
|
# installed texmf trees. |
| 116 |
|
|
|
| 117 |
|
|
texlive-module_pkg_postinst() { |
| 118 |
|
|
if [ "$ROOT" = "/" ] ; then |
| 119 |
|
|
/usr/sbin/texmf-update |
| 120 |
|
|
fi |
| 121 |
|
|
} |
| 122 |
|
|
|
| 123 |
|
|
texlive-module_pkg_postrm() { |
| 124 |
|
|
if [ "$ROOT" = "/" ] ; then |
| 125 |
|
|
/usr/sbin/texmf-update |
| 126 |
|
|
fi |
| 127 |
|
|
} |
| 128 |
|
|
|
| 129 |
|
|
EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm |