--- /opt/local/var/macports/sources/svn.macports.org/trunk/dports/audio/phonon-backend-gstreamer/Portfile	2015-11-11 22:29:55.000000000 +0100
+++ Portfile	2015-11-11 22:31:06.000000000 +0100
@@ -2,36 +2,60 @@
 # $Id:
 
 PortSystem          1.0
-PortGroup           qt4 1.0
-PortGroup           cmake 1.0
 
 name                phonon-backend-gstreamer
 version             4.8.2
 revision            2
-categories          audio kde kde4
 license             {LGPL-2.1 LGPL-3}
 maintainers         michaelld openmaintainer
 description         GStreamer backend for Phonon
-long_description    A GStreamer backend for the Phonon multimedia library.
 platforms           darwin
 homepage            http://phonon.kde.org
 master_sites        kde:stable/phonon/${name}/${version}/src
 use_xz              yes
 distname            phonon-backend-gstreamer-${version}
+#checksums           rmd160 b85b2a248795d72087a9d50479f26f3a59b73e29 \
+#                    sha256 f819cbd6296e1e19579e365902f7930ec8571e8cbb08718484091a795f70587e
 checksums           rmd160 9c0ec7ef27e925c207e769edc225b1d7202c7e37 \
                     sha256 20e0f71f2beb4f859db8385079a13aef5473863ee6f27aad7b065aa7bfe931e0
 
-depends_lib-append  port:phonon port:gstreamer1-gst-plugins-base
+depends_lib-append  port:gstreamer1-gst-plugins-good
 
-depends_build-append port:automoc
+subport qt5-${name} {
+    replaced_by     ${name}-qt5
+    PortGroup       obsolete 1.0
+}
+
+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_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}
+        }
+    }
+}
 
-# do VPATH (out of source tree) build
-
-cmake.out_of_source yes
-
-configure.args-append -DPhonon_DIR=${cmake_share_module_dir}/phonon
-
-patchfiles          phononBGSTr-avoid-x11renderer.patch
+patchfiles-append   phononBGSTr-avoid-x11renderer.patch
 
 livecheck.type		regex
 livecheck.url		http://www.gtlib.gatech.edu/pub/kde/stable/phonon/${name}/
