# -*- coding: utf-8; mode: tcl; tab-width: 4; indent-tabs-mode: nil; c-basic-offset: 4 -*- vim:fenc=utf-8:filetype=tcl:et:sw=4:ts=4:sts=4

PortSystem          1.0
PortGroup           java 1.0

name                asciidoctorj
version             2.5.13
revision            0

categories          textproc java
license             Apache-2
supported_archs     noarch
platforms           any
maintainers         {judaew @judaew} openmaintainer

description         \
    AsciidoctorJ is the official library for running Asciidoctor on the JVM.
long_description    {*}${description} Using AsciidoctorJ, you can convert \
    AsciiDoc content or analyze the structure of a parsed AsciiDoc document \
    from Java and other JVM languages.
homepage            https://asciidoctor.org

master_sites        https://repo1.maven.org/maven2/org/asciidoctor/asciidoctorj/${version}/
distname            ${name}-${version}-bin
worksrcdir          ${name}-${version}

checksums           rmd160  20f4dcde05685429397501cc6c2a0f61483a7cfe \
                    sha256  67b420378c2887fdb330de2eb2d614a249224532eccc26c6f2ebe8330f878c38 \
                    size    66698631

java.version        1.8+
java.fallback       openjdk11

use_zip             yes
use_configure       no
build {}

patchfiles          patch-prefix-for-app-libs.diff

destroot {
    delete ${worksrcpath}/bin/${name}.bat

    reinplace "s,@@PREFIX@@,${prefix}/lib/${name},g" ${worksrcpath}/bin/${name}
    xinstall -m 0755 ${worksrcpath}/bin/${name} ${destroot}${prefix}/bin

    xinstall -m 0755 -d ${destroot}${prefix}/lib/asciidoctorj
    xinstall -m 0644 {*}[glob ${worksrcpath}/lib/*.jar] \
        ${destroot}${prefix}/lib/asciidoctorj
}

livecheck.type      regex
livecheck.url       https://repo1.maven.org/maven2/org/asciidoctor/asciidoctorj/maven-metadata.xml
livecheck.regex     >(\\d+\\.\\d+(\\.\\d+)*)</
