summaryrefslogtreecommitdiff
blob: a1cac6a2931cd994b01e19181460adc3ebd57c4e (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
# Copyright 1999-2013 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-biology/vienna-rna/vienna-rna-2.1.1.ebuild,v 1.2 2013/05/29 16:09:44 jlec Exp $

EAPI=5

PYTHON_COMPAT=( python{2_5,2_6,2_7} )
DISTUTILS_OPTIONAL=true
AUTOTOOLS_AUTORECONF=true

inherit autotools-utils distutils-r1 multilib perl-module toolchain-funcs

DESCRIPTION="RNA secondary structure prediction and comparison"
HOMEPAGE="http://www.tbi.univie.ac.at/~ivo/RNA/"
SRC_URI="http://www.tbi.univie.ac.at/~ronny/RNA/ViennaRNA-${PV}.tar.gz"

SLOT="0"
LICENSE="vienna-rna"
KEYWORDS="~amd64 ~ppc ~x86"
IUSE="doc openmp python static-libs"

REQUIRED_USE="python? ( ${PYTHON_REQUIRED_USE} )"

DEPEND="
	dev-lang/perl
	media-libs/gd
	doc? ( dev-texlive/texlive-latex )
	python? (
		${PYTHON_DEPS}
		dev-lang/swig )"
RDEPEND="${DEPEND}"

S="${WORKDIR}/ViennaRNA-${PV}"

PATCHES=(
	"${FILESDIR}"/${P}-bindir.patch
	"${FILESDIR}"/${P}-prll.patch
	"${FILESDIR}"/${P}-impl-decl.patch
)

AUTOTOOLS_IN_SOURCE_BUILD=1

src_prepare() {
	sed -i 's/ getline/ v_getline/' Readseq/ureadseq.c || die
	sed -i 's/@PerlCmd@ Makefile.PL/& INSTALLDIRS=vendor/' Perl/Makefile.am || die

	autotools-utils_src_prepare

	if use python; then
		cp "${FILESDIR}"/${P}-setup.py "${S}"/setup.py || die
		PATCHES=()
		distutils-r1_src_prepare
	fi
}

src_configure() {
	local myeconfargs=(
		--with-cluster
		$(use_enable openmp) )

	use doc || \
		myeconfargs+=(
			--without-doc-pdf
			--without-doc-html
			--without-doc
			)
	autotools-utils_src_configure
	sed \
		-e "s:LIBDIR = /usr/lib:LIBDIR = ${D}/usr/$(get_libdir):" \
		-e "s:INCDIR = /usr/include:INCDIR = ${D}/usr/include:" \
		-i RNAforester/g2-0.70/Makefile || die
	sed \
		-e "s:CC=gcc:CC=$(tc-getCC):" \
		-e "s:^CFLAGS=:CFLAGS=${CFLAGS}:" \
		-i Readseq/Makefile || die
	use python && distutils-r1_src_configure
}

src_compile() {
	autotools-utils_src_compile
	autotools-utils_src_compile -C Readseq build CC=$(tc-getCC)

	# TODO: Add (optional?) support for the NCBI toolkit.
	if use python; then
		pushd Perl > /dev/null
			mv RNA_wrap.c{,-perl} || die
			swig -python RNA.i || die
		popd > /dev/null
		distutils-r1_src_compile
		mv Perl/RNA_wrap.c{-perl,} || die
	fi
}

src_test() {
	autotools-utils_src_compile -C Perl check
	autotools-utils_src_compile -C Readseq test
}

src_install() {
	autotools-utils_src_install

	if ! use static-libs; then
		rm -f "${ED}"/usr/$(get_libdir)/*.a || die
	fi

	newbin Readseq/readseq readseq-vienna
	dodoc Readseq/Readseq.help
	newdoc Readseq/Readme README.readseq
	newdoc Readseq/Formats Formats.readseq

	# remove perlocal.pod to avoid file collisions (see #240358)
	fixlocalpod || die "Failed to remove perlocal.pod"
	use python && distutils-r1_src_install
}