summaryrefslogtreecommitdiff
blob: 72ee264d493e404b69f7055b8092ff07f40baae8 (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
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-chemistry/pdb2pqr/pdb2pqr-1.5.0.ebuild,v 1.2 2010/06/15 12:46:05 arfrever Exp $

inherit eutils fortran multilib flag-o-matic distutils python versionator

MY_PV=$(get_version_component_range 1-2)
MY_P="${PN}-${MY_PV}"

DESCRIPTION="An automated pipeline for performing Poisson-Boltzmann electrostatics calculations"
LICENSE="BSD"
HOMEPAGE="http://pdb2pqr.sourceforge.net/"
SRC_URI="mirror://sourceforge/${PN}/${MY_P}.tar.gz"

SLOT="0"
IUSE="doc examples opal"
KEYWORDS="~amd64 ~x86"

DEPEND="dev-lang/python
	dev-python/numpy
	opal? ( dev-python/zsi )"
RDEPEND="${DEPEND}"

FORTRAN="g77 gfortran"

S="${WORKDIR}/${MY_P}"

src_unpack() {
	unpack ${A}
	cd "${S}"
	epatch "${FILESDIR}"/${PN}-1.4.0-ldflags.patch
	epatch "${FILESDIR}"/${PN}-1.4.0-automagic.patch
	epatch "${FILESDIR}"/${PN}-1.4.0-install.patch
	sed '50,200s:CWD:DESTDIR:g' -i Makefile.am \
		|| die "Failed to fix Makefile.am"
	eautoreconf
}

src_compile() {
	# we need to compile the *.so as pic
	append-flags -fPIC
	FFLAGS="${FFLAGS} -fPIC"

	# Avoid automagic to numeric
	NUMPY="$(python_get_sitedir)" \
		F77="${FORTRANC}" \
		econf \
		$(use_with opal) || \
		die "econf failed"
	emake || die "emake failed"
}

src_test() {
	emake -j1 test && \
		F77="${FORTRANC}" emake -j1 adv-test \
		|| die "tests failed"
}

src_install() {
	dodir $(python_get_sitedir)/${PN}
	emake -j1 DESTDIR="${D}$(python_get_sitedir)/${PN}" \
		PREFIX=""  install || die "install failed"

	if use doc; then
		cd doc
		sh genpydoc.sh \
			|| die "genpydoc failed"
		dohtml -r *.html images pydoc \
			|| die "failed to install html docs"
		cd -
	fi

	if use examples; then
		insinto /usr/share/${PN}/
		doins -r examples || die "Failed to install examples."
	fi

	INPATH="$(python_get_sitedir)/${PN}"

	# generate pdb2pqr wrapper
	cat >> "${T}"/${PN} <<-EOF
		#!/bin/sh
		$(PYTHON) ${INPATH}/${PN}.py \$*
	EOF

	exeinto /usr/bin
	doexe "${T}"/${PN} || die "Failed to install pdb2pqr wrapper."

	dodoc ChangeLog NEWS README AUTHORS || \
		die "Failed to install docs"

	insinto "${INPATH}"
	doins __init__.py || \
		die "Setting up the pdb2pqr site-package failed."

	exeinto "${INPATH}"
	doexe ${PN}.py || die "Installing pdb2pqr failed."

	insinto "${INPATH}"/dat
	doins dat/* || die "Installing data failed."

	exeinto "${INPATH}"/extensions
	doexe extensions/* || \
		die "Failed to install extensions."

	insinto "${INPATH}"/src
	doins src/*.py || die "Installing of python scripts failed."

	exeinto "${INPATH}"/propka
	doexe propka/_propkalib.so || \
		die "Failed to install propka."

	insinto "${INPATH}"/propka
	doins propka/propkalib.py propka/__init__.py || \
		die "Failed to install propka."

	insinto "${INPATH}"/pdb2pka
	doins pdb2pka/*.{py,so,DAT,h} || \
		die "Failed to install pdb2pka."

	insinto "${INPATH}"/pdb2pka/
	doins pdb2pka/*.{py,so,DAT,h} || \
		die "Failed to install pdb2pka."
}