# -*- 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
PortGroup           clang_dependency 1.0

name                libedit
epoch               20090923
version             20251016-3.1
revision            0
categories          devel
license             BSD
maintainers         {mcalhoun @MarcusCalhoun-Lopez} \
                    {judaew @judaew} openmaintainer

description         command line editing and history library
long_description    libedit is a command line editing and history library. \
                    It is designed to be used by interactive programs that \
                    allow the user to type commands at a terminal prompt.

homepage            https://thrysoee.dk/editline/
master_sites        ${homepage} \
                    http://download.openpkg.org/components/cache/libedit/

checksums           rmd160  b897fbac5983d29bd6e3ca06210820b84a4ec6be \
                    sha256  21362b00653bbfc1c71f71a7578da66b5b5203559d43134d2dd7719e313ce041 \
                    size    549005

depends_lib         port:ncurses

if {${os.platform} eq "darwin" && ${os.major} < 11 && ${cxx_stdlib} eq "libc++"} {
    # This port is required by clang 3.7 and later
    clang_dependency.extra_versions 3.7
}

# add missing includes for types used in getline and wcsdup declarations
# see https://trac.macports.org/ticket/51891
patchfiles-append   src__sys.h.patch

# see https://trac.macports.org/ticket/52866
# this patch is taken from
#    https://opensource.apple.com/source/libedit/libedit-48/src/el.c.auto.html
patchfiles-append   patch-non_ascii.diff

# render moot http://cvsweb.netbsd.org/bsdweb.cgi/src/lib/libedit/filecomplete.c?sortby=date#rev1.47
# see https://trac.macports.org/ticket/57584
patchfiles-append   patch-no_escaping.diff

configure.args      --disable-silent-rules --disable-examples

# If ccache is enabled, ncurses.h is not found during configuration
#
# configure: error: ncurses.h, curses.h, or termcap.h is required!
configure.ccache    no

livecheck.type      regex
livecheck.url       [lindex ${master_sites} 0]
livecheck.regex     "${name}-(\\d+-\\d+(?:\\.\\d+)*)${extract.suffix}"
