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

Contents of /eclass/latex-package.eclass

Parent Directory Parent Directory | Revision Log Revision Log


Revision 1.23 - (hide annotations) (download)
Sat Apr 9 04:42:10 2005 UTC (9 years, 5 months ago) by usata
Branch: MAIN
Changes since 1.22: +15 -3 lines
added has_tetex_3() and use texmf-update in latex-package_rehash when
tetex-3 is installed

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

  ViewVC Help
Powered by ViewVC 1.1.20