# -*- 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                screen4
set real_name       screen
version             4.9.1
revision            0
homepage            https://www.gnu.org/software/screen/
description         Screen manager with VT100/ANSI terminal emulation
long_description    \
    Screen is a full-screen window manager that multiplexes a physical \
    terminal between several processes (typically interactive shells). \
    Each virtual terminal provides the functions of a DEC VT100 terminal \
    and, in addition, several control functions from the ANSI X3.64 (ISO \
    6429) and ISO 2022 standards (e.g. insert/delete line and support for \
    multiple character sets). There is a scrollback history buffer for each \
    virtual terminal and a copy-and-paste mechanism that allows moving text \
    regions between windows.
conflicts           screen
categories          sysutils
license             GPL-3+
platforms           darwin
maintainers         {gmail.com:davidgilman1 @dgilman} openmaintainer
master_sites        gnu:${real_name} \
                    http://www.ryandesign.com/macports/distfiles/screen/:encoding \
                    http://www.ryandesign.com/macports/distfiles/screen/r23776/:launchd_priv_header

distname            ${real_name}-${version}

checksums           ${distname}${extract.suffix} \
                    rmd160  dd3f460992e823783b55d7fc7fd949a349fc4611 \
                    sha256  26cef3e3c42571c0d484ad6faf110c5c15091fbf872b06fa7aa4766c7405ac69 \
                    size    1040785

patchfiles          patch-apple-screen.diff \
                    patch-apple-window.diff \
                    patch-acconfig.h.diff \
                    patch-xcode-12-implicit-function-fixes.diff
depends_lib         port:ncurses

extract.only        ${distname}${extract.suffix}
post-extract {
    file copy ${filespath}/18 ${workpath}
}

use_autoreconf      yes
autoreconf.args     -i

configure.args      --mandir=${prefix}/share/man \
                    --infodir=${prefix}/share/info \
                    --enable-telnet \
                    --enable-colors256 \
                    --enable-rxvt_osc
configure.cflags-append -DRUN_LOGIN

post-destroot {
    xinstall -m 644 ${workpath}/18 ${destroot}${prefix}/share/${real_name}/utf8encodings
    xinstall -m 644 ${worksrcpath}/etc/etcscreenrc ${destroot}${prefix}/etc/screenrc
    xinstall -m 644 ${worksrcpath}/terminfo/screencap ${destroot}${prefix}/etc/termcap
    system "tic ${worksrcpath}/terminfo/screeninfo.src"
}

platform darwin {
    # The vproc_priv.h is the private header from launchd
    # We copied the header file from http://launchd.macosforge.org/trac/browser/trunk/launchd/src/vproc_priv.h, r23776
    post-extract {
        file copy ${filespath}/vproc_priv.h ${worksrcpath}
    }
}

platform darwin 8 {
    # Tiger lacks vproc.h and _CS_DARWIN_USER_TEMP_DIR, just nix the screen.c patch
    patchfiles-delete patch-apple-screen.diff
}

livecheck.regex {screen-(4+(?:\.\d+)*)}

notes "
Any screens running before upgrading, will not be available, post-install.
"
