/[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.8 Revision 1.17
1# Copyright 1999-2008 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.8 2008/02/14 09:02:11 aballier Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/texlive-module.eclass,v 1.17 2008/09/02 09:56:31 aballier Exp $
4 4
5# @ECLASS: texlive-module.eclass 5# @ECLASS: texlive-module.eclass
6# @MAINTAINER: 6# @MAINTAINER:
7# tex@gentoo.org 7# tex@gentoo.org
8# 8#
9# 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 10# @BLURB: Provide generic install functions so that modular texlive's texmf ebuild will only have to inherit this eclass
11# @DESCRIPTION: 11# @DESCRIPTION:
12# 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
13# only have to inherit this eclass. 13# only have to inherit this eclass.
14# 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
15# of packages that it will install. (See below) 15# of packages that it will install. (See below)
16# 16#
22# @ECLASS-VARIABLE: TEXLIVE_MODULE_CONTENTS 22# @ECLASS-VARIABLE: TEXLIVE_MODULE_CONTENTS
23# @DESCRIPTION: 23# @DESCRIPTION:
24# The list of packages that will be installed. This variable will be expanded to 24# The list of packages that will be installed. This variable will be expanded to
25# SRC_URI: 25# SRC_URI:
26# 26#
27# foo -> texlive-module-foo-${PV}.zip 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
28 41
29inherit texlive-common 42inherit texlive-common
30 43
31HOMEPAGE="http://www.tug.org/texlive/" 44HOMEPAGE="http://www.tug.org/texlive/"
32 45
46COMMON_DEPEND=">=app-text/texlive-core-${PV}
47 ${TEXLIVE_MODULES_DEPS}"
48
49IUSE=""
50
51# TeX Live 2007 was providing .zip files of CTAN packages. For 2008 they are now
52# .tar.lzma
53if [ -z "${PV##2007*}" ] ; then
33for i in ${TEXLIVE_MODULE_CONTENTS}; do 54for i in ${TEXLIVE_MODULE_CONTENTS}; do
34 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.zip" 55 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.zip"
35done 56done
36
37COMMON_DEPEND=">=app-text/texlive-core-${PV}
38 ${TEXLIVE_MODULES_DEPS}"
39
40DEPEND="${COMMON_DEPEND} 57DEPEND="${COMMON_DEPEND}
41 app-arch/unzip" 58 app-arch/unzip"
59else
60for i in ${TEXLIVE_MODULE_CONTENTS}; do
61 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.tar.lzma"
62done
63DEPEND="${COMMON_DEPEND}
64 app-arch/lzma-utils"
65IUSE="${IUSE} source"
66
67# Forge doc SRC_URI
68[ -n "${PN##*documentation*}" ] && [ -n "${TEXLIVE_MODULE_DOC_CONTENTS}" ] && SRC_URI="${SRC_URI} doc? ("
69for i in ${TEXLIVE_MODULE_DOC_CONTENTS}; do
70 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.tar.lzma"
71done
72[ -n "${PN##*documentation*}" ] && [ -n "${TEXLIVE_MODULE_DOC_CONTENTS}" ] && SRC_URI="${SRC_URI} )"
73
74# Forge source SRC_URI
75if [ -n "${TEXLIVE_MODULE_SRC_CONTENTS}" ] ; then
76 SRC_URI="${SRC_URI} source? ("
77 for i in ${TEXLIVE_MODULE_SRC_CONTENTS}; do
78 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.tar.lzma"
79 done
80 SRC_URI="${SRC_URI} )"
81fi
82fi
42 83
43RDEPEND="${COMMON_DEPEND}" 84RDEPEND="${COMMON_DEPEND}"
44 85
45IUSE="doc" 86[ -z "${PN##*documentation*}" ] || IUSE="${IUSE} doc"
46 87
47S="${WORKDIR}" 88S="${WORKDIR}"
89
90
91# @FUNCTION: texlive-module_make_language_def_lines
92# @DESCRIPTION:
93# Only valid for TeXLive 2008.
94# Creates a language.${PN}.def entry to put in /etc/texmf/language.def.d
95# It parses the AddHyphen directive of tlpobj files to create it.
96
97texlive-module_make_language_def_lines() {
98 local lefthyphenmin righthyphenmin synonyms name file
99 eval $@
100 einfo "Generating language.def entry for $@"
101 [ -z "$lefthyphenmin" ] && lefthyphenmin="2"
102 [ -z "$righthyphenmin" ] && righthyphenmin="3"
103 echo "\\addlanguage{$name}{$file}{}{$lefthyphenmin}{$righthyphenmin}" >> "${S}/language.${PN}.def"
104 if [ -n "$synonyms" ] ; then
105 for i in $(echo $synonyms | tr ',' ' ') ; do
106 einfo "Generating language.def synonym $i for $@"
107 echo "\\addlanguage{$i}{$file}{}{$lefthyphenmin}{$righthyphenmin}" >> "${S}/language.${PN}.def"
108 done
109 fi
110}
111
112# @FUNCTION: texlive-module_make_language_dat_lines
113# @DESCRIPTION:
114# Only valid for TeXLive 2008.
115# Creates a language.${PN}.dat entry to put in /etc/texmf/language.dat.d
116# It parses the AddHyphen directive of tlpobj files to create it.
117
118texlive-module_make_language_dat_lines() {
119 local lefthyphenmin righthyphenmin synonyms name file
120 eval $@
121 einfo "Generating language.dat entry for $@"
122 echo "$name $file" >> "${S}/language.${PN}.dat"
123 if [ -n "$synonyms" ] ; then
124 for i in $(echo $synonyms | tr ',' ' ') ; do
125 einfo "Generating language.dat synonym $i for $@"
126 echo "=$i" >> "${S}/language.${PN}.dat"
127 done
128 fi
129}
48 130
49# @FUNCTION: texlive-module_src_compile 131# @FUNCTION: texlive-module_src_compile
50# @DESCRIPTION: 132# @DESCRIPTION:
51# exported function: 133# exported function:
52# Will look for format.foo.cnf and build foo format files using fmtutil 134# Will look for format.foo.cnf and build foo format files using fmtutil
67 || die "failed to build format ${i}" 149 || die "failed to build format ${i}"
68 fi 150 fi
69 done 151 done
70 152
71 # Generate config files 153 # Generate config files
154 # TeX Live 2007 was providing lists. For 2008 they are now tlpobj.
155 if [ -z "${PV##2007*}" ] ; then
72 for i in "${S}"/texmf/lists/*; 156 for i in "${S}"/texmf/lists/*;
73 do 157 do
74 grep '^!' "${i}" | tr ' ' '=' |sort|uniq >> "${T}/jobs" 158 grep '^!' "${i}" | sed -e 's/^!//' | tr ' ' '@' |sort|uniq >> "${T}/jobs"
75 done 159 done
76 160 else
77 for j in $(<"${T}/jobs"); 161 for i in "${S}"/tlpkg/tlpobj/*;
78 do 162 do
79 command=$(echo ${j} | sed 's/.\(.*\)=.*/\1/') 163 grep '^execute ' "${i}" | sed -e 's/^execute //' | tr ' ' '@' |sort|uniq >> "${T}/jobs"
80 parameter=$(echo ${j} | sed 's/.*=\(.*\)/\1/') 164 done
165 fi
166
167 for i in $(<"${T}/jobs");
168 do
169 j="$(echo $i | tr '@' ' ')"
170 command=${j%% *}
171 parameter=${j#* }
81 case "${command}" in 172 case "${command}" in
82 addMap) 173 addMap)
83 echo "Map ${parameter}" >> "${S}/${PN}.cfg";; 174 echo "Map ${parameter}" >> "${S}/${PN}.cfg";;
84 addMixedMap) 175 addMixedMap)
85 echo "MixedMap ${parameter}" >> "${S}/${PN}.cfg";; 176 echo "MixedMap ${parameter}" >> "${S}/${PN}.cfg";;
86 addDvipsMap) 177 addDvipsMap)
87 echo "p +${parameter}" >> "${S}/${PN}-config.ps";; 178 echo "p +${parameter}" >> "${S}/${PN}-config.ps";;
88 addDvipdfmMap) 179 addDvipdfmMap)
89 echo "f ${parameter}" >> "${S}/${PN}-config";; 180 echo "f ${parameter}" >> "${S}/${PN}-config";;
181 AddHyphen)
182 texlive-module_make_language_def_lines "$parameter"
183 texlive-module_make_language_dat_lines "$parameter";;
184 BuildFormat)
185 einfo "Format $parameter already built.";;
186 BuildLanguageDat)
187 einfo "Language file $parameter already generated.";;
188 *)
189 die "No rule to proccess ${command}. Please file a bug."
90 esac 190 esac
91 done 191 done
92} 192}
93 193
94# @FUNCTION: texlive-module_src_install 194# @FUNCTION: texlive-module_src_install
100 for i in texmf/fmtutil/format*.cnf; do 200 for i in texmf/fmtutil/format*.cnf; do
101 [ -f "${i}" ] && etexlinks "${i}" 201 [ -f "${i}" ] && etexlinks "${i}"
102 done 202 done
103 203
104 insinto /usr/share 204 insinto /usr/share
105 if use doc; then 205 if [ -z "${PN##*documentation*}" ] || use doc; then
106 [ -d texmf-doc ] && doins -r texmf-doc 206 [ -d texmf-doc ] && doins -r texmf-doc
107 else 207 else
108 [ -d texmf/doc ] && rm -rf texmf/doc 208 [ -d texmf/doc ] && rm -rf texmf/doc
109 [ -d texmf-dist/doc ] && rm -rf texmf-dist/doc 209 [ -d texmf-dist/doc ] && rm -rf texmf-dist/doc
110 fi 210 fi
111 211
112 [ -d texmf ] && doins -r texmf 212 [ -d texmf ] && doins -r texmf
113 [ -d texmf-dist ] && doins -r texmf-dist 213 [ -d texmf-dist ] && doins -r texmf-dist
214 [ -n "${PV##2007*}" ] && [ -d tlpkg ] && use source && doins -r tlpkg
114 215
115 insinto /var/lib/texmf 216 insinto /var/lib/texmf
116 [ -d texmf-var ] && doins -r texmf-var/* 217 [ -d texmf-var ] && doins -r texmf-var/*
117 218
118 insinto /etc/texmf/updmap.d 219 insinto /etc/texmf/updmap.d
120 insinto /etc/texmf/dvips.d 221 insinto /etc/texmf/dvips.d
121 [ -f "${S}/${PN}-config.ps" ] && doins "${S}/${PN}-config.ps" 222 [ -f "${S}/${PN}-config.ps" ] && doins "${S}/${PN}-config.ps"
122 insinto /etc/texmf/dvipdfm/config 223 insinto /etc/texmf/dvipdfm/config
123 [ -f "${S}/${PN}-config" ] && doins "${S}/${PN}-config" 224 [ -f "${S}/${PN}-config" ] && doins "${S}/${PN}-config"
124 225
226 if [ -f "${S}/language.${PN}.def" ] ; then
227 insinto /etc/texmf/language.def.d
228 doins "${S}/language.${PN}.def"
229 fi
230
231 if [ -f "${S}/language.${PN}.dat" ] ; then
232 insinto /etc/texmf/language.dat.d
233 doins "${S}/language.${PN}.dat"
234 fi
235 [ -n "${TEXLIVE_MODULE_BINSCRIPTS}" ] && dobin_texmf_scripts ${TEXLIVE_MODULE_BINSCRIPTS}
236
125 texlive-common_handle_config_files 237 texlive-common_handle_config_files
126} 238}
127 239
128# @FUNCTION: texlive-module_pkg_postinst 240# @FUNCTION: texlive-module_pkg_postinst
129# @DESCRIPTION: 241# @DESCRIPTION:

Legend:
Removed from v.1.8  
changed lines
  Added in v.1.17

  ViewVC Help
Powered by ViewVC 1.1.20