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