# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:ft=tcl:et:sw=4:ts=4:sts=4
# $Id: Portfile 55358 2009-08-09 22:46:09Z takeshi@macports.org $

PortSystem                  1.0

name                        netcdf
version                     4.0.1
revision                    4
maintainers                 takeshi openmaintainer
platforms                   darwin
categories                  science

description                 NetCDF - Network Common Data Form
long_description \
    NetCDF is an interface \
    for array-oriented data access and a library that \
    provides an implementation of the interface. The \
    netCDF library also defines a machine-independent \
    format for representing scientific data. Together, \
    the interface, library, and format support the \
    creation, access, and sharing of scientific data. \
    The netCDF software was developed at the Unidata \
    Program Center in Boulder, Colorado.

homepage                    http://unidata.ucar.edu/packages/netcdf/

master_sites                ftp://ftp.unidata.ucar.edu/pub/netcdf/ \
                            http://www.gfd-dennou.org/arch/netcdf/unidata-mirror/ \
                            ftp://www.gfd-dennou.org/arch/netcdf/unidata-mirror/

checksums                   md5     a251453c5477599f050fa4e593295186 \
                            sha1    96b361de72bcf68eaba42e7e5cf0f92c33d288e9 \
                            rmd160  ba74363bbc4c76fc1bbac578ba4c2af4739b4958

configure.cppflags-append   "-DNDEBUG -Df2cFortran"
configure.cxxflags-append   "-O2 -fno-common"
configure.cflags-append     "-O2 -fno-common"
configure.args              --enable-shared \
                            --disable-f77

test.run                    yes
test.target                 check

destroot.destdir            prefix=${destroot}${prefix} \
                            MANDIR=\\\${prefix}/share/man

post-destroot {
    file delete -force ${destroot}${prefix}/share/man/whatis.db
}

variant gcc43 description conflicts g95 description {Enable Fortran support with gfortran} {
    depends_lib-append      port:gcc43
    configure.args-delete   --disable-f77
    configure.fc            ${prefix}/bin/gfortran-mp-4.3
    configure.env-append    FCFLAGS=-O2
}

variant g95 description conflicts gcc43 description {Enable Fortran support with g95} {
    depends_lib-append      port:g95
    configure.args-delete   --disable-f77
    configure.fc            ${prefix}/bin/g95
    configure.env-append    FCFLAGS=-O2
}

variant openmpi description {compile with openmpi} {
    depends_lib-append      port:openmpi
    configure.fc            openmpif77
    configure.cc            openmpicc
    configure.cxx           openmpicxx
}

variant dap description {enable dap} {
    depends_lib-append      port:curl
    configure.args-append   --enable-dap
}

variant netcdf4 description {compile with hdf5} {
    configure.args-append   --enable-netcdf-4 \
                            --enable-ncgen4 \
                            --with-hdf5=${prefix} \
                            --with-szlib=${prefix}
    depends_lib-append      port:szip \
                            port:hdf5-18
}

variant static description {build static libraries} {
    configure.args-delete  --enable-shared
}
