# -*- 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                grads
version             2.0.1
platforms           darwin
maintainers         takeshi
categories          science
description         interactive visualization tool for earth science data
master_sites        ftp://grads.iges.org/grads/2.0/:src \
                    ftp://grads.iges.org/grads/:data
set gradssrc        ${name}-${version}-src${extract.suffix}
set gradsdata       data2${extract.suffix}
distfiles           ${gradssrc}:src ${gradsdata}:data
checksums           ${gradssrc}  rmd160 6fa94639174f626a664effcf236beace79d660f4 \
                    ${gradssrc}  sha256 5c8111ad650f10092dda12fc875e6f58bf00cf12affa6b10c0fefd03a29591a2 \
                    ${gradsdata} rmd160 98637dd79e49335e0d986429549fbce2b81afc7a \
                    ${gradsdata} sha256 55419fe15478d8213031bb1bfa7adec96984379373ec751cbe37d4bb22f6ce18
homepage            http://www.iges.org/grads/grads.html
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:netcdf     \
                    port:udunits    \
                    port:hdf4       \
                    port:gd2        \
                    port:gadap      \
                    port:wgrib2     \
                    port:curl       \
                    port:libgeotiff \
                    port:shapelib
depends_build       port:pkgconfig

patchfiles          patch-configure.diff

#if {${configure.compiler}=="clang"} {
#    configure.compiler llvm-gcc-4.2
#}
configure.env-append    SUPPLIBS="${prefix}"
configure.args          --without-gui   \
                        --with-readline \
                        --with-printim  \
                        --with-grib2    \
                        --with-sdf      \
                        --with-gadap    \
                        --with-shp      \
                        --with-geotiff  \
                        --with-x

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
}
