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

Contents of /eclass/texlive-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.11 - (hide annotations) (download)
Thu Jul 3 22:36:12 2008 UTC (6 years, 1 month ago) by aballier
Branch: MAIN
Changes since 1.10: +3 -2 lines
update comments about tl2008's way of distributing packages

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

  ViewVC Help
Powered by ViewVC 1.1.20