summaryrefslogtreecommitdiff
blob: 8c5251c9baf1343a646a0f97a6dc5fbb2b548370 (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
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/media-libs/libraw/libraw-0.10.0.ebuild,v 1.1 2010/09/19 08:16:02 hollow Exp $

EAPI="2"

inherit eutils

DESCRIPTION="LibRaw is a library for reading RAW files obtained from digital photo cameras"
HOMEPAGE="http://www.libraw.org/"
SRC_URI="http://www.libraw.org/data/LibRaw-${PV}.tar.gz"

# Libraw also has it's own license, which is a pdf file and
# can be obtained from here:
# http://www.libraw.org/data/LICENSE.LibRaw.pdf
LICENSE="LGPL-2.1 CDDL"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="lcms openmp examples"

RDEPEND="lcms? ( =media-libs/lcms-1* )"

S="${WORKDIR}/LibRaw-${PV}"

src_prepare() {
	# Add pkg-config support
	epatch "${FILESDIR}/libraw-0.10.0-pkg-config.patch"

	sed -i -e "s:/usr/local/:${D}usr/:g" \
		-e "/^CFLAGS/ s:-O4:${CFLAGS}:" \
		Makefile

	if use lcms; then
		sed -i -r '/^#LCMS/ s!^#!!' Makefile
		sed -i -r -e '/^Libs/ s!$! -llcms!' \
			-e '/^Requires/ s!$! lcms2!' *.pc
	fi

	if use openmp; then
		sed -i -r '/^CFLAGS/ s!^(.*)$!\1 -fopenmp!' Makefile
		sed -i -r -e '/^Cflags/ s!$! -fopenmp!' \
			-e '/^Libs/ s!$! -lgomp!' *.pc
	fi
}

src_install() {
	# This makefile doesn't even make the directories..
	mkdir -p "${D}usr/include" "${D}usr/lib" "${D}usr/lib/pkgconfig" \
		$(use examples && echo "${D}/usr/bin") || die "Directory making failed."

	emake install \
		$(use examples && echo "install-binaries") || die "Install failed."
}