| 1 |
blocke |
1.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 |
danarmak |
1.4 |
ECLASS=latex-package |
| 8 |
danarmak |
1.3 |
INHERITED="$INHERITED $ECLASS" |
| 9 |
blocke |
1.1 |
|
| 10 |
|
|
newdepend ">=app-text/tetex-1.0.7" |
| 11 |
danarmak |
1.4 |
|
| 12 |
blocke |
1.1 |
HOMEPAGE="http://www.tug.org/" |
| 13 |
|
|
SRC_URI="ftp://tug.ctan.org/macros/latex/" |
| 14 |
|
|
S=${WORKDIR}/${P} |
| 15 |
|
|
TEXMF="/usr/share/texmf" |
| 16 |
|
|
SUPPLIER="misc" # This refers to the font supplier; it should be overridden |
| 17 |
|
|
|
| 18 |
|
|
latex-package_src_doinstall() { |
| 19 |
|
|
debug-print function $FUNCNAME $* |
| 20 |
|
|
# This actually follows the directions for a "single-user" system |
| 21 |
|
|
# at http://www.ctan.org/installationadvice/ modified for gentoo. |
| 22 |
|
|
[ -z "$1" ] && latex-package_src_install all |
| 23 |
|
|
|
| 24 |
|
|
while [ "$1" ]; do |
| 25 |
|
|
case $1 in |
| 26 |
|
|
"sh") |
| 27 |
|
|
for i in `find . -maxdepth 1 -name "*.${1}"` |
| 28 |
|
|
do |
| 29 |
|
|
dobin $i |
| 30 |
|
|
done |
| 31 |
|
|
;; |
| 32 |
|
|
"sty" | "cls" | "fd") |
| 33 |
|
|
for i in `find . -maxdepth 1 -name "*.${1}"` |
| 34 |
|
|
do |
| 35 |
|
|
insinto ${TEXMF}/tex/latex/${PN} |
| 36 |
|
|
doins $i |
| 37 |
|
|
done |
| 38 |
|
|
;; |
| 39 |
|
|
"dvi" | "ps" | "pdf" | "tex") |
| 40 |
|
|
for i in `find . -maxdepth 1 -name "*.${1}"` |
| 41 |
|
|
do |
| 42 |
|
|
insinto ${TEXMF}/doc/latex/${PN} |
| 43 |
|
|
doins $i |
| 44 |
|
|
done |
| 45 |
|
|
;; |
| 46 |
|
|
"tfm" | "vf" | "afm" | "pfb") |
| 47 |
|
|
for i in `find . -maxdepth 1 -name "*.${1}"` |
| 48 |
|
|
do |
| 49 |
|
|
insinto ${TEXMF}/fonts/${1}/${SUPPLIER}/${PN} |
| 50 |
|
|
doins $i |
| 51 |
|
|
done |
| 52 |
|
|
;; |
| 53 |
|
|
"ttf") |
| 54 |
|
|
for i in `find . -maxdepth 1 -name "*.ttf"` |
| 55 |
|
|
do |
| 56 |
|
|
insinto ${TEXMF}/fonts/truetype/${SUPPLIER}/${PN} |
| 57 |
|
|
doins $i |
| 58 |
|
|
done |
| 59 |
|
|
;; |
| 60 |
|
|
"styles") |
| 61 |
|
|
latex-package_src_doinstall sty cls fd |
| 62 |
|
|
;; |
| 63 |
|
|
"doc") |
| 64 |
|
|
latex-package_src_doinstall dvi ps pdf tex |
| 65 |
|
|
;; |
| 66 |
|
|
"fonts") |
| 67 |
|
|
latex-package_src_doinstall tfm vg afm pfb ttf |
| 68 |
|
|
;; |
| 69 |
|
|
"bin") |
| 70 |
|
|
latex-package_src_doinstall sh |
| 71 |
|
|
;; |
| 72 |
|
|
"all") |
| 73 |
|
|
latex-package_src_doinstall styles doc fonts bin |
| 74 |
|
|
;; |
| 75 |
|
|
esac |
| 76 |
|
|
shift |
| 77 |
|
|
done |
| 78 |
|
|
} |
| 79 |
|
|
|
| 80 |
|
|
latex-package_src_compile() { |
| 81 |
|
|
debug-print function $FUNCNAME $* |
| 82 |
|
|
cd ${S} |
| 83 |
|
|
for i in `find \`pwd\` -maxdepth 1 -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 |
| 90 |
|
|
echo "Extracting from $i" |
| 91 |
|
|
latex --interaction=batchmode $i > /dev/null |
| 92 |
|
|
done |
| 93 |
|
|
} |
| 94 |
|
|
|
| 95 |
|
|
latex-package_src_install() { |
| 96 |
|
|
debug-print function $FUNCNAME $* |
| 97 |
|
|
cd ${S} |
| 98 |
|
|
latex-package_src_doinstall all |
| 99 |
|
|
} |
| 100 |
|
|
|
| 101 |
|
|
latex-package_pkg_postinst() { |
| 102 |
|
|
debug-print function $FUNCNAME $* |
| 103 |
|
|
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 |
|
|
} |
| 108 |
|
|
|
| 109 |
|
|
latex-package_pkg_postrm() { |
| 110 |
|
|
debug-print function $FUNCNAME $* |
| 111 |
|
|
# This may be a bit harsh, so perhaps it should be overridden. |
| 112 |
|
|
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 |
|
|
} |
| 117 |
|
|
|
| 118 |
|
|
latex-package_rehash() { |
| 119 |
|
|
debug-print function $FUNCNAME $* |
| 120 |
|
|
texconfig rehash |
| 121 |
|
|
} |
| 122 |
|
|
|
| 123 |
|
|
latex-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 |
|
|
|
| 136 |
|
|
EXPORT_FUNCTIONS src_compile src_install pkg_postinst pkg_postrm |