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

PortSystem          1.0
PortGroup           github 1.0

github.setup        Gant Gant 1.9.10
# Change github.tarball_from to 'releases' or 'archive' next update
github.tarball_from tarball
name                gant
categories          java devel groovy
platforms           any
maintainers         nomaintainer
license             Apache-2
supported_archs     noarch

description         A groovy based tool for scripting ant

long_description    Gant is a tool for scripting Ant tasks using Groovy instead of XML \
                    to specify the logic. A Gant specification is a Groovy script and so \
                    can bring all the power of Groovy to bear directly, something not \
                    possible with Ant scripts. Whilst it might be seen as a competitor \
                    to Ant, Gant uses Ant tasks for many of the actions, so Gant is really \
                    an alternative way of doing things using Ant, but using a \
                    programming language rather than XML to specify the rules.

distname            ${name}-${version}
extract.suffix      .tgz
master_sites        https://web.archive.org/web/20150506155753/http://dist.codehaus.org/gant/distributions/

checksums           rmd160  8ed15ba3b3306263c1c32c408ac72174cbd6a76f \
                    sha256  33042f2e221a8407103a04b63232c18ce34902637e268aa02a4b4b7bafa90a19

post-extract {
    foreach f [glob -directory ${worksrcpath} README* conf/* lib/*] {
        file attributes ${f} -permissions a+r
    }
}

use_configure       no

build {}

platform darwin {
    build.env       JAVA_HOME=/Library/Java/Home
}

pre-destroot {
    # Remove extraneous bat files
    delete {*}[glob -directory ${worksrcpath}/bin *.bat]
}

destroot {
    # Create the target java directory
    xinstall -m 755 -d ${destroot}${prefix}/share/java/${name}

    # Copy over the needed elements of our directory tree
    file copy ${worksrcpath}/bin                            \
              ${worksrcpath}/lib                            \
              ${worksrcpath}/conf                           \
              ${destroot}${prefix}/share/java/${name}

    # Symlink gant into the bin directory
    ln -s ${prefix}/share/java/${name}/bin/gant ${destroot}${prefix}/bin
}

notes "
Remember to set the environment variable GANT_HOME to the path to\
the gant distribution: ${prefix}/share/java/${name}
"
