summaryrefslogtreecommitdiff
blob: bcf4ecbb9cca5de75c95db2fe9ce4b389183da4b (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
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-libs/vigra/vigra-1.6.0.ebuild,v 1.8 2010/03/09 13:01:41 ssuominen Exp $

EAPI=2

inherit eutils multilib

DESCRIPTION="C++ computer vision library with emphasize on customizable algorithms and data structures"
HOMEPAGE="http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/"
SRC_URI="http://kogs-www.informatik.uni-hamburg.de/~koethe/vigra/${P/-}.tar.gz"

LICENSE="MIT"
SLOT="0"
KEYWORDS="amd64 ppc ppc64 sparc x86"
IUSE="doc fftw jpeg png tiff zlib test"

RDEPEND="png? ( media-libs/libpng )
	tiff? ( media-libs/tiff )
	jpeg? ( media-libs/jpeg )
	fftw? ( >=sci-libs/fftw-3 )"
DEPEND="${RDEPEND}
	dev-util/pkgconfig"

S="${WORKDIR}/${P/-}"

MY_DOCDIR="usr/share/doc/${PF}"

pkg_setup() {
	local flag
	export usefail=""
	if use test
	then
		for flag in png tiff jpeg fftw
		do
			use $flag || usefail="$usefail $flag"
		done

		if [[ -n "$usefail" ]]
		then
			elog "USE=test enabled but the following use-flags are disabled:"
			elog "${usefail# }"
			elog "Tests will be skipped, please enable the other use-flags."
		fi
	fi
}

src_prepare() {
	epatch "${FILESDIR}/${P}-gcc44.patch"
	sed -i \
		-e 's:png_set_gray_1_2_4_to_8:png_set_expand_gray_1_2_4_to_8:g' \
		src/impex/png.cxx || die
}

src_configure() {
	./configure \
		--docdir="${D}/${MY_DOCDIR}" \
		--prefix=/usr \
		$(use_with png) \
		$(use_with tiff) \
		$(use_with jpeg) \
		$(use_with zlib) \
		$(use_with fftw) \
		|| die "configure failed"
}

src_test() {
	if [[ -z "${usefail}" ]]
	then
		default
	fi
}

src_install() {
	emake libdir="${D}/usr/$(get_libdir)" prefix="${D}/usr" install || die "emake install failed"
	use doc || rm -Rf "${D}/${MY_DOCDIR}"
	dodoc README.txt
}