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

PortSystem          1.0

name                doclifter
version             2.20
revision            1
categories          textproc
platforms           any
supported_archs     noarch
maintainers         nomaintainer
description         troff macro to DocBook translater
long_description    {*}${description} For example, \
                    it may be used to convert man pages to DocBook.
license             BSD
homepage            http://catb.org/~esr/doclifter
master_sites        ${homepage}
checksums           rmd160  31057d9cbbc08d2b58bb7f74236978877b007e0e \
                    sha256  044b8c6c8089f130f7f958d4afcae686cb3b5e53cd8f14b2d4fd1292628b3ec7 \
                    size    355576

set py_ver          3.11
set py_ver_nodot    [string map {. {}} ${py_ver}]
depends_lib-append  port:python${py_ver_nodot}

patchfiles          py3.patch

use_configure       no

destroot {
    xinstall -m 755 -d ${destroot}${prefix}/bin
    xinstall -m 755 -d ${destroot}${prefix}/share/man/man1
    xinstall ${worksrcpath}/doclifter ${destroot}${prefix}/bin
    xinstall ${worksrcpath}/manlifter ${destroot}${prefix}/bin
    xinstall ${worksrcpath}/doclifter.1 ${destroot}${prefix}/share/man/man1
    xinstall ${worksrcpath}/manlifter.1 ${destroot}${prefix}/share/man/man1

    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    foreach doc {COPYING PATCHES README TODO} {
        xinstall -m 644 ${worksrcpath}/${doc} ${destroot}${prefix}/share/doc/${name}
    }
    reinplace "s|#!/usr/bin/env python3|#! ${prefix}/bin/python${py_ver}|" \
        ${destroot}${prefix}/bin/doclifter
    reinplace "s|#!/usr/bin/env python2|#! ${prefix}/bin/python${py_ver}|" \
        ${destroot}${prefix}/bin/manlifter
}
