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/xetex-package.eclass,v 1.37 2008/08/30 13:49:28 aballier Exp $
5 # @ECLASS: xetex-package.eclass
7 # TeX team <tex@gentoo.org>
9 # Author Matthew Turk <satai@gentoo.org>
10 # Martin Ehmsen <ehmsen@gentoo.org>
11 # @BLURB: An eclass for easy installation of LaTeX packages
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.
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 xetex-package_src_compile() and
21 # xetex-package_src_install() in each directory, as shown here:
26 # xetex-package_src_compile
29 # xetex-package_src_compile
35 # xetex-package_src_install
38 # xetex-package_src_install
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}
46 # For examples of basic installations, check out dev-tex/aastex and
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)
54 # Use EAPI2 to make USE dependency easy to specify
61 # here we check three different case for installing xetex,
62 # first is the standard texlive-2008 installation,
63 # second is suppose to be the minimal installation of texlive-xetex-2008
64 # this case is not very certain, but may work.
65 # last is the solo xetex
67 >=app-text/texlive-2008[xetex]
69 >=dev-texlive/texlive-xetex-2008
70 >=dev-texlive/texlive-fontsrecommended-2008
73 >=app-text/xetex-0.997
76 >=sys-apps/texinfo-4.2-r5"
77 HOMEPAGE
="http://www.tug.org/"
78 SRC_URI
="ftp://tug.ctan.org/macros/xetex/"
79 TEXMF
="/usr/share/texmf"
81 # @ECLASS-VARIABLE: SUPPLIER
83 # This refers to the font supplier; it should be overridden (see eclass
87 # @FUNCTION: xetex-package_has_tetex3
88 # @RETURN: true if at least one of (>=tetex-3 or >=ptex-3.1.8 or >=texlive-core-2007) is installed, else false
90 # It is often used to know if the current TeX installation supports gentoo's
91 # texmf-update or if the package has to do it the old way
92 xetex-package_has_tetex_3
() {
93 if has_version
'>=app-text/tetex-3' || has_version
'>=app-text/ptex-3.1.8' || has_version
'>=app-text/texlive-core-2007' ; then
100 # @FUNCTION: xetex-package_src_doinstall
103 # [module] can be one or more of: sh, sty, cls, fd, clo, def, cfg, dvi, ps, pdf,
104 # tex, dtx, tfm, vf, afm, pfb, ttf, bst, styles, doc, fonts, bin, or all.
105 # If [module] is not given, all is assumed.
106 # It installs the files found in the current directory to the standard locations
107 # for a TeX installation
108 xetex-package_src_doinstall
() {
109 debug-print
function $FUNCNAME $
*
110 # This actually follows the directions for a "single-user" system
111 # at http://www.ctan.org/installationadvice/ modified for gentoo.
112 [ -z "$1" ] && xetex-package_src_install all
117 for i
in `find . -maxdepth 1 -type f -name "*.${1}"`
119 dobin
$i || die
"dobin $i failed"
122 "sty" |
"cls" |
"fd" |
"clo" |
"def" |
"cfg")
123 for i
in `find . -maxdepth 1 -type f -name "*.${1}"`
125 insinto
${TEXMF}/tex
/xetex
/${PN}
126 doins
$i || die
"doins $i failed"
129 "dvi" |
"ps" |
"pdf")
130 for i
in `find . -maxdepth 1 -type f -name "*.${1}"`
132 insinto
/usr
/share
/doc
/${PF}
133 doins
$i || die
"doins $i failed"
134 dosym
/usr
/share
/doc
/${PF}/$(basename ${i}) ${TEXMF}/doc/xetex/${PN}/${i}
139 for i
in `find . -maxdepth 1 -type f -name "*.${1}"`
141 einfo
"Making documentation: $i"
142 texi2dvi
-q -c --language=latex
$i &> /dev
/null
145 "tfm" |
"vf" |
"afm")
146 for i
in `find . -maxdepth 1 -type f -name "*.${1}"`
148 insinto
${TEXMF}/fonts/${1}/${SUPPLIER}/${PN}
149 doins
$i || die
"doins $i failed"
153 for i
in `find . -maxdepth 1 -type f -name "*.pfb"`
155 insinto
${TEXMF}/fonts/type1/${SUPPLIER}/${PN}
156 doins
$i || die
"doins $i failed"
160 for i
in `find . -maxdepth 1 -type f -name "*.ttf"`
162 insinto
${TEXMF}/fonts/truetype/${SUPPLIER}/${PN}
163 doins
$i || die
"doins $i failed"
167 for i
in `find . -maxdepth 1 -type f -name "*.bst"`
169 insinto
${TEXMF}/bibtex
/bst
/${PN}
170 doins
$i || die
"doins $i failed"
174 xetex-package_src_doinstall sty cls fd clo def cfg bst
177 xetex-package_src_doinstall tex dtx dvi ps pdf
180 xetex-package_src_doinstall tfm vf afm pfb ttf
183 xetex-package_src_doinstall sh
186 xetex-package_src_doinstall styles fonts bin doc
193 # @FUNCTION: xetex_src_configure
195 # Overide base_src_configure phrase which is inherited from base.eclass
196 # ( http://rafb.net/p/HgzEoq71.html )
197 xetex-package_src_configure
() {
198 einfo
"Nothing to configure."
201 # @FUNCTION: xetex-package_src_compile
203 # Calls xetex for each *.ins in the current directory in order to generate the
204 # relevant files that will be installed
205 xetex-package_src_compile
() {
206 debug-print
function $FUNCNAME $
*
207 for i
in `find \`pwd\
` -maxdepth 1 -type f -name "*.ins"`
209 einfo
"Extracting from $i"
210 xetex
--interaction=batchmode
$i &> /dev
/null
214 # @FUNCTION: xetex-package_src_install
216 # Installs the package
217 xetex-package_src_install
() {
218 debug-print
function $FUNCNAME $
*
219 xetex-package_src_doinstall all
220 if [ -n "${DOCS}" ] ; then
225 # @FUNCTION: xetex-pacakge_pkg_postinst
227 # Calls xetex-package_rehash to ensure the TeX installation is consistent with
228 # the kpathsea database
229 xetex-package_pkg_postinst
() {
230 debug-print
function $FUNCNAME $
*
234 # @FUNCTION: xetex-package_pkg_postrm
236 # Calls xetex-package_rehash to ensure the TeX installation is consistent with
237 # the kpathsea database
238 xetex-package_pkg_postrm
() {
239 debug-print
function $FUNCNAME $
*
243 # @FUNCTION: xetex-package_rehash
245 # Rehashes the kpathsea database, according to the current TeX installation
246 xetex-package_rehash
() {
247 debug-print
function $FUNCNAME $
*
248 if xetex-package_has_tetex_3
; then
255 EXPORT_FUNCTIONS src_configure src_compile src_install pkg_postinst pkg_postrm