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

name                hdhomerun_gui
version             20221031
revision            1
categories          multimedia
platforms           darwin
license             GPL-3
maintainers         nomaintainer
description         HDHomeRun configuration utility, GTK GUI
long_description    Provides a utility program to access, configure and test \
                    HDHomeRun network tuner devices from SiliconDust including viewing \
                    live television.  May also be used to upgrade firmware.  Uses GTK \
                    graphical environment.
homepage            https://www.silicondust.com/

master_sites        https://download.silicondust.com/hdhomerun
distfiles           hdhomerun_config_gui_${version}
checksums           hdhomerun_config_gui_20221031 \
                    rmd160  9946f20e82ecd04b4d97a928310c16c144e9e690 \
                    sha256  bf3ad293be3609ad88f14934b86a38e12c69128558d50067eb6021c33f04ee9f \
                    size    253374

patchfiles          patch-libhdhomerun.diff
patch.pre_args-replace  -p0 -p1
extract.suffix      .tgz
worksrcdir          hdhomerun_config_gui

depends_build       port:pkgconfig
depends_lib         port:hdhomerun \
                    path:lib/pkgconfig/gtk+-2.0.pc:gtk2 \
                    port:gtk-osx-application-gtk2

require_active_variants path:lib/pkgconfig/gtk+-2.0.pc:gtk2 quartz

configure.env-append \
                    LIBS=-lgtkmacintegration-gtk2
configure.ldflags-append \
                    -L${prefix}/lib/gtkmacintegration-gtk2 \
                    -L${prefix}/lib/libhdhomerun
configure.cppflags-append \
                    -I${prefix}/include/gtkmacintegration-gtk2 \
                    -I${prefix}/include/libhdhomerun

post-build {
# no execute permission, will refuse to run with "Error 126", Permission denied
    file attributes ${worksrcpath}/install-sh -permissions +x
}

app.name            HDHomerun
app.executable      hdhomerun_config_gui
app.icon            ${worksrcpath}/OSX/hdhr.icns
app.hide_dock_icon  yes

notes "To viewing television directly from your HDHomerun device,\n \
install VLC.\n\
Up to date device firmware is available from:\n\
\thttps://www.silicondust.com/support/linux/"

livecheck.type      regex
livecheck.url       https://www.silicondust.com/support/hdhomerun/downloads/
livecheck.regex     Current release: (\[0-9\]+)
