summaryrefslogtreecommitdiff
blob: 7b068b08c98f22fab9fe6d64e09a9ed9fe06d375 (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-chemistry/apbs/apbs-1.0.0-r1.ebuild,v 1.3 2009/05/06 21:05:52 maekke Exp $

inherit eutils fortran autotools

MY_P="${P}-source"
S="${WORKDIR}"/"${MY_P}"

DESCRIPTION=" Software for evaluating the electrostatic properties of nanoscale biomolecular systems"
LICENSE="BSD"
HOMEPAGE="http://apbs.sourceforge.net/"
SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"

SLOT="0"
IUSE="blas mpi python doc"
KEYWORDS="amd64 ~ppc x86"

DEPEND="blas? ( virtual/blas )
		python? ( dev-lang/python )
		sys-libs/readline
		mpi? ( virtual/mpi )"

FORTRAN="g77 gfortran"

pkg_setup() {
	# It is important that you use the same compiler to compile
	# APBS that you used when compiling MPI.
	fortran_pkg_setup
}

src_unpack() {
	unpack ${A}
	cd "${S}"
	epatch "${FILESDIR}"/${P}-openmpi.patch
	epatch "${FILESDIR}"/${P}-install-fix.patch
	epatch "${FILESDIR}"/${P}-libmaloc-noinstall.patch
	epatch "${FILESDIR}"/${P}-LDFLAGS.patch
	eautoreconf
}

src_compile() {
	local myconf="--docdir=/usr/share/doc/${PF}"
	use blas && myconf="${myconf} --with-blas=-lblas"

	# check which mpi version is installed and tell configure
	if use mpi; then
		if has_version sys-cluster/mpich; then
	 		myconf="${myconf} --with-mpich=/usr"
		elif has_version sys-cluster/mpich2; then
			myconf="${myconf} --with-mpich2=/usr"
		elif has_version sys-cluster/lam-mpi; then
			myconf="${myconf} --with-lam=/usr"
		elif has_version sys-cluster/openmpi; then
			myconf="${myconf} --with-openmpi=/usr"
		fi
	fi || die "Failed to select proper mpi implementation"

	econf $(use_enable python) \
		${myconf} || die "configure failed"

	emake -j1 || die "make failed"
}

src_test() {
	cd examples && make test \
		|| die "Tests failed"
}

src_install() {
	make DESTDIR="${D}" install || die "make install failed"
	dodoc AUTHORS INSTALL README NEWS ChangeLog \
		|| die "Failed to install docs"
}