summaryrefslogtreecommitdiff
blob: 47aa743d8df60442739b082e905a94f9e2776716 (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
# Copyright 1999-2008 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-libs/metis/metis-5.0_pre2.ebuild,v 1.2 2008/02/05 22:27:24 mr_bones_ Exp $

inherit autotools eutils

MY_PV=${PV/_/}

DESCRIPTION="A package for unstructured serial graph partitioning"
HOMEPAGE="http://www-users.cs.umn.edu/~karypis/metis/metis/index.html"
SRC_URI="http://glaros.dtc.umn.edu/gkhome/fetch/sw/metis/metis-${MY_PV}.tar.gz"

KEYWORDS="~amd64 ~x86"
LICENSE="free-noncomm"

IUSE="pcre openmp int64 threads"
SLOT="5"

DEPEND="pcre? ( dev-libs/libpcre )
	openmp? ( || ( >=sys-devel/gcc-4.2 >=dev-lang/icc-9 ) )"

S="${WORKDIR}/metis-${MY_PV}"

pkg_setup() {
	if use openmp \
		&& [[ $(tc-getCC) == *gcc ]] \
		&& [[  $(gcc-major-version)$(gcc-minor-version) -lt 42 ]]; then
			eerror "You need gcc >= 4.2 to use openmp features."
			eerror "Please use gcc-config to switch gcc version >= 4.2"
			die "setup gcc failed"
	fi
}

src_unpack() {
	unpack ${A}
	cd "${S}"
	epatch "${FILESDIR}"/${P}-autotools.patch
	if use int64; then
		sed -e 's/\(#define IDXTYPEWIDTH\).*32/\1 64/' \
			-i include/metis.h \
			|| die "sed for int64 failed"
	fi
	if use threads; then
		sed -e 's/\(#define HAVE_THREADLOCALSTORAGE\).*0/\1 1/' \
			-i include/metis.h \
			|| die "sed for threads failed"
	fi
	eautoreconf
}

src_compile() {
	econf \
		$(use_enable pcre) \
		$(use_enable openmp) \
		|| die "econf failed"
	emake || die "emake failed"
}

src_install() {
	emake DESTDIR="${D}" install || die "emake install failed"
	dodoc CHANGES.v5 || die "dodoc failed"
}