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

Contents of /eclass/texlive-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.8 - (show annotations) (download)
Thu Feb 14 09:02:11 2008 UTC (6 years, 6 months ago) by aballier
Branch: MAIN
Changes since 1.7: +32 -8 lines
improve comments of texlive eclasses so that they're ready to get a man page, thanks to mren <bugs@rennings.net>, bug #210049

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

  ViewVC Help
Powered by ViewVC 1.1.20