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

Contents of /eclass/texlive-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.13 - (hide annotations) (download)
Tue Jul 15 10:33:40 2008 UTC (6 years, 2 months ago) by aballier
Branch: MAIN
Changes since 1.12: +29 -1 lines
Add TEXLIVE_MODULE_DOC_CONTENTS and TEXLIVE_MODULE_SRC_CONTENTS support for texlive 2008 and document it.

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

  ViewVC Help
Powered by ViewVC 1.1.20