summaryrefslogtreecommitdiff
blob: 77361bb034caa21bdb0254b8e5ece90a02d952f9 (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
# Copyright 1999-2012 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-libs/grib_api/grib_api-1.9.16.ebuild,v 1.1 2012/04/18 21:50:32 bicatali Exp $

EAPI=4
inherit eutils autotools

#MYP=${P}_libtool
MYP=${P}

DESCRIPTION="Library for decoding WMO FM-92 GRIB messages"
HOMEPAGE="http://www.ecmwf.int/products/data/software/grib_api.html"
SRC_URI="http://www.ecmwf.int/products/data/software/download/software_files/${MYP}.tar.gz"

LICENSE="LGPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86"
IUSE="doc examples fortran jpeg2k netcdf openmp png python static-libs"

DEPEND="jpeg2k? ( || ( media-libs/jasper media-libs/openjpeg ) )
	netcdf? ( sci-libs/netcdf )
	png? ( media-libs/libpng )
	python? ( dev-python/numpy )"
RDEPEND="${DEPEND}"

S="${WORKDIR}/${MYP}"

src_prepare() {
	epatch \
		"${FILESDIR}"/${PN}-1.9.9-ieeefloat.patch \
		"${FILESDIR}"/${PN}-1.9.16-autotools.patch
	eautoreconf
}

src_configure() {
	local myconf
	if use jpeg2k; then
		myconf="--enable-jpeg"
		if hasv media-libs/jasper; then
			myconf="${myconf} --with-jasper=system --without-openjpeg"
		elif hasv media-libs/openjpeg; then
			myconf="${myconf} --without-jasper --with-openjpeg=system"
		fi
	else
		myconf="--disable-jpeg --without-jasper --without-openjpeg"
	fi

	# perl sources disappear from tar ball
	econf \
		--without-perl \
		$(use_enable fortran) \
		$(use_enable openmp omp-packing) \
		$(use_enable python) \
		$(use_enable python numpy) \
		$(use_enable static-libs static) \
		$(use_with netcdf netcdf "${EPREFIX}"/usr) \
		$(use_with png png-support) \
		${myconf}
}

src_install() {
	default
	use doc && dohtml html/*
	if use examples; then
		insinto /usr/share/doc/${PF}/examples
		emake clean
		doins -r *
	fi
}