| 1 |
blocke |
1.1 |
# Author Matthew Turk <m-turk@nwu.edu> |
| 2 |
satai |
1.5 |
# |
| 3 |
|
|
# This eClass is designed to be easy to use and implement. The vast majority of |
| 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) |
| 43 |
blocke |
1.1 |
|
| 44 |
|
|
inherit base |
| 45 |
danarmak |
1.3 |
INHERITED="$INHERITED $ECLASS" |
| 46 |
blocke |
1.1 |
|
| 47 |
|
|
newdepend ">=app-text/tetex-1.0.7" |
| 48 |
satai |
1.5 |
ECLASS=latex-package |
| 49 |
blocke |
1.1 |
HOMEPAGE="http://www.tug.org/" |
| 50 |
|
|
SRC_URI="ftp://tug.ctan.org/macros/latex/" |
| 51 |
|
|
S=${WORKDIR}/${P} |
| 52 |
|
|
TEXMF="/usr/share/texmf" |
| 53 |
|
|
SUPPLIER="misc" # This refers to the font supplier; it should be overridden |
| 54 |
|
|
|
| 55 |
|
|
latex-package_src_doinstall() { |
| 56 |
|
|
debug-print function $FUNCNAME $* |
| 57 |
|
|
# This actually follows the directions for a "single-user" system |
| 58 |
|
|
# at http://www.ctan.org/installationadvice/ modified for gentoo. |
| 59 |
|
|
[ -z "$1" ] && latex-package_src_install all |
| 60 |
satai |
1.5 |
|
| 61 |
blocke |
1.1 |
while [ "$1" ]; do |
| 62 |
|
|
case $1 in |
| 63 |
|
|
"sh") |
| 64 |
satai |
1.5 |
for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
| 65 |
blocke |
1.1 |
do |
| 66 |
|
|
dobin $i |
| 67 |
|
|
done |
| 68 |
|
|
;; |
| 69 |
satai |
1.5 |
"sty" | "cls" | "fd" | "clo" | "def") |
| 70 |
|
|
for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
| 71 |
blocke |
1.1 |
do |
| 72 |
|
|
insinto ${TEXMF}/tex/latex/${PN} |
| 73 |
|
|
doins $i |
| 74 |
|
|
done |
| 75 |
|
|
;; |
| 76 |
satai |
1.5 |
"dvi" | "ps" | "pdf" | "tex" | "dtx") |
| 77 |
|
|
for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
| 78 |
blocke |
1.1 |
do |
| 79 |
satai |
1.5 |
dodoc $i |
| 80 |
blocke |
1.1 |
done |
| 81 |
|
|
;; |
| 82 |
|
|
"tfm" | "vf" | "afm" | "pfb") |
| 83 |
satai |
1.5 |
for i in `find . -maxdepth 1 -type f -name "*.${1}"` |
| 84 |
blocke |
1.1 |
do |
| 85 |
|
|
insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN} |
| 86 |
|
|
doins $i |
| 87 |
|
|
done |
| 88 |
|
|
;; |
| 89 |
|
|
"ttf") |
| 90 |
satai |
1.5 |
for i in `find . -maxdepth 1 -type f -name "*.ttf"` |
| 91 |
blocke |
1.1 |
do |
| 92 |
|
|
insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN} |
| 93 |
|
|
doins $i |
| 94 |
|
|
done |
| 95 |
|
|
;; |
| 96 |
|
|
"styles") |
| 97 |
satai |
1.5 |
latex-package_src_doinstall sty cls fd clo def |
| 98 |
blocke |
1.1 |
;; |
| 99 |
|
|
"doc") |
| 100 |
satai |
1.5 |
latex-package_src_doinstall dvi ps pdf tex dtx |
| 101 |
blocke |
1.1 |
;; |
| 102 |
|
|
"fonts") |
| 103 |
|
|
latex-package_src_doinstall tfm vg afm pfb ttf |
| 104 |
|
|
;; |
| 105 |
|
|
"bin") |
| 106 |
|
|
latex-package_src_doinstall sh |
| 107 |
|
|
;; |
| 108 |
|
|
"all") |
| 109 |
|
|
latex-package_src_doinstall styles doc fonts bin |
| 110 |
|
|
;; |
| 111 |
|
|
esac |
| 112 |
|
|
shift |
| 113 |
|
|
done |
| 114 |
|
|
} |
| 115 |
|
|
|
| 116 |
|
|
latex-package_src_compile() { |
| 117 |
|
|
debug-print function $FUNCNAME $* |
| 118 |
|
|
cd ${S} |
| 119 |
satai |
1.5 |
for i in `find \`pwd\` -maxdepth 1 -type f -name "*.ins"` |
| 120 |
blocke |
1.1 |
do |
| 121 |
|
|
echo "Extracting from $i" |
| 122 |
|
|
latex --interaction=batchmode $i > /dev/null |
| 123 |
|
|
done |
| 124 |
|
|
} |
| 125 |
|
|
|
| 126 |
|
|
latex-package_src_install() { |
| 127 |
|
|
debug-print function $FUNCNAME $* |
| 128 |
|
|
cd ${S} |
| 129 |
|
|
latex-package_src_doinstall all |
| 130 |
|
|
} |
| 131 |
|
|
|
| 132 |
|
|
latex-package_pkg_postinst() { |
| 133 |
|
|
debug-print function $FUNCNAME $* |
| 134 |
|
|
latex-package_rehash |
| 135 |
satai |
1.5 |
if [ ! -e /usr/doc/latex/${PN} ] ; then return ; fi |
| 136 |
|
|
cd /usr/share/doc/${PN} |
| 137 |
blocke |
1.1 |
latex-package_make_documentation |
| 138 |
|
|
} |
| 139 |
|
|
|
| 140 |
|
|
latex-package_pkg_postrm() { |
| 141 |
|
|
debug-print function $FUNCNAME $* |
| 142 |
|
|
latex-package_rehash |
| 143 |
|
|
} |
| 144 |
|
|
|
| 145 |
|
|
latex-package_rehash() { |
| 146 |
|
|
debug-print function $FUNCNAME $* |
| 147 |
|
|
texconfig rehash |
| 148 |
|
|
} |
| 149 |
|
|
|
| 150 |
|
|
latex-package_make_documentation() { |
| 151 |
|
|
debug-print function $FUNCNAME $* |
| 152 |
satai |
1.5 |
for i in `find \`pwd\` -maxdepth 1 -type f -name "*.[dt]tex"` |
| 153 |
blocke |
1.1 |
do |
| 154 |
|
|
echo "Making Documentation: $i" |
| 155 |
|
|
latex --interaction=batchmode $i > /dev/null |
| 156 |
satai |
1.5 |
# And we don't want any leftovers... |
| 157 |
|
|
for ext in aux toc log |
| 158 |
|
|
do |
| 159 |
|
|
rm ${i}.${ext} |
| 160 |
|
|
done |
| 161 |
blocke |
1.1 |
done |
| 162 |
|
|
echo "Completed." |
| 163 |
|
|
} |
| 164 |
|
|
|
| 165 |
|
|
EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm |