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

Contents of /eclass/texlive-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.10 - (show annotations) (download)
Thu Jul 3 22:33:00 2008 UTC (6 years, 3 months ago) by aballier
Branch: MAIN
Changes since 1.9: +3 -3 lines
remove doc useflag from documentation packages, it does not make much sense for them, thanks to Pacho Ramos <pacho@condmat1.ciencias.uniovi.es>, bug #223617.

1 # Copyright 1999-2008 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.9 2008/07/03 21:06:25 aballier Exp $
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 COMMON_DEPEND=">=app-text/texlive-core-${PV}
34 ${TEXLIVE_MODULES_DEPS}"
35
36 # TeX Live 2007 was providing .zip files of CTAN packages. For 2008 they are now
37 # .tar.lzma
38 if [ -z "${PV##2007*}" ] ; then
39 for i in ${TEXLIVE_MODULE_CONTENTS}; do
40 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.zip"
41 done
42 DEPEND="${COMMON_DEPEND}
43 app-arch/unzip"
44 else
45 for i in ${TEXLIVE_MODULE_CONTENTS}; do
46 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.tar.lzma"
47 done
48 DEPEND="${COMMON_DEPEND}
49 app-arch/lzma-utils"
50 fi
51
52 RDEPEND="${COMMON_DEPEND}"
53
54 [ -z "${PN##*documentation*}" ] || IUSE="doc"
55
56 S="${WORKDIR}"
57
58 # @FUNCTION: texlive-module_src_compile
59 # @DESCRIPTION:
60 # exported function:
61 # Will look for format.foo.cnf and build foo format files using fmtutil
62 # (provided by texlive-core). The compiled format files will be sent to
63 # texmf-var/web2c, like fmtutil defaults to but with some trick to stay in the
64 # sandbox
65 # The next step is to generate config files that are to be installed in
66 # /etc/texmf; texmf-update script will take care of merging the different config
67 # files for different packages in a single one used by the whole tex installation.
68
69 texlive-module_src_compile() {
70 # Build format files
71 for i in texmf/fmtutil/format*.cnf; do
72 if [ -f "${i}" ]; then
73 einfo "Building format ${i}"
74 TEXMFHOME="${S}/texmf:${S}/texmf-dist"\
75 fmtutil --cnffile "${i}" --fmtdir "${S}/texmf-var/web2c" --all\
76 || die "failed to build format ${i}"
77 fi
78 done
79
80 # Generate config files
81 # TeX Live 2007 was providing lists. For 2008 they are now tlpobj.
82 if [ -z "${PV##2007*}" ] ; then
83 for i in "${S}"/texmf/lists/*;
84 do
85 grep '^!' "${i}" | sed -e 's/^!//' | tr ' ' '@' |sort|uniq >> "${T}/jobs"
86 done
87 else
88 for i in "${S}"/tlpkg/tlpobj/*;
89 do
90 grep '^execute ' "${i}" | sed -e 's/^execute //' | tr ' ' '@' |sort|uniq >> "${T}/jobs"
91 done
92 fi
93
94 for i in $(<"${T}/jobs");
95 do
96 j="$(echo $i | tr '@' ' ')"
97 command=${j%% *}
98 parameter=${j#* }
99 case "${command}" in
100 addMap)
101 echo "Map ${parameter}" >> "${S}/${PN}.cfg";;
102 addMixedMap)
103 echo "MixedMap ${parameter}" >> "${S}/${PN}.cfg";;
104 addDvipsMap)
105 echo "p +${parameter}" >> "${S}/${PN}-config.ps";;
106 addDvipdfmMap)
107 echo "f ${parameter}" >> "${S}/${PN}-config";;
108 AddHyphen)
109 ewarn "Sorry, $command not implemented yet.";;
110 BuildFormat)
111 elog "Format $parameter already built.";;
112 BuildLanguageDat)
113 elog "Language file $parameter already generated.";;
114 *)
115 die "No rule to proccess ${command}. Please file a bug."
116 esac
117 done
118 }
119
120 # @FUNCTION: texlive-module_src_install
121 # @DESCRIPTION:
122 # exported function:
123 # Install texmf and config files to the system
124
125 texlive-module_src_install() {
126 for i in texmf/fmtutil/format*.cnf; do
127 [ -f "${i}" ] && etexlinks "${i}"
128 done
129
130 insinto /usr/share
131 if [ -z "${PN##*documentation*}" ] || use doc; then
132 [ -d texmf-doc ] && doins -r texmf-doc
133 else
134 [ -d texmf/doc ] && rm -rf texmf/doc
135 [ -d texmf-dist/doc ] && rm -rf texmf-dist/doc
136 fi
137
138 [ -d texmf ] && doins -r texmf
139 [ -d texmf-dist ] && doins -r texmf-dist
140 [ -d tlpkg ] && doins -r tlpkg
141
142 insinto /var/lib/texmf
143 [ -d texmf-var ] && doins -r texmf-var/*
144
145 insinto /etc/texmf/updmap.d
146 [ -f "${S}/${PN}.cfg" ] && doins "${S}/${PN}.cfg"
147 insinto /etc/texmf/dvips.d
148 [ -f "${S}/${PN}-config.ps" ] && doins "${S}/${PN}-config.ps"
149 insinto /etc/texmf/dvipdfm/config
150 [ -f "${S}/${PN}-config" ] && doins "${S}/${PN}-config"
151
152 texlive-common_handle_config_files
153 }
154
155 # @FUNCTION: texlive-module_pkg_postinst
156 # @DESCRIPTION:
157 # exported function:
158 # run texmf-update to ensure the tex installation is consistent with the
159 # installed texmf trees.
160
161 texlive-module_pkg_postinst() {
162 if [ "$ROOT" = "/" ] && [ -x /usr/sbin/texmf-update ] ; then
163 /usr/sbin/texmf-update
164 else
165 ewarn "Cannot run texmf-update for some reason."
166 ewarn "Your texmf tree might be inconsistent with your configuration"
167 ewarn "Please try to figure what has happened"
168 fi
169 }
170
171 # @FUNCTION: texlive-module_pkg_postrm
172 # @DESCRIPTION:
173 # exported function:
174 # run texmf-update to ensure the tex installation is consistent with the
175 # installed texmf trees.
176
177 texlive-module_pkg_postrm() {
178 if [ "$ROOT" = "/" ] && [ -x /usr/sbin/texmf-update ] ; then
179 /usr/sbin/texmf-update
180 else
181 ewarn "Cannot run texmf-update for some reason."
182 ewarn "Your texmf tree might be inconsistent with your configuration"
183 ewarn "Please try to figure what has happened"
184 fi
185 }
186
187 EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm

  ViewVC Help
Powered by ViewVC 1.1.20