| 1 |
# Author Matthew Turk <m-turk@nwu.edu>
|
| 2 |
# An ebuild calling this class can cd to the appropriate
|
| 3 |
# directory and call latex-package_src_doinstall all, or leave
|
| 4 |
# the src_install function as-is if the system is single-directory.
|
| 5 |
|
| 6 |
inherit base
|
| 7 |
|
| 8 |
newdepend ">=app-text/tetex-1.0.7"
|
| 9 |
ECLASS=latex-package
|
| 10 |
HOMEPAGE="http://www.tug.org/"
|
| 11 |
SRC_URI="ftp://tug.ctan.org/macros/latex/"
|
| 12 |
S=${WORKDIR}/${P}
|
| 13 |
TEXMF="/usr/share/texmf"
|
| 14 |
SUPPLIER="misc" # This refers to the font supplier; it should be overridden
|
| 15 |
|
| 16 |
latex-package_src_doinstall() {
|
| 17 |
debug-print function $FUNCNAME $*
|
| 18 |
# This actually follows the directions for a "single-user" system
|
| 19 |
# at http://www.ctan.org/installationadvice/ modified for gentoo.
|
| 20 |
[ -z "$1" ] && latex-package_src_install all
|
| 21 |
|
| 22 |
while [ "$1" ]; do
|
| 23 |
case $1 in
|
| 24 |
"sh")
|
| 25 |
for i in `find . -maxdepth 1 -name "*.${1}"`
|
| 26 |
do
|
| 27 |
dobin $i
|
| 28 |
done
|
| 29 |
;;
|
| 30 |
"sty" | "cls" | "fd")
|
| 31 |
for i in `find . -maxdepth 1 -name "*.${1}"`
|
| 32 |
do
|
| 33 |
insinto ${TEXMF}/tex/latex/${PN}
|
| 34 |
doins $i
|
| 35 |
done
|
| 36 |
;;
|
| 37 |
"dvi" | "ps" | "pdf" | "tex")
|
| 38 |
for i in `find . -maxdepth 1 -name "*.${1}"`
|
| 39 |
do
|
| 40 |
insinto ${TEXMF}/doc/latex/${PN}
|
| 41 |
doins $i
|
| 42 |
done
|
| 43 |
;;
|
| 44 |
"tfm" | "vf" | "afm" | "pfb")
|
| 45 |
for i in `find . -maxdepth 1 -name "*.${1}"`
|
| 46 |
do
|
| 47 |
insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN}
|
| 48 |
doins $i
|
| 49 |
done
|
| 50 |
;;
|
| 51 |
"ttf")
|
| 52 |
for i in `find . -maxdepth 1 -name "*.ttf"`
|
| 53 |
do
|
| 54 |
insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN}
|
| 55 |
doins $i
|
| 56 |
done
|
| 57 |
;;
|
| 58 |
"styles")
|
| 59 |
latex-package_src_doinstall sty cls fd
|
| 60 |
;;
|
| 61 |
"doc")
|
| 62 |
latex-package_src_doinstall dvi ps pdf tex
|
| 63 |
;;
|
| 64 |
"fonts")
|
| 65 |
latex-package_src_doinstall tfm vg afm pfb ttf
|
| 66 |
;;
|
| 67 |
"bin")
|
| 68 |
latex-package_src_doinstall sh
|
| 69 |
;;
|
| 70 |
"all")
|
| 71 |
latex-package_src_doinstall styles doc fonts bin
|
| 72 |
;;
|
| 73 |
esac
|
| 74 |
shift
|
| 75 |
done
|
| 76 |
}
|
| 77 |
|
| 78 |
latex-package_src_compile() {
|
| 79 |
debug-print function $FUNCNAME $*
|
| 80 |
cd ${S}
|
| 81 |
for i in `find \`pwd\` -maxdepth 1 -name "*.ins"`
|
| 82 |
do
|
| 83 |
echo "Extracting from $i"
|
| 84 |
latex --interaction=batchmode $i > /dev/null
|
| 85 |
done
|
| 86 |
for i in `find \`pwd\` -maxdepth 1 -name "*.dtx"`
|
| 87 |
do
|
| 88 |
echo "Extracting from $i"
|
| 89 |
latex --interaction=batchmode $i > /dev/null
|
| 90 |
done
|
| 91 |
}
|
| 92 |
|
| 93 |
latex-package_src_install() {
|
| 94 |
debug-print function $FUNCNAME $*
|
| 95 |
cd ${S}
|
| 96 |
latex-package_src_doinstall all
|
| 97 |
}
|
| 98 |
|
| 99 |
latex-package_pkg_postinst() {
|
| 100 |
debug-print function $FUNCNAME $*
|
| 101 |
latex-package_rehash
|
| 102 |
if [ ! -e ${TEXMF}/doc/latex/${PN} ] ; then return ; fi
|
| 103 |
cd ${TEXMF}/doc/latex/${PN}
|
| 104 |
latex-package_make_documentation
|
| 105 |
}
|
| 106 |
|
| 107 |
latex-package_pkg_postrm() {
|
| 108 |
debug-print function $FUNCNAME $*
|
| 109 |
# This may be a bit harsh, so perhaps it should be overridden.
|
| 110 |
latex-package_rehash
|
| 111 |
if [ ! -e ${TEXMF}/doc/latex/${PN} ] ; then return ; fi
|
| 112 |
echo "Removing stale documentation: ${TEXMF}/doc/latex/${PN}"
|
| 113 |
rm -rf ${TEXMF}/doc/latex/${PN}
|
| 114 |
}
|
| 115 |
|
| 116 |
latex-package_rehash() {
|
| 117 |
debug-print function $FUNCNAME $*
|
| 118 |
texconfig rehash
|
| 119 |
}
|
| 120 |
|
| 121 |
latex-package_make_documentation() {
|
| 122 |
debug-print function $FUNCNAME $*
|
| 123 |
# This has to come after the installation of all our files.
|
| 124 |
# All errors will be discarded.
|
| 125 |
for i in `find \`pwd\` -maxdepth 1 -name "*.tex"`
|
| 126 |
do
|
| 127 |
# Note - we rerun twice to get references properly.
|
| 128 |
echo "Making Documentation: $i"
|
| 129 |
latex --interaction=batchmode $i > /dev/null
|
| 130 |
done
|
| 131 |
echo "Completed."
|
| 132 |
}
|
| 133 |
|
| 134 |
EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm
|