/[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.4 Revision 1.9
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
6inherit base 44inherit base
7ECLASS=latex-package
8INHERITED="$INHERITED $ECLASS" 45INHERITED="$INHERITED $ECLASS"
9 46
10newdepend ">=app-text/tetex-1.0.7" 47newdepend ">=app-text/tetex-1.0.7
11 48 >=sys-apps/texinfo-4.2-r5"
49ECLASS=latex-package
12HOMEPAGE="http://www.tug.org/" 50HOMEPAGE="http://www.tug.org/"
13SRC_URI="ftp://tug.ctan.org/macros/latex/" 51SRC_URI="ftp://tug.ctan.org/macros/latex/"
14S=${WORKDIR}/${P} 52S=${WORKDIR}/${P}
15TEXMF="/usr/share/texmf" 53TEXMF="/usr/share/texmf"
16SUPPLIER="misc" # This refers to the font supplier; it should be overridden 54SUPPLIER="misc" # This refers to the font supplier; it should be overridden
18latex-package_src_doinstall() { 56latex-package_src_doinstall() {
19 debug-print function $FUNCNAME $* 57 debug-print function $FUNCNAME $*
20 # This actually follows the directions for a "single-user" system 58 # This actually follows the directions for a "single-user" system
21 # at http://www.ctan.org/installationadvice/ modified for gentoo. 59 # at http://www.ctan.org/installationadvice/ modified for gentoo.
22 [ -z "$1" ] && latex-package_src_install all 60 [ -z "$1" ] && latex-package_src_install all
23 61
24 while [ "$1" ]; do 62 while [ "$1" ]; do
25 case $1 in 63 case $1 in
26 "sh") 64 "sh")
27 for i in `find . -maxdepth 1 -name "*.${1}"` 65 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
28 do 66 do
29 dobin $i 67 dobin $i
30 done 68 done
31 ;; 69 ;;
32 "sty" | "cls" | "fd") 70 "sty" | "cls" | "fd" | "clo" | "def")
33 for i in `find . -maxdepth 1 -name "*.${1}"` 71 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
34 do 72 do
35 insinto ${TEXMF}/tex/latex/${PN} 73 insinto ${TEXMF}/tex/latex/${PN}
36 doins $i 74 doins $i
37 done 75 done
38 ;; 76 ;;
39 "dvi" | "ps" | "pdf" | "tex") 77 "dvi" | "ps" | "pdf")
40 for i in `find . -maxdepth 1 -name "*.${1}"` 78 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
41 do 79 do
42 insinto ${TEXMF}/doc/latex/${PN} 80 insinto /usr/share/doc/${P}
43 doins $i 81 doins $i
82 #dodoc -u $i
44 done 83 done
45 ;; 84 ;;
85 "tex" | "dtx")
86 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
87 do
88 echo "Making documentation: $i"
89 texi2dvi -q -c --language=latex $i
90 done
91 ;;
46 "tfm" | "vf" | "afm" | "pfb") 92 "tfm" | "vf" | "afm" | "pfb")
47 for i in `find . -maxdepth 1 -name "*.${1}"` 93 for i in `find . -maxdepth 1 -type f -name "*.${1}"`
48 do 94 do
49 insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN} 95 insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN}
50 doins $i 96 doins $i
51 done 97 done
52 ;; 98 ;;
53 "ttf") 99 "ttf")
54 for i in `find . -maxdepth 1 -name "*.ttf"` 100 for i in `find . -maxdepth 1 -type f -name "*.ttf"`
55 do 101 do
56 insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN} 102 insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN}
57 doins $i 103 doins $i
58 done 104 done
59 ;; 105 ;;
60 "styles") 106 "styles")
61 latex-package_src_doinstall sty cls fd 107 latex-package_src_doinstall sty cls fd clo def
62 ;; 108 ;;
63 "doc") 109 "doc")
64 latex-package_src_doinstall dvi ps pdf tex 110 latex-package_src_doinstall tex dtx dvi ps pdf
65 ;; 111 ;;
66 "fonts") 112 "fonts")
67 latex-package_src_doinstall tfm vg afm pfb ttf 113 latex-package_src_doinstall tfm vg afm pfb ttf
68 ;; 114 ;;
69 "bin") 115 "bin")
70 latex-package_src_doinstall sh 116 latex-package_src_doinstall sh
71 ;; 117 ;;
72 "all") 118 "all")
73 latex-package_src_doinstall styles doc fonts bin 119 latex-package_src_doinstall styles fonts bin doc
74 ;; 120 ;;
75 esac 121 esac
76 shift 122 shift
77 done 123 done
78} 124}
79 125
80latex-package_src_compile() { 126latex-package_src_compile() {
81 debug-print function $FUNCNAME $* 127 debug-print function $FUNCNAME $*
82 cd ${S} 128 cd ${S}
83 for i in `find \`pwd\` -maxdepth 1 -name "*.ins"` 129 for i in `find \`pwd\` -maxdepth 1 -type f -name "*.ins"`
84 do
85 echo "Extracting from $i"
86 latex --interaction=batchmode $i > /dev/null
87 done
88 for i in `find \`pwd\` -maxdepth 1 -name "*.dtx"`
89 do 130 do
90 echo "Extracting from $i" 131 echo "Extracting from $i"
91 latex --interaction=batchmode $i > /dev/null 132 latex --interaction=batchmode $i > /dev/null
92 done 133 done
93} 134}
99} 140}
100 141
101latex-package_pkg_postinst() { 142latex-package_pkg_postinst() {
102 debug-print function $FUNCNAME $* 143 debug-print function $FUNCNAME $*
103 latex-package_rehash 144 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} 145}
108 146
109latex-package_pkg_postrm() { 147latex-package_pkg_postrm() {
110 debug-print function $FUNCNAME $* 148 debug-print function $FUNCNAME $*
111 # This may be a bit harsh, so perhaps it should be overridden.
112 latex-package_rehash 149 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} 150}
117 151
118latex-package_rehash() { 152latex-package_rehash() {
119 debug-print function $FUNCNAME $* 153 debug-print function $FUNCNAME $*
120 texconfig rehash 154 texconfig rehash
121} 155}
122 156
123latex-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
136EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm 157EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm

Legend:
Removed from v.1.4  
changed lines
  Added in v.1.9

  ViewVC Help
Powered by ViewVC 1.1.20