summaryrefslogtreecommitdiff
blob: ac9f4cd9327d618d51e845d3072ecb0a4dd515c6 (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
79
80
81
# Copyright 1999-2010 Gentoo Foundation
# Distributed under the terms of the GNU General Public License v2
# $Header: /var/cvsroot/gentoo-x86/sci-libs/netcdf/netcdf-4.1.1.ebuild,v 1.1 2010/04/27 16:13:14 scarabeus Exp $

EAPI="3"

inherit eutils autotools

DESCRIPTION="Scientific library and interface for array oriented data access"
SRC_URI="ftp://ftp.unidata.ucar.edu/pub/netcdf/${P}.tar.gz"
HOMEPAGE="http://www.unidata.ucar.edu/software/netcdf/"

LICENSE="UCAR-Unidata"
SLOT="0"
IUSE="dap doc fortran hdf5 static-libs szip cxx"
KEYWORDS="~alpha ~amd64 ~hppa ~ia64 ~mips ~ppc ~ppc64 ~sparc ~x86 ~amd64-linux ~x86-linux"

RDEPEND="
	hdf5? ( >=sci-libs/hdf5-1.8[zlib,szip?,fortran?] )
	dap? ( net-misc/curl )
"
DEPEND="${RDEPEND}
	>=sys-devel/libtool-2.2
	doc? ( virtual/latex-base )
	fortran? ( dev-lang/cfortran )"

pkg_setup() {
	if use hdf5 && has_version sci-libs/hdf5[mpi]; then
		export CC=mpicc
		if use cxx; then
			export CXX=mpicxx
		fi
		if use fortran; then
			export FC=mpif90
			export F77=mpif77
		fi
	fi
}

src_prepare() {
	# use system cfortran
	rm -f fortran/cfortran.h || die
}

src_configure() {
	local myconf
	if use hdf5; then
		myconf="--with-hdf5=${EPREFIX}/usr --with-zlib=${EPREFIX}/usr"
		use szip && myconf="${myconf} --with-szlib=${EPREFIX}/usr"
	fi

	econf \
		--enable-shared \
		--docdir="${EPREFIX}"/usr/share/doc/${PF} \
		$(use_enable dap) \
		$(use_enable static-libs static) \
		$(use_enable fortran f77) \
		$(use_enable fortran f90) \
		$(use_enable cxx) \
		$(use_enable fortran separate-fortran) \
		$(use_enable hdf5 netcdf-4) \
		$(use_enable hdf5 ncgen4) \
		$(use_enable doc docs-install) \
		${myconf}
}

src_compile() {
	# hack to allow parallel build
	if use doc; then
		emake pdf || die "emake pdf failed"
		cd man4
		emake -j1 || die "emake doc failed"
		cd ..
	fi
	emake || die "emake failed"
}

src_install() {
	emake DESTDIR="${D}" install || die "emake install failed"
	dodoc README RELEASE_NOTES VERSION || die
}