# -*- 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                xmlto
version             0.0.29
revision            0
categories          textproc
license             GPL-2+
installs_libs       no
maintainers         nomaintainer

description         Convert an XML document to another format based on XSL \
                    or other tools
long_description \
    The purpose of xmlto is to convert an XML file to the desired format \
    using whatever means necessary. This may involve two steps: \
        1. The application of an appropriate XSL stylesheet using an XSL-T \
           processor. \
        2. Further processing with other tools. This step may not be necessary.

homepage            https://pagure.io/xmlto
master_sites        https://releases.pagure.org/xmlto/
use_bzip2           yes

checksums           rmd160  8ab75903683c3c88c519850ba8d9dc1d0176e270 \
                    sha256  6000d8e8f0f9040426c4f85d7ad86789bc88d4aeaef585c4d4110adb0b214f21 \
                    size    54700

# Needs xsltproc at build time, not just at runtime
depends_build       port:docbook-xml \
                    port:docbook-xsl-nons \
                    port:libxslt \
                    port:util-linux

depends_skip_archcheck-append \
                    libxslt

depends_run         port:docbook-xml \
                    port:docbook-xsl-nons \
                    port:fop \
                    port:libpaper-utils \
                    port:libxml2 \
                    port:libxslt \
                    port:w3m \
                    port:util-linux

patchfiles          xml-catalog.patch

use_autoreconf      yes

configure.env-append \
    GETOPT=${prefix}/bin/getopt \
    PAPER_CONF=${prefix}/bin/paperconf \
    XMLLINT=${prefix}/bin/xmllint \
    XSLTPROC=${prefix}/bin/xsltproc \
    FOP=${prefix}/bin/fop \
    W3M=${prefix}/bin/w3m

build.env-append    XML_CATALOG_FILES=${prefix}/etc/xml/catalog

destroot.env-append ${build.env}

post-destroot {
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} AUTHORS.md COPYING ChangeLog FAQ.md \
        NEWS.md README.md ${destroot}${docdir}
    xinstall -m 0644 {*}[glob ${worksrcpath}/doc/*] ${destroot}${docdir}
}

test.run            yes
test.target         check

livecheck.type      regex
livecheck.url       [lindex ${master_sites} 0]
livecheck.regex     ${name}-(\[0-9.\]+)${extract.suffix}
