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

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

  ViewVC Help
Powered by ViewVC 1.1.20