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

github.setup        giantpinkrobots varia 2026.1.5-3 v
revision            0
categories          net www sysutils
license             MPL-2
maintainers         {@barracuda156 macos-powerpc.org:barracuda} openmaintainer
description         Download manager that supports regular downloads, torrents and videos
long_description    {*}${description}
homepage            https://giantpinkrobots.github.io/varia
checksums           rmd160  5001e3203c87f53cf14a71df5e40ac8fd2961a89 \
                    sha256  01dc36ee71f40666219ee70699dd8350116a18b94b4c3931c16a1fc18e2d0afc \
                    size    1273024
github.tarball_from archive

set py_ver          3.13
set py_ver_nodot    [string map {. {}} ${py_ver}]
configure.python    ${prefix}/bin/python${py_ver}

post-patch {
    reinplace "s|'python3'|'${configure.python}'|" ${worksrcpath}/src/meson.build
}

depends_build-append \
                    port:gettext \
                    path:bin/pkg-config:pkgconfig \
                    port:python${py_ver_nodot}
depends_lib-append  port:aria2p \
                    path:bin/ffmpeg:ffmpeg \
                    path:lib/pkgconfig/gdk-pixbuf-2.0.pc:gdk-pixbuf2 \
                    port:gettext-runtime \
                    path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    path:lib/pkgconfig/gnutls.pc:gnutls \
                    path:lib/pkgconfig/gobject-introspection-1.0.pc:gobject-introspection \
                    path:lib/pkgconfig/gtk4.pc:gtk4 \
                    port:lame \
                    port:libadwaita \
                    port:libayatana-appindicator \
                    port:libogg \
                    port:libopus \
                    port:libvorbis \
                    path:lib/pkgconfig/pango.pc:pango \
                    port:py${py_ver_nodot}-appdirs \
                    port:py${py_ver_nodot}-emoji-country-flag \
                    port:py${py_ver_nodot}-gobject3 \
                    port:py${py_ver_nodot}-Pillow \
                    port:py${py_ver_nodot}-requests \
                    port:yt-dlp

depends_run-append  port:desktop-file-utils

# https://trac.macports.org/ticket/70137
notes "
The app needs dbus session. Please run the following:
launchctl load -w /Library/LaunchAgents/org.freedesktop.dbus-session.plist

If you get an error upon launching the app, try setting GSK_RENDERER=cairo\
in the environment. You may also add it into a shell config file.
"
