# -*- 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
# $Id: Portfile 85832 2011-10-16 19:06:54Z ecronin@macports.org $

PortSystem          1.0

name                hdhomerun_gui
version             20110925a
categories          multimedia
platforms           darwin
license             GPL-3
maintainers         ecronin openmaintainer
description         HDHomeRun GTK GUI
long_description    ${description}
homepage            http://www.silicondust.com/

master_sites        http://download.silicondust.com/hdhomerun
distname            hdhomerun_config_gui_${version}
patchfiles          patch-libhdhomerun.diff \
                    patch-firmware_path.diff \
                    patch-missing_frameworks.diff
# Until MacPorts updates VLC to 1.1.x we need this
patchfiles-append   patch-vlc_args.diff
patch.args          -p1
extract.suffix      .tgz
worksrcdir          hdhomerun_config_gui
checksums           rmd160 94201ffba2742fe99845599861ce1d4040eebe5a \
                    sha256 91ccdebba71c0bcc3927b52fdcc5fcd637fdb6f1e3087a17eed8605a2b5c15ad
livecheck.type      regex
livecheck.url       http://www.silicondust.com/support/hdhomerun/downloads/
livecheck.regex     Current release: (\[0-9\]+)

depends_build       port:pkgconfig
depends_lib         port:hdhomerun port:gtk2
depends_run         port:VLC

post-patch {
    reinplace "s|@FIRMWARE_DIR@|${prefix}/share/hdhomerun/|g" \
        ${worksrcpath}/src/HDHRConfig.cpp
    reinplace "s|\${EXECUTABLE_NAME}|hdhomerun_config_gui|g" \
        ${worksrcpath}/OSX/Info.plist
    reinplace "s|\${PRODUCT_NAME}|HDHomeRun Config|g" \
        ${worksrcpath}/OSX/Info.plist
}

post-destroot {
    set app_contents \
        "${destroot}${applications_dir}/HDHomeRun Config.app/Contents"

    xinstall -d -m 0755 ${app_contents}/Resources
    xinstall -d -m 0755 ${app_contents}/MacOS

    xinstall -m 0644 ${filespath}/PkgInfo ${app_contents}
    xinstall -m 0644 ${worksrcpath}/OSX/Info.plist ${app_contents}
    xinstall -m 0644 ${worksrcpath}/OSX/hdhr.icns \
        ${app_contents}/Resources
    ln -s ${prefix}/bin/hdhomerun_config_gui ${app_contents}/MacOS/
}
