summaryrefslogtreecommitdiff
blob: 714f99f4b0595c16844ba2737083e615baa3f822 (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
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: $

EAPI="2"

MY_P="LibRaw-${PV}"

inherit eutils

DESCRIPTION="Decoding library for RAW image formats"
HOMEPAGE="http://www.libraw.org/"
SRC_URI="http://www.${PN}.org/data/${MY_P}.tar.gz"

LICENSE="LGPL-2.1 CDDL-1.0"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="lcms openmp utils"

RDEPEND="media-libs/jpeg:0
	lcms? ( media-libs/lcms:0 )"
DEPEND="${RDEPEND}
	openmp? ( sys-devel/gcc[openmp] )"
S="${WORKDIR}/${MY_P}"

src_prepare() {
	local prefix=/usr

	sed -e "s:@prefix@:${prefix}:g" \
		-e "s:@version@:${PV}:g" \
		-e "s:@PN@:${PN}:g" \
		${FILESDIR}/libraw.pc > ${WORKDIR}/libraw.pc || die "pkgconfig sed failed"

	sed -ie "s:CFLAGS=\(.*\):CFLAGS=${CFLAGS} \1:g" Makefile || die "CFLAGS fix failed"

	if use lcms; then
		sed -ie "s:^#\(LCMS_.*\)/usr/local/\(.*\):\1${ROOT}${prefix}/\2:" Makefile || die "Enable lcms failed"
		sed -ie "s/^\(Libs:.*\)/\1 -llcms/g" ${WORKDIR}/libraw.pc || die "lcms pkgconfig failed"
	fi

	if use openmp; then
		sed -ie "s:^#\(CFLAGS.*openmp\):\1:" Makefile || die "Enable openmp failed"
		sed -ie "s/^\(Libs:.*\)/\1 -fopenmp/g" ${WORKDIR}/libraw.pc || die "openmp pkgconfig failed"
	fi
}

src_compile() {
	emake library || die "emake library failed"
	if use utils; then
		emake all_samples  || die "emake utils failed"
	fi
}

src_install() {
	insinto /usr/$(get_libdir)
	doins ./lib/lib* || die "doins libs failed"

	insinto /usr/include
	doins -r ./libraw || die "doins includes failed"

	if use utils; then
		insinto /usr/bin
		doins samples/* || die "doins utils failed"
	fi

	# Only static libs are installed
	insinto /usr/lib/pkgconfig
	doins ${WORKDIR}/libraw.pc || die "doins .pc failed"

	dodoc Changelog.txt || die "dodoc failed"
}