summaryrefslogtreecommitdiff
blob: 5112e60cd7cc9b96d898c102dda3505650d6f359 (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
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
# Copyright 1999-2005 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/app-text/active-dvi/active-dvi-1.4.0.ebuild,v 1.9 2005/02/08 12:48:53 usata Exp $

inherit eutils

MY_PN=${PN/ctive-/}
MY_P=${MY_PN}-${PV}
S=${WORKDIR}/${MY_P}

DESCRIPTION="A DVI previewer and a presenter for slides written in LaTeX"
SRC_URI="ftp://ftp.inria.fr/INRIA/Projects/cristal/${MY_PN}/${MY_P}.tar.gz"
HOMEPAGE="http://pauillac.inria.fr/advi/"
LICENSE="LGPL-2.1"

IUSE="cjk tcltk"
SLOT="0"
KEYWORDS="x86"

DEPEND=">=dev-lang/ocaml-3.04
	>=dev-ml/camlimages-2.11
	virtual/tetex
	virtual/ghostscript"
RDEPEND="${DEPEND}
	cjk? ( media-fonts/kochi-substitute )"

DOCS="README TODO"

pkg_setup() {

	# warn those who have USE="tcltk" but no ocaml tcltk support
	# because we cant force ocaml to be build with tcltk.
	if use tcltk; then
		if [ ! -d /usr/lib/ocaml/labltk ]; then

			echo ""
			ewarn "You have requested tcltk support, but it appears"
			ewarn "your ocaml wasnt compiled with tcltk support, "
			ewarn "so it can't be included for active-dvi."
			echo ""
			ewarn "Please stop this build, and emerge ocaml with "
			ewarn "USE=\"tcltk\" ocaml"
			ewarn "before emerging active-dvi if you want tcltk support."
			echo ""
			# give the user some time to read this, but leave the
			# choice up to them
			epause 8

		fi
	fi

}

src_unpack() {

	unpack ${A}
	# need to remove texhash, it'll cause problems with
	# the sandbox if we try and run it during emerge
	sed -i -e "s/texhash//" ${S}/Makefile

	if use cjk ; then
		local fp=/usr/X11R6/lib/X11/fonts/truetype
		sed -i -e "s%msmincho.ttc%${fp}/kochi-mincho-subst.ttf%g" \
			-e "s%msgothic.ttc%${fp}/kochi-gothic-subst.ttf%g" \
			${S}/conf/jpfonts.conf
	fi

}

src_compile() {

	econf --with-camlimages=/usr/lib/ocaml/site-packages/camlimages || die
	emake || die

}

src_install() {

	TEXMFADVI=/usr/share/texmf/advi
	dodir /usr/bin $TEXMFADVI
	make ADVI_LOC=${D}/${TEXMFADVI} prefix=${D}/usr install || die

	# only include the jpfonts.config if use cjk
	use cjk || rm ${D}${TEXMFADVI}/jpfonts.conf

	# now install the documentation
	dodoc ${DOCS}
	cd ${S}/doc
	dohtml *.{jpg,gif,css,html}
	dodoc manual.{dvi,pdf,ps}
	# and the manual page
	doman advi.1

}

pkg_postinst() {

	if use cjk; then

		echo ""
		einfo "If you wish to use Japanese True Type fonts with"
		einfo "active-dvi, please edit /usr/share/texmf/advi/jpfonts.conf"
		echo ""

	fi

}