# -*- 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                mc
version             4.8.33
revision            0

categories          sysutils
maintainers         nomaintainer
license             GPL-3+

description         GNU Midnight Commander

long_description    \
                    GNU Midnight Commander is a user-friendly yet powerful file \
                    manager and visual shell, useful to novice and guru alike. \
                    It provides a clear, user-friendly, and somewhat protected \
                    interface to a Unix system while making many frequent file \
                    operations more efficient and preserving the full power of \
                    the command prompt. After some practice, you will wonder how \
                    you could ever live without it.
homepage            https://www.midnight-commander.org
master_sites        ${homepage}/downloads

use_xz              yes

checksums           rmd160  87c5363d8f6645a9b35c5ad067c0fdcf2af7b438 \
                    sha256  cae149d42f844e5185d8c81d7db3913a8fa214c65f852200a9d896b468af164c \
                    size    2424476

depends_build       port:pkgconfig
depends_lib         path:lib/pkgconfig/glib-2.0.pc:glib2

patchfiles          patch-src_subshell_common.c.diff

compiler.c_standard 1999

configure.args      --without-x --enable-vfs-sftp=no

post-destroot {
    set docdir ${destroot}${prefix}/share/doc/${name}
    xinstall -d ${docdir}
    xinstall -m 644 -W ${worksrcpath} \
        AUTHORS \
        COPYING \
        NEWS \
        README \
        ${docdir}
}

variant slang2 conflicts ncurses description {use slang2 screen library} {
    depends_lib-append      port:slang2
    configure.args-append   --with-screen=slang
}

variant ncurses conflicts slang2 description {use ncurses screen library} {
    depends_lib-append      port:ncurses
    configure.args-append   --with-screen=ncurses
}

variant sftp description {adds remote access to sftp servers} {
    depends_lib-append      port:libssh2
    configure.args-replace  --enable-vfs-sftp=no \
                            --enable-vfs-sftp=yes
}

if { ![variant_isset ncurses] } {
    default_variants        +slang2
}

livecheck.type  regex
livecheck.url   ${homepage}
livecheck.regex {Current version is: ([0-9.]+)}
