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

name                poi
version             5.5.1
categories          java
platforms           any
maintainers         nomaintainer
supported_archs     noarch
license             LGPL-2.1

description         Apache POI - the Java API for Microsoft Documents

long_description    The Apache POI Project's mission is to create and maintain Java APIs for manipulating \
                    various file formats based upon the Office Open XML standards (OOXML) \
                    and Microsoft's OLE 2 Compound Document format (OLE2).

homepage            https://poi.apache.org/
master_sites        https://archive.apache.org/dist/poi/release/src/
distname            apache-poi-src-${version}-20251126
extract.suffix      .tgz

checksums           rmd160  c7931e3c560970306670e22fbb026338faea9656 \
                    sha256  62aaf3c36fce6172516007bdea13be2a8b85abf5c84932114f7787c2532f89c4 \
                    size    121846633

depends_build       bin:ant:apache-ant
use_configure       no
build.cmd           ant
build.target        compile


destroot {
    set javadir ${destroot}${prefix}/share/java/${name}
    xinstall -m 755 -d ${javadir}

    foreach jar [glob -nocomplain -tails -directory ${worksrcpath}/build/dist/maven/ **/poi*${version}.jar] {
        set fileName [file tail $jar]
        
        if {[string match "*-sources.jar" $fileName] || [string match "*-tests.jar" $fileName]} {
            continue
        }

        xinstall -m 644 ${worksrcpath}/build/dist/maven/${jar} ${javadir}

        set unversionedName [regsub -- "-${version}" $fileName ""]

        ln -s ${fileName} ${destroot}${prefix}/share/java/${name}/${unversionedName}
    }
}

livecheck.type  regex
livecheck.url   https://poi.apache.org/download.html
livecheck.regex {The latest stable release is Apache POI (\d+\.\d+)}
