summaryrefslogtreecommitdiff
blob: fb7ad3b092c35adafef2a1d934cb2202078b8222 (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-2009 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-misc/nco/nco-3.9.9.ebuild,v 1.2 2009/12/14 17:45:32 bicatali Exp $

EAPI=2
inherit eutils flag-o-matic

DESCRIPTION="Command line utilities for operating on netCDF files"
SRC_URI="http://dust.ess.uci.edu/nco/src/${P}.tar.gz"
HOMEPAGE="http://nco.sourceforge.net/"

LICENSE="GPL-3"
SLOT="0"
KEYWORDS="~amd64 ~x86 ~ppc"

IUSE="doc mpi ncap2 udunits"

RDEPEND="sci-libs/netcdf
	mpi? ( virtual/mpi )
	udunits? ( >=sci-libs/udunits-2 )"

DEPEND="${RDEPEND}
	ncap2? ( !mpi? ( dev-java/antlr:0 ) )
	doc? ( virtual/latex-base )"

pkg_setup() {
	if use mpi && use ncap2; then
		elog
		elog "mpi and ncap2 are still incompatible flags"
		elog "nco configure will automatically disables ncap2"
		elog
	fi
}

src_configure() {
	local myconf
	if has_version ">=sci-libs/netcdf-4" && built_with_use sci-libs/netcdf hdf5; then
		append-cppflags -DHAVE_NETCDF4_H
		myconf="--enable-netcdf4"
	else
		myconf="--disable-netcdf4"
	fi
	econf \
		${myconf} \
		--disable-udunits \
		$(use_enable ncap2) \
		$(use_enable udunits udunits2) \
		$(use_enable mpi)
}

src_compile() {
	emake || die "emake failed"
	cd doc
	emake clean info
	if use doc; then
		VARTEXFONTS="${T}/fonts" emake html pdf || die "emake doc failed"
	fi
}

src_install() {
	emake DESTDIR="${D}" install || die "emake install failed"
	cd doc
	dodoc ANNOUNCE ChangeLog MANIFEST NEWS README TAG TODO VERSION *.txt \
		|| die "dodoc failed"
	doinfo *.info* || die "doinfo failed"
	if use doc; then
		dohtml nco.html/* || die "dohtml failed"
		insinto /usr/share/doc/${PF}
		doins nco.pdf || die "pdf install failed"
	fi
}