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

# wrapper
legacysupport.newest_darwin_requires_legacy 0
legacysupport.redirect_bins FTB

github.setup        Cyxuan0311 FTB 2.1.1 v
name                [string tolower ${github.project}]
revision            0
categories          sysutils
license             MIT
maintainers         {@barracuda156 macos-powerpc.org:barracuda} openmaintainer
description         FTB (Terminal File Browser)
long_description    The FTB is a file brower based on FTXUI.
checksums           rmd160  a90221b5ac8528222e53e8f2a037ddcb66767267 \
                    sha256  212d56fa48b1c4992161cf61ef54708819e713290396e1308a021b789f400d42 \
                    size    2317631
github.tarball_from archive

depends_lib-append  port:chafa \
                    port:FTXUI \
                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    port:libsixel \
                    port:libssh2

depends_build-append \
                    port:gtest \
                    port:nlohmann-json \
                    path:bin/pkg-config:pkgconfig

compiler.cxx_standard   2017

configure.args-append \
                    -DFTB_ENABLE_AI=OFF \
                    -DFTB_ENABLE_ICONS=ON \
                    -DFTB_ENABLE_LIBCHAFA=ON \
                    -DFTB_ENABLE_LIBSIXEL=ON \
                    -DFTB_ENABLE_PLUGINS=OFF \
                    -DFTB_ENABLE_SSH=ON \
                    -DFTB_ENABLE_TREE_SITTER=OFF

# ___atomic_load_8, ___atomic_store_8
if {[string match *gcc* ${configure.compiler}] && ${configure.build_arch} in [list arm i386 ppc]} {
    configure.ldflags-append \
        -latomic
}

notes "
    FTB requires a modern-enough terminal emulator to run.\
    Consider using contour, mlterm(-minimal), iTerm2 or alike.
"
