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

name                dialog
epoch               20150920
version             1.3-20260107
revision            0

categories          devel
license             LGPL-2.1
maintainers         {judaew @judaew} openmaintainer

description         a utility to create nice user interfaces for command-line scripts
long_description    ${name} is {*}${description}. It is non-graphical (it uses \
                    curses) so it can be run in the console or an xterm.

homepage            https://invisible-island.net/dialog/
master_sites        https://invisible-island.net/archives/${name}/ \
                    https://invisible-mirror.net/archives/${name}/

extract.suffix      .tgz

checksums           rmd160  37cd29501d3f72eed9bae62635bfeb781e7c2a79 \
                    sha256  78b3dd18d95e50f0be8f9b9c1e7cffe28c9bf1cdf20d5b3ef17279c4da35c5b5 \
                    size    584313

depends_build       port:pkgconfig
depends_lib         port:ncurses

configure.args      --mandir=${prefix}/share/man \
                    --with-ncursesw

configure.checks.implicit_function_declaration.whitelist-append waddnwstr

test.run            yes
test.target         check

if {${name} == ${subport}} {

    installs_libs   no

post-destroot   {
    file delete -force ${destroot}${prefix}/lib/libdialog.a

    xinstall -m 755 -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 644 -W ${worksrcpath} CHANGES COPYING README VERSION \
        ${destroot}${prefix}/share/doc/${name}
    file copy ${worksrcpath}/samples \
            ${destroot}${prefix}/share/doc/${name}/examples
}

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

subport libdialog {
    description         a library to create nice user interfaces for command-line programs

    long_description    ${name} is {*}${description}. It is non-graphical (it uses \
                        curses) so it can be used in console or xterm programs.

    destroot.target     install-lib
}
