| 1 | # Author Matthew Turk <m-turk@nwu.edu> |
1 | # Copyright 1999-2004 Gentoo Foundation |
| 2 | # An ebuild calling this class can cd to the appropriate |
2 | # Distributed under the terms of the GNU General Public License v2 |
| 3 | # directory and call latex-package_src_doinstall all, or leave |
3 | # $Header: /var/cvsroot/gentoo-x86/eclass/latex-package.eclass,v 1.18 2004/06/25 00:39:48 vapier Exp $ |
| 4 | # the src_install function as-is if the system is single-directory. |
4 | # |
|
|
5 | # Author Matthew Turk <satai@gentoo.org> |
|
|
6 | # |
|
|
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 | # For examples of basic installations, check out dev-tex/aastex and |
|
|
41 | # dev-tex/leaflet . |
|
|
42 | # |
|
|
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) |
| 5 | |
47 | |
| 6 | inherit base |
48 | inherit base |
| 7 | ECLASS=latex-package |
|
|
| 8 | INHERITED="$INHERITED $ECLASS" |
49 | INHERITED="$INHERITED $ECLASS" |
| 9 | |
50 | |
| 10 | newdepend ">=app-text/tetex-1.0.7" |
51 | DEPEND="virtual/tetex |
| 11 | |
52 | >=sys-apps/texinfo-4.2-r5" |
|
|
53 | ECLASS=latex-package |
| 12 | HOMEPAGE="http://www.tug.org/" |
54 | HOMEPAGE="http://www.tug.org/" |
| 13 | SRC_URI="ftp://tug.ctan.org/macros/latex/" |
55 | SRC_URI="ftp://tug.ctan.org/macros/latex/" |
| 14 | S=${WORKDIR}/${P} |
56 | S=${WORKDIR}/${P} |
| 15 | TEXMF="/usr/share/texmf" |
57 | TEXMF="/usr/share/texmf" |
| 16 | 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 |
| … | |
… | |
| 18 | latex-package_src_doinstall() { |
60 | latex-package_src_doinstall() { |
| 19 | debug-print function $FUNCNAME $* |
61 | debug-print function $FUNCNAME $* |
| 20 | # This actually follows the directions for a "single-user" system |
62 | # This actually follows the directions for a "single-user" system |
| 21 | # at http://www.ctan.org/installationadvice/ modified for gentoo. |
63 | # at http://www.ctan.org/installationadvice/ modified for gentoo. |
| 22 | [ -z "$1" ] && latex-package_src_install all |
64 | [ -z "$1" ] && latex-package_src_install all |
| 23 | |
65 | |
| 24 | while [ "$1" ]; do |
66 | while [ "$1" ]; do |
| 25 | case $1 in |
67 | case $1 in |
| 26 | "sh") |
68 | "sh") |
| 27 | for i in `find . -maxdepth 1 -name "*.${1}"` |
69 | for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
| 28 | do |
70 | do |
| 29 | dobin $i |
71 | dobin $i |
| 30 | done |
72 | done |
| 31 | ;; |
73 | ;; |
| 32 | "sty" | "cls" | "fd") |
74 | "sty" | "cls" | "fd" | "clo" | "def") |
| 33 | for i in `find . -maxdepth 1 -name "*.${1}"` |
75 | for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
| 34 | do |
76 | do |
| 35 | insinto ${TEXMF}/tex/latex/${PN} |
77 | insinto ${TEXMF}/tex/latex/${PN} |
| 36 | doins $i |
78 | doins $i |
| 37 | done |
79 | done |
| 38 | ;; |
80 | ;; |
| 39 | "dvi" | "ps" | "pdf" | "tex") |
81 | "dvi" | "ps" | "pdf") |
| 40 | for i in `find . -maxdepth 1 -name "*.${1}"` |
82 | for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
| 41 | do |
83 | do |
| 42 | insinto ${TEXMF}/doc/latex/${PN} |
84 | insinto /usr/share/doc/${P} |
| 43 | doins $i |
85 | doins $i |
|
|
86 | #dodoc -u $i |
| 44 | done |
87 | done |
| 45 | ;; |
88 | ;; |
|
|
89 | "tex" | "dtx") |
|
|
90 | for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
|
|
91 | do |
|
|
92 | einfo "Making documentation: $i" |
|
|
93 | texi2dvi -q -c --language=latex $i &> /dev/null |
|
|
94 | done |
|
|
95 | ;; |
| 46 | "tfm" | "vf" | "afm" | "pfb") |
96 | "tfm" | "vf" | "afm" | "pfb") |
| 47 | for i in `find . -maxdepth 1 -name "*.${1}"` |
97 | for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
| 48 | do |
98 | do |
| 49 | insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN} |
99 | insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN} |
| 50 | doins $i |
100 | doins $i |
| 51 | done |
101 | done |
| 52 | ;; |
102 | ;; |
| 53 | "ttf") |
103 | "ttf") |
| 54 | for i in `find . -maxdepth 1 -name "*.ttf"` |
104 | for i in `find . -maxdepth 1 -type f -name "*.ttf"` |
| 55 | do |
105 | do |
| 56 | insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN} |
106 | insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN} |
| 57 | doins $i |
107 | doins $i |
| 58 | done |
108 | done |
| 59 | ;; |
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 |
|
|
115 | done |
|
|
116 | ;; |
| 60 | "styles") |
117 | "styles") |
| 61 | latex-package_src_doinstall sty cls fd |
118 | latex-package_src_doinstall sty cls fd clo def bst |
| 62 | ;; |
119 | ;; |
| 63 | "doc") |
120 | "doc") |
| 64 | latex-package_src_doinstall dvi ps pdf tex |
121 | latex-package_src_doinstall tex dtx dvi ps pdf |
| 65 | ;; |
122 | ;; |
| 66 | "fonts") |
123 | "fonts") |
| 67 | latex-package_src_doinstall tfm vg afm pfb ttf |
124 | latex-package_src_doinstall tfm vg afm pfb ttf |
| 68 | ;; |
125 | ;; |
| 69 | "bin") |
126 | "bin") |
| 70 | latex-package_src_doinstall sh |
127 | latex-package_src_doinstall sh |
| 71 | ;; |
128 | ;; |
| 72 | "all") |
129 | "all") |
| 73 | latex-package_src_doinstall styles doc fonts bin |
130 | latex-package_src_doinstall styles fonts bin doc |
| 74 | ;; |
131 | ;; |
| 75 | esac |
132 | esac |
| 76 | shift |
133 | shift |
| 77 | done |
134 | done |
| 78 | } |
135 | } |
| 79 | |
136 | |
| 80 | latex-package_src_compile() { |
137 | latex-package_src_compile() { |
| 81 | debug-print function $FUNCNAME $* |
138 | debug-print function $FUNCNAME $* |
| 82 | cd ${S} |
|
|
| 83 | for i in `find \`pwd\` -maxdepth 1 -name "*.ins"` |
139 | for i in `find \`pwd\` -maxdepth 1 -type f -name "*.ins"` |
| 84 | do |
140 | do |
| 85 | echo "Extracting from $i" |
141 | einfo "Extracting from $i" |
| 86 | latex --interaction=batchmode $i > /dev/null |
142 | latex --interaction=batchmode $i &> /dev/null |
| 87 | done |
|
|
| 88 | for i in `find \`pwd\` -maxdepth 1 -name "*.dtx"` |
|
|
| 89 | do |
|
|
| 90 | echo "Extracting from $i" |
|
|
| 91 | latex --interaction=batchmode $i > /dev/null |
|
|
| 92 | done |
143 | done |
| 93 | } |
144 | } |
| 94 | |
145 | |
| 95 | latex-package_src_install() { |
146 | latex-package_src_install() { |
| 96 | debug-print function $FUNCNAME $* |
147 | debug-print function $FUNCNAME $* |
| 97 | cd ${S} |
|
|
| 98 | latex-package_src_doinstall all |
148 | latex-package_src_doinstall all |
| 99 | } |
149 | } |
| 100 | |
150 | |
| 101 | latex-package_pkg_postinst() { |
151 | latex-package_pkg_postinst() { |
| 102 | debug-print function $FUNCNAME $* |
152 | debug-print function $FUNCNAME $* |
| 103 | latex-package_rehash |
153 | latex-package_rehash |
| 104 | if [ ! -e ${TEXMF}/doc/latex/${PN} ] ; then return ; fi |
|
|
| 105 | cd ${TEXMF}/doc/latex/${PN} |
|
|
| 106 | latex-package_make_documentation |
|
|
| 107 | } |
154 | } |
| 108 | |
155 | |
| 109 | latex-package_pkg_postrm() { |
156 | latex-package_pkg_postrm() { |
| 110 | debug-print function $FUNCNAME $* |
157 | debug-print function $FUNCNAME $* |
| 111 | # This may be a bit harsh, so perhaps it should be overridden. |
|
|
| 112 | latex-package_rehash |
158 | latex-package_rehash |
| 113 | if [ ! -e ${TEXMF}/doc/latex/${PN} ] ; then return ; fi |
|
|
| 114 | echo "Removing stale documentation: ${TEXMF}/doc/latex/${PN}" |
|
|
| 115 | rm -rf ${TEXMF}/doc/latex/${PN} |
|
|
| 116 | } |
159 | } |
| 117 | |
160 | |
| 118 | latex-package_rehash() { |
161 | latex-package_rehash() { |
| 119 | debug-print function $FUNCNAME $* |
162 | debug-print function $FUNCNAME $* |
| 120 | texconfig rehash |
163 | texconfig rehash |
| 121 | } |
164 | } |
| 122 | |
165 | |
| 123 | latex-package_make_documentation() { |
|
|
| 124 | debug-print function $FUNCNAME $* |
|
|
| 125 | # This has to come after the installation of all our files. |
|
|
| 126 | # All errors will be discarded. |
|
|
| 127 | for i in `find \`pwd\` -maxdepth 1 -name "*.tex"` |
|
|
| 128 | do |
|
|
| 129 | # Note - we rerun twice to get references properly. |
|
|
| 130 | echo "Making Documentation: $i" |
|
|
| 131 | latex --interaction=batchmode $i > /dev/null |
|
|
| 132 | done |
|
|
| 133 | echo "Completed." |
|
|
| 134 | } |
|
|
| 135 | |
|
|
| 136 | EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm |
166 | EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm |