# -*- 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 67178 2010-04-30 21:42:41Z takeshi@macports.org $

PortSystem                  1.0

name                        cdo
version                     1.4.4
platforms                   darwin
maintainers                 takeshi
license                     GPLv2
categories                  science
description                 Climate Data Operators
homepage                    https://code.zmaw.de/projects/cdo
master_sites                https://code.zmaw.de/attachments/download/174
checksums                   md5     da0258a85d4e97225d7eb1c1ea02fae5 \
                            sha1    e5c22ab2e1c1a846d4801c74a39c4ec197def2c5 \
                            rmd160  bc86dc0b170df057a16515d85750289358e56e23
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 400 operators available.

fetch.ignore_sslcert        yes

depends_lib                 port:netcdf-devel \
                            port:hdf5-18 \
                            port:proj \
                            port:szip

configure.cppflags-delete   -I${prefix}/include
configure.cppflags-append   -I${prefix}/lib/netcdf-devel/include \
                            -I${prefix}/include
configure.ldflags-delete    -L${prefix}/lib
configure.ldflags-append    -L${prefix}/lib/netcdf-devel/lib \
                            -L${prefix}/lib
configure.args              --with-netcdf=${prefix}/lib/netcdf-devel \
                            --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}
}

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