summaryrefslogtreecommitdiff
blob: d0fee6eb790a64bfe9bcd1a56a6ff13fdabb6fbb (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-tex/xmltex/xmltex-1.9-r1.ebuild,v 1.5 2005/09/11 01:47:21 agriffis Exp $

inherit latex-package

IUSE=""

DESCRIPTION="A non validating namespace aware XML parser implemented in TeX"
HOMEPAGE="http://www.dcarlisle.demon.co.uk/xmltex/manual.html"
# Taken from: ftp://www.ctan.org/tex-archive/macros/xmltex.tar.gz
SRC_URI="mirror://gentoo/${P}.tar.gz"

LICENSE="LPPL-1.2"
SLOT="0"
KEYWORDS="alpha ~amd64 ppc ~sparc x86"

DEPEND="virtual/tetex"

S=${WORKDIR}/${PN}/base

has_tetex_3() {
	if has_version '>=app-text/tetex-2.96' || has_version '>=app-text/ptex-3.1.4.20041026' ; then
		true
	else
		false
	fi
}

src_compile() {
	if has_tetex_3 ; then
		latex -ini -progname=xmltex "&latex" xmltex.ini || die "xmltex.ini failed"
		pdftex -ini -progname=pdfxmltex "&pdflatex" pdfxmltex.ini || die "pdfxmltex.ini failed"
	else
		tex -ini -progname=xmltex xmltex.ini || die "xmltex.ini failed"
		pdftex -ini -progname=pdfxmltex pdfxmltex.ini || die "pdfxmltex.ini failed"
	fi
}

src_install() {

	local TEXMF_PATH="$(kpsewhich --expand-var='$TEXMFMAIN')"

	insinto ${TEXMF_PATH}/web2c
	doins *.fmt || die

	insinto ${TEXMF}/tex/xmltex
	doins *.{xml,xmt,cfg,tex,ini}

	dodir /usr/bin
	if has_tetex_3 ; then
		dosym /usr/bin/latex /usr/bin/xmltex
		dosym /usr/bin/pdflatex /usr/bin/pdfxmltex
	else
		dosym /usr/bin/tex /usr/bin/xmltex
		dosym /usr/bin/pdftex /usr/bin/pdfxmltex
	fi

	dohtml *.html
	dodoc readme.txt
}

pkg_preinst() {

	local TEXMF_PATH="$(kpsewhich --expand-var='$TEXMFMAIN')"

	if ! grep pdfxmltex ${TEXMF_PATH}/web2c/texmf.cnf > /dev/null 2>&1 ; then
		cat >>${TEXMF_PATH}/web2c/texmf.cnf<<-EOF

		! Automatically added by Portage (dev-tex/xmltex)
		TEXINPUTS.pdfxmltex = .;\$TEXMF/{pdftex,tex}/{xmltex,plain,generic,}//
		EOF
	fi
}