/[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.3 Revision 1.6
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
7INHERITED="$INHERITED $ECLASS" 45INHERITED="$INHERITED $ECLASS"
8 46
9newdepend ">=app-text/tetex-1.0.7" 47newdepend ">=app-text/tetex-1.0.7
48 >=sys-apps/texinfo-4.2-r5"
10ECLASS=latex-package 49ECLASS=latex-package
11HOMEPAGE="http://www.tug.org/" 50HOMEPAGE="http://www.tug.org/"
12SRC_URI="ftp://tug.ctan.org/macros/latex/" 51SRC_URI="ftp://tug.ctan.org/macros/latex/"
13S=${WORKDIR}/${P} 52S=${WORKDIR}/${P}
14TEXMF="/usr/share/texmf" 53TEXMF="/usr/share/texmf"
17latex-package_src_doinstall() { 56latex-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 texi2dvi -q -c --language=latex $i
87 done
88 ;;
45 "tfm" | "vf" | "afm" | "pfb") 89 "tfm" | "vf" | "afm" | "pfb")
46 for i in `find . -maxdepth 1 -name "*.${1}"` 90 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
47 do 91 do
48 insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN} 92 insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN}
49 doins $i 93 doins $i
50 done 94 done
51 ;; 95 ;;
52 "ttf") 96 "ttf")
53 for i in `find . -maxdepth 1 -name "*.ttf"` 97 for i in `find . -maxdepth 1 -type f -name "*.ttf"`
54 do 98 do
55 insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN} 99 insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN}
56 doins $i 100 doins $i
57 done 101 done
58 ;; 102 ;;
59 "styles") 103 "styles")
60 latex-package_src_doinstall sty cls fd 104 latex-package_src_doinstall sty cls fd clo def
61 ;; 105 ;;
62 "doc") 106 "doc")
63 latex-package_src_doinstall dvi ps pdf tex 107 latex-package_src_doinstall tex dtx dvi ps pdf
64 ;; 108 ;;
65 "fonts") 109 "fonts")
66 latex-package_src_doinstall tfm vg afm pfb ttf 110 latex-package_src_doinstall tfm vg afm pfb ttf
67 ;; 111 ;;
68 "bin") 112 "bin")
77} 121}
78 122
79latex-package_src_compile() { 123latex-package_src_compile() {
80 debug-print function $FUNCNAME $* 124 debug-print function $FUNCNAME $*
81 cd ${S} 125 cd ${S}
82 for i in `find \`pwd\` -maxdepth 1 -name "*.ins"` 126 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 127 do
89 echo "Extracting from $i" 128 echo "Extracting from $i"
90 latex --interaction=batchmode $i > /dev/null 129 latex --interaction=batchmode $i > /dev/null
91 done 130 done
92} 131}
98} 137}
99 138
100latex-package_pkg_postinst() { 139latex-package_pkg_postinst() {
101 debug-print function $FUNCNAME $* 140 debug-print function $FUNCNAME $*
102 latex-package_rehash 141 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} 142}
107 143
108latex-package_pkg_postrm() { 144latex-package_pkg_postrm() {
109 debug-print function $FUNCNAME $* 145 debug-print function $FUNCNAME $*
110 # This may be a bit harsh, so perhaps it should be overridden.
111 latex-package_rehash 146 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} 147}
116 148
117latex-package_rehash() { 149latex-package_rehash() {
118 debug-print function $FUNCNAME $* 150 debug-print function $FUNCNAME $*
119 texconfig rehash 151 texconfig rehash
120} 152}
121 153
122latex-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
135EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm 154EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm

Legend:
Removed from v.1.3  
changed lines
  Added in v.1.6

  ViewVC Help
Powered by ViewVC 1.1.20