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

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

  ViewVC Help
Powered by ViewVC 1.1.20