# -*- 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-usage
set _name               [ string map {"-" "_"} $name ]
version                 3.1
revision                1
platforms               darwin
categories              net
license                 Apache-2
maintainers             nikhef.nl:dennisvd
homepage                http://www.globus.org/

description             Globus Toolkit - Usage statistics collector
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 ${name} package contains: \
                        Usage statistics collector

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 1d62f587a896e0a2043ad3c47a283f6407583db4b1ff8c17c92f2b92b28f07b9 \
                            rmp160 dfcef5afdecf0fa736d78c44ad17a2e951779f96

patchfiles              globus-usage-collector.patch

patch.pre_args          -p1

depends_run             port:globus-common \
                        port:globus-xio

depends_build           port:grid-packaging-tools \
                        port:globus-common \
                        port:globus-core \
                        port:globus-xio

worksrcdir              ${_name}-${version}

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

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

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

pre-configure {
    file delete -force ${worksrcpath}/autom4te.cache
    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
    }
}
