/[gentoo-x86]/eclass/latex-package.eclass
Gentoo

Diff of /eclass/latex-package.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.20 Revision 1.36
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/latex-package.eclass,v 1.20 2004/11/07 09:19:54 usata Exp $ 3# $Header: /var/cvsroot/gentoo-x86/eclass/latex-package.eclass,v 1.36 2008/08/30 13:13:45 aballier Exp $
4# 4
5# @ECLASS: latex-package.eclass
6# @MAINTAINER:
7# TeX team <tex@gentoo.org>
8#
5# Author Matthew Turk <satai@gentoo.org> 9# Author Matthew Turk <satai@gentoo.org>
6# 10# Martin Ehmsen <ehmsen@gentoo.org>
11# @BLURB: An eclass for easy installation of LaTeX packages
12# @DESCRIPTION:
7# This eClass is designed to be easy to use and implement. The vast majority of 13# This eClass is designed to be easy to use and implement. The vast majority of
8# LaTeX packages will only need to define SRC_URI (and sometimes S) for a 14# LaTeX packages will only need to define SRC_URI (and sometimes S) for a
9# successful installation. If fonts need to be installed, then the variable 15# successful installation. If fonts need to be installed, then the variable
10# SUPPLIER must also be defined. 16# SUPPLIER must also be defined.
11# 17#
32# latex-package_src_install 38# latex-package_src_install
33# } 39# }
34# 40#
35# The eClass automatically takes care of rehashing TeX's cache (ls-lR) after 41# The eClass automatically takes care of rehashing TeX's cache (ls-lR) after
36# installation and after removal, as well as creating final documentation from 42# installation and after removal, as well as creating final documentation from
37# TeX files that come with the source. Note that we break TeX layout standards 43# TeX files that come with the source. Note that we break TeX layout standards
38# by placing documentation in /usr/share/doc/${PN} 44# by placing documentation in /usr/share/doc/${PN}
39# 45#
40# For examples of basic installations, check out dev-tex/aastex and 46# For examples of basic installations, check out dev-tex/aastex and
41# dev-tex/leaflet . 47# dev-tex/leaflet .
42# 48#
43# NOTE: The CTAN "directory grab" function creates files with different MD5 49# NOTE: The CTAN "directory grab" function creates files with different MD5
44# signatures EVERY TIME. For this reason, if you are grabbing from the CTAN, 50# signatures EVERY TIME. For this reason, if you are grabbing from the CTAN,
45# you must either grab each file individually, or find a place to mirror an 51# you must either grab each file individually, or find a place to mirror an
46# archive of them. (iBiblio) 52# archive of them. (iBiblio)
53#
54# It inherits base.
47 55
48inherit base 56inherit base
49INHERITED="$INHERITED $ECLASS"
50 57
51DEPEND="virtual/tetex 58DEPEND="virtual/latex-base
52 >=sys-apps/texinfo-4.2-r5" 59 >=sys-apps/texinfo-4.2-r5"
53ECLASS=latex-package
54HOMEPAGE="http://www.tug.org/" 60HOMEPAGE="http://www.tug.org/"
55SRC_URI="ftp://tug.ctan.org/macros/latex/" 61SRC_URI="ftp://tug.ctan.org/macros/latex/"
56S=${WORKDIR}/${P} 62S=${WORKDIR}/${P}
57TEXMF="/usr/share/texmf" 63TEXMF="/usr/share/texmf"
64
65# @ECLASS-VARIABLE: SUPPLIER
66# @DESCRIPTION:
58SUPPLIER="misc" # This refers to the font supplier; it should be overridden 67# This refers to the font supplier; it should be overridden (see eclass
68# DESCRIPTION above)
69SUPPLIER="misc"
59 70
71# @FUNCTION: latex-package_has_tetex3
72# @RETURN: true if at least one of (>=tetex-3 or >=ptex-3.1.8 or >=texlive-core-2007) is installed, else false
73# @DESCRIPTION:
74# It is often used to know if the current TeX installation supports gentoo's
75# texmf-update or if the package has to do it the old way
76latex-package_has_tetex_3() {
77 if has_version '>=app-text/tetex-3' || has_version '>=app-text/ptex-3.1.8' || has_version '>=app-text/texlive-core-2007' ; then
78 true
79 else
80 false
81 fi
82}
83
84# @FUNCTION: latex-package_src_doinstall
85# @USAGE: [ module ]
86# @DESCRIPTION:
87# [module] can be one or more of: sh, sty, cls, fd, clo, def, cfg, dvi, ps, pdf,
88# tex, dtx, tfm, vf, afm, pfb, ttf, bst, styles, doc, fonts, bin, or all.
89# If [module] is not given, all is assumed.
90# It installs the files found in the current directory to the standard locations
91# for a TeX installation
60latex-package_src_doinstall() { 92latex-package_src_doinstall() {
61 debug-print function $FUNCNAME $* 93 debug-print function $FUNCNAME $*
62 # This actually follows the directions for a "single-user" system 94 # This actually follows the directions for a "single-user" system
63 # at http://www.ctan.org/installationadvice/ modified for gentoo. 95 # at http://www.ctan.org/installationadvice/ modified for gentoo.
64 [ -z "$1" ] && latex-package_src_install all 96 [ -z "$1" ] && latex-package_src_install all
66 while [ "$1" ]; do 98 while [ "$1" ]; do
67 case $1 in 99 case $1 in
68 "sh") 100 "sh")
69 for i in `find . -maxdepth 1 -type f -name "*.${1}"` 101 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
70 do 102 do
71 dobin $i 103 dobin $i || die "dobin $i failed"
72 done 104 done
73 ;; 105 ;;
74 "sty" | "cls" | "fd" | "clo" | "def" | "cfg") 106 "sty" | "cls" | "fd" | "clo" | "def" | "cfg")
75 for i in `find . -maxdepth 1 -type f -name "*.${1}"` 107 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
76 do 108 do
77 insinto ${TEXMF}/tex/latex/${PN} 109 insinto ${TEXMF}/tex/latex/${PN}
78 doins $i 110 doins $i || die "doins $i failed"
79 done 111 done
80 ;; 112 ;;
81 "dvi" | "ps" | "pdf") 113 "dvi" | "ps" | "pdf")
82 for i in `find . -maxdepth 1 -type f -name "*.${1}"` 114 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
83 do 115 do
84 insinto /usr/share/doc/${P} 116 insinto /usr/share/doc/${PF}
85 doins $i 117 doins $i || die "doins $i failed"
118 dosym /usr/share/doc/${PF}/$(basename ${i}) ${TEXMF}/doc/latex/${PN}/${i}
86 #dodoc -u $i 119 #dodoc -u $i
87 done 120 done
88 ;; 121 ;;
89 "tex" | "dtx") 122 "tex" | "dtx")
90 for i in `find . -maxdepth 1 -type f -name "*.${1}"` 123 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
91 do 124 do
92 einfo "Making documentation: $i" 125 einfo "Making documentation: $i"
93 texi2dvi -q -c --language=latex $i &> /dev/null 126 texi2dvi -q -c --language=latex $i &> /dev/null
94 done 127 done
95 ;; 128 ;;
96 "tfm" | "vf" | "afm" | "pfb") 129 "tfm" | "vf" | "afm")
97 for i in `find . -maxdepth 1 -type f -name "*.${1}"` 130 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
98 do 131 do
99 insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN} 132 insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN}
100 doins $i 133 doins $i || die "doins $i failed"
134 done
135 ;;
136 "pfb")
137 for i in `find . -maxdepth 1 -type f -name "*.pfb"`
138 do
139 insinto ${TEXMF}/fonts/type1/${SUPPLIER}/${PN}
140 doins $i || die "doins $i failed"
101 done 141 done
102 ;; 142 ;;
103 "ttf") 143 "ttf")
104 for i in `find . -maxdepth 1 -type f -name "*.ttf"` 144 for i in `find . -maxdepth 1 -type f -name "*.ttf"`
105 do 145 do
106 insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN} 146 insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN}
107 doins $i 147 doins $i || die "doins $i failed"
108 done 148 done
109 ;; 149 ;;
110 "bst") 150 "bst")
111 for i in `find . -maxdepth 1 -type f -name "*.bst"` 151 for i in `find . -maxdepth 1 -type f -name "*.bst"`
112 do 152 do
113 insinto ${TEXMF}/bibtex/bst/${PN} 153 insinto ${TEXMF}/bibtex/bst/${PN}
114 doins $i 154 doins $i || die "doins $i failed"
115 done 155 done
116 ;; 156 ;;
117 "styles") 157 "styles")
118 latex-package_src_doinstall sty cls fd clo def cfg bst 158 latex-package_src_doinstall sty cls fd clo def cfg bst
119 ;; 159 ;;
120 "doc") 160 "doc")
121 latex-package_src_doinstall tex dtx dvi ps pdf 161 latex-package_src_doinstall tex dtx dvi ps pdf
122 ;; 162 ;;
123 "fonts") 163 "fonts")
124 latex-package_src_doinstall tfm vg afm pfb ttf 164 latex-package_src_doinstall tfm vf afm pfb ttf
125 ;; 165 ;;
126 "bin") 166 "bin")
127 latex-package_src_doinstall sh 167 latex-package_src_doinstall sh
128 ;; 168 ;;
129 "all") 169 "all")
132 esac 172 esac
133 shift 173 shift
134 done 174 done
135} 175}
136 176
177# @FUNCTION: latex-package_src_compile
178# @DESCRIPTION:
179# Calls latex for each *.ins in the current directory in order to generate the
180# relevant files that will be installed
137latex-package_src_compile() { 181latex-package_src_compile() {
138 debug-print function $FUNCNAME $* 182 debug-print function $FUNCNAME $*
139 for i in `find \`pwd\` -maxdepth 1 -type f -name "*.ins"` 183 for i in `find \`pwd\` -maxdepth 1 -type f -name "*.ins"`
140 do 184 do
141 einfo "Extracting from $i" 185 einfo "Extracting from $i"
142 latex --interaction=batchmode $i &> /dev/null 186 latex --interaction=batchmode $i &> /dev/null
143 done 187 done
144} 188}
145 189
190# @FUNCTION: latex-package_src_install
191# @DESCRIPTION:
192# Installs the package
146latex-package_src_install() { 193latex-package_src_install() {
147 debug-print function $FUNCNAME $* 194 debug-print function $FUNCNAME $*
148 latex-package_src_doinstall all 195 latex-package_src_doinstall all
149 [ -n "${DOCS}" ] && dodoc ${DOCS} 196 if [ -n "${DOCS}" ] ; then
197 dodoc ${DOCS}
198 fi
150} 199}
151 200
201# @FUNCTION: latex-pacakge_pkg_postinst
202# @DESCRIPTION:
203# Calls latex-package_rehash to ensure the TeX installation is consistent with
204# the kpathsea database
152latex-package_pkg_postinst() { 205latex-package_pkg_postinst() {
153 debug-print function $FUNCNAME $* 206 debug-print function $FUNCNAME $*
154 latex-package_rehash 207 latex-package_rehash
155} 208}
156 209
210# @FUNCTION: latex-package_pkg_postrm
211# @DESCRIPTION:
212# Calls latex-package_rehash to ensure the TeX installation is consistent with
213# the kpathsea database
157latex-package_pkg_postrm() { 214latex-package_pkg_postrm() {
158 debug-print function $FUNCNAME $* 215 debug-print function $FUNCNAME $*
159 latex-package_rehash 216 latex-package_rehash
160} 217}
161 218
219# @FUNCTION: latex-package_rehash
220# @DESCRIPTION:
221# Rehashes the kpathsea database, according to the current TeX installation
162latex-package_rehash() { 222latex-package_rehash() {
163 debug-print function $FUNCNAME $* 223 debug-print function $FUNCNAME $*
224 if latex-package_has_tetex_3 ; then
225 texmf-update
226 else
164 texconfig rehash 227 texconfig rehash
228 fi
165} 229}
166 230
167EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm 231EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm

Legend:
Removed from v.1.20  
changed lines
  Added in v.1.36

  ViewVC Help
Powered by ViewVC 1.1.20