| 1 | # Copyright 1999-2006 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.28 2006/06/15 10:58:10 ehmsen Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/latex-package.eclass,v 1.35 2008/08/30 12:49:36 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 | # Martin Ehmsen <ehmsen@gentoo.org> |
10 | # Martin Ehmsen <ehmsen@gentoo.org> |
| 7 | # |
11 | # @BLURB: An eclass for easy installation of LaTeX packages |
|
|
12 | # @DESCRIPTION: |
| 8 | # 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 |
| 9 | # 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 |
| 10 | # successful installation. If fonts need to be installed, then the variable |
15 | # successful installation. If fonts need to be installed, then the variable |
| 11 | # SUPPLIER must also be defined. |
16 | # SUPPLIER must also be defined. |
| 12 | # |
17 | # |
| … | |
… | |
| 43 | # |
48 | # |
| 44 | # NOTE: The CTAN "directory grab" function creates files with different MD5 |
49 | # NOTE: The CTAN "directory grab" function creates files with different MD5 |
| 45 | # 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, |
| 46 | # 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 |
| 47 | # archive of them. (iBiblio) |
52 | # archive of them. (iBiblio) |
|
|
53 | # |
|
|
54 | # It inherits base. |
| 48 | |
55 | |
| 49 | inherit base |
56 | inherit base |
| 50 | |
57 | |
| 51 | DEPEND="virtual/tetex |
58 | DEPEND="virtual/latex-base |
| 52 | >=sys-apps/texinfo-4.2-r5" |
59 | >=sys-apps/texinfo-4.2-r5" |
| 53 | HOMEPAGE="http://www.tug.org/" |
60 | HOMEPAGE="http://www.tug.org/" |
| 54 | SRC_URI="ftp://tug.ctan.org/macros/latex/" |
61 | SRC_URI="ftp://tug.ctan.org/macros/latex/" |
| 55 | S=${WORKDIR}/${P} |
62 | S=${WORKDIR}/${P} |
| 56 | TEXMF="/usr/share/texmf" |
63 | TEXMF="/usr/share/texmf" |
|
|
64 | |
|
|
65 | # @ECLASS-VARIABLE: SUPPLIER |
|
|
66 | # @DESCRIPTION: |
| 57 | SUPPLIER="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) |
|
|
69 | SUPPLIER="misc" |
| 58 | |
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 |
| 59 | latex-package_has_tetex_3() { |
76 | latex-package_has_tetex_3() { |
| 60 | if has_version '>=app-text/tetex-3' || has_version '>=app-text/ptex-3.1.8' ; then |
77 | if has_version '>=app-text/tetex-3' || has_version '>=app-text/ptex-3.1.8' || has_version '>=app-text/texlive-core-2007' ; then |
| 61 | true |
78 | true |
| 62 | else |
79 | else |
| 63 | false |
80 | false |
| 64 | fi |
81 | fi |
| 65 | } |
82 | } |
| 66 | |
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 |
| 67 | latex-package_src_doinstall() { |
92 | latex-package_src_doinstall() { |
| 68 | debug-print function $FUNCNAME $* |
93 | debug-print function $FUNCNAME $* |
| 69 | # This actually follows the directions for a "single-user" system |
94 | # This actually follows the directions for a "single-user" system |
| 70 | # at http://www.ctan.org/installationadvice/ modified for gentoo. |
95 | # at http://www.ctan.org/installationadvice/ modified for gentoo. |
| 71 | [ -z "$1" ] && latex-package_src_install all |
96 | [ -z "$1" ] && latex-package_src_install all |
| … | |
… | |
| 86 | done |
111 | done |
| 87 | ;; |
112 | ;; |
| 88 | "dvi" | "ps" | "pdf") |
113 | "dvi" | "ps" | "pdf") |
| 89 | for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
114 | for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
| 90 | do |
115 | do |
| 91 | insinto /usr/share/doc/${P} |
116 | insinto /usr/share/doc/${PF} |
| 92 | doins $i || "doins $i failed" |
117 | doins $i || die "doins $i failed" |
| 93 | #dodoc -u $i |
118 | #dodoc -u $i |
| 94 | done |
119 | done |
| 95 | ;; |
120 | ;; |
| 96 | "tex" | "dtx") |
121 | "tex" | "dtx") |
| 97 | for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
122 | for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
| … | |
… | |
| 146 | esac |
171 | esac |
| 147 | shift |
172 | shift |
| 148 | done |
173 | done |
| 149 | } |
174 | } |
| 150 | |
175 | |
|
|
176 | # @FUNCTION: latex-package_src_compile |
|
|
177 | # @DESCRIPTION: |
|
|
178 | # Calls latex for each *.ins in the current directory in order to generate the |
|
|
179 | # relevant files that will be installed |
| 151 | latex-package_src_compile() { |
180 | latex-package_src_compile() { |
| 152 | debug-print function $FUNCNAME $* |
181 | debug-print function $FUNCNAME $* |
| 153 | for i in `find \`pwd\` -maxdepth 1 -type f -name "*.ins"` |
182 | for i in `find \`pwd\` -maxdepth 1 -type f -name "*.ins"` |
| 154 | do |
183 | do |
| 155 | einfo "Extracting from $i" |
184 | einfo "Extracting from $i" |
| 156 | latex --interaction=batchmode $i &> /dev/null |
185 | latex --interaction=batchmode $i &> /dev/null |
| 157 | done |
186 | done |
| 158 | } |
187 | } |
| 159 | |
188 | |
|
|
189 | # @FUNCTION: latex-package_src_install |
|
|
190 | # @DESCRIPTION: |
|
|
191 | # Installs the package |
| 160 | latex-package_src_install() { |
192 | latex-package_src_install() { |
| 161 | debug-print function $FUNCNAME $* |
193 | debug-print function $FUNCNAME $* |
| 162 | latex-package_src_doinstall all |
194 | latex-package_src_doinstall all |
| 163 | if [ -n "${DOCS}" ] ; then |
195 | if [ -n "${DOCS}" ] ; then |
| 164 | dodoc ${DOCS} |
196 | dodoc ${DOCS} |
| 165 | fi |
197 | fi |
| 166 | } |
198 | } |
| 167 | |
199 | |
|
|
200 | # @FUNCTION: latex-pacakge_pkg_postinst |
|
|
201 | # @DESCRIPTION: |
|
|
202 | # Calls latex-package_rehash to ensure the TeX installation is consistent with |
|
|
203 | # the kpathsea database |
| 168 | latex-package_pkg_postinst() { |
204 | latex-package_pkg_postinst() { |
| 169 | debug-print function $FUNCNAME $* |
205 | debug-print function $FUNCNAME $* |
| 170 | latex-package_rehash |
206 | latex-package_rehash |
| 171 | } |
207 | } |
| 172 | |
208 | |
|
|
209 | # @FUNCTION: latex-package_pkg_postrm |
|
|
210 | # @DESCRIPTION: |
|
|
211 | # Calls latex-package_rehash to ensure the TeX installation is consistent with |
|
|
212 | # the kpathsea database |
| 173 | latex-package_pkg_postrm() { |
213 | latex-package_pkg_postrm() { |
| 174 | debug-print function $FUNCNAME $* |
214 | debug-print function $FUNCNAME $* |
| 175 | latex-package_rehash |
215 | latex-package_rehash |
| 176 | } |
216 | } |
| 177 | |
217 | |
|
|
218 | # @FUNCTION: latex-package_rehash |
|
|
219 | # @DESCRIPTION: |
|
|
220 | # Rehashes the kpathsea database, according to the current TeX installation |
| 178 | latex-package_rehash() { |
221 | latex-package_rehash() { |
| 179 | debug-print function $FUNCNAME $* |
222 | debug-print function $FUNCNAME $* |
| 180 | if latex-package_has_tetex_3 ; then |
223 | if latex-package_has_tetex_3 ; then |
| 181 | texmf-update |
224 | texmf-update |
| 182 | else |
225 | else |