# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           github 1.0

github.setup        ncar ncplot 4.11.0 v
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
revision            4
epoch               1

categories          science
license             permissive
maintainers         nomaintainer
platforms           any

description         ncplot is an interactive plotting tool
long_description    ncplot is an interactive plotting tool that allows the user to \
    view time-series data stored in netCDF files that conform to the NCAR-RAF/nimbus \
    conventions. Both Low-rate and Mixed-rate files are supported, as well as files \
    where the data have been reduced below 1 sps (sample per second), e.g., files run \
    through ncav.

homepage            https://archive.eol.ucar.edu/raf/Software/ncplot.html

checksums           rmd160  f5b49b5b7f4c75422950d875d44a15cf2d29d330 \
                    sha256  c2ec218031e87f71f1f2d6769fd567bb1b2e94ef91acca0db42ba18af1b44b52 \
                    size    133649

patchfiles          patch-geopolmap.c.diff \
                    patch-Makefile.diff

post-patch {
    reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/geopolmap.c
    reinplace "s|@@PREFIX@@|${prefix}|g" ${worksrcpath}/Makefile
}

use_configure       no
build.target

build.args          CC="${configure.cc} [get_canonical_archflags cc]" \
                    CXX="${configure.cxx} [get_canonical_archflags cxx]" \
                    INCL="${configure.cppflags}" \
                    LIB="${configure.ldflags}"

depends_lib-append  port:flex \
                    port:gsl \
                    port:libpng \
                    port:netcdf \
                    port:netcdf-cxx \
                    port:motif \
                    port:xorg-libX11 \
                    port:xorg-libXt \
                    port:zlib

depends_run         port:gmt6

#  Makefile does not support destroot
destroot {
    xinstall -m 755 ${worksrcpath}/ncplot ${destroot}${prefix}/bin/ncplot
    xinstall -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 755 ${worksrcpath}/ncplot.html ${destroot}${prefix}/share/doc/${name}/ncplot.html
}
