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

if {$build_arch == "x86_64" || $build_arch == "ppc64"} {
    set flavor gcc64pthr
} else {
    set flavor gcc32pthr
}

PortSystem              1.0

name                    globus-gram-protocol
set _name               [ string map {"-" "_"} $name ]
version                 11.3
revision                1
platforms               darwin
categories              net
license                 Apache-2
maintainers             nikhef.nl:dennisvd
homepage                http://www.globus.org/

description             Globus Toolkit - GRAM Protocol Library
long_description        The Globus Toolkit is an open source software \
                        toolkit used for building Grid systems and \
                        applications. It is being developed by the \
                        Globus Alliance and many others all over the \
                        world. A growing number of projects and \
                        companies are using the Globus Toolkit to \
                        unlock the potential of grids for their \
                        cause. \
                        The Globus GRAM Protocol Library implements the \
                        GRAM protocol. It is used by the GRAM Client \
                        and GRAM Job Manager. It provides the constants \
                        used  by in the sending and receiving of GRAM \
                        messages. It also provides functions to encode \
                        GRAM requests and replies, and to send and receive \
                        the GRAM queries.

master_sites            http://www.globus.org/ftppub/gt5/5.2/5.2.4/packages/src/

distfiles               ${_name}-${version}.tar.gz

checksums               ${_name}-${version}.tar.gz \
                            sha256 e65b8f9a1bdf705f041da3905844f6a2610fae6217699ac1a4eba49dc89152a0 \
                            rmp160 8b41a8c6bf976e317662920fdd6090ccf43992cc

depends_run             port:globus-common \
                        port:globus-io \
                        port:globus-gssapi-gsi \
                        port:globus-gss-assist

depends_build           port:grid-packaging-tools \
                        port:globus-common \
                        port:globus-gssapi-gsi \
                        port:globus-gss-assist \
                        port:globus-io \
                        port:globus-core

worksrcdir              ${_name}-${version}

configure.env-append    GPT_LOCATION=${prefix} \
                        GLOBUS_LOCATION=${prefix}

configure.post_args     --with-flavor=${flavor} \
                        --with-docdir='\${datadir}/doc/${name}-${version}'

build.env-append        GPT_LOCATION=${prefix} \
                        GLOBUS_LOCATION=${prefix}

pre-configure {
    # Remove files that should be replaced during bootstrap
    eval file delete -force \
        [ glob -nocomplain ${worksrcpath}/doxygen/Doxyfile* ] dummy
    file delete -force ${worksrcpath}/doxygen/Makefile.am
    file delete -force ${worksrcpath}/pkgdata/Makefile.am
    eval file delete -force \
        [ glob -nocomplain ${worksrcpath}/globus_automake* ] dummy

    system "cd $worksrcpath && \
        GPT_LOCATION=${prefix} GLOBUS_LOCATION=${prefix} \
        ${prefix}/share/globus/globus-bootstrap.sh"
}

post-destroot {
    # Remove libtool archives (.la files)
    foreach file [ exec find ${destroot}/${prefix}/lib -name "lib*.la" ] {
        delete $file
    }

    # Remove static libraries (.a files)
    foreach file [ exec find ${destroot}/${prefix}/lib -name "lib*.a" ] {
        delete $file
    }
}
