# -*- 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           github          1.0
PortGroup           legacysupport   1.1
PortGroup           makefile        1.0

github.setup        mawww kakoune 2025.06.03 v
github.tarball_from archive
revision            0

homepage            https://kakoune.org

description         Modal editor — Faster as in fewer keystrokes — \
                    Multiple selections — Orthogonal design

long_description    Kakoune is a code editor that implements Vi’s \
                    \"keystrokes as a text editing language\" model. As it’s \
                    also a modal editor, it is somewhat similar to the Vim \
                    editor (after which Kakoune was originally inspired). \
                    Kakoune can operate in two modes, normal and insertion. \
                    In insertion mode, keys are directly inserted into the \
                    current buffer. In normal mode, keys are used to \
                    manipulate the current selection and to enter insertion \
                    mode.  Kakoune has a strong focus on interactivity, most \
                    commands provide immediate and incremental results, while \
                    still being competitive (as in keystroke count) with Vim. \
                    Kakoune works on selections, which are oriented, \
                    inclusive ranges of characters. Selections have an anchor \
                    and a cursor. Most commands move both of them except when \
                    extending selections, where the anchor character stays \
                    fixed and the cursor moves around.

# kakoune is licensed via The Unlicense, making it public domain.
license             public-domain

categories          editors
installs_libs       no
maintainers         {gmail.com:herby.gillot @herbygillot} \
                    openmaintainer
platforms           darwin linux freebsd

checksums           rmd160  1d32fdc4af5458fb5be8a3f4cc8fd29b395bc2ac \
                    sha256  e065dbb715bfe6b0abdaeee775243115748bd540a346d0212fdca6c20c13d340 \
                    size    739067

patchfiles-append   patch-fix-prefix.diff

# error: 'uncaught_exceptions' is unavailable: introduced in macOS 10.12
if {${os.platform} eq "darwin" && ${os.major} < 16} {
    post-patch {
        reinplace "s|std::uncaught_exceptions()|std::uncaught_exception()?1:0|" \
            ${worksrcpath}/src/file.cc
    }
}

pre-build {
    set _version_file [open ${worksrcpath}/src/.version "w"]
    puts -nonewline ${_version_file} "${version}"
    close ${_version_file}
}

compiler.cxx_standard   2020

depends_lib-append      port:ncurses

makefile.has_destdir    yes

use_parallel_build      no
