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

name                docbook2X
version             0.8.8
revision            12
categories          textproc
license             MIT
maintainers         {gmail.com:tlockhart1976 @lockhart} openmaintainer
homepage            http://docbook2x.sourceforge.net/
description         Converts DocBook documents into the traditional Unix man \
                    page format and the GNU Texinfo format.
long_description    {*}${description}
master_sites        sourceforge:project/docbook2x/docbook2x/${version}

checksums           rmd160  35c8dcbe86e91e787a67b1d17251bf00fed9aabf \
                    sha256  4077757d367a9d1b1427e8d5dfc3c49d993e90deabc6df23d05cfe9cd2fcdc45 \
                    size    723909

conflicts           docbook-utils

# add perl variants
perl5.require_variant   yes
perl5.conflict_variants yes
perl5.branches          5.28 5.30 5.32 5.34
perl5.default_branch    5.34
perl5.create_variants   ${perl5.branches}

depends_lib         port:perl${perl5.major} \
                    port:p${perl5.major}-xml-namespacesupport \
                    port:p${perl5.major}-xml-sax \
                    port:p${perl5.major}-xml-parser \
                    port:p${perl5.major}-xml-sax-expat \
                    port:libiconv \
                    port:libxml2 \
                    port:libxslt

configure.args      PERL=${perl5.bin}

post-patch          {
    reinplace "s|http://docbook2x.sf.net/latest/xslt|${prefix}/share/docbook2X/xslt|" \
        ${worksrcpath}/perl/db2x_xsltproc.pl
    reinplace "s|/etc/xml/catalog|${prefix}/etc/xml/catalog|" \
        ${worksrcpath}/perl/db2x_xsltproc.pl \
        ${worksrcpath}/doc/db2x_xsltproc.1 \
        ${worksrcpath}/doc/db2x_xsltproc.html \
        ${worksrcpath}/doc/docbook2X.info
    reinplace "s|\${prefix}|${prefix}|" \
        ${worksrcpath}/configure
}
