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

Contents of /eclass/texlive-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.9 - (hide annotations) (download)
Thu Jul 3 21:06:25 2008 UTC (6 years, 1 month ago) by aballier
Branch: MAIN
Changes since 1.8: +36 -9 lines
start to make room for TeX Live 2008 and simplify the jobs parser.

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.9 # $Header: /var/cvsroot/gentoo-x86/eclass/texlive-module.eclass,v 1.8 2008/02/14 09:02:11 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     # foo -> texlive-module-foo-${PV}.zip
28 aballier 1.1
29     inherit texlive-common
30    
31     HOMEPAGE="http://www.tug.org/texlive/"
32    
33 aballier 1.9 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 aballier 1.1 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 aballier 1.9 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 aballier 1.1
52     RDEPEND="${COMMON_DEPEND}"
53    
54     IUSE="doc"
55    
56     S="${WORKDIR}"
57    
58 aballier 1.8 # @FUNCTION: texlive-module_src_compile
59     # @DESCRIPTION:
60     # exported function:
61 aballier 1.1 # 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 aballier 1.9 # TeX Live 2007 was providing lists. For 2008 they are now tlpobj.
82     if [ -z "${PV##2007*}" ] ; then
83 aballier 1.1 for i in "${S}"/texmf/lists/*;
84     do
85 aballier 1.9 grep '^!' "${i}" | sed -e 's/^!//' | tr ' ' '@' |sort|uniq >> "${T}/jobs"
86 aballier 1.1 done
87 aballier 1.9 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 aballier 1.1
94 aballier 1.9 for i in $(<"${T}/jobs");
95 aballier 1.1 do
96 aballier 1.9 j="$(echo $i | tr '@' ' ')"
97     command=${j%% *}
98     parameter=${j#* }
99 aballier 1.1 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 aballier 1.9 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 aballier 1.1 esac
117     done
118     }
119    
120 aballier 1.8 # @FUNCTION: texlive-module_src_install
121     # @DESCRIPTION:
122     # exported function:
123 aballier 1.1 # Install texmf and config files to the system
124    
125     texlive-module_src_install() {
126 aballier 1.3 for i in texmf/fmtutil/format*.cnf; do
127     [ -f "${i}" ] && etexlinks "${i}"
128     done
129    
130 aballier 1.1 insinto /usr/share
131 aballier 1.4 if 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 aballier 1.1 [ -d texmf ] && doins -r texmf
139     [ -d texmf-dist ] && doins -r texmf-dist
140 aballier 1.9 [ -d tlpkg ] && doins -r tlpkg
141 aballier 1.4
142 aballier 1.5 insinto /var/lib/texmf
143 aballier 1.2 [ -d texmf-var ] && doins -r texmf-var/*
144 aballier 1.1
145     insinto /etc/texmf/updmap.d
146     [ -f "${S}/${PN}.cfg" ] && doins "${S}/${PN}.cfg"
147 aballier 1.6 insinto /etc/texmf/dvips.d
148 aballier 1.1 [ -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 aballier 1.8 # @FUNCTION: texlive-module_pkg_postinst
156     # @DESCRIPTION:
157     # exported function:
158 aballier 1.1 # run texmf-update to ensure the tex installation is consistent with the
159     # installed texmf trees.
160    
161     texlive-module_pkg_postinst() {
162 aballier 1.7 if [ "$ROOT" = "/" ] && [ -x /usr/sbin/texmf-update ] ; then
163 aballier 1.1 /usr/sbin/texmf-update
164 aballier 1.7 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 aballier 1.1 fi
169     }
170    
171 aballier 1.8 # @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 aballier 1.1 texlive-module_pkg_postrm() {
178 aballier 1.7 if [ "$ROOT" = "/" ] && [ -x /usr/sbin/texmf-update ] ; then
179 aballier 1.1 /usr/sbin/texmf-update
180 aballier 1.7 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 aballier 1.1 fi
185     }
186    
187     EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm

  ViewVC Help
Powered by ViewVC 1.1.20