/[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.11
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.11 2008/07/03 22:36:12 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
16 29
17inherit texlive-common 30inherit texlive-common
18 31
19HOMEPAGE="http://www.tug.org/texlive/" 32HOMEPAGE="http://www.tug.org/texlive/"
20 33
34COMMON_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
39if [ -z "${PV##2007*}" ] ; then
21for i in ${TEXLIVE_MODULE_CONTENTS}; do 40for i in ${TEXLIVE_MODULE_CONTENTS}; do
22 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.zip" 41 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.zip"
23done 42done
24
25COMMON_DEPEND=">=app-text/texlive-core-${PV}
26 ${TEXLIVE_MODULES_DEPS}"
27
28DEPEND="${COMMON_DEPEND} 43DEPEND="${COMMON_DEPEND}
29 app-arch/unzip" 44 app-arch/unzip"
45else
46for i in ${TEXLIVE_MODULE_CONTENTS}; do
47 SRC_URI="${SRC_URI} mirror://gentoo/texlive-module-${i}-${PV}.tar.lzma"
48done
49DEPEND="${COMMON_DEPEND}
50 app-arch/lzma-utils"
51fi
30 52
31RDEPEND="${COMMON_DEPEND}" 53RDEPEND="${COMMON_DEPEND}"
32 54
33IUSE="doc" 55[ -z "${PN##*documentation*}" ] || IUSE="doc"
34 56
35S="${WORKDIR}" 57S="${WORKDIR}"
36 58
59# @FUNCTION: texlive-module_src_compile
60# @DESCRIPTION:
37# src_compile, exported function: 61# exported function:
38# Will look for format.foo.cnf and build foo format files using fmtutil 62# 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 63# (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 64# texmf-var/web2c, like fmtutil defaults to but with some trick to stay in the
41# sandbox 65# sandbox
42# The next step is to generate config files that are to be installed in 66# The next step is to generate config files that are to be installed in
53 || die "failed to build format ${i}" 77 || die "failed to build format ${i}"
54 fi 78 fi
55 done 79 done
56 80
57 # Generate config files 81 # Generate config files
82 # TeX Live 2007 was providing lists. For 2008 they are now tlpobj.
83 if [ -z "${PV##2007*}" ] ; then
58 for i in "${S}"/texmf/lists/*; 84 for i in "${S}"/texmf/lists/*;
59 do 85 do
60 grep '^!' "${i}" | tr ' ' '=' |sort|uniq >> "${T}/jobs" 86 grep '^!' "${i}" | sed -e 's/^!//' | tr ' ' '@' |sort|uniq >> "${T}/jobs"
61 done 87 done
88 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
62 94
63 for j in $(<"${T}/jobs"); 95 for i in $(<"${T}/jobs");
64 do 96 do
65 command=$(echo ${j} | sed 's/.\(.*\)=.*/\1/') 97 j="$(echo $i | tr '@' ' ')"
66 parameter=$(echo ${j} | sed 's/.*=\(.*\)/\1/') 98 command=${j%% *}
99 parameter=${j#* }
67 case "${command}" in 100 case "${command}" in
68 addMap) 101 addMap)
69 echo "Map ${parameter}" >> "${S}/${PN}.cfg";; 102 echo "Map ${parameter}" >> "${S}/${PN}.cfg";;
70 addMixedMap) 103 addMixedMap)
71 echo "MixedMap ${parameter}" >> "${S}/${PN}.cfg";; 104 echo "MixedMap ${parameter}" >> "${S}/${PN}.cfg";;
72 addDvipsMap) 105 addDvipsMap)
73 echo "p +${parameter}" >> "${S}/${PN}-config.ps";; 106 echo "p +${parameter}" >> "${S}/${PN}-config.ps";;
74 addDvipdfmMap) 107 addDvipdfmMap)
75 echo "f ${parameter}" >> "${S}/${PN}-config";; 108 echo "f ${parameter}" >> "${S}/${PN}-config";;
109 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."
76 esac 117 esac
77 done 118 done
78} 119}
79 120
121# @FUNCTION: texlive-module_src_install
122# @DESCRIPTION:
80# src_install, exported function: 123# exported function:
81# Install texmf and config files to the system 124# Install texmf and config files to the system
82 125
83texlive-module_src_install() { 126texlive-module_src_install() {
84 for i in texmf/fmtutil/format*.cnf; do 127 for i in texmf/fmtutil/format*.cnf; do
85 [ -f "${i}" ] && etexlinks "${i}" 128 [ -f "${i}" ] && etexlinks "${i}"
86 done 129 done
87 130
88 insinto /usr/share 131 insinto /usr/share
89 if use doc; then 132 if [ -z "${PN##*documentation*}" ] || use doc; then
90 [ -d texmf-doc ] && doins -r texmf-doc 133 [ -d texmf-doc ] && doins -r texmf-doc
91 else 134 else
92 [ -d texmf/doc ] && rm -rf texmf/doc 135 [ -d texmf/doc ] && rm -rf texmf/doc
93 [ -d texmf-dist/doc ] && rm -rf texmf-dist/doc 136 [ -d texmf-dist/doc ] && rm -rf texmf-dist/doc
94 fi 137 fi
95 138
96 [ -d texmf ] && doins -r texmf 139 [ -d texmf ] && doins -r texmf
97 [ -d texmf-dist ] && doins -r texmf-dist 140 [ -d texmf-dist ] && doins -r texmf-dist
141 [ -d tlpkg ] && doins -r tlpkg
98 142
99 insinto /var/lib/texmf 143 insinto /var/lib/texmf
100 [ -d texmf-var ] && doins -r texmf-var/* 144 [ -d texmf-var ] && doins -r texmf-var/*
101 145
102 insinto /etc/texmf/updmap.d 146 insinto /etc/texmf/updmap.d
107 [ -f "${S}/${PN}-config" ] && doins "${S}/${PN}-config" 151 [ -f "${S}/${PN}-config" ] && doins "${S}/${PN}-config"
108 152
109 texlive-common_handle_config_files 153 texlive-common_handle_config_files
110} 154}
111 155
112# pkg_postinst and pkg_postrm, exported functions: 156# @FUNCTION: texlive-module_pkg_postinst
157# @DESCRIPTION:
158# exported function:
113# run texmf-update to ensure the tex installation is consistent with the 159# run texmf-update to ensure the tex installation is consistent with the
114# installed texmf trees. 160# installed texmf trees.
115 161
116texlive-module_pkg_postinst() { 162texlive-module_pkg_postinst() {
117 if [ "$ROOT" = "/" ] ; then 163 if [ "$ROOT" = "/" ] && [ -x /usr/sbin/texmf-update ] ; then
118 /usr/sbin/texmf-update 164 /usr/sbin/texmf-update
165 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"
119 fi 169 fi
120} 170}
121 171
172# @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
122texlive-module_pkg_postrm() { 178texlive-module_pkg_postrm() {
123 if [ "$ROOT" = "/" ] ; then 179 if [ "$ROOT" = "/" ] && [ -x /usr/sbin/texmf-update ] ; then
124 /usr/sbin/texmf-update 180 /usr/sbin/texmf-update
181 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"
125 fi 185 fi
126} 186}
127 187
128EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm 188EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm

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

  ViewVC Help
Powered by ViewVC 1.1.20