summaryrefslogtreecommitdiff
blob: 1f2a870725322e19ed29f6080bdd0a709733d01f (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
75
76
77
78
79
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=4

inherit elisp

DESCRIPTION="An Emacs minor mode for incremental viewing of LaTeX documents"
HOMEPAGE="http://cristal.inria.fr/whizzytex/"
SRC_URI="http://cristal.inria.fr/${PN}/${P}.tgz"

LICENSE="GPL-2+"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="advi xdvi gv doc examples"

DEPEND="virtual/latex-base
	advi? ( app-text/active-dvi )
	xdvi? ( app-text/xdvik )
	gv? ( app-text/gv )
	!advi? ( !xdvi? ( !gv? ( app-text/active-dvi ) ) )"
RDEPEND="${DEPEND}"

SITEFILE="50${PN}-gentoo.el"
TEXMF="/usr/share/texmf-site"

src_configure() {
	local advi xdvi gv
	use advi && advi=/usr/bin/advi
	use xdvi && xdvi=/usr/bin/xdvi
	use gv && gv=/usr/bin/gv

	if [[ -z ${advi}${xdvi}${gv} ]]; then
		ewarn "No previewer defined (USE=\"-advi -xdvi -gv\"), enabling advi"
		advi=/usr/bin/advi
	fi

	# hand-crafted configure, econf doesn't work
	./configure \
		-prefix /usr \
		-emacsdir "${SITELISP}/${PN}" \
		-latexdir "${TEXMF}/tex/latex/${PN}" \
		-docdir /usr/share/doc/${PF} \
		-initex "pdfetex -ini" \
		-advi ${advi:-false} \
		-xdvi ${xdvi:-false} \
		-gv ${gv:-false} \
		-emacs emacs \
		-xemacs "" \
		-elc \
		|| die "configure failed"

	# disable XEmacs support (not completely possible in configure)
	sed -i -e "/^XEMACSDIR/s/=.*/=/" Makefile.config || die
}

src_compile() {
	# config.force is needed, otherwise checkconfig will try to call xdvi etc
	emake config.force
	emake all
}

src_install() {
	emake DESTDIR="${D}" install
	rm -f "${ED}"/usr/share/doc/${PF}/{COPYING,GPL}

	elisp-site-file-install "${FILESDIR}/${SITEFILE}" || die
	dodoc CHANGES

	if use doc; then
		dodoc doc/whizzytex.{ps,pdf}
	fi

	if use examples; then
		insinto /usr/share/doc/${PF}
		doins -r examples
	fi
}