summaryrefslogtreecommitdiff
blob: 514a78fef0595a4ca009902436147699f5fdd3c6 (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-2011 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-libs/vigra/vigra-1.7.1-r1.ebuild,v 1.3 2011/10/18 07:30:00 scarabeus Exp $

EAPI=4

PYTHON_DEPEND="2"
PYTHON_USE_WITH="threads,xml"

MY_P=${P}-src

inherit base cmake-utils multilib python

DESCRIPTION="C++ computer vision library with emphasize on customizable algorithms and data structures"
HOMEPAGE="http://hci.iwr.uni-heidelberg.de/vigra/"
SRC_URI="http://hci.iwr.uni-heidelberg.de/vigra/${MY_P}.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="~amd64 ~ppc ~ppc64 ~sparc ~x86"
IUSE="doc +fftw +hdf5 +jpeg +png +python test +tiff"

RDEPEND="
	dev-libs/boost
	fftw? ( >=sci-libs/fftw-3 )
	hdf5? ( sci-libs/hdf5 )
	jpeg? ( virtual/jpeg )
	png? ( media-libs/libpng )
	python? (
		|| ( dev-lang/python:2.6 dev-lang/python:2.7 )
	)
	tiff? ( media-libs/tiff )
"
DEPEND="${RDEPEND}
	doc? (
		app-doc/doxygen
		python? ( dev-python/sphinx )
	)
	test? (
		python? ( dev-python/nose )
	)
"

PATCHES=(
	"${FILESDIR}/1.7.1-png-1.5.patch"
	"${FILESDIR}/1.7.1-automagicness.patch"
	"${FILESDIR}/1.7.1-hdf5.patch"
	"${FILESDIR}/1.7.1-gcc4.6.patch"
	"${FILESDIR}/1.7.1-numpy_doc.patch"
	"${FILESDIR}/1.7.1-fix-tests.patch"
	"${FILESDIR}/1.7.1-fix-nosetest.patch"
)

REQUIRED_USE="
	doc? ( hdf5 fftw )
	python? ( hdf5 )
	test? ( hdf5 python fftw )
"

CMAKE_IN_SOURCE_BUILD=1

DOCS=(README.txt)

pkg_setup() {
	python_set_active_version 2
	python_pkg_setup
}

src_prepare() {
	base_src_prepare

	# Don't build nor install API docs when not requested
	use doc || sed -e '/ADD_SUBDIRECTORY(docsrc)/d' -i CMakeLists.txt || die
}

src_configure() {
	local libdir=$(get_libdir)

	# required for ddocdir
	_check_build_dir init
	# vigranumpy needs python and if enabled it ooms
	# doc needs doxygen and python
	# walgrind no use for us since we restrict test
	# $(cmake-utils_use_with valgrind VALGRIND)
	local mycmakeargs=(
		"-DDOCDIR=${CMAKE_BUILD_DIR}/doc"
		"-DLIBDIR_SUFFIX=${libdir/lib}"
		"-DDOCINSTALL=share/doc/${PF}"
		"-DWITH_VALGRIND=OFF"
		$(cmake-utils_use_with python VIGRANUMPY)
		$(cmake-utils_use_with png)
		$(cmake-utils_use_with jpeg)
		$(cmake-utils_use_with tiff)
		$(cmake-utils_use_with fftw FFTW3)
		$(cmake-utils_use_with hdf5)
		$(cmake-utils_use_build test TESTING)
		$(cmake-utils_use test CREATE_CTEST_TARGETS)
		$(cmake-utils_use test AUTOBUILD_TESTS)
	)

	cmake-utils_src_configure
}

src_compile() {
	cmake-utils_src_compile
	use doc && cmake-utils_src_make doc
}

src_install() {
	cmake-utils_src_install

	# drop useless cmake files from libdir
	rm -rf "${ED}"/usr/$(get_libdir)/${PN}/
}