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

Contents of /eclass/latex-package.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.32 - (hide annotations) (download)
Sun Feb 17 19:01:31 2008 UTC (6 years, 1 month ago) by aballier
Branch: MAIN
Changes since 1.31: +48 -6 lines
make latex-package.eclass ready for eclass manpages, patch by mren <bugs@rennings.net> in bug #210049 modified a litte bit by me to give more verbose comments

1 aballier 1.32 # Copyright 1999-2008 Gentoo Foundation
2 vapier 1.10 # Distributed under the terms of the GNU General Public License v2
3 aballier 1.32 # $Header: $
4    
5     # @ECLASS: latex-package.eclass
6     # @MAINTAINER:
7     # text-markup team <text-markup@gentoo.org>
8     #
9 satai 1.7 # Author Matthew Turk <satai@gentoo.org>
10 ehmsen 1.28 # Martin Ehmsen <ehmsen@gentoo.org>
11 aballier 1.32 # @BLURB: An eclass for easy installation of LaTeX packages
12     # @DESCRIPTION:
13 satai 1.5 # 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 swegener 1.25 # TeX files that come with the source. Note that we break TeX layout standards
44 satai 1.5 # by placing documentation in /usr/share/doc/${PN}
45     #
46 satai 1.14 # For examples of basic installations, check out dev-tex/aastex and
47     # dev-tex/leaflet .
48 satai 1.5 #
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 aballier 1.32 #
54     # It inherits base.
55 blocke 1.1
56     inherit base
57    
58 aballier 1.30 DEPEND="virtual/latex-base
59 usata 1.17 >=sys-apps/texinfo-4.2-r5"
60 blocke 1.1 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 aballier 1.32 # @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 usata 1.23 latex-package_has_tetex_3() {
77 aballier 1.31 if has_version '>=app-text/tetex-3' || has_version '>=app-text/ptex-3.1.8' || has_version '>=app-text/texlive-core-2007' ; then
78 usata 1.23 true
79     else
80     false
81     fi
82     }
83    
84 aballier 1.32 # @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 blocke 1.1 latex-package_src_doinstall() {
93 usata 1.19 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 usata 1.21 dobin $i || die "dobin $i failed"
104 usata 1.19 done
105     ;;
106 usata 1.20 "sty" | "cls" | "fd" | "clo" | "def" | "cfg")
107 usata 1.19 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
108     do
109     insinto ${TEXMF}/tex/latex/${PN}
110 usata 1.21 doins $i || die "doins $i failed"
111 usata 1.19 done
112     ;;
113     "dvi" | "ps" | "pdf")
114     for i in `find . -maxdepth 1 -type f -name "*.${1}"`
115     do
116     insinto /usr/share/doc/${P}
117 usata 1.21 doins $i || "doins $i failed"
118 usata 1.19 #dodoc -u $i
119     done
120     ;;
121     "tex" | "dtx")
122     for i in `find . -maxdepth 1 -type f -name "*.${1}"`
123     do
124     einfo "Making documentation: $i"
125     texi2dvi -q -c --language=latex $i &> /dev/null
126     done
127     ;;
128 leonardop 1.26 "tfm" | "vf" | "afm")
129 usata 1.19 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
130     do
131     insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN}
132 usata 1.21 doins $i || die "doins $i failed"
133 usata 1.19 done
134     ;;
135 leonardop 1.26 "pfb")
136     for i in `find . -maxdepth 1 -type f -name "*.pfb"`
137     do
138     insinto ${TEXMF}/fonts/type1/${SUPPLIER}/${PN}
139     doins $i || die "doins $i failed"
140     done
141     ;;
142 usata 1.19 "ttf")
143     for i in `find . -maxdepth 1 -type f -name "*.ttf"`
144     do
145     insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN}
146 usata 1.21 doins $i || die "doins $i failed"
147 usata 1.19 done
148     ;;
149     "bst")
150     for i in `find . -maxdepth 1 -type f -name "*.bst"`
151     do
152     insinto ${TEXMF}/bibtex/bst/${PN}
153 usata 1.21 doins $i || die "doins $i failed"
154 usata 1.19 done
155     ;;
156     "styles")
157 usata 1.20 latex-package_src_doinstall sty cls fd clo def cfg bst
158 usata 1.19 ;;
159     "doc")
160     latex-package_src_doinstall tex dtx dvi ps pdf
161     ;;
162     "fonts")
163 usata 1.22 latex-package_src_doinstall tfm vf afm pfb ttf
164 usata 1.19 ;;
165     "bin")
166     latex-package_src_doinstall sh
167     ;;
168     "all")
169 usata 1.20 latex-package_src_doinstall styles fonts bin doc
170 usata 1.19 ;;
171     esac
172     shift
173     done
174 blocke 1.1 }
175    
176 aballier 1.32 # @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
180 blocke 1.1 latex-package_src_compile() {
181 usata 1.19 debug-print function $FUNCNAME $*
182     for i in `find \`pwd\` -maxdepth 1 -type f -name "*.ins"`
183     do
184     einfo "Extracting from $i"
185     latex --interaction=batchmode $i &> /dev/null
186     done
187 blocke 1.1 }
188    
189 aballier 1.32 # @FUNCTION: latex-package_src_install
190     # @DESCRIPTION:
191     # Installs the package
192 blocke 1.1 latex-package_src_install() {
193 usata 1.19 debug-print function $FUNCNAME $*
194     latex-package_src_doinstall all
195 usata 1.21 if [ -n "${DOCS}" ] ; then
196     dodoc ${DOCS}
197     fi
198 blocke 1.1 }
199    
200 aballier 1.32 # @FUNCTION: latex-pacakge_pkg_postinst
201     # @DESCRIPTION:
202     # Calls latex-package_rehash to ensure the TeX installation is consistent with
203     # the kpathsea database
204 blocke 1.1 latex-package_pkg_postinst() {
205 usata 1.19 debug-print function $FUNCNAME $*
206     latex-package_rehash
207 blocke 1.1 }
208    
209 aballier 1.32 # @FUNCTION: latex-package_pkg_postrm
210     # @DESCRIPTION:
211     # Calls latex-package_rehash to ensure the TeX installation is consistent with
212     # the kpathsea database
213 blocke 1.1 latex-package_pkg_postrm() {
214 usata 1.19 debug-print function $FUNCNAME $*
215     latex-package_rehash
216 blocke 1.1 }
217    
218 aballier 1.32 # @FUNCTION: latex-package_rehash
219     # @DESCRIPTION:
220     # Rehashes the kpathsea database, according to the current TeX installation
221 blocke 1.1 latex-package_rehash() {
222 usata 1.19 debug-print function $FUNCNAME $*
223 usata 1.23 if latex-package_has_tetex_3 ; then
224     texmf-update
225     else
226     texconfig rehash
227     fi
228 blocke 1.1 }
229    
230 nattfodd 1.27 EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm

  ViewVC Help
Powered by ViewVC 1.1.20