# -*- 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

github.setup            ascii-boxes boxes 2.3.1 v
github.tarball_from     archive

categories              textproc
license                 GPL-3
maintainers             @StefKKK openmaintainer

description             draws boxes around text
long_description        boxes is a text filter which can draw various \
                        ASCII art boxes around its input text. \
                        Variants: 'emacs' -- installs boxes.el, which \
                        simplifies using boxes from emacs

homepage                https://boxes.thomasjensen.com

checksums               rmd160  733bb03492a97948ae9daf74fc6e2c6a5cca82c9 \
                        sha256  0834e54c0d5293950412729cabf16ada3076a804eacba8f1aacc5381dfe3a96a \
                        size    299074

depends_build-append    port:bison \
                        port:flex \
                        port:gsed

depends_lib-append      port:libunistring \
                        port:ncurses \
                        port:pcre2

use_configure           no

variant emacs description {Install boxes.el for running inside emacs} {
    post-destroot {
        xinstall -d ${destroot}${prefix}/share/emacs/site-lisp/${name}
        xinstall -m 0644 ${worksrcpath}/doc/boxes.el ${destroot}${prefix}/share/emacs/site-lisp/${name}/
    }
}

build.target            ;# default target
build.args              CC=${configure.cc} GLOBALCONF=${prefix}/share/boxes

test.run                yes
test.env-append         PATH=${prefix}/libexec/gnubin:$env(PATH) \
                        TERM=xterm-color

destroot {
    xinstall -m 0755 ${worksrcpath}/out/boxes ${destroot}${prefix}/bin/${name}
    file copy ${worksrcpath}/boxes-config ${worksrcpath}/boxes
    xinstall -m 0644 ${worksrcpath}/boxes ${destroot}${prefix}/share/${name}
    xinstall ${worksrcpath}/doc/boxes.1 ${destroot}${prefix}/share/man/man1/
    xinstall -d ${destroot}${prefix}/share/doc/${name}
    xinstall -m 0644 -W ${worksrcpath} README.md LICENSE boxes-config ${destroot}${prefix}/share/doc/${name}
}
