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

name                phonon-backend-gstreamer
version             4.9.0
license             {LGPL-2.1 LGPL-3}
maintainers         {gmail.com:rjvbertin @RJVB} openmaintainer
description         GStreamer backend for Phonon
platforms           darwin
homepage            https://phonon.kde.org
master_sites        kde:stable/phonon/${name}/${version}
use_xz              yes
distname            phonon-backend-gstreamer-${version}
checksums           rmd160  43095bdb9fe8729fd795910188c46cdcb0eae12f \
                    sha256  cec3e5ece1261d344b68363ef0606ebf49772628ba94bb55b0c0d18773b885f1

# ATTENTION: This renaming is suddenly needed, as the foldername skips "-backend" from version 4.8.2 to 4.9.0:
worksrcdir          phonon-gstreamer-${version}

# NOTE: There is now a variable called BUILD_X11RENDERER, which seems to control the building of the X11 renderer.
#       Weird, but this variable's default value in gstreamer's CMakeLists.txt is set to TRUE, although FALSE is needed!
patchfiles-append   patch-gstreamer_CMakeLists.txt.diff

depends_lib-append  port:gstreamer1-gst-plugins-good

subport ${name}-qt5 {
    PortGroup       qt5 1.0
    PortGroup       cmake 1.0
    categories      audio kde kf5
    long_description        A GStreamer backend for the Phonon4Qt5 multimedia library.
    depends_build-append    port:kde-extra-cmake-modules
    depends_lib-append      port:phonon-qt5
    configure.args-append   -DPHONON_BUILD_PHONON4QT5:BOOL=ON
    post-destroot {
        delete      ${destroot}${prefix}/share/icons
    }
}

if {${subport} ne "${name}-qt5"} {
    PortGroup       qt4 1.0
    PortGroup       cmake 1.0
    categories      audio kde kde4
    long_description    A GStreamer backend for the Phonon multimedia library.
    depends_lib-append  port:phonon port:automoc

    configure.args-append -DPhonon_DIR=${qt_cmake_module_dir}/phonon
    post-destroot {
        if {[file exists ${qt_plugins_dir}] && ![file exists ${qt_plugins_dir}/phonon_backend]} {
            xinstall -m 755 -d ${destroot}${qt_plugins_dir}
            ln -s ${prefix}/lib/kde4/plugins/phonon_backend ${destroot}${qt_plugins_dir}
        }
    }
}

livecheck.type	    regex
livecheck.url	    http://www.gtlib.gatech.edu/pub/kde/stable/phonon/${name}/
livecheck.regex     "\(\\d+(?:\\.\\d+)*)\/"