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

EAPI=5

inherit cmake-utils

DESCRIPTION="C++ template static library of common data structures and algorithms"
HOMEPAGE="https://lemon.cs.elte.hu/trac/lemon/"
SRC_URI="http://lemon.cs.elte.hu/pub/sources/${P}.tar.gz"

LICENSE="Boost-1.0"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~amd64-linux ~x86-linux"
IUSE="+coin doc glpk static-libs test tools"

RDEPEND="
	glpk? ( sci-mathematics/glpk:= )
	coin? ( sci-libs/coinor-cbc:= sci-libs/coinor-clp:= )"
DEPEND="${RDEPEND}
	doc? (
		app-text/ghostscript-gpl
		dev-libs/mathjax
		app-doc/doxygen )"

REQUIRED_USE="|| ( coin glpk )"

PATCHES=(
	"${FILESDIR}"/${P}-multilib.patch
	"${FILESDIR}"/${P}-as-needed.patch
)

src_prepare() {
	sed -i \
		-e '/ADD_SUBDIRECTORY(demo)/d' \
		CMakeLists.txt || die

	use doc || sed -i \
		-e '/ADD_SUBDIRECTORY(doc)/d' \
		CMakeLists.txt || die

	use tools || sed -i \
		-e '/ADD_SUBDIRECTORY(tools)/d' \
		CMakeLists.txt || die

	use test || sed -i \
		-e '/ADD_SUBDIRECTORY(test)/d' \
		CMakeLists.txt || die

	for t in \
		max_clique \
		max_flow \
		graph_utils \
		random \
		time_measure \
		tsp; do
		sed -i -e "/${t}_test/d" test/CMakeLists.txt || die
	done
	sed -i \
		-e '/ADD_TEST(lp_test lp_test)/d' \
		-e '/ADD_DEPENDENCIES(check lp_test)/d' \
		test/CMakeLists.txt || die
	cmake-utils_src_prepare
}

src_configure() {
	local mycmakeargs=(
		-DBUILD_SHARED_LIBS=TRUE
		-DCOIN_ROOT_DIR="${EPREFIX}/usr"
		-DLEMON_DOC_MATHJAX_RELPATH="${EPREFIX}/usr/share/mathjax"
		$(cmake-utils_use doc LEMON_DOC_SOURCE_BROWSER)
		$(cmake-utils_use doc LEMON_DOC_USE_MATHJAX)
		$(cmake-utils_use coin LEMON_ENABLE_COIN)
		$(cmake-utils_use glpk LEMON_ENABLE_GLPK)
	)
	cmake-utils_src_configure
}

src_test() {
	emake -C "${BUILD_DIR}" check
}