# -*- 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 90053 2012-02-20 08:17:04Z takeshi@macports.org $

PortSystem                  1.0

name                        cdo
version                     1.5.4
platforms                   darwin
maintainers                 takeshi
license                     GPL-2
categories                  science
description                 Climate Data Operators
homepage                    https://code.zmaw.de/projects/cdo
master_sites                https://code.zmaw.de/attachments/download/2372
checksums           md5     ceacb1acfa921a5bf1a3e4cda1097405 \
                    sha1    e2c089e02fab92034a2b0de4be62db539dbb8205 \
                    rmd160  6ccb6a22e8dd63471ec51e2550fc7bc2595cbef5
long_description \
    CDO is a collection of command line Operators               \
    to manipulate and analyse Climate Data files.               \
    Supported data formats are GRIB, netCDF, SERVICE, EXTRA and IEG. \
    There are more than 600 operators available.

fetch.ignore_sslcert        yes

depends_lib                 port:netcdf \
                            port:proj

configure.args              --with-netcdf=${prefix} \
                            --disable-dependency-tracking \
                            --with-proj=${prefix} \
                            --with-hdf5=${prefix} \
                            --with-zlib=${prefix} \
                            --with-szlib=${prefix}

post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}/doc
    eval xinstall -m 644 [glob ${worksrcpath}/doc/*.pdf] ${destroot}${prefix}/share/doc/${name}/doc
    foreach f {AUTHORS  ChangeLog NEWS OPERATORS README} {
        eval xinstall -m 644 [glob ${worksrcpath}/${f}] ${destroot}${prefix}/share/doc/${name}
    }
}

variant grib2 description {enable experimental grib2 support} {
    depends_lib-append      port:grib_api
    configure.args-append   --with-jasper=${prefix} \
                            --with-grib_api=${prefix}
    configure.ldflags-append    -lpng -lopenjpeg
}

livecheck.type              regex
livecheck.url               ${homepage}
livecheck.regex             {Version ([0-9]+\.[0-9]+\.[0-9]+\.*[0-9]*)}
