# -*- 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        pystardust ani-cli 5.2 v
revision            0
categories          www multimedia anime
platforms           any
license             GPL-3
maintainers         {@barracuda156 macos-powerpc.org:barracuda} openmaintainer
description         CLI tool to browse and play anime
long_description    {*}${description}
checksums           rmd160  80edc3fa42b9d84c72711c9ecbbfe3ca86a757e6 \
                    sha256  af2e3102d661d2eab0606f98f3b30c9e1a63d8e38adcaf5de6d3c0b191c9bd91 \
                    size    479096
github.tarball_from archive
supported_archs     noarch

depends_run-append  port:curl-impersonate \
                    path:libexec/gnubin/mktemp:coreutils \
                    port:curl \
                    path:bin/ffmpeg:ffmpeg \
                    port:grep \
                    port:gsed \
                    path:bin/mpv:mpv \
                    port:yt-dlp

# On macOS versions where fzf fails to build, use fzf++ fallback,
# otherwise default to golang fzf.
# The threshold reflects fzf status: https://ports.macports.org/port/fzf/details
if {${os.platform} eq "darwin" && ${os.major} < 17} {
    depends_run-append \
                    path:bin/fzf:fzfpp
} else {
    depends_run-append \
                    path:bin/fzf:fzf
}

use_configure       no
build               { }
destroot {
    xinstall -m 775 ${worksrcpath}/${name} ${destroot}${prefix}/bin/
}

notes "
    It is REQUIRED to add gnubin to the PATH before running the app:\
    `export PATH=${prefix}/libexec/gnubin:\$PATH`\
"
