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

Contents of /eclass/latex-package.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.36 - (show annotations) (download)
Sat Aug 30 13:13:45 2008 UTC (6 years, 3 months ago) by aballier
Branch: MAIN
Changes since 1.35: +2 -1 lines
Symlink the docs from the texmf tree so that texdoc can find them.

1 # Copyright 1999-2008 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: /var/cvsroot/gentoo-x86/eclass/latex-package.eclass,v 1.35 2008/08/30 12:49:36 aballier Exp $
4
5 # @ECLASS: latex-package.eclass
6 # @MAINTAINER:
7 # TeX team <tex@gentoo.org>
8 #
9 # Author Matthew Turk <satai@gentoo.org>
10 # Martin Ehmsen <ehmsen@gentoo.org>
11 # @BLURB: An eclass for easy installation of LaTeX packages
12 # @DESCRIPTION:
13 # This eClass is designed to be easy to use and implement. The vast majority of
14 # LaTeX packages will only need to define SRC_URI (and sometimes S) for a
15 # successful installation. If fonts need to be installed, then the variable
16 # SUPPLIER must also be defined.
17 #
18 # However, those packages that contain subdirectories must process each
19 # subdirectory individually. For example, a package that contains directories
20 # DIR1 and DIR2 must call latex-package_src_compile() and
21 # latex-package_src_install() in each directory, as shown here:
22 #
23 # src_compile() {
24 # cd ${S}
25 # cd DIR1
26 # latex-package_src_compile
27 # cd ..
28 # cd DIR2
29 # latex-package_src_compile
30 # }
31 #
32 # src_install() {
33 # cd ${S}
34 # cd DIR1
35 # latex-package_src_install
36 # cd ..
37 # cd DIR2
38 # latex-package_src_install
39 # }
40 #
41 # The eClass automatically takes care of rehashing TeX's cache (ls-lR) after
42 # installation and after removal, as well as creating final documentation from
43 # TeX files that come with the source. Note that we break TeX layout standards
44 # by placing documentation in /usr/share/doc/${PN}
45 #
46 # For examples of basic installations, check out dev-tex/aastex and
47 # dev-tex/leaflet .
48 #
49 # NOTE: The CTAN "directory grab" function creates files with different MD5
50 # signatures EVERY TIME. For this reason, if you are grabbing from the CTAN,
51 # you must either grab each file individually, or find a place to mirror an
52 # archive of them. (iBiblio)
53 #
54 # It inherits base.
55
56 inherit base
57
58 DEPEND="virtual/latex-base
59 >=sys-apps/texinfo-4.2-r5"
60 HOMEPAGE="http://www.tug.org/"
61 SRC_URI="ftp://tug.ctan.org/macros/latex/"
62 S=${WORKDIR}/${P}
63 TEXMF="/usr/share/texmf"
64
65 # @ECLASS-VARIABLE: SUPPLIER
66 # @DESCRIPTION:
67 # This refers to the font supplier; it should be overridden (see eclass
68 # DESCRIPTION above)
69 SUPPLIER="misc"
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
76 latex-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
92 latex-package_src_doinstall() {
93 debug-print function $FUNCNAME $*
94 # This actually follows the directions for a "single-user" system
95 # at http://www.ctan.org/installationadvice/ modified for gentoo.
96 [ -z "$1" ] && latex-package_src_install all
97
98 while [ "$1" ]; do
99 case $1 in
100 "sh")
101 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
102 do
103 dobin $i || die "dobin $i failed"
104 done
105 ;;
106 "sty" | "cls" | "fd" | "clo" | "def" | "cfg")
107 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
108 do
109 insinto ${TEXMF}/tex/latex/${PN}
110 doins $i || die "doins $i failed"
111 done
112 ;;
113 "dvi" | "ps" | "pdf")
114 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
115 do
116 insinto /usr/share/doc/${PF}
117 doins $i || die "doins $i failed"
118 dosym /usr/share/doc/${PF}/$(basename ${i}) ${TEXMF}/doc/latex/${PN}/${i}
119 #dodoc -u $i
120 done
121 ;;
122 "tex" | "dtx")
123 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
124 do
125 einfo "Making documentation: $i"
126 texi2dvi -q -c --language=latex $i &> /dev/null
127 done
128 ;;
129 "tfm" | "vf" | "afm")
130 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
131 do
132 insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN}
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"
141 done
142 ;;
143 "ttf")
144 for i in `find . -maxdepth 1 -type f -name "*.ttf"`
145 do
146 insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN}
147 doins $i || die "doins $i failed"
148 done
149 ;;
150 "bst")
151 for i in `find . -maxdepth 1 -type f -name "*.bst"`
152 do
153 insinto ${TEXMF}/bibtex/bst/${PN}
154 doins $i || die "doins $i failed"
155 done
156 ;;
157 "styles")
158 latex-package_src_doinstall sty cls fd clo def cfg bst
159 ;;
160 "doc")
161 latex-package_src_doinstall tex dtx dvi ps pdf
162 ;;
163 "fonts")
164 latex-package_src_doinstall tfm vf afm pfb ttf
165 ;;
166 "bin")
167 latex-package_src_doinstall sh
168 ;;
169 "all")
170 latex-package_src_doinstall styles fonts bin doc
171 ;;
172 esac
173 shift
174 done
175 }
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
181 latex-package_src_compile() {
182 debug-print function $FUNCNAME $*
183 for i in `find \`pwd\` -maxdepth 1 -type f -name "*.ins"`
184 do
185 einfo "Extracting from $i"
186 latex --interaction=batchmode $i &> /dev/null
187 done
188 }
189
190 # @FUNCTION: latex-package_src_install
191 # @DESCRIPTION:
192 # Installs the package
193 latex-package_src_install() {
194 debug-print function $FUNCNAME $*
195 latex-package_src_doinstall all
196 if [ -n "${DOCS}" ] ; then
197 dodoc ${DOCS}
198 fi
199 }
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
205 latex-package_pkg_postinst() {
206 debug-print function $FUNCNAME $*
207 latex-package_rehash
208 }
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
214 latex-package_pkg_postrm() {
215 debug-print function $FUNCNAME $*
216 latex-package_rehash
217 }
218
219 # @FUNCTION: latex-package_rehash
220 # @DESCRIPTION:
221 # Rehashes the kpathsea database, according to the current TeX installation
222 latex-package_rehash() {
223 debug-print function $FUNCNAME $*
224 if latex-package_has_tetex_3 ; then
225 texmf-update
226 else
227 texconfig rehash
228 fi
229 }
230
231 EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm

  ViewVC Help
Powered by ViewVC 1.1.20