# -*- 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 91551 2012-04-05 00:58:49Z takeshi@macports.org $

PortSystem          1.0

name                grads2
version             2.0.a9.oga.1
revision            3
platforms           darwin
maintainers         nomaintainer
categories          science
description         interactive visualization tool for earth science data
master_sites        sourceforge:opengrads
distname            grads-${version}-bundle
worksrcdir          grads-${version}
checksums           md5     d8f11e55f4d1f43eedb59e81cac177c4 \
                    sha1    b54c63c3124765561426453a5e13148d046acb09 \
                    rmd160  9b3cec052c57cb13e406242b9b516c4884209087
homepage            http://www.opengrads.org/
long_description   \
    The Grid Analysis and Display System (GrADS) is an interactive     \
    desktop tool that is used for easy access, manipulation, and       \
    visualization of earth science data. The format of the data may    \
    be either binary, GRIB, NetCDF, or HDF-SDS (Scientific Data Sets). \
    GrADS has been implemented worldwide on a variety of commonly used \
    operating systems and is freely distributed over the Internet.

depends_lib         port:readline   port:rx         \
                    port:netcdf     port:udunits                    \
                    port:hdf4       port:gd2        port:libnc-dap  \
                    port:gadap      port:wgrib2                     \
                    port:curl       port:libgeotiff port:shapelib
depends_build       port:pkgconfig

patchfiles          patch-configure.diff
post-patch {
    reinplace "s|png12|png14|g" ${worksrcpath}/configure
}

if {${configure.compiler}=="clang"} {
    configure.compiler llvm-gcc-4.2
}
configure.env-append    SUPPLIBS="${prefix}"
configure.args          --with-readline                             \
                        --enable-dyn-supplibs                       \
                        --with-nc --with-dap                        \
                        --with-netcdf=${prefix}                     \
                        --with-geotiff                              \
                        --with-x --with-printim --without-gui       \
                        --with-shp                                  \
                        --program-suffix="-2"

test.run            yes
test.target         check

post-destroot {
    xinstall -d -m 755 ${destroot}${prefix}/share/${name}
    eval xinstall -m 644 [glob -directory ${worksrcpath}/data *.dat *res] \
        ${destroot}${prefix}/share/${name}
    xinstall -d -m 755 ${destroot}${prefix}/share/${name}/tables
    eval xinstall -m 644 [glob -directory ${worksrcpath}/data/tables *] \
        ${destroot}${prefix}/share/${name}/tables
}

platform darwin 8 {
    depends_lib-delete      libnc-dap
    configure.args-delete   --with-dap
    configure.args-append   --without-dap
}
