#-*- 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                tcldoc
version             0.3
revision            2
categories          lang
maintainers         nomaintainer
# License is given as "GPL blah"
license             GPL-2
description         Generates HTML pages of API documentation from Tcl source files
long_description    TclDoc parses the declarations and documentation comments in a set of Tcl source files and \
                    produces a corresponding set of HTML pages describing procedure declarations.
homepage            https://wiki.tcl-lang.org/page/tcldoc
platforms           any
supported_archs     noarch
master_sites        http://www.jtang.org/tcl/tcldoc/

checksums           rmd160  a9429e982323891433fbe40a9b44860badf053c6 \
                    sha256  0e9ee47ae1482962e2760c3d47c06820d7e0dc264e853c523ddcb744045fc5c5 \
                    size    30743

depends_lib         port:tcl

# use TCL from MacPorts
patchfiles          patch-macports_tclsh.diff
post-patch {
    reinplace \
        "s|__MACPORTS_PREFIX__|${prefix}|g" \
        ${worksrcpath}/tcldoc.tcl
}

use_configure       no
build.target        all tcldoc
destroot {
    xinstall -d -m 755 ${destroot}${prefix}/share/doc/${name}
    foreach file [glob ${worksrcpath}/${name}/*.html] {
        copy $file ${destroot}${prefix}/share/doc/${name}
    }
    foreach file [glob ${worksrcpath}/*.tcl] {
        copy $file ${destroot}${prefix}/bin
    }
    ln -s ${name}.tcl  ${destroot}${prefix}/bin/${name}
}
