/[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.6 Revision 1.19
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.6 2007/12/02 22:47:10 aballier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/texlive-module.eclass,v 1.19 2008/10/31 15:16:28 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
54IUSE=""
55
56# TeX Live 2007 was providing .zip files of CTAN packages. For 2008 they are now
57# .tar.lzma
58if [ -z "${PV##2007*}" ] ; then
21for i in ${TEXLIVE_MODULE_CONTENTS}; do 59for i in ${TEXLIVE_MODULE_CONTENTS}; do
22 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.zip" 60 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.zip"
23done 61done
24 62COMMON_DEPEND="${COMMON_DEPEND}
25COMMON_DEPEND=">=app-text/texlive-core-${PV}
26 ${TEXLIVE_MODULES_DEPS}" 63 ${TEXLIVE_MODULES_DEPS}"
27
28DEPEND="${COMMON_DEPEND} 64DEPEND="${COMMON_DEPEND}
29 app-arch/unzip" 65 app-arch/unzip"
66else
67for i in ${TEXLIVE_MODULE_CONTENTS}; do
68 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.tar.lzma"
69done
70DEPEND="${COMMON_DEPEND}
71 app-arch/lzma-utils"
72IUSE="${IUSE} source"
73
74# Forge doc SRC_URI
75[ -n "${PN##*documentation*}" ] && [ -n "${TEXLIVE_MODULE_DOC_CONTENTS}" ] && SRC_URI="${SRC_URI} doc? ("
76for i in ${TEXLIVE_MODULE_DOC_CONTENTS}; do
77 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.tar.lzma"
78done
79[ -n "${PN##*documentation*}" ] && [ -n "${TEXLIVE_MODULE_DOC_CONTENTS}" ] && SRC_URI="${SRC_URI} )"
80
81# Forge source SRC_URI
82if [ -n "${TEXLIVE_MODULE_SRC_CONTENTS}" ] ; then
83 SRC_URI="${SRC_URI} source? ("
84 for i in ${TEXLIVE_MODULE_SRC_CONTENTS}; do
85 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.tar.lzma"
86 done
87 SRC_URI="${SRC_URI} )"
88fi
89fi
30 90
31RDEPEND="${COMMON_DEPEND}" 91RDEPEND="${COMMON_DEPEND}"
32 92
33IUSE="doc" 93[ -z "${PN##*documentation*}" ] || IUSE="${IUSE} doc"
34 94
35S="${WORKDIR}" 95S="${WORKDIR}"
36 96
97
98# @FUNCTION: texlive-module_make_language_def_lines
99# @DESCRIPTION:
100# Only valid for TeXLive 2008.
101# Creates a language.${PN}.def entry to put in /etc/texmf/language.def.d
102# It parses the AddHyphen directive of tlpobj files to create it.
103
104texlive-module_make_language_def_lines() {
105 local lefthyphenmin righthyphenmin synonyms name file
106 eval $@
107 einfo "Generating language.def entry for $@"
108 [ -z "$lefthyphenmin" ] && lefthyphenmin="2"
109 [ -z "$righthyphenmin" ] && righthyphenmin="3"
110 echo "\\addlanguage{$name}{$file}{}{$lefthyphenmin}{$righthyphenmin}" >> "${S}/language.${PN}.def"
111 if [ -n "$synonyms" ] ; then
112 for i in $(echo $synonyms | tr ',' ' ') ; do
113 einfo "Generating language.def synonym $i for $@"
114 echo "\\addlanguage{$i}{$file}{}{$lefthyphenmin}{$righthyphenmin}" >> "${S}/language.${PN}.def"
115 done
116 fi
117}
118
119# @FUNCTION: texlive-module_make_language_dat_lines
120# @DESCRIPTION:
121# Only valid for TeXLive 2008.
122# Creates a language.${PN}.dat entry to put in /etc/texmf/language.dat.d
123# It parses the AddHyphen directive of tlpobj files to create it.
124
125texlive-module_make_language_dat_lines() {
126 local lefthyphenmin righthyphenmin synonyms name file
127 eval $@
128 einfo "Generating language.dat entry for $@"
129 echo "$name $file" >> "${S}/language.${PN}.dat"
130 if [ -n "$synonyms" ] ; then
131 for i in $(echo $synonyms | tr ',' ' ') ; do
132 einfo "Generating language.dat synonym $i for $@"
133 echo "=$i" >> "${S}/language.${PN}.dat"
134 done
135 fi
136}
137
138# @FUNCTION: texlive-module_src_compile
139# @DESCRIPTION:
37# src_compile, exported function: 140# exported function:
38# Will look for format.foo.cnf and build foo format files using fmtutil 141# 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 142# (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 143# texmf-var/web2c, like fmtutil defaults to but with some trick to stay in the
41# sandbox 144# sandbox
42# The next step is to generate config files that are to be installed in 145# The next step is to generate config files that are to be installed in
53 || die "failed to build format ${i}" 156 || die "failed to build format ${i}"
54 fi 157 fi
55 done 158 done
56 159
57 # Generate config files 160 # Generate config files
161 # TeX Live 2007 was providing lists. For 2008 they are now tlpobj.
162 if [ -z "${PV##2007*}" ] ; then
58 for i in "${S}"/texmf/lists/*; 163 for i in "${S}"/texmf/lists/*;
59 do 164 do
60 grep '^!' "${i}" | tr ' ' '=' |sort|uniq >> "${T}/jobs" 165 grep '^!' "${i}" | sed -e 's/^!//' | tr ' ' '@' |sort|uniq >> "${T}/jobs"
61 done 166 done
62 167 else
63 for j in $(<"${T}/jobs"); 168 for i in "${S}"/tlpkg/tlpobj/*;
64 do 169 do
65 command=$(echo ${j} | sed 's/.\(.*\)=.*/\1/') 170 grep '^execute ' "${i}" | sed -e 's/^execute //' | tr ' ' '@' |sort|uniq >> "${T}/jobs"
66 parameter=$(echo ${j} | sed 's/.*=\(.*\)/\1/') 171 done
172 fi
173
174 for i in $(<"${T}/jobs");
175 do
176 j="$(echo $i | tr '@' ' ')"
177 command=${j%% *}
178 parameter=${j#* }
67 case "${command}" in 179 case "${command}" in
68 addMap) 180 addMap)
69 echo "Map ${parameter}" >> "${S}/${PN}.cfg";; 181 echo "Map ${parameter}" >> "${S}/${PN}.cfg";;
70 addMixedMap) 182 addMixedMap)
71 echo "MixedMap ${parameter}" >> "${S}/${PN}.cfg";; 183 echo "MixedMap ${parameter}" >> "${S}/${PN}.cfg";;
72 addDvipsMap) 184 addDvipsMap)
73 echo "p +${parameter}" >> "${S}/${PN}-config.ps";; 185 echo "p +${parameter}" >> "${S}/${PN}-config.ps";;
74 addDvipdfmMap) 186 addDvipdfmMap)
75 echo "f ${parameter}" >> "${S}/${PN}-config";; 187 echo "f ${parameter}" >> "${S}/${PN}-config";;
188 AddHyphen)
189 texlive-module_make_language_def_lines "$parameter"
190 texlive-module_make_language_dat_lines "$parameter";;
191 BuildFormat)
192 einfo "Format $parameter already built.";;
193 BuildLanguageDat)
194 einfo "Language file $parameter already generated.";;
195 *)
196 die "No rule to proccess ${command}. Please file a bug."
76 esac 197 esac
77 done 198 done
78} 199}
79 200
201# @FUNCTION: texlive-module_src_install
202# @DESCRIPTION:
80# src_install, exported function: 203# exported function:
81# Install texmf and config files to the system 204# Install texmf and config files to the system
82 205
83texlive-module_src_install() { 206texlive-module_src_install() {
84 for i in texmf/fmtutil/format*.cnf; do 207 for i in texmf/fmtutil/format*.cnf; do
85 [ -f "${i}" ] && etexlinks "${i}" 208 [ -f "${i}" ] && etexlinks "${i}"
86 done 209 done
87 210
88 insinto /usr/share 211 insinto /usr/share
89 if use doc; then 212 if [ -z "${PN##*documentation*}" ] || use doc; then
90 [ -d texmf-doc ] && doins -r texmf-doc 213 [ -d texmf-doc ] && doins -r texmf-doc
91 else 214 else
92 [ -d texmf/doc ] && rm -rf texmf/doc 215 [ -d texmf/doc ] && rm -rf texmf/doc
93 [ -d texmf-dist/doc ] && rm -rf texmf-dist/doc 216 [ -d texmf-dist/doc ] && rm -rf texmf-dist/doc
94 fi 217 fi
95 218
96 [ -d texmf ] && doins -r texmf 219 [ -d texmf ] && doins -r texmf
97 [ -d texmf-dist ] && doins -r texmf-dist 220 [ -d texmf-dist ] && doins -r texmf-dist
221 [ -n "${PV##2007*}" ] && [ -d tlpkg ] && use source && doins -r tlpkg
98 222
99 insinto /var/lib/texmf 223 insinto /var/lib/texmf
100 [ -d texmf-var ] && doins -r texmf-var/* 224 [ -d texmf-var ] && doins -r texmf-var/*
101 225
102 insinto /etc/texmf/updmap.d 226 insinto /etc/texmf/updmap.d
104 insinto /etc/texmf/dvips.d 228 insinto /etc/texmf/dvips.d
105 [ -f "${S}/${PN}-config.ps" ] && doins "${S}/${PN}-config.ps" 229 [ -f "${S}/${PN}-config.ps" ] && doins "${S}/${PN}-config.ps"
106 insinto /etc/texmf/dvipdfm/config 230 insinto /etc/texmf/dvipdfm/config
107 [ -f "${S}/${PN}-config" ] && doins "${S}/${PN}-config" 231 [ -f "${S}/${PN}-config" ] && doins "${S}/${PN}-config"
108 232
233 if [ -f "${S}/language.${PN}.def" ] ; then
234 insinto /etc/texmf/language.def.d
235 doins "${S}/language.${PN}.def"
236 fi
237
238 if [ -f "${S}/language.${PN}.dat" ] ; then
239 insinto /etc/texmf/language.dat.d
240 doins "${S}/language.${PN}.dat"
241 fi
242 [ -n "${TEXLIVE_MODULE_BINSCRIPTS}" ] && dobin_texmf_scripts ${TEXLIVE_MODULE_BINSCRIPTS}
243
109 texlive-common_handle_config_files 244 texlive-common_handle_config_files
110} 245}
111 246
112# pkg_postinst and pkg_postrm, exported functions: 247# @FUNCTION: texlive-module_pkg_postinst
248# @DESCRIPTION:
249# exported function:
113# run texmf-update to ensure the tex installation is consistent with the 250# run texmf-update to ensure the tex installation is consistent with the
114# installed texmf trees. 251# installed texmf trees.
115 252
116texlive-module_pkg_postinst() { 253texlive-module_pkg_postinst() {
117 if [ "$ROOT" = "/" ] ; then 254 if [ "$ROOT" = "/" ] && [ -x /usr/sbin/texmf-update ] ; then
118 /usr/sbin/texmf-update 255 /usr/sbin/texmf-update
256 else
257 ewarn "Cannot run texmf-update for some reason."
258 ewarn "Your texmf tree might be inconsistent with your configuration"
259 ewarn "Please try to figure what has happened"
119 fi 260 fi
120} 261}
262
263# @FUNCTION: texlive-module_pkg_postrm
264# @DESCRIPTION:
265# exported function:
266# run texmf-update to ensure the tex installation is consistent with the
267# installed texmf trees.
121 268
122texlive-module_pkg_postrm() { 269texlive-module_pkg_postrm() {
123 if [ "$ROOT" = "/" ] ; then 270 if [ "$ROOT" = "/" ] && [ -x /usr/sbin/texmf-update ] ; then
124 /usr/sbin/texmf-update 271 /usr/sbin/texmf-update
272 else
273 ewarn "Cannot run texmf-update for some reason."
274 ewarn "Your texmf tree might be inconsistent with your configuration"
275 ewarn "Please try to figure what has happened"
125 fi 276 fi
126} 277}
127 278
128EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm 279EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm

Legend:
Removed from v.1.6  
changed lines
  Added in v.1.19

  ViewVC Help
Powered by ViewVC 1.1.20