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

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

  ViewVC Help
Powered by ViewVC 1.1.20