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

Diff of /eclass/texlive-module.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.1 Revision 1.18
1# Copyright 1999-2004 Gentoo Foundation 1# Copyright 1999-2008 Gentoo Foundation
2# Distributed under the terms of the GNU General Public License v2 2# Distributed under the terms of the GNU General Public License v2
3# $Header: /var/cvsroot/gentoo-x86/eclass/texlive-module.eclass,v 1.1 2007/10/14 07:47:10 aballier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/texlive-module.eclass,v 1.18 2008/09/02 10:00:06 aballier Exp $
4 4
5# @ECLASS: texlive-module.eclass
6# @MAINTAINER:
7# tex@gentoo.org
5# 8#
6# Original Author: Alexis Ballier <aballier@gentoo.org> 9# Original Author: Alexis Ballier <aballier@gentoo.org>
10# @BLURB: Provide generic install functions so that modular texlive's texmf ebuild will only have to inherit this eclass
11# @DESCRIPTION:
7# Purpose: Provide generic install functions so that modular texlive's texmf ebuilds will 12# Purpose: Provide generic install functions so that modular texlive's texmf ebuilds will
8# only have to inherit this eclass. 13# only have to inherit this eclass.
9# Ebuilds have to provide TEXLIVE_MODULE_CONTENTS variable that contains the list 14# Ebuilds have to provide TEXLIVE_MODULE_CONTENTS variable that contains the list
10# of packages that it will install. 15# of packages that it will install. (See below)
11# TEXLIVE_MODULE_CONTENTS will be expanded to SRC_URI : 16#
12# foo -> texlive-module-foo-${PV}.zip
13# What is assumed is that it unpacks texmf and texmf-dist directories to 17# What is assumed is that it unpacks texmf and texmf-dist directories to
14# ${WORKDIR}. 18# ${WORKDIR}.
15# 19#
20# 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# For TeX Live 2007: foo -> texlive-module-foo-${PV}.zip
28# For TeX Live 2008: foo -> texlive-module-foo-${PV}.tar.lzma
29
30# @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# @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.
16 47
17inherit texlive-common 48inherit texlive-common
18 49
19HOMEPAGE="http://www.tug.org/texlive/" 50HOMEPAGE="http://www.tug.org/texlive/"
20 51
52COMMON_DEPEND=">=app-text/texlive-core-${PV}
53 ${TEXLIVE_MODULES_DEPS}"
54
55IUSE=""
56
57# TeX Live 2007 was providing .zip files of CTAN packages. For 2008 they are now
58# .tar.lzma
59if [ -z "${PV##2007*}" ] ; then
21for i in ${TEXLIVE_MODULE_CONTENTS}; do 60for i in ${TEXLIVE_MODULE_CONTENTS}; do
22 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.zip" 61 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.zip"
23done 62done
24
25COMMON_DEPEND=">=app-text/texlive-core-${PV}
26 ${TEXLIVE_MODULES_DEPS}"
27
28DEPEND="${COMMON_DEPEND} 63DEPEND="${COMMON_DEPEND}
29 app-arch/unzip" 64 app-arch/unzip"
65else
66for i in ${TEXLIVE_MODULE_CONTENTS}; do
67 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.tar.lzma"
68done
69DEPEND="${COMMON_DEPEND}
70 app-arch/lzma-utils"
71IUSE="${IUSE} source"
72
73# Forge doc SRC_URI
74[ -n "${PN##*documentation*}" ] && [ -n "${TEXLIVE_MODULE_DOC_CONTENTS}" ] && SRC_URI="${SRC_URI} doc? ("
75for i in ${TEXLIVE_MODULE_DOC_CONTENTS}; do
76 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.tar.lzma"
77done
78[ -n "${PN##*documentation*}" ] && [ -n "${TEXLIVE_MODULE_DOC_CONTENTS}" ] && SRC_URI="${SRC_URI} )"
79
80# Forge source SRC_URI
81if [ -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} )"
87fi
88fi
30 89
31RDEPEND="${COMMON_DEPEND}" 90RDEPEND="${COMMON_DEPEND}"
32 91
33IUSE="doc" 92[ -z "${PN##*documentation*}" ] || IUSE="${IUSE} doc"
34 93
35S="${WORKDIR}" 94S="${WORKDIR}"
36 95
96
97# @FUNCTION: texlive-module_make_language_def_lines
98# @DESCRIPTION:
99# Only valid for TeXLive 2008.
100# Creates a language.${PN}.def entry to put in /etc/texmf/language.def.d
101# It parses the AddHyphen directive of tlpobj files to create it.
102
103texlive-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# Creates a language.${PN}.dat entry to put in /etc/texmf/language.dat.d
122# It parses the AddHyphen directive of tlpobj files to create it.
123
124texlive-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# @FUNCTION: texlive-module_src_compile
138# @DESCRIPTION:
37# src_compile, exported function: 139# exported function:
38# Will look for format.foo.cnf and build foo format files using fmtutil 140# Will look for format.foo.cnf and build foo format files using fmtutil
39# (provided by texlive-core). The compiled format files will be sent to 141# (provided by texlive-core). The compiled format files will be sent to
40# texmf-var/web2c, like fmtutil defaults to but with some trick to stay in the 142# texmf-var/web2c, like fmtutil defaults to but with some trick to stay in the
41# sandbox 143# sandbox
42# The next step is to generate config files that are to be installed in 144# The next step is to generate config files that are to be installed in
53 || die "failed to build format ${i}" 155 || die "failed to build format ${i}"
54 fi 156 fi
55 done 157 done
56 158
57 # Generate config files 159 # Generate config files
160 # TeX Live 2007 was providing lists. For 2008 they are now tlpobj.
161 if [ -z "${PV##2007*}" ] ; then
58 for i in "${S}"/texmf/lists/*; 162 for i in "${S}"/texmf/lists/*;
59 do 163 do
60 grep '^!' "${i}" | tr ' ' '=' |sort|uniq >> "${T}/jobs" 164 grep '^!' "${i}" | sed -e 's/^!//' | tr ' ' '@' |sort|uniq >> "${T}/jobs"
61 done 165 done
62 166 else
63 for j in $(<"${T}/jobs"); 167 for i in "${S}"/tlpkg/tlpobj/*;
64 do 168 do
65 command=$(echo ${j} | sed 's/.\(.*\)=.*/\1/') 169 grep '^execute ' "${i}" | sed -e 's/^execute //' | tr ' ' '@' |sort|uniq >> "${T}/jobs"
66 parameter=$(echo ${j} | sed 's/.*=\(.*\)/\1/') 170 done
171 fi
172
173 for i in $(<"${T}/jobs");
174 do
175 j="$(echo $i | tr '@' ' ')"
176 command=${j%% *}
177 parameter=${j#* }
67 case "${command}" in 178 case "${command}" in
68 addMap) 179 addMap)
69 echo "Map ${parameter}" >> "${S}/${PN}.cfg";; 180 echo "Map ${parameter}" >> "${S}/${PN}.cfg";;
70 addMixedMap) 181 addMixedMap)
71 echo "MixedMap ${parameter}" >> "${S}/${PN}.cfg";; 182 echo "MixedMap ${parameter}" >> "${S}/${PN}.cfg";;
72 addDvipsMap) 183 addDvipsMap)
73 echo "p +${parameter}" >> "${S}/${PN}-config.ps";; 184 echo "p +${parameter}" >> "${S}/${PN}-config.ps";;
74 addDvipdfmMap) 185 addDvipdfmMap)
75 echo "f ${parameter}" >> "${S}/${PN}-config";; 186 echo "f ${parameter}" >> "${S}/${PN}-config";;
187 AddHyphen)
188 texlive-module_make_language_def_lines "$parameter"
189 texlive-module_make_language_dat_lines "$parameter";;
190 BuildFormat)
191 einfo "Format $parameter already built.";;
192 BuildLanguageDat)
193 einfo "Language file $parameter already generated.";;
194 *)
195 die "No rule to proccess ${command}. Please file a bug."
76 esac 196 esac
77 done 197 done
78} 198}
79 199
200# @FUNCTION: texlive-module_src_install
201# @DESCRIPTION:
80# src_install, exported function: 202# exported function:
81# Install texmf and config files to the system 203# Install texmf and config files to the system
82 204
83texlive-module_src_install() { 205texlive-module_src_install() {
206 for i in texmf/fmtutil/format*.cnf; do
207 [ -f "${i}" ] && etexlinks "${i}"
208 done
209
84 insinto /usr/share 210 insinto /usr/share
211 if [ -z "${PN##*documentation*}" ] || use doc; then
212 [ -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
85 [ -d texmf ] && doins -r texmf 218 [ -d texmf ] && doins -r texmf
86 [ -d texmf-dist ] && doins -r texmf-dist 219 [ -d texmf-dist ] && doins -r texmf-dist
220 [ -n "${PV##2007*}" ] && [ -d tlpkg ] && use source && doins -r tlpkg
221
222 insinto /var/lib/texmf
87 [ -d texmf-var ] && doins -r texmf-var 223 [ -d texmf-var ] && doins -r texmf-var/*
88 use doc && [ -d texmf-doc ] && doins -r texmf-doc
89 224
90 insinto /etc/texmf/updmap.d 225 insinto /etc/texmf/updmap.d
91 [ -f "${S}/${PN}.cfg" ] && doins "${S}/${PN}.cfg" 226 [ -f "${S}/${PN}.cfg" ] && doins "${S}/${PN}.cfg"
92 insinto /etc/texmf/dvips/config 227 insinto /etc/texmf/dvips.d
93 [ -f "${S}/${PN}-config.ps" ] && doins "${S}/${PN}-config.ps" 228 [ -f "${S}/${PN}-config.ps" ] && doins "${S}/${PN}-config.ps"
94 insinto /etc/texmf/dvipdfm/config 229 insinto /etc/texmf/dvipdfm/config
95 [ -f "${S}/${PN}-config" ] && doins "${S}/${PN}-config" 230 [ -f "${S}/${PN}-config" ] && doins "${S}/${PN}-config"
96 231
232 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 [ -n "${TEXLIVE_MODULE_BINSCRIPTS}" ] && dobin_texmf_scripts ${TEXLIVE_MODULE_BINSCRIPTS}
242
97 texlive-common_handle_config_files 243 texlive-common_handle_config_files
98} 244}
99 245
100# pkg_postinst and pkg_postrm, exported functions: 246# @FUNCTION: texlive-module_pkg_postinst
247# @DESCRIPTION:
248# exported function:
101# run texmf-update to ensure the tex installation is consistent with the 249# run texmf-update to ensure the tex installation is consistent with the
102# installed texmf trees. 250# installed texmf trees.
103 251
104texlive-module_pkg_postinst() { 252texlive-module_pkg_postinst() {
105 if [ "$ROOT" = "/" ] ; then 253 if [ "$ROOT" = "/" ] && [ -x /usr/sbin/texmf-update ] ; then
106 /usr/sbin/texmf-update 254 /usr/sbin/texmf-update
255 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"
107 fi 259 fi
108} 260}
261
262# @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.
109 267
110texlive-module_pkg_postrm() { 268texlive-module_pkg_postrm() {
111 if [ "$ROOT" = "/" ] ; then 269 if [ "$ROOT" = "/" ] && [ -x /usr/sbin/texmf-update ] ; then
112 /usr/sbin/texmf-update 270 /usr/sbin/texmf-update
271 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"
113 fi 275 fi
114} 276}
115 277
116EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm 278EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm

Legend:
Removed from v.1.1  
changed lines
  Added in v.1.18

  ViewVC Help
Powered by ViewVC 1.1.20