# -*- 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            jarun nnn 5.1 v
github.tarball_from     archive
revision                0
categories              sysutils
license                 BSD
maintainers             {mcalhoun @MarcusCalhoun-Lopez} openmaintainer
description             tiny, lightning fast, feature-packed file manager
long_description        ${name} is a tiny, lightning fast, feature-packed file manager.

checksums               rmd160  8fd8c56d6f7d152dd343358ed781a880ac672a30 \
                        sha256  9faaff1e3f5a2fd3ed570a83f6fb3baf0bfc6ebd6a9abac16203d057ac3fffe3 \
                        size    261313

installs_libs           no

depends_build           path:bin/pkg-config:pkgconfig

depends_lib             port:readline \
                        port:ncurses \
                        port:pcre

# https://trac.macports.org/ticket/70577
patchfiles-append       0001-Drop-a-defunct-fallback.patch

compiler.c_standard     2011
compiler.blacklist-append \
                        {clang < 602}

build.args-append       CFLAGS_OPTIMIZATION="" \
                        O_PCRE=1

post-destroot {
    set bash_completion ${prefix}/share/bash-completion/completions
    xinstall -d ${destroot}${bash_completion}
    xinstall -m 0644 ${worksrcpath}/misc/auto-completion/bash/nnn-completion.bash \
        ${destroot}${bash_completion}/nnn.bash

    set zsh_completion ${prefix}/share/zsh/site-functions
    xinstall -d ${destroot}${zsh_completion}
    xinstall -m 0644 ${worksrcpath}/misc/auto-completion/zsh/_nnn \
        ${destroot}${zsh_completion}/_nnn

    set fish_completion ${prefix}/share/fish/vendor_completions.d
    xinstall -d ${destroot}${fish_completion}
    xinstall -m 0644 ${worksrcpath}/misc/auto-completion/fish/nnn.fish \
        ${destroot}${fish_completion}/nnn.fish

    xinstall -d ${destroot}${prefix}/share/${name}/quitcd
    xinstall -m 0644 {*}[glob ${worksrcpath}/misc/quitcd/quitcd.*] \
        ${destroot}${prefix}/share/${name}/quitcd

    xinstall -d ${destroot}${prefix}/share/${name}/plugins
    xinstall -m 0644 {*}[glob ${worksrcpath}/plugins/*] \
        ${destroot}${prefix}/share/${name}/plugins
}
