--- /opt/local/var/macports/sources/svn.macports.org/trunk/dports/kde/kde-extra-cmake-modules/Portfile	2015-09-23 19:31:02.000000000 +0200
+++ /opt/local/site-ports/kde/ECM/Portfile	2015-12-15 13:20:41.000000000 +0100
@@ -2,14 +2,34 @@
 # $Id: Portfile 138055 2015-06-27 01:03:30Z mk@macports.org $
 
 PortSystem          1.0
-PortGroup           cmake 1.0
-
+PortGroup           cmake   1.0
 cmake.out_of_source yes
 
 set ECM             extra-cmake-modules
 name                kde-${ECM}
-version             5.11.0
-set branch          [join [lrange [split ${version} .] 0 1] .]
+subport ${name}-devel {}
+
+set kf5.branch      5.17
+
+if {${subport} eq "${name}-devel"} {
+    # version v5.16.0-rc1-6-g55c5580 according to git describe, but 5.16.0 according to CMakeLists.txt
+    version         ${kf5.branch}.0.1
+    fetch.type      git
+    git.url         git://anongit.kde.org/extra-cmake-modules
+    git.branch      9911382614c46be19fd6ed3b163ebcf468bd5337
+    distname        ECM-5.1x.git
+} else {
+    version         ${kf5.branch}.0
+    set branch      [join [lrange [split ${version} .] 0 1] .]
+    master_sites    http://download.kde.org/stable/frameworks/${branch}/
+
+    distname        ${ECM}-${version}
+    use_xz          yes
+
+    checksums       rmd160  055d774f8ef552a30e9771ac12255ce64676a1ef \
+                    sha256  1a57fe0e07cca59e68bcbb4e06e07e62e335473173ce1e447bda399e47537405
+}
+
 supported_archs     noarch
 categories          kde kf5 devel
 license             GPL-2+
@@ -21,30 +41,32 @@
                     whatever reason, are not a good fit for CMake itself.
 platforms           darwin
 homepage            http://projects.kde.org/projects/kdesupport/${ECM}
-master_sites        http://download.kde.org/stable/frameworks/${branch}/
-
-distname            ${ECM}-${version}
-use_xz              yes
 
-checksums           rmd160  f5df1f931934433cce0496630d7eca5e9efbe69c \
-                    sha256  9ee39c08ca4a6066e9c7061b740ed8b1d5f289e6b19a568d1704585d883cb718
+patchfiles-append   patch-BUNDLEDIR.diff
 
+# # Apparently not used here, but these should be used when configuring KF5 packages:
+# configure.args-append \
+#                     -DCMAKE_DISABLE_FIND_PACKAGE_X11=ON \
+#                     -DAPPLE_SUPPRESS_X11_WARNING=ON \
+#                     -DCMAKE_INSTALL_LIBEXECDIR=${prefix}/libexec \
+#                     -DKDE_INSTALL_LIBEXECDIR=${prefix}/libexec/kde5
 
-variant qt4 description {Use qt4-mac to build the Qt documentation} {
+variant qt4 description {Use Qt4 to build the Qt documentation} {
     PortGroup               qt4 1.0
 }
-variant qt5 description {Use qt5-mac to build the Qt documentation} {
+variant qt5 description {Use Qt5 to build the Qt documentation} {
     PortGroup               qt5 1.0
 }
 variant docs description {Build documentation} {
-   if {![variant_isset qt4] && ![variant_isset qt5]} {
+    if {![variant_isset qt4] && ![variant_isset qt5]} {
         # user didn't request a Qt variant to use for building the documentation
-        if {[file exists ${prefix}/libexec/qt5/bin/qcollectiongenerator] || [file exists ${prefix}/libexec/qt5-mac/bin/qcollectiongenerator]} {
-            # qcollectiongenerator is installed and provided by a concurrent qt5-mac port
+        if {[file exists ${prefix}/libexec/qt5/bin/qcollectiongenerator] \
+            || [file exists ${prefix}/libexec/qt5-mac/bin/qcollectiongenerator]} {
+            # qcollectiongenerator is installed and provided by a concurrent qt5 port
             default_variants    +qt5
             PortGroup           qt5 1.0
         } elseif {[file exists ${prefix}/libexec/qt4/bin/qcollectiongenerator]} {
-            # qcollectiongenerator is installed and provided by a concurrent qt4-mac port
+            # qcollectiongenerator is installed and provided by a concurrent qt4 port
             default_variants    +qt4
             PortGroup           qt4 1.0
         } else {
@@ -55,13 +77,14 @@
             PortGroup           qt4 1.0
         }
     }
-    depends_build-append    port:py-sphinx
     patchfiles-append       patch-doc-building.diff
+    depends_build-append    port:py-sphinx
     configure.args-append   -DBUILD_HTML_DOCS:BOOL=OFF -DBUILD_QTHELP_DOCS:BOOL=ON
     pre-destroot {
         system -W ${build.dir}/docs "${qt_bins_dir}/qcollectiongenerator qthelp/ExtraCMakeModules.qhcp"
     }
 }
 
-livecheck.type      none
-
+livecheck.type      regex
+livecheck.url       http://download.kde.org/stable/frameworks/${kf5.branch}
+livecheck.regex     (5+(\\.\\d+)+)
