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

# strndup
legacysupport.newest_darwin_requires_legacy 10

github.setup        lichray nvi2 2.2.1 v
categories          editors
license             BSD
maintainers         {@barracuda156 gmail.com:vital.had} openmaintainer
description         Reimplementation of nex/nvi
long_description    ${description}, text editors originally distributed \
                    as part of the Fourth Berkeley Software Distribution (4BSD), \
                    by the University of California, Berkeley.
checksums           rmd160  7ac37a051d6054682bf9e89fdac8bb59fedb203c \
                    sha256  9f7c9aef3924c0e39ef96e1aadb8f5d396825b8251addab1290aa866cf3d5af4 \
                    size    443376
github.tarball_from archive

cmake.generator     Ninja

depends_lib-append  port:libiconv \
                    port:ncurses

# https://github.com/lichray/nvi2/issues/133
patchfiles          patch-fix-include-path.diff \
                    patch-SLIST_REMOVE_AFTER.diff

# https://trac.macports.org/ticket/69888
compiler.blacklist-append \
                    {*gcc-[34].*} {clang < 400}

configure.args-append \
                    -DUSE_ICONV=ON \
                    -DUSE_WIDECHAR=ON

destroot {
    move ${cmake.build_dir}/nvi ${destroot}${prefix}/bin/${name}
    set docdir ${prefix}/share/doc/${name}
    xinstall -d ${destroot}${docdir}
    xinstall -m 0644 -W ${worksrcpath} INSTALL.md LICENSE README ${destroot}${docdir}
    copy ${worksrcpath}/man ${destroot}${docdir}
}
