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

Contents of /eclass/latex-package.eclass

Parent Directory Parent Directory | Revision Log Revision Log


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

1 ehmsen 1.28 # Copyright 1999-2006 Gentoo Foundation
2 vapier 1.10 # Distributed under the terms of the GNU General Public License v2
3 ehmsen 1.28 # $Header: $
4 vapier 1.13 #
5 satai 1.7 # Author Matthew Turk <satai@gentoo.org>
6 ehmsen 1.28 # Martin Ehmsen <ehmsen@gentoo.org>
7 satai 1.5 #
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 swegener 1.25 # TeX files that come with the source. Note that we break TeX layout standards
39 satai 1.5 # by placing documentation in /usr/share/doc/${PN}
40     #
41 satai 1.14 # For examples of basic installations, check out dev-tex/aastex and
42     # dev-tex/leaflet .
43 satai 1.5 #
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 blocke 1.1
49     inherit base
50    
51 usata 1.17 DEPEND="virtual/tetex
52     >=sys-apps/texinfo-4.2-r5"
53 blocke 1.1 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 usata 1.23 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 blocke 1.1 latex-package_src_doinstall() {
68 usata 1.19 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 usata 1.21 dobin $i || die "dobin $i failed"
79 usata 1.19 done
80     ;;
81 usata 1.20 "sty" | "cls" | "fd" | "clo" | "def" | "cfg")
82 usata 1.19 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
83     do
84     insinto ${TEXMF}/tex/latex/${PN}
85 usata 1.21 doins $i || die "doins $i failed"
86 usata 1.19 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 usata 1.21 doins $i || "doins $i failed"
93 usata 1.19 #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 leonardop 1.26 "tfm" | "vf" | "afm")
104 usata 1.19 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
105     do
106     insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN}
107 usata 1.21 doins $i || die "doins $i failed"
108 usata 1.19 done
109     ;;
110 leonardop 1.26 "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 usata 1.19 "ttf")
118     for i in `find . -maxdepth 1 -type f -name "*.ttf"`
119     do
120     insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN}
121 usata 1.21 doins $i || die "doins $i failed"
122 usata 1.19 done
123     ;;
124     "bst")
125     for i in `find . -maxdepth 1 -type f -name "*.bst"`
126     do
127     insinto ${TEXMF}/bibtex/bst/${PN}
128 usata 1.21 doins $i || die "doins $i failed"
129 usata 1.19 done
130     ;;
131     "styles")
132 usata 1.20 latex-package_src_doinstall sty cls fd clo def cfg bst
133 usata 1.19 ;;
134     "doc")
135     latex-package_src_doinstall tex dtx dvi ps pdf
136     ;;
137     "fonts")
138 usata 1.22 latex-package_src_doinstall tfm vf afm pfb ttf
139 usata 1.19 ;;
140     "bin")
141     latex-package_src_doinstall sh
142     ;;
143     "all")
144 usata 1.20 latex-package_src_doinstall styles fonts bin doc
145 usata 1.19 ;;
146     esac
147     shift
148     done
149 blocke 1.1 }
150    
151     latex-package_src_compile() {
152 usata 1.19 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 blocke 1.1 }
159    
160     latex-package_src_install() {
161 usata 1.19 debug-print function $FUNCNAME $*
162     latex-package_src_doinstall all
163 usata 1.21 if [ -n "${DOCS}" ] ; then
164     dodoc ${DOCS}
165     fi
166 blocke 1.1 }
167    
168     latex-package_pkg_postinst() {
169 usata 1.19 debug-print function $FUNCNAME $*
170     latex-package_rehash
171 blocke 1.1 }
172    
173     latex-package_pkg_postrm() {
174 usata 1.19 debug-print function $FUNCNAME $*
175     latex-package_rehash
176 blocke 1.1 }
177    
178     latex-package_rehash() {
179 usata 1.19 debug-print function $FUNCNAME $*
180 usata 1.23 if latex-package_has_tetex_3 ; then
181     texmf-update
182     else
183     texconfig rehash
184     fi
185 blocke 1.1 }
186    
187 nattfodd 1.27 EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm

  ViewVC Help
Powered by ViewVC 1.1.20