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

github.setup        resurrecting-open-source-projects txt2html 3.0 v
github.tarball_from archive
revision            0

categories          textproc
platforms           any
supported_archs     noarch
license             BSD
maintainers         nomaintainer

description         Convert ASCII text to HTML
long_description    txt2html is a Perl program that converts plain text to \
                    HTML.  It supports headings, lists, simple character \
                    markup, hyperlinking, and is highly customizable.  It \
                    recognizes some of the structure of the source document \
                    (whitespace, typographic layout, etc.), and attempts to \
                    mark that structure explicitly using HTML.

checksums           rmd160  144e9514e7137f682a738fa25ead029241d0bc31 \
                    sha256  6a2d23a23dd7d06cac0d383745bf456754da4992b5f2f4536d478a46d3a8e57e \
                    size    140611

use_configure       no
perl5.use_module_build

depends_lib-append  port:p${perl5.major}-getopt-long \
                    port:p${perl5.major}-getopt-argvfile \
                    port:p${perl5.major}-yaml-syck

# Also requires: Pod::Usage, Test::More but those should be in any
# non-obsolete Perl's core modules.

post-patch {
    reinplace "s|/usr/bin/env perl|${perl5.bin}|" ${worksrcpath}/scripts/${name}
}

configure {
    system -W ${worksrcpath} "'${perl5.bin}' './Build.PL' \
        '--install_base' '${prefix}'"
}

post-destroot {
    file mkdir ${destroot}${prefix}/lib/perl5/${perl5.major}
    move ${destroot}${prefix}/lib/perl5/HTML \
        ${destroot}${prefix}/lib/perl5/${perl5.major}
    move ${destroot}${prefix}/man/man1/txt2html.1pm \
        ${destroot}${prefix}/share/man/man1
    move ${destroot}${prefix}/man/man3/HTML::TextToHTML.3pm \
        ${destroot}/${prefix}/share/man/man3
    file delete -force ${destroot}${prefix}/lib/perl5/darwin-thread-multi-2level
}
