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

Contents of /eclass/latex-package.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.28 - (show annotations) (download)
Thu Jun 15 10:58:10 2006 UTC (8 years, 5 months ago) by ehmsen
Branch: MAIN
Changes since 1.27: +3 -2 lines
Added Martin Ehmsen <ehmsen@gentoo.org> as maintainer

1 # Copyright 1999-2006 Gentoo Foundation
2 # Distributed under the terms of the GNU General Public License v2
3 # $Header: $
4 #
5 # Author Matthew Turk <satai@gentoo.org>
6 # Martin Ehmsen <ehmsen@gentoo.org>
7 #
8 # 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
10 # successful installation. If fonts need to be installed, then the variable
11 # SUPPLIER must also be defined.
12 #
13 # However, those packages that contain subdirectories must process each
14 # subdirectory individually. For example, a package that contains directories
15 # DIR1 and DIR2 must call latex-package_src_compile() and
16 # latex-package_src_install() in each directory, as shown here:
17 #
18 # src_compile() {
19 # cd ${S}
20 # cd DIR1
21 # latex-package_src_compile
22 # cd ..
23 # cd DIR2
24 # latex-package_src_compile
25 # }
26 #
27 # src_install() {
28 # cd ${S}
29 # cd DIR1
30 # latex-package_src_install
31 # cd ..
32 # cd DIR2
33 # latex-package_src_install
34 # }
35 #
36 # The eClass automatically takes care of rehashing TeX's cache (ls-lR) after
37 # installation and after removal, as well as creating final documentation from
38 # TeX files that come with the source. Note that we break TeX layout standards
39 # by placing documentation in /usr/share/doc/${PN}
40 #
41 # For examples of basic installations, check out dev-tex/aastex and
42 # dev-tex/leaflet .
43 #
44 # 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,
46 # you must either grab each file individually, or find a place to mirror an
47 # archive of them. (iBiblio)
48
49 inherit base
50
51 DEPEND="virtual/tetex
52 >=sys-apps/texinfo-4.2-r5"
53 HOMEPAGE="http://www.tug.org/"
54 SRC_URI="ftp://tug.ctan.org/macros/latex/"
55 S=${WORKDIR}/${P}
56 TEXMF="/usr/share/texmf"
57 SUPPLIER="misc" # This refers to the font supplier; it should be overridden
58
59 latex-package_has_tetex_3() {
60 if has_version '>=app-text/tetex-3' || has_version '>=app-text/ptex-3.1.8' ; then
61 true
62 else
63 false
64 fi
65 }
66
67 latex-package_src_doinstall() {
68 debug-print function $FUNCNAME $*
69 # This actually follows the directions for a "single-user" system
70 # at http://www.ctan.org/installationadvice/ modified for gentoo.
71 [ -z "$1" ] && latex-package_src_install all
72
73 while [ "$1" ]; do
74 case $1 in
75 "sh")
76 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
77 do
78 dobin $i || die "dobin $i failed"
79 done
80 ;;
81 "sty" | "cls" | "fd" | "clo" | "def" | "cfg")
82 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
83 do
84 insinto ${TEXMF}/tex/latex/${PN}
85 doins $i || die "doins $i failed"
86 done
87 ;;
88 "dvi" | "ps" | "pdf")
89 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
90 do
91 insinto /usr/share/doc/${P}
92 doins $i || "doins $i failed"
93 #dodoc -u $i
94 done
95 ;;
96 "tex" | "dtx")
97 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
98 do
99 einfo "Making documentation: $i"
100 texi2dvi -q -c --language=latex $i &> /dev/null
101 done
102 ;;
103 "tfm" | "vf" | "afm")
104 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
105 do
106 insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN}
107 doins $i || die "doins $i failed"
108 done
109 ;;
110 "pfb")
111 for i in `find . -maxdepth 1 -type f -name "*.pfb"`
112 do
113 insinto ${TEXMF}/fonts/type1/${SUPPLIER}/${PN}
114 doins $i || die "doins $i failed"
115 done
116 ;;
117 "ttf")
118 for i in `find . -maxdepth 1 -type f -name "*.ttf"`
119 do
120 insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN}
121 doins $i || die "doins $i failed"
122 done
123 ;;
124 "bst")
125 for i in `find . -maxdepth 1 -type f -name "*.bst"`
126 do
127 insinto ${TEXMF}/bibtex/bst/${PN}
128 doins $i || die "doins $i failed"
129 done
130 ;;
131 "styles")
132 latex-package_src_doinstall sty cls fd clo def cfg bst
133 ;;
134 "doc")
135 latex-package_src_doinstall tex dtx dvi ps pdf
136 ;;
137 "fonts")
138 latex-package_src_doinstall tfm vf afm pfb ttf
139 ;;
140 "bin")
141 latex-package_src_doinstall sh
142 ;;
143 "all")
144 latex-package_src_doinstall styles fonts bin doc
145 ;;
146 esac
147 shift
148 done
149 }
150
151 latex-package_src_compile() {
152 debug-print function $FUNCNAME $*
153 for i in `find \`pwd\` -maxdepth 1 -type f -name "*.ins"`
154 do
155 einfo "Extracting from $i"
156 latex --interaction=batchmode $i &> /dev/null
157 done
158 }
159
160 latex-package_src_install() {
161 debug-print function $FUNCNAME $*
162 latex-package_src_doinstall all
163 if [ -n "${DOCS}" ] ; then
164 dodoc ${DOCS}
165 fi
166 }
167
168 latex-package_pkg_postinst() {
169 debug-print function $FUNCNAME $*
170 latex-package_rehash
171 }
172
173 latex-package_pkg_postrm() {
174 debug-print function $FUNCNAME $*
175 latex-package_rehash
176 }
177
178 latex-package_rehash() {
179 debug-print function $FUNCNAME $*
180 if latex-package_has_tetex_3 ; then
181 texmf-update
182 else
183 texconfig rehash
184 fi
185 }
186
187 EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm

  ViewVC Help
Powered by ViewVC 1.1.20