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

name                    apache-ant-1.9
version                 1.9.16
set branch              [join [lrange [split ${version} .] 0 1] .]
categories              devel java
license                 Apache-2 W3C
maintainers             nomaintainer
supported_archs         noarch

description             Java opensource build system
long_description        Ant is a Java based build tool.  In theory it is \
                        kind of like make without make's wrinkles.  Ant \
                        uses XML build files that define a set of targets.  \
                        Each target has dependencies (other targets) and \
                        contains a set of tasks to perform.
homepage                https://ant.apache.org/

platforms               any

distname                apache-ant-${version}-bin
master_sites            apache:ant/
master_sites.mirror_subdir  binaries

checksums               rmd160  3b8fb74f30e76c35c7320902e861146b5d141c53 \
                        sha256  57ceb0b249708cb28d081a72045657ab067fc4bc4a0d1e4af252496be44c2e66 \
                        size    4495811

worksrcdir              apache-ant-${version}
set workTarget          ""

use_bzip2               yes
use_configure           no

conflicts               apache-ant

build {}

pre-destroot {
    delete \
        ${worksrcpath}${workTarget}/bin/ant.bat \
        ${worksrcpath}${workTarget}/bin/ant.cmd \
        ${worksrcpath}${workTarget}/bin/antRun.bat \
        ${worksrcpath}${workTarget}/bin/antenv.cmd \
        ${worksrcpath}${workTarget}/bin/envset.cmd \
        ${worksrcpath}${workTarget}/bin/lcp.bat \
        ${worksrcpath}${workTarget}/bin/runrc.cmd
}

destroot {
    xinstall -m 755 -d ${destroot}${prefix}/share/java
    file copy ${worksrcpath}${workTarget} \
        ${destroot}${prefix}/share/java/apache-ant

    xinstall -m 755 -d ${destroot}${prefix}/share/doc/apache-ant
    foreach f { INSTALL KEYS LICENSE NOTICE README WHATSNEW manual } {
        file rename ${destroot}${prefix}/share/java/apache-ant/${f} \
            ${destroot}${prefix}/share/doc/apache-ant/${f}
    }

    ln -s ../share/java/apache-ant/bin/ant ${destroot}${prefix}/bin/ant
}

livecheck.type          regex
livecheck.url           https://www.apache.org/dist/ant/binaries/
livecheck.regex         apache-ant-([quotemeta ${branch}](?:\\.\\d+)*)-bin\\.tar\\.bz2
