summaryrefslogtreecommitdiff
blob: 5cc2910fa3ab7af4fba8969e723fcf848f72c80d (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
# Copyright 1999-2015 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Id$

EAPI=5

inherit cmake-utils fortran-2 multilib

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

SLOT="0"
KEYWORDS="~amd64 ~arm ~hppa ~ppc ~ppc64 ~sparc ~x86 ~amd64-fbsd ~x86-fbsd ~amd64-linux ~x86-linux"
LICENSE="free-noncomm"
IUSE="doc openmp static-libs"

DEPEND=""
RDEPEND="${DEPEND}
	!sci-libs/parmetis"

DOCS=( manual/manual.pdf )

PATCHES=(
	"${FILESDIR}"/${P}-datatype.patch
	"${FILESDIR}"/${P}-shared-GKlib.patch
	"${FILESDIR}"/${P}-multilib.patch
	)

src_prepare() {
	sed \
		-e 's:-O3::g' \
		-i GKlib/GKlibSystem.cmake || die

	cmake-utils_src_prepare
}

src_configure() {
	local mycmakeargs=(
		-DGKLIB_PATH="${S}"/GKlib
		-DSHARED=TRUE
		$(cmake-utils_use openmp)
	)
	cmake-utils_src_configure
}

src_test() {
	cd graphs || die
	PATH="${BUILD_DIR}"/programs/:${PATH} LD_LIBRARY_PATH="${BUILD_DIR}"/lib ndmetis mdual.graph || die
	PATH="${BUILD_DIR}"/programs/:${PATH} LD_LIBRARY_PATH="${BUILD_DIR}"/lib mpmetis metis.mesh 2 || die
	PATH="${BUILD_DIR}"/programs/:${PATH} LD_LIBRARY_PATH="${BUILD_DIR}"/lib gpmetis test.mgraph 4 || die
	PATH="${BUILD_DIR}"/programs/:${PATH} LD_LIBRARY_PATH="${BUILD_DIR}"/lib gpmetis copter2.graph 4 || die
	PATH="${BUILD_DIR}"/programs/:${PATH} LD_LIBRARY_PATH="${BUILD_DIR}"/lib graphchk 4elt.graph || die
}

src_install() {
	cat >> "${T}"/metis.pc <<- EOF
	prefix="${EPREFIX}"/usr
	exec_prefix="${EPREFIX}"/usr
	libdir="${EPREFIX}"/usr/$(get_libdir)
	includedir="${EPREFIX}"/usr/include

	Name: METIS
	Description: Software for partioning unstructured graphes and meshes
	Version: ${PV}
	Libs: -L${libdir} -lmetis
	Cflags: -I${includedir}/metis
	EOF

	insinto /usr/$(get_libdir)/pkgconfig
	doins "${T}"/metis.pc
	cmake-utils_src_install
}