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

Contents of /eclass/texlive-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (show annotations) (download)
Mon Jul 14 16:42:48 2008 UTC (6 years, 5 months ago) by aballier
Branch: MAIN
Changes since 1.11: +6 -3 lines
Add source useflag for texlive2008

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

  ViewVC Help
Powered by ViewVC 1.1.20