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

Contents of /eclass/latex-package.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.41 - (hide annotations) (download)
Sun May 17 11:10:22 2015 UTC (2 months, 1 week ago) by ulm
Branch: MAIN
CVS Tags: HEAD
Changes since 1.40: +9 -3 lines
Prevent compression of symlink targets in docdir in EAPIs where this is possible, bug 549584.

1 ulm 1.41 # Copyright 1999-2015 Gentoo Foundation
2 vapier 1.10 # Distributed under the terms of the GNU General Public License v2
3 ulm 1.41 # $Header: /var/cvsroot/gentoo-x86/eclass/latex-package.eclass,v 1.40 2013/07/05 22:59:40 aballier Exp $
4 aballier 1.32
5     # @ECLASS: latex-package.eclass
6     # @MAINTAINER:
7 aballier 1.33 # TeX team <tex@gentoo.org>
8 vapier 1.39 # @AUTHOR:
9     # 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.37 RDEPEND="virtual/latex-base"
59     DEPEND="${RDEPEND}
60 usata 1.17 >=sys-apps/texinfo-4.2-r5"
61 blocke 1.1 HOMEPAGE="http://www.tug.org/"
62     SRC_URI="ftp://tug.ctan.org/macros/latex/"
63     S=${WORKDIR}/${P}
64 aballier 1.40 TEXMF="/usr/share/texmf-site"
65 blocke 1.1
66 aballier 1.32 # @ECLASS-VARIABLE: SUPPLIER
67     # @DESCRIPTION:
68     # This refers to the font supplier; it should be overridden (see eclass
69     # DESCRIPTION above)
70 ulm 1.38 SUPPLIER="misc"
71 aballier 1.32
72     # @FUNCTION: latex-package_has_tetex3
73     # @RETURN: true if at least one of (>=tetex-3 or >=ptex-3.1.8 or >=texlive-core-2007) is installed, else false
74     # @DESCRIPTION:
75     # It is often used to know if the current TeX installation supports gentoo's
76     # texmf-update or if the package has to do it the old way
77 usata 1.23 latex-package_has_tetex_3() {
78 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
79 usata 1.23 true
80     else
81     false
82     fi
83     }
84    
85 aballier 1.32 # @FUNCTION: latex-package_src_doinstall
86     # @USAGE: [ module ]
87     # @DESCRIPTION:
88     # [module] can be one or more of: sh, sty, cls, fd, clo, def, cfg, dvi, ps, pdf,
89     # tex, dtx, tfm, vf, afm, pfb, ttf, bst, styles, doc, fonts, bin, or all.
90     # If [module] is not given, all is assumed.
91     # It installs the files found in the current directory to the standard locations
92     # for a TeX installation
93 blocke 1.1 latex-package_src_doinstall() {
94 usata 1.19 debug-print function $FUNCNAME $*
95     # This actually follows the directions for a "single-user" system
96     # at http://www.ctan.org/installationadvice/ modified for gentoo.
97     [ -z "$1" ] && latex-package_src_install all
98    
99     while [ "$1" ]; do
100     case $1 in
101     "sh")
102     for i in `find . -maxdepth 1 -type f -name "*.${1}"`
103     do
104 usata 1.21 dobin $i || die "dobin $i failed"
105 usata 1.19 done
106     ;;
107 usata 1.20 "sty" | "cls" | "fd" | "clo" | "def" | "cfg")
108 usata 1.19 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
109     do
110     insinto ${TEXMF}/tex/latex/${PN}
111 usata 1.21 doins $i || die "doins $i failed"
112 usata 1.19 done
113     ;;
114     "dvi" | "ps" | "pdf")
115     for i in `find . -maxdepth 1 -type f -name "*.${1}"`
116     do
117 aballier 1.35 insinto /usr/share/doc/${PF}
118 tove 1.34 doins $i || die "doins $i failed"
119 aballier 1.36 dosym /usr/share/doc/${PF}/$(basename ${i}) ${TEXMF}/doc/latex/${PN}/${i}
120 ulm 1.41 case "${EAPI:-0}" in
121     0|1|2|3) ;;
122     *)
123     # prevent compression of symlink target
124     docompress -x /usr/share/doc/${PF}/$(basename ${i})
125     ;;
126     esac
127 usata 1.19 done
128     ;;
129     "tex" | "dtx")
130     for i in `find . -maxdepth 1 -type f -name "*.${1}"`
131     do
132     einfo "Making documentation: $i"
133     texi2dvi -q -c --language=latex $i &> /dev/null
134     done
135     ;;
136 leonardop 1.26 "tfm" | "vf" | "afm")
137 usata 1.19 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
138     do
139     insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN}
140 usata 1.21 doins $i || die "doins $i failed"
141 usata 1.19 done
142     ;;
143 leonardop 1.26 "pfb")
144     for i in `find . -maxdepth 1 -type f -name "*.pfb"`
145     do
146     insinto ${TEXMF}/fonts/type1/${SUPPLIER}/${PN}
147     doins $i || die "doins $i failed"
148     done
149     ;;
150 usata 1.19 "ttf")
151     for i in `find . -maxdepth 1 -type f -name "*.ttf"`
152     do
153     insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN}
154 usata 1.21 doins $i || die "doins $i failed"
155 usata 1.19 done
156     ;;
157     "bst")
158     for i in `find . -maxdepth 1 -type f -name "*.bst"`
159     do
160     insinto ${TEXMF}/bibtex/bst/${PN}
161 usata 1.21 doins $i || die "doins $i failed"
162 usata 1.19 done
163     ;;
164     "styles")
165 usata 1.20 latex-package_src_doinstall sty cls fd clo def cfg bst
166 usata 1.19 ;;
167     "doc")
168     latex-package_src_doinstall tex dtx dvi ps pdf
169     ;;
170     "fonts")
171 usata 1.22 latex-package_src_doinstall tfm vf afm pfb ttf
172 usata 1.19 ;;
173     "bin")
174     latex-package_src_doinstall sh
175     ;;
176     "all")
177 usata 1.20 latex-package_src_doinstall styles fonts bin doc
178 usata 1.19 ;;
179     esac
180     shift
181     done
182 blocke 1.1 }
183    
184 aballier 1.32 # @FUNCTION: latex-package_src_compile
185     # @DESCRIPTION:
186     # Calls latex for each *.ins in the current directory in order to generate the
187     # relevant files that will be installed
188 blocke 1.1 latex-package_src_compile() {
189 usata 1.19 debug-print function $FUNCNAME $*
190     for i in `find \`pwd\` -maxdepth 1 -type f -name "*.ins"`
191     do
192     einfo "Extracting from $i"
193     latex --interaction=batchmode $i &> /dev/null
194     done
195 blocke 1.1 }
196    
197 aballier 1.32 # @FUNCTION: latex-package_src_install
198     # @DESCRIPTION:
199     # Installs the package
200 blocke 1.1 latex-package_src_install() {
201 usata 1.19 debug-print function $FUNCNAME $*
202     latex-package_src_doinstall all
203 usata 1.21 if [ -n "${DOCS}" ] ; then
204     dodoc ${DOCS}
205     fi
206 blocke 1.1 }
207    
208 ulm 1.38 # @FUNCTION: latex-package_pkg_postinst
209 aballier 1.32 # @DESCRIPTION:
210     # Calls latex-package_rehash to ensure the TeX installation is consistent with
211     # the kpathsea database
212 blocke 1.1 latex-package_pkg_postinst() {
213 usata 1.19 debug-print function $FUNCNAME $*
214     latex-package_rehash
215 blocke 1.1 }
216    
217 aballier 1.32 # @FUNCTION: latex-package_pkg_postrm
218     # @DESCRIPTION:
219     # Calls latex-package_rehash to ensure the TeX installation is consistent with
220     # the kpathsea database
221 blocke 1.1 latex-package_pkg_postrm() {
222 usata 1.19 debug-print function $FUNCNAME $*
223     latex-package_rehash
224 blocke 1.1 }
225    
226 aballier 1.32 # @FUNCTION: latex-package_rehash
227     # @DESCRIPTION:
228     # Rehashes the kpathsea database, according to the current TeX installation
229 blocke 1.1 latex-package_rehash() {
230 usata 1.19 debug-print function $FUNCNAME $*
231 usata 1.23 if latex-package_has_tetex_3 ; then
232     texmf-update
233     else
234     texconfig rehash
235     fi
236 blocke 1.1 }
237    
238 nattfodd 1.27 EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm

  ViewVC Help
Powered by ViewVC 1.1.20