| 1 | # Copyright 1999-2003 Gentoo Technologies, Inc. |
1 | # Copyright 1999-2004 Gentoo Foundation |
| 2 | # Distributed under the terms of the GNU General Public License v2 |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # $Header: /var/cvsroot/gentoo-x86/eclass/latex-package.eclass,v 1.15 2003/09/09 01:06:09 usata Exp $ |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/latex-package.eclass,v 1.21 2004/11/12 00:33:19 usata Exp $ |
| 4 | # |
4 | # |
| 5 | # Author Matthew Turk <satai@gentoo.org> |
5 | # Author Matthew Turk <satai@gentoo.org> |
| 6 | # |
6 | # |
| 7 | # 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 |
| 8 | # 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 |
| … | |
… | |
| 46 | # archive of them. (iBiblio) |
46 | # archive of them. (iBiblio) |
| 47 | |
47 | |
| 48 | inherit base |
48 | inherit base |
| 49 | INHERITED="$INHERITED $ECLASS" |
49 | INHERITED="$INHERITED $ECLASS" |
| 50 | |
50 | |
| 51 | newdepend "virtual/tetex |
51 | DEPEND="virtual/tetex |
| 52 | >=sys-apps/texinfo-4.2-r5" |
52 | >=sys-apps/texinfo-4.2-r5" |
| 53 | ECLASS=latex-package |
53 | ECLASS=latex-package |
| 54 | HOMEPAGE="http://www.tug.org/" |
54 | HOMEPAGE="http://www.tug.org/" |
| 55 | SRC_URI="ftp://tug.ctan.org/macros/latex/" |
55 | SRC_URI="ftp://tug.ctan.org/macros/latex/" |
| 56 | S=${WORKDIR}/${P} |
56 | S=${WORKDIR}/${P} |
| 57 | TEXMF="/usr/share/texmf" |
57 | TEXMF="/usr/share/texmf" |
| 58 | 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 |
| 59 | |
59 | |
| 60 | latex-package_src_doinstall() { |
60 | latex-package_src_doinstall() { |
| 61 | debug-print function $FUNCNAME $* |
61 | debug-print function $FUNCNAME $* |
| 62 | # This actually follows the directions for a "single-user" system |
62 | # This actually follows the directions for a "single-user" system |
| 63 | # at http://www.ctan.org/installationadvice/ modified for gentoo. |
63 | # at http://www.ctan.org/installationadvice/ modified for gentoo. |
| 64 | [ -z "$1" ] && latex-package_src_install all |
64 | [ -z "$1" ] && latex-package_src_install all |
| 65 | |
65 | |
| 66 | while [ "$1" ]; do |
66 | while [ "$1" ]; do |
| 67 | case $1 in |
67 | case $1 in |
| 68 | "sh") |
68 | "sh") |
| 69 | for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
69 | for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
| 70 | do |
70 | do |
| 71 | dobin $i |
71 | dobin $i || die "dobin $i failed" |
| 72 | done |
72 | done |
| 73 | ;; |
73 | ;; |
| 74 | "sty" | "cls" | "fd" | "clo" | "def") |
74 | "sty" | "cls" | "fd" | "clo" | "def" | "cfg") |
| 75 | for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
75 | for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
| 76 | do |
76 | do |
| 77 | insinto ${TEXMF}/tex/latex/${PN} |
77 | insinto ${TEXMF}/tex/latex/${PN} |
| 78 | doins $i |
78 | doins $i || die "doins $i failed" |
| 79 | done |
79 | done |
| 80 | ;; |
80 | ;; |
| 81 | "dvi" | "ps" | "pdf") |
81 | "dvi" | "ps" | "pdf") |
| 82 | for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
82 | for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
| 83 | do |
83 | do |
| 84 | insinto /usr/share/doc/${P} |
84 | insinto /usr/share/doc/${P} |
| 85 | doins $i |
85 | doins $i || "doins $i failed" |
| 86 | #dodoc -u $i |
86 | #dodoc -u $i |
| 87 | done |
87 | done |
| 88 | ;; |
88 | ;; |
| 89 | "tex" | "dtx") |
89 | "tex" | "dtx") |
| 90 | for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
90 | for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
| 91 | do |
91 | do |
| 92 | einfo "Making documentation: $i" |
92 | einfo "Making documentation: $i" |
| 93 | texi2dvi -q -c --language=latex $i &> /dev/null |
93 | texi2dvi -q -c --language=latex $i &> /dev/null |
| 94 | done |
94 | done |
| 95 | ;; |
95 | ;; |
| 96 | "tfm" | "vf" | "afm" | "pfb") |
96 | "tfm" | "vf" | "afm" | "pfb") |
| 97 | for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
97 | for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
| 98 | do |
98 | do |
| 99 | insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN} |
99 | insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN} |
| 100 | doins $i |
100 | doins $i || die "doins $i failed" |
| 101 | done |
101 | done |
| 102 | ;; |
102 | ;; |
| 103 | "ttf") |
103 | "ttf") |
| 104 | for i in `find . -maxdepth 1 -type f -name "*.ttf"` |
104 | for i in `find . -maxdepth 1 -type f -name "*.ttf"` |
| 105 | do |
105 | do |
| 106 | insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN} |
106 | insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN} |
| 107 | doins $i |
107 | doins $i || die "doins $i failed" |
| 108 | done |
108 | done |
| 109 | ;; |
109 | ;; |
| 110 | "styles") |
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") |
| 111 | latex-package_src_doinstall sty cls fd clo def |
118 | latex-package_src_doinstall sty cls fd clo def cfg bst |
| 112 | ;; |
119 | ;; |
| 113 | "doc") |
120 | "doc") |
| 114 | latex-package_src_doinstall tex dtx dvi ps pdf |
121 | latex-package_src_doinstall tex dtx dvi ps pdf |
| 115 | ;; |
122 | ;; |
| 116 | "fonts") |
123 | "fonts") |
| 117 | latex-package_src_doinstall tfm vg afm pfb ttf |
124 | latex-package_src_doinstall tfm vg afm pfb ttf |
| 118 | ;; |
125 | ;; |
| 119 | "bin") |
126 | "bin") |
| 120 | latex-package_src_doinstall sh |
127 | latex-package_src_doinstall sh |
| 121 | ;; |
128 | ;; |
| 122 | "all") |
129 | "all") |
| 123 | latex-package_src_doinstall styles fonts bin doc |
130 | latex-package_src_doinstall styles fonts bin doc |
| 124 | ;; |
131 | ;; |
| 125 | esac |
132 | esac |
| 126 | shift |
133 | shift |
| 127 | done |
134 | done |
| 128 | } |
135 | } |
| 129 | |
136 | |
| 130 | latex-package_src_compile() { |
137 | latex-package_src_compile() { |
| 131 | debug-print function $FUNCNAME $* |
138 | debug-print function $FUNCNAME $* |
| 132 | cd ${S} |
|
|
| 133 | for i in `find \`pwd\` -maxdepth 1 -type f -name "*.ins"` |
139 | for i in `find \`pwd\` -maxdepth 1 -type f -name "*.ins"` |
| 134 | do |
140 | do |
| 135 | einfo "Extracting from $i" |
141 | einfo "Extracting from $i" |
| 136 | latex --interaction=batchmode $i &> /dev/null |
142 | latex --interaction=batchmode $i &> /dev/null |
| 137 | done |
143 | done |
| 138 | } |
144 | } |
| 139 | |
145 | |
| 140 | latex-package_src_install() { |
146 | latex-package_src_install() { |
| 141 | debug-print function $FUNCNAME $* |
147 | debug-print function $FUNCNAME $* |
| 142 | cd ${S} |
|
|
| 143 | latex-package_src_doinstall all |
148 | latex-package_src_doinstall all |
|
|
149 | if [ -n "${DOCS}" ] ; then |
|
|
150 | dodoc ${DOCS} |
|
|
151 | fi |
| 144 | } |
152 | } |
| 145 | |
153 | |
| 146 | latex-package_pkg_postinst() { |
154 | latex-package_pkg_postinst() { |
| 147 | debug-print function $FUNCNAME $* |
155 | debug-print function $FUNCNAME $* |
| 148 | latex-package_rehash |
156 | latex-package_rehash |
| 149 | } |
157 | } |
| 150 | |
158 | |
| 151 | latex-package_pkg_postrm() { |
159 | latex-package_pkg_postrm() { |
| 152 | debug-print function $FUNCNAME $* |
160 | debug-print function $FUNCNAME $* |
| 153 | latex-package_rehash |
161 | latex-package_rehash |
| 154 | } |
162 | } |
| 155 | |
163 | |
| 156 | latex-package_rehash() { |
164 | latex-package_rehash() { |
| 157 | debug-print function $FUNCNAME $* |
165 | debug-print function $FUNCNAME $* |
| 158 | texconfig rehash |
166 | texconfig rehash |
| 159 | } |
167 | } |
| 160 | |
168 | |
| 161 | EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm |
169 | EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm |