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