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