summaryrefslogtreecommitdiff
blob: f6b69b4497876beadec8de72c34f0226ccbdb125 (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-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-mathematics/fann/fann-2.1.0_beta.ebuild,v 1.3 2009/09/09 20:35:37 bicatali Exp $

EAPI=2
inherit eutils python autotools

MY_P=${P/_/}
DESCRIPTION="Fast Artificial Neural Network Library"
HOMEPAGE="http://leenissen.dk/fann/"
SRC_URI="mirror://sourceforge/${PN}/${MY_P}.zip"

LICENSE="LGPL-2.1"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="doc python"

RDEPEND="python? ( virtual/python )"
DEPEND="${RDEPEND}
	python? ( dev-lang/swig )
	app-arch/unzip"

S="${WORKDIR}/${P/_beta/}"

src_prepare() {
	epatch "${FILESDIR}"/${P}-python.patch
	epatch "${FILESDIR}"/${P}-benchmark.patch
	epatch "${FILESDIR}"/${P}-examples.patch
	epatch "${FILESDIR}"/${P}-asneeded.patch
	eautoreconf
}

src_compile() {
	emake || die "emake failed"
	if use python; then
		cd "${S}"/python
		python_version
		emake PYTHON_VERSION="${PYVER}" || die "emake python failed"
	fi
}

src_test() {
	cd "${S}"/examples
	emake CFLAGS="${CFLAGS} -I../src/include -L../src/.libs" \
		|| die "emake examples failed"
	LD_LIBRARY_PATH="../src/.libs" emake runtest || die "tests failed"
	emake clean
	if use python; then
		cd "${S}"/python
		emake test || die "failed tests for python wrappers"
	fi
}

src_install() {
	emake install DESTDIR="${D}" || die "emake install failed"
	dodoc AUTHORS ChangeLog NEWS README TODO

	if use doc; then
		dodoc doc/*.txt
		insinto /usr/share/doc/${PF}
		doins doc/fann_en.pdf || die "failed to install reference manual"
		doins -r examples || die "failed to install examples"
		doins -r benchmarks || die "failed to install benchmarks"
	fi

	if use python; then
		cd "${S}"/python
		emake install ROOT="${D}" || die "failed to install python wrappers"
		if use doc; then
			insinto /usr/share/doc/${PF}/examples/python
			doins -r examples || die "failed to install python examples"
		fi
	fi
}