/[gentoo-x86]/eclass/latex-package.eclass
Gentoo

Diff of /eclass/latex-package.eclass

Parent Directory Parent Directory | Revision Log Revision Log | View Patch Patch

Revision 1.2 Revision 1.5
1# Author Matthew Turk <m-turk@nwu.edu> 1# Author Matthew Turk <m-turk@nwu.edu>
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
6inherit base 44inherit base
45INHERITED="$INHERITED $ECLASS"
7 46
8newdepend ">=app-text/tetex-1.0.7" 47newdepend ">=app-text/tetex-1.0.7"
9ECLASS=latex-package 48ECLASS=latex-package
10HOMEPAGE="http://www.tug.org/" 49HOMEPAGE="http://www.tug.org/"
11SRC_URI="ftp://tug.ctan.org/macros/latex/" 50SRC_URI="ftp://tug.ctan.org/macros/latex/"
16latex-package_src_doinstall() { 55latex-package_src_doinstall() {
17 debug-print function $FUNCNAME $* 56 debug-print function $FUNCNAME $*
18 # This actually follows the directions for a "single-user" system 57 # This actually follows the directions for a "single-user" system
19 # at http://www.ctan.org/installationadvice/ modified for gentoo. 58 # at http://www.ctan.org/installationadvice/ modified for gentoo.
20 [ -z "$1" ] && latex-package_src_install all 59 [ -z "$1" ] && latex-package_src_install all
21 60
22 while [ "$1" ]; do 61 while [ "$1" ]; do
23 case $1 in 62 case $1 in
24 "sh") 63 "sh")
25 for i in `find . -maxdepth 1 -name "*.${1}"` 64 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
26 do 65 do
27 dobin $i 66 dobin $i
28 done 67 done
29 ;; 68 ;;
30 "sty" | "cls" | "fd") 69 "sty" | "cls" | "fd" | "clo" | "def")
31 for i in `find . -maxdepth 1 -name "*.${1}"` 70 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
32 do 71 do
33 insinto ${TEXMF}/tex/latex/${PN} 72 insinto ${TEXMF}/tex/latex/${PN}
34 doins $i 73 doins $i
35 done 74 done
36 ;; 75 ;;
37 "dvi" | "ps" | "pdf" | "tex") 76 "dvi" | "ps" | "pdf" | "tex" | "dtx")
38 for i in `find . -maxdepth 1 -name "*.${1}"` 77 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
39 do 78 do
40 insinto ${TEXMF}/doc/latex/${PN}
41 doins $i 79 dodoc $i
42 done 80 done
43 ;; 81 ;;
44 "tfm" | "vf" | "afm" | "pfb") 82 "tfm" | "vf" | "afm" | "pfb")
45 for i in `find . -maxdepth 1 -name "*.${1}"` 83 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
46 do 84 do
47 insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN} 85 insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN}
48 doins $i 86 doins $i
49 done 87 done
50 ;; 88 ;;
51 "ttf") 89 "ttf")
52 for i in `find . -maxdepth 1 -name "*.ttf"` 90 for i in `find . -maxdepth 1 -type f -name "*.ttf"`
53 do 91 do
54 insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN} 92 insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN}
55 doins $i 93 doins $i
56 done 94 done
57 ;; 95 ;;
58 "styles") 96 "styles")
59 latex-package_src_doinstall sty cls fd 97 latex-package_src_doinstall sty cls fd clo def
60 ;; 98 ;;
61 "doc") 99 "doc")
62 latex-package_src_doinstall dvi ps pdf tex 100 latex-package_src_doinstall dvi ps pdf tex dtx
63 ;; 101 ;;
64 "fonts") 102 "fonts")
65 latex-package_src_doinstall tfm vg afm pfb ttf 103 latex-package_src_doinstall tfm vg afm pfb ttf
66 ;; 104 ;;
67 "bin") 105 "bin")
76} 114}
77 115
78latex-package_src_compile() { 116latex-package_src_compile() {
79 debug-print function $FUNCNAME $* 117 debug-print function $FUNCNAME $*
80 cd ${S} 118 cd ${S}
81 for i in `find \`pwd\` -maxdepth 1 -name "*.ins"` 119 for i in `find \`pwd\` -maxdepth 1 -type f -name "*.ins"`
82 do
83 echo "Extracting from $i"
84 latex --interaction=batchmode $i > /dev/null
85 done
86 for i in `find \`pwd\` -maxdepth 1 -name "*.dtx"`
87 do 120 do
88 echo "Extracting from $i" 121 echo "Extracting from $i"
89 latex --interaction=batchmode $i > /dev/null 122 latex --interaction=batchmode $i > /dev/null
90 done 123 done
91} 124}
97} 130}
98 131
99latex-package_pkg_postinst() { 132latex-package_pkg_postinst() {
100 debug-print function $FUNCNAME $* 133 debug-print function $FUNCNAME $*
101 latex-package_rehash 134 latex-package_rehash
102 if [ ! -e ${TEXMF}/doc/latex/${PN} ] ; then return ; fi 135 if [ ! -e /usr/doc/latex/${PN} ] ; then return ; fi
103 cd ${TEXMF}/doc/latex/${PN} 136 cd /usr/share/doc/${PN}
104 latex-package_make_documentation 137 latex-package_make_documentation
105} 138}
106 139
107latex-package_pkg_postrm() { 140latex-package_pkg_postrm() {
108 debug-print function $FUNCNAME $* 141 debug-print function $FUNCNAME $*
109 # This may be a bit harsh, so perhaps it should be overridden.
110 latex-package_rehash 142 latex-package_rehash
111 if [ ! -e ${TEXMF}/doc/latex/${PN} ] ; then return ; fi
112 echo "Removing stale documentation: ${TEXMF}/doc/latex/${PN}"
113 rm -rf ${TEXMF}/doc/latex/${PN}
114} 143}
115 144
116latex-package_rehash() { 145latex-package_rehash() {
117 debug-print function $FUNCNAME $* 146 debug-print function $FUNCNAME $*
118 texconfig rehash 147 texconfig rehash
119} 148}
120 149
121latex-package_make_documentation() { 150latex-package_make_documentation() {
122 debug-print function $FUNCNAME $* 151 debug-print function $FUNCNAME $*
123 # This has to come after the installation of all our files.
124 # All errors will be discarded.
125 for i in `find \`pwd\` -maxdepth 1 -name "*.tex"` 152 for i in `find \`pwd\` -maxdepth 1 -type f -name "*.[dt]tex"`
126 do 153 do
127 # Note - we rerun twice to get references properly.
128 echo "Making Documentation: $i" 154 echo "Making Documentation: $i"
129 latex --interaction=batchmode $i > /dev/null 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
130 done 161 done
131 echo "Completed." 162 echo "Completed."
132} 163}
133 164
134EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm 165EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm

Legend:
Removed from v.1.2  
changed lines
  Added in v.1.5

  ViewVC Help
Powered by ViewVC 1.1.20