/[gentoo-x86]/eclass/texlive-module.eclass
Gentoo

Contents of /eclass/texlive-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.6 - (show annotations) (download)
Sun Dec 2 22:47:10 2007 UTC (7 years ago) by aballier
Branch: MAIN
Changes since 1.5: +2 -2 lines
install dvips config files in dvips.d; no module installs such files, only texlive-core for now, but better safe than sorry if this happens after dvips config files handling has been switched to texmf-update

1 # Copyright 1999-2004 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/texlive-module.eclass,v 1.5 2007/10/27 14:30:38 aballier Exp $
4
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 for i in texmf/fmtutil/format*.cnf; do
85 [ -f "${i}" ] && etexlinks "${i}"
86 done
87
88 insinto /usr/share
89 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 [ -d texmf ] && doins -r texmf
97 [ -d texmf-dist ] && doins -r texmf-dist
98
99 insinto /var/lib/texmf
100 [ -d texmf-var ] && doins -r texmf-var/*
101
102 insinto /etc/texmf/updmap.d
103 [ -f "${S}/${PN}.cfg" ] && doins "${S}/${PN}.cfg"
104 insinto /etc/texmf/dvips.d
105 [ -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 if [ "$ROOT" = "/" ] ; then
118 /usr/sbin/texmf-update
119 fi
120 }
121
122 texlive-module_pkg_postrm() {
123 if [ "$ROOT" = "/" ] ; then
124 /usr/sbin/texmf-update
125 fi
126 }
127
128 EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm

  ViewVC Help
Powered by ViewVC 1.1.20