# -*- 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             20260512-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  ede4aea606f38e1a5c84857258b214f2b945300d \
                    sha256  432d5e7ea8b0116dd39f2eca7bc11d0eed77faa6b77ea526ace89907c23ea4a0 \
                    size    550471

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}"
