# -*- 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-20250817
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  cfebf9168d01c7cd1c71eff58f0356fb4e3f07d0 \
                    sha256  6c59b4671616041dcd75d0d4a1d8646e8ca6b10a1ae534d3b9368c4c4ba29aa7 \
                    size    575508

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
}
