# -*- 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-20251001
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  fa2b2f2623fdd1377f0fd859ef6b30b616c39c5e \
                    sha256  bee47347a983312facc4dbcccd7fcc86608d684e1f119d9049c4692213db96c3 \
                    size    576372

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
}
