# -*- 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

PortSystem              1.0
PortGroup               conflicts_build 1.0

name                    ncview
version                 2.1.11
revision                1
maintainers             {@thiagoveloso gmail.com:thiagoveloso} openmaintainer
categories              science
license                 GPL-3

description             X windows point'n'click NetCDF viewer.
long_description        Ncview is a visual browser for NetCDF format \
                        files. Typically you would use ncview to get \
                        a quick and easy, push-button look at your \
                        NetCDF files. You can view simple movies of \
                        the data, view along various dimensions, take \
                        a look at the actual data values, change color \
                        maps, invert the data, etc.

homepage                https://cirrus.ucsd.edu/ncview/

master_sites            https://cirrus.ucsd.edu/~pierce/ncview/

checksums               rmd160  1187ae9dec5718b8041cb44bb85638a8369e3489 \
                        sha256  597cfddf9c2d7993e9b0b86bca1b73839567ee9116ee33f6d750a449b5033d91 \
                        size 1248628

patchfiles              patch-configure.diff

depends_lib             port:expat \
                        port:udunits2 \
                        port:netcdf \
                        port:libpng \
                        port:xorg-libXaw \
                        port:xorg-libXt \
                        port:xorg-libice

pre-configure {
    set nc4 [exec ${prefix}/bin/nc-config --has-nc4]
    if {${nc4} != "yes"} {
        ui_error "Install netcdf +netcdf4 first. Run:"
        ui_error "    port install netcdf +netcdf4"
        return -code error "netcdf +netcdf4 not installed"
    }
}

configure.args          --with-nc-config=${prefix}/bin/nc-config \
                        --with-udunits2_incdir=${prefix}/include/udunits2 \
                        --with-udunits2_libdir=${prefix}/lib \
                        --with-png_incdir=${prefix}/include \
                        --with-png_libdir=${prefix}/lib \
                        --x-libraries=${prefix}/lib \
                        --x-includes=${prefix}/include

use_parallel_build      yes

post-destroot {
    xinstall -m 755 -d ${destroot}${prefix}/lib/${name}
    xinstall -m 755 -W ${worksrcpath} 3gauss.ncmap 3saw.ncmap bw.ncmap default.ncmap detail.ncmap hotres.ncmap ${destroot}${prefix}/lib/${name}

    xinstall -m 755 ${worksrcpath}/data/ncview.1 ${destroot}${prefix}/share/man/man1

    set docdir ${prefix}/share/doc/${subport}
    xinstall -m 755 -d ${destroot}${docdir}
    xinstall -m 755 -W ${worksrcpath} README ${destroot}${docdir}
}

livecheck.type              regex
livecheck.url               ${homepage}
livecheck.regex             {New version \(([^)]+)\)}
