summaryrefslogtreecommitdiff
blob: 4910618db758669b7734e800cebe95899b3a0b9a (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
80
81
82
# Copyright 1999-2004 Gentoo Technologies, Inc.
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-tex/preview-latex/preview-latex-0.7.8.ebuild,v 1.2 2004/03/22 16:21:22 usata Exp $

inherit latex-package elisp-common

DESCRIPTION="Renders embed latex environments such as math or figures in realtime"
HOMEPAGE="http://preview-latex.sourceforge.net/"
SRC_URI="mirror://sourceforge/preview-latex/${P}.tar.gz"
LICENSE="GPL-2"
SLOT="0"
KEYWORDS="x86"
IUSE="emacs xemacs"

DEPEND="emacs? ( virtual/emacs
		>=app-emacs/auctex-11.14 )
	xemacs? ( virtual/xemacs
		>=app-xemacs/auctex-1.32 )
	virtual/ghostscript
	virtual/tetex"

src_unpack() {
	unpack ${A}
	cp -a ${P}/* ${T}
}

src_compile() {
	if [ "`use emacs`" -a "`use xemacs`" ] ; then
		econf --with-emacs \
			--with-lispdir=${D}/usr/share/emacs/site-lisp/${PN} \
			|| die
		emake || die
		cd ${T}
		econf --with-xemacs \
			--with-packagedir=${D}/usr/lib/xemacs/site-packages \
			|| die
		emake || die
	elif [ "`use emacs`" -o "`use xemacs`" ] ; then
		local myconf
		if [ "`use emacs`" ] ; then
			myconf="--with-emacs
				--with-lispdir=${D}/usr/share/emacs/site-lisp/${PN}"
		elif [ "`use xemacs`" ] ; then
			myconf="--with-xemacs
				--with-packagedir=${D}/usr/lib/xemacs/site-packages"
		fi
		econf ${myconf} || die
		emake || die
	else
		econf || die
		emake || die
	fi
}

src_install() {
	# hack.- we cant call texhash within the make install because of sandbox violations
	# doing it later by hand
	if [ "`use emacs`" -a "`use xemacs`" ] ; then
		einstall texmfdir=${D}${TEXMF} TEXHASH=/bin/true || die
		pushd ${T}
		einstall texmfdir=${D}${TEXMF} TEXHASH=/bin/true || die
		popd
	else
		einstall texmfdir=${D}${TEXMF} TEXHASH=/bin/true || die
	fi

	if [ -n "`use emacs`" ] ; then
		elisp-site-file-install ${FILESDIR}/60preview-latex-gentoo.el
	fi

	dodoc ChangeLog FAQ INSTALL PROBLEMS README RELEASE TODO doc/preview-latex.dvi
}

pkg_postinst() {
	latex-package_pkg_postinst
	use emacs && elisp-site-regen
}

pkg_postrm() {
	latex-package_pkg_postrm
	use emacs && elisp-site-regen
}