# -*- 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           python 1.0
PortGroup           github 1.0
PortGroup           app 1.0

github.setup        quodlibet quodlibet 4.7.1 release-
github.tarball_from releases
revision            0

categories-append   audio gnome
maintainers         nomaintainer
license             GPL-2+

description         audio library manager and player for GTK+
long_description    Quod Libet is a GTK+-based audio player written in Python, \
                    using the Mutagen tagging library and GStreamer for playback.\
                    It provides several different ways to view your audio library, \
                    as well as support for Internet radio and audio feeds.\
                    It has extremely flexible metadata tag editing and searching capabilities.

checksums           rmd160  3dbdc3ebec2f5be13269f3b30bce039c16d74231 \
                    sha256  b77ce02a3144133acc37489dc8cea2afc71a22ce0ed1e780fe92072012f03dd1 \
                    size    5707982

python.default_version 313

# https://github.com/quodlibet/quodlibet/issues/4680
python.pep517       no

depends_build-append \
                    port:gettext \
                    port:py${python.version}-setuptools

depends_lib-append  port:dbus-python${python.version} \
                    port:libsoup \
                    port:gstreamer1-gst-plugins-good \
                    path:lib/pkgconfig/gtk+-3.0.pc:gtk3 \
                    port:py${python.version}-cairo \
                    port:py${python.version}-feedparser \
                    port:py${python.version}-gobject3 \
                    port:py${python.version}-mutagen \
                    port:py${python.version}-pyobjc

depends_run-append  port:adwaita-icon-theme

variant quartz {
    depends_lib-append  port:gtk-osx-application-gtk3
}

post-patch {
    foreach file { quodlibet.py exfalso.py operon.py } {
        reinplace "s|/usr/bin/env python3|${python.bin}|g" \
            ${worksrcpath}/${file}
    }
}

post-destroot {
    # icon keeps bouncing in the dock otherwise
    if {![variant_isset quartz]} {
      reinplace -E {s|(<string>APPL</string>)|\1 <key>LSUIElement</key><string>1</string>|} \
                "${destroot}${applications_dir}/Quodlibet.app/Contents/Info.plist"
    }

}

app.icon       quodlibet/images/hicolor/scalable/apps/io.github.quodlibet.QuodLibet.svg
app.executable "${frameworks_dir}/Python.framework/Versions/${python.branch}/bin/quodlibet"

notes "If you want to play mp3 files, don't forget to install gstreamer1-gst-plugins-ugly"
