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

Contents of /eclass/texlive-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.12 - (hide 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 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.12 # $Header: /var/cvsroot/gentoo-x86/eclass/texlive-module.eclass,v 1.11 2008/07/03 22:36:12 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     inherit texlive-common
31    
32     HOMEPAGE="http://www.tug.org/texlive/"
33    
34 aballier 1.9 COMMON_DEPEND=">=app-text/texlive-core-${PV}
35     ${TEXLIVE_MODULES_DEPS}"
36    
37 aballier 1.12 IUSE=""
38    
39 aballier 1.9 # 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 aballier 1.1 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 aballier 1.9 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 aballier 1.12 IUSE="${IUSE} source"
54 aballier 1.9 fi
55 aballier 1.1
56     RDEPEND="${COMMON_DEPEND}"
57    
58 aballier 1.12 [ -z "${PN##*documentation*}" ] || IUSE="${IUSE} doc"
59 aballier 1.1
60     S="${WORKDIR}"
61    
62 aballier 1.8 # @FUNCTION: texlive-module_src_compile
63     # @DESCRIPTION:
64     # exported function:
65 aballier 1.1 # 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 aballier 1.9 # TeX Live 2007 was providing lists. For 2008 they are now tlpobj.
86     if [ -z "${PV##2007*}" ] ; then
87 aballier 1.1 for i in "${S}"/texmf/lists/*;
88     do
89 aballier 1.9 grep '^!' "${i}" | sed -e 's/^!//' | tr ' ' '@' |sort|uniq >> "${T}/jobs"
90 aballier 1.1 done
91 aballier 1.9 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 aballier 1.1
98 aballier 1.9 for i in $(<"${T}/jobs");
99 aballier 1.1 do
100 aballier 1.9 j="$(echo $i | tr '@' ' ')"
101     command=${j%% *}
102     parameter=${j#* }
103 aballier 1.1 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 aballier 1.9 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 aballier 1.1 esac
121     done
122     }
123    
124 aballier 1.8 # @FUNCTION: texlive-module_src_install
125     # @DESCRIPTION:
126     # exported function:
127 aballier 1.1 # Install texmf and config files to the system
128    
129     texlive-module_src_install() {
130 aballier 1.3 for i in texmf/fmtutil/format*.cnf; do
131     [ -f "${i}" ] && etexlinks "${i}"
132     done
133    
134 aballier 1.1 insinto /usr/share
135 aballier 1.10 if [ -z "${PN##*documentation*}" ] || use doc; then
136 aballier 1.4 [ -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 aballier 1.1 [ -d texmf ] && doins -r texmf
143     [ -d texmf-dist ] && doins -r texmf-dist
144 aballier 1.12 [ -n "${PV##2007*}" ] && [ -d tlpkg ] && use source && doins -r tlpkg
145 aballier 1.4
146 aballier 1.5 insinto /var/lib/texmf
147 aballier 1.2 [ -d texmf-var ] && doins -r texmf-var/*
148 aballier 1.1
149     insinto /etc/texmf/updmap.d
150     [ -f "${S}/${PN}.cfg" ] && doins "${S}/${PN}.cfg"
151 aballier 1.6 insinto /etc/texmf/dvips.d
152 aballier 1.1 [ -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 aballier 1.8 # @FUNCTION: texlive-module_pkg_postinst
160     # @DESCRIPTION:
161     # exported function:
162 aballier 1.1 # run texmf-update to ensure the tex installation is consistent with the
163     # installed texmf trees.
164    
165     texlive-module_pkg_postinst() {
166 aballier 1.7 if [ "$ROOT" = "/" ] && [ -x /usr/sbin/texmf-update ] ; then
167 aballier 1.1 /usr/sbin/texmf-update
168 aballier 1.7 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 aballier 1.1 fi
173     }
174    
175 aballier 1.8 # @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 aballier 1.1 texlive-module_pkg_postrm() {
182 aballier 1.7 if [ "$ROOT" = "/" ] && [ -x /usr/sbin/texmf-update ] ; then
183 aballier 1.1 /usr/sbin/texmf-update
184 aballier 1.7 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 aballier 1.1 fi
189     }
190    
191     EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm

  ViewVC Help
Powered by ViewVC 1.1.20