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

Contents of /eclass/texlive-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.18 - (hide annotations) (download)
Tue Sep 2 10:00:06 2008 UTC (5 years, 7 months ago) by aballier
Branch: MAIN
Changes since 1.17: +7 -1 lines
document TEXLIVE_MODULE_BINSCRIPTS

1 aballier 1.8 # Copyright 1999-2008 Gentoo Foundation
2 aballier 1.1 # Distributed under the terms of the GNU General Public License v2
3 aballier 1.18 # $Header: /var/cvsroot/gentoo-x86/eclass/texlive-module.eclass,v 1.17 2008/09/02 09:56:31 aballier Exp $
4 aballier 1.1
5 aballier 1.8 # @ECLASS: texlive-module.eclass
6     # @MAINTAINER:
7     # tex@gentoo.org
8 aballier 1.1 #
9     # Original Author: Alexis Ballier <aballier@gentoo.org>
10 aballier 1.8 # @BLURB: Provide generic install functions so that modular texlive's texmf ebuild will only have to inherit this eclass
11 aballier 1.15 # @DESCRIPTION:
12 aballier 1.1 # 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 aballier 1.8 # of packages that it will install. (See below)
16     #
17 aballier 1.1 # What is assumed is that it unpacks texmf and texmf-dist directories to
18     # ${WORKDIR}.
19     #
20 aballier 1.8 # 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 aballier 1.11 # For TeX Live 2007: foo -> texlive-module-foo-${PV}.zip
28     # For TeX Live 2008: foo -> texlive-module-foo-${PV}.tar.lzma
29 aballier 1.1
30 aballier 1.13 # @ECLASS-VARIABLE: TEXLIVE_MODULE_DOC_CONTENTS
31     # @DESCRIPTION:
32     # The list of packages that will be installed if the doc useflag is enabled.
33     # Expansion to SRC_URI is the same as for TEXLIVE_MODULE_CONTENTS. This is only
34     # valid for TeX Live 2008
35    
36     # @ECLASS-VARIABLE: TEXLIVE_MODULE_SRC_CONTENTS
37     # @DESCRIPTION:
38     # The list of packages that will be installed if the source useflag is enabled.
39     # Expansion to SRC_URI is the same as for TEXLIVE_MODULE_CONTENTS. This is only
40     # valid for TeX Live 2008
41    
42 aballier 1.18 # @ECLASS-VARIABLE: TEXLIVE_MODULE_BINSCRIPTS
43     # @DESCRIPTION:
44     # A space separated list of files that are in fact scripts installed in the
45     # texmf tree and that we want to be available directly. They will be installed in
46     # /usr/bin.
47    
48 aballier 1.1 inherit texlive-common
49    
50     HOMEPAGE="http://www.tug.org/texlive/"
51    
52 aballier 1.9 COMMON_DEPEND=">=app-text/texlive-core-${PV}
53     ${TEXLIVE_MODULES_DEPS}"
54    
55 aballier 1.12 IUSE=""
56    
57 aballier 1.9 # TeX Live 2007 was providing .zip files of CTAN packages. For 2008 they are now
58     # .tar.lzma
59     if [ -z "${PV##2007*}" ] ; then
60 aballier 1.1 for i in ${TEXLIVE_MODULE_CONTENTS}; do
61     SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.zip"
62     done
63     DEPEND="${COMMON_DEPEND}
64     app-arch/unzip"
65 aballier 1.9 else
66     for i in ${TEXLIVE_MODULE_CONTENTS}; do
67     SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.tar.lzma"
68     done
69     DEPEND="${COMMON_DEPEND}
70     app-arch/lzma-utils"
71 aballier 1.12 IUSE="${IUSE} source"
72 aballier 1.13
73     # Forge doc SRC_URI
74     [ -n "${PN##*documentation*}" ] && [ -n "${TEXLIVE_MODULE_DOC_CONTENTS}" ] && SRC_URI="${SRC_URI} doc? ("
75     for i in ${TEXLIVE_MODULE_DOC_CONTENTS}; do
76     SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.tar.lzma"
77     done
78     [ -n "${PN##*documentation*}" ] && [ -n "${TEXLIVE_MODULE_DOC_CONTENTS}" ] && SRC_URI="${SRC_URI} )"
79    
80     # Forge source SRC_URI
81     if [ -n "${TEXLIVE_MODULE_SRC_CONTENTS}" ] ; then
82     SRC_URI="${SRC_URI} source? ("
83     for i in ${TEXLIVE_MODULE_SRC_CONTENTS}; do
84     SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.tar.lzma"
85     done
86     SRC_URI="${SRC_URI} )"
87     fi
88 aballier 1.9 fi
89 aballier 1.1
90     RDEPEND="${COMMON_DEPEND}"
91    
92 aballier 1.12 [ -z "${PN##*documentation*}" ] || IUSE="${IUSE} doc"
93 aballier 1.1
94     S="${WORKDIR}"
95    
96 aballier 1.15
97     # @FUNCTION: texlive-module_make_language_def_lines
98     # @DESCRIPTION:
99     # Only valid for TeXLive 2008.
100 aballier 1.16 # Creates a language.${PN}.def entry to put in /etc/texmf/language.def.d
101 aballier 1.15 # It parses the AddHyphen directive of tlpobj files to create it.
102    
103     texlive-module_make_language_def_lines() {
104     local lefthyphenmin righthyphenmin synonyms name file
105     eval $@
106     einfo "Generating language.def entry for $@"
107     [ -z "$lefthyphenmin" ] && lefthyphenmin="2"
108     [ -z "$righthyphenmin" ] && righthyphenmin="3"
109     echo "\\addlanguage{$name}{$file}{}{$lefthyphenmin}{$righthyphenmin}" >> "${S}/language.${PN}.def"
110     if [ -n "$synonyms" ] ; then
111     for i in $(echo $synonyms | tr ',' ' ') ; do
112     einfo "Generating language.def synonym $i for $@"
113     echo "\\addlanguage{$i}{$file}{}{$lefthyphenmin}{$righthyphenmin}" >> "${S}/language.${PN}.def"
114     done
115     fi
116     }
117    
118     # @FUNCTION: texlive-module_make_language_dat_lines
119     # @DESCRIPTION:
120     # Only valid for TeXLive 2008.
121 aballier 1.16 # Creates a language.${PN}.dat entry to put in /etc/texmf/language.dat.d
122 aballier 1.15 # It parses the AddHyphen directive of tlpobj files to create it.
123    
124     texlive-module_make_language_dat_lines() {
125     local lefthyphenmin righthyphenmin synonyms name file
126     eval $@
127     einfo "Generating language.dat entry for $@"
128     echo "$name $file" >> "${S}/language.${PN}.dat"
129     if [ -n "$synonyms" ] ; then
130     for i in $(echo $synonyms | tr ',' ' ') ; do
131     einfo "Generating language.dat synonym $i for $@"
132     echo "=$i" >> "${S}/language.${PN}.dat"
133     done
134     fi
135     }
136    
137 aballier 1.8 # @FUNCTION: texlive-module_src_compile
138     # @DESCRIPTION:
139     # exported function:
140 aballier 1.1 # Will look for format.foo.cnf and build foo format files using fmtutil
141     # (provided by texlive-core). The compiled format files will be sent to
142     # texmf-var/web2c, like fmtutil defaults to but with some trick to stay in the
143     # sandbox
144     # The next step is to generate config files that are to be installed in
145     # /etc/texmf; texmf-update script will take care of merging the different config
146     # files for different packages in a single one used by the whole tex installation.
147    
148     texlive-module_src_compile() {
149     # Build format files
150     for i in texmf/fmtutil/format*.cnf; do
151     if [ -f "${i}" ]; then
152     einfo "Building format ${i}"
153     TEXMFHOME="${S}/texmf:${S}/texmf-dist"\
154     fmtutil --cnffile "${i}" --fmtdir "${S}/texmf-var/web2c" --all\
155     || die "failed to build format ${i}"
156     fi
157     done
158    
159     # Generate config files
160 aballier 1.9 # TeX Live 2007 was providing lists. For 2008 they are now tlpobj.
161     if [ -z "${PV##2007*}" ] ; then
162 aballier 1.1 for i in "${S}"/texmf/lists/*;
163     do
164 aballier 1.9 grep '^!' "${i}" | sed -e 's/^!//' | tr ' ' '@' |sort|uniq >> "${T}/jobs"
165 aballier 1.1 done
166 aballier 1.9 else
167     for i in "${S}"/tlpkg/tlpobj/*;
168     do
169     grep '^execute ' "${i}" | sed -e 's/^execute //' | tr ' ' '@' |sort|uniq >> "${T}/jobs"
170     done
171     fi
172 aballier 1.1
173 aballier 1.9 for i in $(<"${T}/jobs");
174 aballier 1.1 do
175 aballier 1.9 j="$(echo $i | tr '@' ' ')"
176     command=${j%% *}
177     parameter=${j#* }
178 aballier 1.1 case "${command}" in
179     addMap)
180     echo "Map ${parameter}" >> "${S}/${PN}.cfg";;
181     addMixedMap)
182     echo "MixedMap ${parameter}" >> "${S}/${PN}.cfg";;
183     addDvipsMap)
184     echo "p +${parameter}" >> "${S}/${PN}-config.ps";;
185     addDvipdfmMap)
186     echo "f ${parameter}" >> "${S}/${PN}-config";;
187 aballier 1.9 AddHyphen)
188 aballier 1.15 texlive-module_make_language_def_lines "$parameter"
189     texlive-module_make_language_dat_lines "$parameter";;
190 aballier 1.9 BuildFormat)
191 aballier 1.14 einfo "Format $parameter already built.";;
192 aballier 1.9 BuildLanguageDat)
193 aballier 1.14 einfo "Language file $parameter already generated.";;
194 aballier 1.9 *)
195     die "No rule to proccess ${command}. Please file a bug."
196 aballier 1.1 esac
197     done
198     }
199    
200 aballier 1.8 # @FUNCTION: texlive-module_src_install
201     # @DESCRIPTION:
202     # exported function:
203 aballier 1.1 # Install texmf and config files to the system
204    
205     texlive-module_src_install() {
206 aballier 1.3 for i in texmf/fmtutil/format*.cnf; do
207     [ -f "${i}" ] && etexlinks "${i}"
208     done
209    
210 aballier 1.1 insinto /usr/share
211 aballier 1.10 if [ -z "${PN##*documentation*}" ] || use doc; then
212 aballier 1.4 [ -d texmf-doc ] && doins -r texmf-doc
213     else
214     [ -d texmf/doc ] && rm -rf texmf/doc
215     [ -d texmf-dist/doc ] && rm -rf texmf-dist/doc
216     fi
217    
218 aballier 1.1 [ -d texmf ] && doins -r texmf
219     [ -d texmf-dist ] && doins -r texmf-dist
220 aballier 1.12 [ -n "${PV##2007*}" ] && [ -d tlpkg ] && use source && doins -r tlpkg
221 aballier 1.4
222 aballier 1.5 insinto /var/lib/texmf
223 aballier 1.2 [ -d texmf-var ] && doins -r texmf-var/*
224 aballier 1.1
225     insinto /etc/texmf/updmap.d
226     [ -f "${S}/${PN}.cfg" ] && doins "${S}/${PN}.cfg"
227 aballier 1.6 insinto /etc/texmf/dvips.d
228 aballier 1.1 [ -f "${S}/${PN}-config.ps" ] && doins "${S}/${PN}-config.ps"
229     insinto /etc/texmf/dvipdfm/config
230     [ -f "${S}/${PN}-config" ] && doins "${S}/${PN}-config"
231    
232 aballier 1.15 if [ -f "${S}/language.${PN}.def" ] ; then
233     insinto /etc/texmf/language.def.d
234     doins "${S}/language.${PN}.def"
235     fi
236    
237     if [ -f "${S}/language.${PN}.dat" ] ; then
238     insinto /etc/texmf/language.dat.d
239     doins "${S}/language.${PN}.dat"
240     fi
241 aballier 1.17 [ -n "${TEXLIVE_MODULE_BINSCRIPTS}" ] && dobin_texmf_scripts ${TEXLIVE_MODULE_BINSCRIPTS}
242 aballier 1.15
243 aballier 1.1 texlive-common_handle_config_files
244     }
245    
246 aballier 1.8 # @FUNCTION: texlive-module_pkg_postinst
247     # @DESCRIPTION:
248     # exported function:
249 aballier 1.1 # run texmf-update to ensure the tex installation is consistent with the
250     # installed texmf trees.
251    
252     texlive-module_pkg_postinst() {
253 aballier 1.7 if [ "$ROOT" = "/" ] && [ -x /usr/sbin/texmf-update ] ; then
254 aballier 1.1 /usr/sbin/texmf-update
255 aballier 1.7 else
256     ewarn "Cannot run texmf-update for some reason."
257     ewarn "Your texmf tree might be inconsistent with your configuration"
258     ewarn "Please try to figure what has happened"
259 aballier 1.1 fi
260     }
261    
262 aballier 1.8 # @FUNCTION: texlive-module_pkg_postrm
263     # @DESCRIPTION:
264     # exported function:
265     # run texmf-update to ensure the tex installation is consistent with the
266     # installed texmf trees.
267    
268 aballier 1.1 texlive-module_pkg_postrm() {
269 aballier 1.7 if [ "$ROOT" = "/" ] && [ -x /usr/sbin/texmf-update ] ; then
270 aballier 1.1 /usr/sbin/texmf-update
271 aballier 1.7 else
272     ewarn "Cannot run texmf-update for some reason."
273     ewarn "Your texmf tree might be inconsistent with your configuration"
274     ewarn "Please try to figure what has happened"
275 aballier 1.1 fi
276     }
277    
278     EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm

  ViewVC Help
Powered by ViewVC 1.1.20