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

Legend:
Removed from v.1.7  
changed lines
  Added in v.1.10

  ViewVC Help
Powered by ViewVC 1.1.20