# -*- 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
PortGroup               maven 1.0

github.setup            jtidy jtidy 1.0.5 jtidy-
github.tarball_from     archive
revision                1

categories              java devel textproc
license                 Permissive
platforms               any
supported_archs         noarch
homepage                https://jtidy.sourceforge.net
maintainers             {sethm.id.au:dev @McDaMastR} \
                        openmaintainer

description             Java library for checking and pretty printing HTML
long_description        jtidy is a Java port of HTML Tidy, a HTML syntax \
                        checker and pretty printer.  Like its non-Java cousin, \
                        jtidy can be used as a tool for cleaning up malformed \
                        and faulty HTML.  In addition, jtidy provides a DOM \
                        interface to the document that is being processed, \
                        which effectively makes you able to use jtidy as a DOM \
                        parser for real-world HTML.

checksums               rmd160  d650722022af74f79ef60b1129d61f290ca190de \
                        sha256  6a7447f1f91fe5e27bc3e1cbd2c86fb06d6a4762202e43275bd74292de865edb \
                        size    685248

patchfiles              fix-javadoc-for-jdk-17.diff

java.version            1.8+

destroot {
    set destbindir  ${destroot}${prefix}/bin
    set destdocdir  ${destroot}${prefix}/share/doc/${name}
    set destjavadir ${destroot}${prefix}/share/java

    xinstall -d ${destbindir}
    xinstall ${filespath}/${name} ${destbindir}
    reinplace "s|@@PREFIX@@|${prefix}|g" ${destbindir}/${name}

    xinstall -d ${destjavadir}
    xinstall -m 644 \
        ${worksrcpath}/target/${name}-${version}.jar \
        ${destjavadir}/${name}.jar

    xinstall -d ${destdocdir}
    xinstall -m 644 \
        ${worksrcpath}/LICENSE.txt \
        ${worksrcpath}/README.md \
        ${worksrcpath}/docs/CodingConventions.md \
        ${worksrcpath}/docs/TestCases.md \
        ${destdocdir}

    if {[variant_isset doc]} {
        copy ${worksrcpath}/target/reports/apidocs ${destdocdir}/javadoc
    }
}

variant doc \
        description {Install javadoc} {
    build.target-append javadoc:javadoc
}
