summaryrefslogtreecommitdiff
blob: 3a19429fac849cb4dd7a11f72ea70aa67c87821c (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
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/dev-lang/yap/yap-6.0.5-r1.ebuild,v 1.1 2010/09/12 02:31:41 keri Exp $

inherit eutils java-pkg-opt-2

DESCRIPTION="YAP is a high-performance Prolog compiler."
HOMEPAGE="http://www.ncc.up.pt/~vsc/Yap/"
SRC_URI="http://www.ncc.up.pt/~vsc/Yap/${P}.tar.gz"

LICENSE="Artistic LGPL-2"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="debug doc examples gmp java mpi mysql odbc readline static tk threads"

DEPEND="gmp? ( dev-libs/gmp )
	java? ( >=virtual/jdk-1.4 )
	mpi? ( virtual/mpi )
	mysql? ( virtual/mysql )
	odbc? ( dev-db/unixODBC )
	readline? ( sys-libs/readline )
	doc? ( app-text/texi2html )"

RDEPEND="${DEPEND}
	tk? ( dev-lang/tk )"

S="${WORKDIR}"/${PN}-6

src_unpack() {
	unpack ${A}
	cd "${S}"

	epatch "${FILESDIR}"/${P}-ldflags.patch
	epatch "${FILESDIR}"/${P}-yapsharedir.patch
	epatch "${FILESDIR}"/${P}-JAVALIBPATH.patch
	epatch "${FILESDIR}"/${P}-chr-sublist.patch
}

src_compile() {
	local myddas_conf
	if use mysql || use odbc; then
		myddas_conf="--enable-myddas \
				--enable-myddas-stats \
				--enable-myddas-top-level"
	else
		myddas_conf="--disable-myddas"
	fi

	econf \
		--libdir=/usr/$(get_libdir) \
		$(use_enable !static dynamic-loading) \
		$(use_enable threads) \
		$(use_enable threads pthread-locking) \
		$(use_enable debug debug-yap) \
		$(use_enable debug low-level-tracer) \
		$(use_with gmp) \
		$(use_with readline) \
		$(use_with mpi) \
		$(use_with mpi mpe) \
		$(use_with java jpl) \
		${myddas_conf} \
		|| die "econf failed"

	emake || die "emake failed"

	if use doc ; then
		emake html || die "emake html failed"
	fi
}

src_install() {
	emake DESTDIR="${D}" -j1 install || die "make install failed."

	if use tk ; then
		exeinto /usr/bin
		doexe misc/tkyap
	fi

	dodoc changes*.html README

	if use doc ; then
		dodoc yap.html
	fi

	if use examples ; then
		docinto examples/chr
		dodoc packages/chr/Examples/*.{chr,pl}
		docinto examples/plunit
		dodoc packages/plunit/examples/*.pl
		if use java ; then
			docinto examples/jpl/prolog
			dodoc packages/jpl/examples/prolog/*.pl
			docinto examples/jpl/java
			dodoc packages/jpl/examples/java/*/*.java
		fi
		if use mpi ; then
			docinto examples/mpi
			dodoc library/mpi/examples/*.pl
		fi
	fi
}