# -*- 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           active_variants 1.1
PortGroup           debug 1.0
PortGroup           app 1.0
PortGroup           yelp 1.0

name                gtk-internet-radio-locator
version             5.4.8
revision            0
set branch          [join [lrange [split $version .] 0 1] .]

categories          gnome
platforms           darwin
license             GPL-3+
maintainers         {gnome.org:ole @oleaamot} \
                    openmaintainer
description         GTK Internet Radio Locator
long_description    Locate Internet Radio Stations on the Earth
homepage            https://gtk.audio/
master_sites        https://gtk.audio/src/

use_xz              yes

checksums           rmd160  719f4a02e07b230a11fede18fff8b6f1127679fa \
                    sha256  b647a110cd8e84ecc5328dd28f02125800664b0e189586a9c36ef9b26fc9ddbc \
                    size    513888

depends_build       port:autoconf \
                    port:automake \
                    port:geocode-glib \
                    port:gnome-common \
                    port:gstreamer1-gst-plugins-bad \
                    port:gstreamer1-gst-plugins-good \
                    port:gstreamer1-gst-plugins-ugly \
                    port:gtk-doc \
                    port:intltool \
                    port:itstool \
                    path:bin/pkg-config:pkgconfig \
                    port:yelp-tools

depends_lib         path:lib/pkgconfig/glib-2.0.pc:glib2 \
                    path:lib/pkgconfig/pango.pc:pango \
                    port:desktop-file-utils \
                    port:geocode-glib \
                    port:gstreamer1 \
                    port:gstreamer1-gst-plugins-base \
                    path:lib/pkgconfig/gtk4.pc:gtk4 \
                    port:libchamplain \
                    port:libxml2 \
                    port:zlib

depends_run         port:adwaita-icon-theme \
                    port:gstreamer1-gst-plugins-bad \
                    port:gstreamer1-gst-plugins-good \
                    port:gstreamer1-gst-plugins-ugly

# reconfigure using autogen.sh from upstream git for intltool 0.51 compatibility

post-patch {
    xinstall -m 755 ${filespath}/autogen.sh ${worksrcpath}
}

configure.cmd       ./autogen.sh

# building with optimization greater than -O0 causes crash on selecting station
# https://trac.macports.org/ticket/52993
configure.optflags  -O0
configure.args      --disable-silent-rules

post-activate {
   system "${prefix}/bin/gtk-update-icon-cache -f -t ${prefix}/share/icons/hicolor"
   system "${prefix}/bin/update-desktop-database ${prefix}/share/applications"
}

app.name            InternetRadioLocator
app.icon            ${worksrcpath}/data/icons/1024x1024/apps/gtk-internet-radio-locator.png

variant quartz conflicts x11 {
    require_active_variants gtk3 quartz x11
}
variant x11 conflicts quartz {
    require_active_variants gtk3 x11 quartz
}

if {![variant_isset quartz]} {
    default_variants +x11
}
if {![variant_isset x11]} {
    default_variants +quartz
}
if {![variant_isset quartz] && ![variant_isset x11]} {
    error "Either +x11 or +quartz is required"
}
variant debug description {Build with debug symbols and enable debug messages} {
    configure.optflags  -O0 -g
}

livecheck.type      gnome-with-unstable
