diff --git a/_resources/port1.0/group/kde4-1.1.tcl b/_resources/port1.0/group/kde4-1.1.tcl
index ab51fc8..f3e9409 100644
--- a/_resources/port1.0/group/kde4-1.1.tcl
+++ b/_resources/port1.0/group/kde4-1.1.tcl
@@ -125,11 +125,12 @@ configure.args-append   -DDOCBOOKXSL_DIR=${prefix}/share/xsl/docbook-xsl \
                         -DPNG_INCLUDE_DIR=${prefix}/include \
                         -DPNG_PNG_INCLUDE_DIR=${prefix}/include \
                         -DPNG_LIBRARY=${prefix}/lib/libpng.dylib \
-                        -DQCA2_INCLUDE_DIR=${prefix}/include/QtCrypto \
-                        -DQCA2_LIBRARIES=${prefix}/lib/libqca.dylib \
                         -DTIFF_INCLUDE_DIR=${prefix}/include \
                         -DTIFF_LIBRARY=${prefix}/lib/libtiff.dylib
 
+#                        -DQCA2_INCLUDE_DIR=${prefix}/include/QtCrypto \
+#                        -DQCA2_LIBRARIES=${prefix}/lib/libqca.dylib \
+
 # standard variant for building documentation
 variant docs description "Build documentation" {
     depends_lib-append      port:doxygen
diff --git a/_resources/port1.0/group/qt4-1.0.tcl b/_resources/port1.0/group/qt4-1.0.tcl
index baea318..9bcffc9 100644
--- a/_resources/port1.0/group/qt4-1.0.tcl
+++ b/_resources/port1.0/group/qt4-1.0.tcl
@@ -51,94 +51,131 @@ Qt4 must also be installed with +debug.\n"
     }
 }
 
+if {[info exists name] && ${subport} ne "${name}-transitional"} {
+    # exclusive mode doesn't make sense for the transitional subport ...
+    variant exclusive description {Builds and installs Qt4-mac the older way, such that other Qt versions can NOT be installed alongside it} {}
+}
+
 # standard Qt4 name
 global qt_name
 set qt_name             qt4
 
 # standard install directory
-global qt_dir
-set qt_dir              ${prefix}/libexec/${qt_name}
-
+    global qt_dir
+    global qt_dir_rel
 # standard Qt documents directory
-global qt_docs_dir
-set qt_docs_dir         ${prefix}/share/doc/${qt_name}
-
+    global qt_docs_dir
 # standard Qt plugins directory
-global qt_plugins_dir
-set qt_plugins_dir      ${prefix}/share/${qt_name}/plugins
-
+    global qt_plugins_dir
 # standard Qt mkspecs directory
-global qt_mkspecs_dir
-set qt_mkspecs_dir      ${prefix}/share/${qt_name}/mkspecs
-
+    global qt_mkspecs_dir
 # standard Qt imports directory
-global qt_imports_dir
-set qt_imports_dir      ${prefix}/share/${qt_name}/imports
-
+    global qt_imports_dir
 # standard Qt includes directory
-global qt_includes_dir
-set qt_includes_dir     ${prefix}/include/${qt_name}
-
+    global qt_includes_dir
 # standard Qt libraries directory
-global qt_libs_dir
-set qt_libs_dir         ${qt_dir}/lib
-
+    global qt_libs_dir
 # standard Qt libraries directory
-global qt_frameworks_dir
-set qt_frameworks_dir   ${qt_dir}/Library/Frameworks
-
+    global qt_frameworks_dir
+    global qt_frameworks_dir_rel
 # standard Qt non-.app executables directory
-global qt_bins_dir
-set qt_bins_dir         ${qt_dir}/bin
-
-# standard Qt .app executables directory, if created
-global qt_apps_dir
-set qt_apps_dir         ${applications_dir}/Qt4
-
+    global qt_bins_dir
 # standard Qt data directory
-global qt_data_dir
-set qt_data_dir         ${prefix}/share/${qt_name}
-
+    global qt_data_dir
 # standard Qt translations directory
-global qt_translations_dir
-set qt_translations_dir ${prefix}/share/${qt_name}/translations
-
+    global qt_translations_dir
 # standard Qt sysconf directory
-global qt_sysconf_dir
-set qt_sysconf_dir      ${prefix}/etc/${qt_name}
-
+    global qt_sysconf_dir
 # standard Qt examples directory
-global qt_examples_dir
-set qt_examples_dir     ${prefix}/share/${qt_name}/examples
-
+    global qt_examples_dir
 # standard Qt demos directory
-global qt_demos_dir
-set qt_demos_dir        ${prefix}/share/${qt_name}/demos
-
+    global qt_demos_dir
 # standard CMake module directory for Qt-related files
-global qt_cmake_module_dir
-set qt_cmake_module_dir ${qt_libs_dir}/cmake
-
+    global qt_cmake_module_dir
 # standard qmake command location
-global qt_qmake_cmd
-set qt_qmake_cmd        ${qt_dir}/bin/qmake
+    global qt_qmake_cmd
+# standard moc command location
+    global qt_moc_cmd
+# standard uic command location
+    global qt_uic_cmd
+# standard lrelease command location
+    global qt_lrelease_cmd
+
+global qt4_is_concurrent
+if {![variant_isset exclusive]} {
+    if {![info exists building_qt4] || ![info exists name] || ${name} ne "qt4-mac" || ${subport} eq "${name}-transitional"} {
+        #exec ls -l ${prefix}/libexec/${qt_name}/bin/qmake
+        if {[file exists ${prefix}/libexec/${qt_name}/bin/qmake]} {
+            # we have a "concurrent" install, which means we must look for the various components
+            # in different locations (esp. qmake)
+            set qt4_is_concurrent   1
+            set auto_concurrent 1
+        }
+    } else {
+        if {![info exists qt4_is_concurrent]} {
+            ui_msg "NB:\nQt4 has been or will be installed in concurrent mode\n"
+        }
+        # we're asking for the standard concurrent install. No need to guess anything, give the user what s/he wants
+        set qt4_is_concurrent   1
+        set auto_concurrent     1
+    }
+}
+
+if {[info exists qt4_is_concurrent]} {
+    set qt_dir              ${prefix}/libexec/${qt_name}
+    set qt_dir_rel          libexec/${qt_name}
+    set qt_docs_dir         ${prefix}/share/doc/${qt_name}
+    set qt_plugins_dir      ${prefix}/share/${qt_name}/plugins
+    set qt_mkspecs_dir      ${prefix}/share/${qt_name}/mkspecs
+    set qt_imports_dir      ${prefix}/share/${qt_name}/imports
+    set qt_includes_dir     ${prefix}/include/${qt_name}
+    set qt_libs_dir         ${qt_dir}/lib
+    set qt_frameworks_dir   ${qt_dir}/Library/Frameworks
+    set qt_bins_dir         ${qt_dir}/bin
+    set qt_data_dir         ${prefix}/share/${qt_name}
+    set qt_translations_dir ${prefix}/share/${qt_name}/translations
+    set qt_sysconf_dir      ${prefix}/etc/${qt_name}
+    set qt_examples_dir     ${prefix}/share/${qt_name}/examples
+    set qt_demos_dir        ${prefix}/share/${qt_name}/demos
+    # no need to change the cmake_module_dir, though I'd have preferred to
+    # put it into ${prefix}/lib/cmake as qt5-mac also does, and which is the place Linux uses
+    set qt_cmake_module_dir ${prefix}/share/cmake/Modules
+    set qt_qmake_cmd        ${qt_dir}/bin/qmake
+    set qt_moc_cmd          ${qt_dir}/bin/moc
+    set qt_uic_cmd          ${qt_dir}/bin/uic
+    set qt_lrelease_cmd     ${qt_dir}/bin/lrelease
+} else {
+    set qt_dir              ${prefix}
+    set qt_dir_rel          ""
+    set qt_docs_dir         ${qt_dir}/share/doc/${qt_name}
+    set qt_plugins_dir      ${qt_dir}/share/${qt_name}/plugins
+    set qt_mkspecs_dir      ${qt_dir}/share/${qt_name}/mkspecs
+    set qt_imports_dir      ${qt_dir}/share/${qt_name}/imports
+    set qt_includes_dir     ${qt_dir}/include
+    set qt_libs_dir         ${qt_dir}/lib
+    set qt_frameworks_dir   ${qt_dir}/Library/Frameworks
+    set qt_bins_dir         ${qt_dir}/bin
+    set qt_data_dir         ${qt_dir}/share/${qt_name}
+    set qt_translations_dir ${qt_dir}/share/${qt_name}/translations
+    set qt_sysconf_dir      ${qt_dir}/etc/${qt_name}
+    set qt_examples_dir     ${qt_dir}/share/${qt_name}/examples
+    set qt_demos_dir        ${qt_dir}/share/${qt_name}/demos
+    set qt_cmake_module_dir ${qt_dir}/share/cmake/Modules
+    set qt_qmake_cmd        ${qt_dir}/bin/qmake
+    set qt_moc_cmd          ${qt_dir}/bin/moc
+    set qt_uic_cmd          ${qt_dir}/bin/uic
+    set qt_lrelease_cmd     ${qt_dir}/bin/lrelease
+}
+set qt_frameworks_dir_rel   ${qt_dir_rel}/Library/Frameworks
+
+# standard Qt .app executables directory, if created
+global qt_apps_dir
+set qt_apps_dir         ${applications_dir}/Qt4
 
 # standard qmake spec
 global qt_qmake_spec
 set qt_qmake_spec       macx-g++
 
-# standard moc command location
-global qt_moc_cmd
-set qt_moc_cmd          ${qt_dir}/bin/moc
-
-# standard uic command location
-global qt_uic_cmd
-set qt_uic_cmd          ${qt_dir}/bin/uic
-
-# standard lrelease command location
-global qt_lrelease_cmd
-set qt_lrelease_cmd     ${qt_dir}/bin/lrelease
-
 # standard PKGCONFIG path
 global qt_pkg_config_dir
 set qt_pkg_config_dir   ${prefix}/lib/pkgconfig
@@ -163,10 +200,18 @@ if {![info exists building_qt4]} {
         # see if the framework install exists, and if so depend on it;
         # if not, depend on the library version
 
-        if {[file exists ${qt_frameworks_dir}/QtCore/QtCore]} {
-            depends_lib-append path:Library/Frameworks/QtCore/QtCore:qt4-mac
+        if {[info exists qt4_is_concurrent]} {
+            if {[file exists ${qt_frameworks_dir}/QtCore/QtCore]} {
+                depends_lib-append path:libexec/${qt_name}/Library/Frameworks/QtCore/QtCore:qt4-mac
+            } else {
+                depends_lib-append path:libexec/${qt_name}/lib/libQtCore.4.dylib:qt4-mac
+            }
         } else {
-            depends_lib-append path:lib/libQtCore.4.dylib:qt4-mac
+            if {[file exists ${qt_frameworks_dir}/QtCore/QtCore]} {
+                depends_lib-append path:Library/Frameworks/QtCore/QtCore:qt4-mac
+            } else {
+                depends_lib-append path:lib/libQtCore.4.dylib:qt4-mac
+            }
         }
 
     } else {
diff --git a/aqua/qt4-mac/Portfile b/aqua/qt4-mac/Portfile
index 3c680f8..1161a4f 100644
--- a/aqua/qt4-mac/Portfile
+++ b/aqua/qt4-mac/Portfile
@@ -3,1065 +3,20 @@
 
 PortSystem          1.0
 
-# use the qt4 group; set 'building_qt4' so that the portgroup
-# does not include certain parts
-set building_qt4    1
-PortGroup           qt4 1.0
-PortGroup           xcodeversion 1.0
-PortGroup           compiler_blacklist_versions 1.0
-
 name                qt4-mac
-# qt4-mac-devel is "replaced_by" this port,
-# so this port cannot conflict with it.
-#conflicts           qt3 qt3-mac qt4-mac-devel
-conflicts           qt3 qt3-mac qt5-mac
-version             4.8.6 
-set branch          [join [lrange [split ${version} .] 0 1] .]
-
-categories          aqua
-platforms           macosx
-maintainers         michaelld openmaintainer
-license             {LGPL-2.1 GPL-3}
-
-homepage            http://qt-project.org
-description         Qt Tool Kit
-long_description    Qt Tool Kit: A cross-platform framework \
-                    (headers, data, and libraries) for writing \
-                    cross-platform GUI-based applications.
-
-distname            qt-everywhere-opensource-src-${version}
-
-master_sites        http://download.qt-project.org/official_releases/qt/${branch}/${version}/
-
-checksums           rmd160  0220d4e76ac761c9ecfb8ddab6f2c1dc6ad70c33 \
-                    sha256  8b14dd91b52862e09b8e6a963507b74bc2580787d171feda197badfa7034032c
-
-minimum_xcodeversions   {8 2.5}
-
-depends_lib-append  port:zlib path:bin/dbus-daemon:dbus \
-                    port:openssl port:tiff \
-                    port:libpng port:libmng port:jpeg
-
-# find a way to specify the OS MINOR version.  For OSX 10.X, this
-# value will be X.  The type is this variable is integer, so we can
-# use "==" and so forth for comparison.
-
-global MINOR
-set MINOR ""
-
-# hopefully the MACOSX_DEPLOYMENT_TARGET exists and is set by now.  if
-# not, last resort (which is not desirable) is to use the os.version.
+version             4.8.6
+revision            3
 
-if {${macosx_deployment_target} ne ""} {
-    set MINOR [lindex [split ${macosx_deployment_target} "."] 1]
-} else {
-    set MINOR [expr [lindex [split ${os.version} "."] 0] - 4]
+if {[catch {source "${portpath}/Portfile.qt4"} err]} {
+    puts stderr "Error reading Portfile.qt4: $err"
+    return 1; 
 }
 
-###############################################
-# Patches are used to both fix compiling on various OS versions, and
-# to enhance the functionality of QMake and its build files.  Some of
-# these patches are 2-stage: use a file here, and the replace an
-# @VARIABLE@ in post-patch.  There are LOTS of patches, because Qt is
-# a large, complicated system.
-
-# (0) Fix the testing script to properly handle both +universal as
-# well as the native arch for both CXX and CC compiling; also make
-# sure it does not create a Mac app bundle.
-
-patchfiles-append   patch-config.tests_unix_compile.test.diff
-
-# (1) Test for Precompiled-headers support (a) requires a C++
-# compiler, but configure calls it, by default, with a C compiler;
-# thus, enable testing using the C compiler. (b) to work with ccache,
-# if used.
-
-patchfiles-append   patch-config.tests_unix_precomp.test.diff
-
-# (2) fix 'configure' script: (a) to allow easy replacement of arch
-# type(s). (b) to find the correct QMAKE CXX compiler by removing
-# possibilities that include the character "$". (c) to declare, use,
-# and set QT_INSTALL_FRAMEWORKS and QMAKE_FRAMEWORKDIR_QT, both here
-# and in the resulting .qmake.cache files. (d) to allow easy
-# replacement of MACOSX_DEPLOYMENT_TARGET: build for just the user's
-# current OS. (e) add hooks for C++11 testing.
-
-patchfiles-append   patch-configure.diff
-
-# (3) (a) Tweak various scripts to allow easy replacement of
-# MACOSX_DEPLOYMENT_TARGET: build for just the user's current OS.
-# (b) Assign initial OBJECTIVE_CXXFLAGS.
-
-patchfiles-append   patch-mkspecs_common_g++-macx.conf.diff
-
-# (4) (a) Allow easy replacement of MACOSX_DEPLOYMENT_TARGET: build
-# for just the user's current OS; (b) allow QMake to use 'ccache' via,
-# e.g., "qmake && make CCACHE=ccache".
-
-patchfiles-append   patch-mkspecs_common_mac.conf.diff
-
-# (5) Place the -I path for local moc-created headers -before-
-# all other -I paths.
-
-patchfiles-append   patch-mkspecs_features_moc.prf.diff
-
-# (6) Remove Qt's LIBDIR and INCDIR from various QMake internal
-# variables, since they are already included in the user-supplied
-# LIBS and INCLUDEPATH.
-
-patchfiles-append   patch-mkspecs_features_qt.prf.diff
-
-# (7) (a) Change placement of Qt's LIBDIR and INCDIR, to always be
-# after those supplied by the user's QMake (.pro) files.  By the time
-# QMake gets to the patched function, it is creating the Makefile
-# parts to find Qt's headers and libraries, so moving these paths to
-# this location should always work. (b) If the library is QtWebKit,
-# and the build is library (no-framework), universal, and debug, then
-# the linkage is just -lQtWebKit, not -lQtWebKit_debug because the
-# debug library for 32-bit system cannot be created (too large).
-
-patchfiles-append   patch-mkspecs_features_qt_functions.prf.diff
-
-# (8) (a) Change "gcc" and "g++" to @'s for replacement in
-# post-patch; (b) add hooks for C++11.
-
-patchfiles-append   patch-mkspecs_common_g++-base.conf.diff
-
-# (9) Add default QMake variables for Objective C++.
-
-patchfiles-append   patch-mkspecs_objective_cxx.diff
-
-# (10) Add "absolute_library_soname" to the default CONFIG variables,
-# so that when a DYLIB is created, if "target.path" is set for it then
-# that path is prepended to its "install_name".
-
-patchfiles-append   patch-mkspecs_macx-g++_qmake.conf.diff
-
-# (11) Add QT_INSTALL_FRAMEWORKS and related variables to QMake, to
-# provide a default variable for the location of QMake installed
-# frameworks.
-
-patchfiles-append   \
-    patch-qmake_option.h.diff \
-    patch-qmake_property.cpp.diff \
-    patch-src_corelib_global_qlibraryinfo.cpp.diff \
-    patch-src_corelib_global_qlibraryinfo.h.diff
-
-# (12) In QMake, disable default MKSPECS and FEATURES path
-# concatinations if the shell environment variable QMAKE_NO_DEFAULTS
-# is set (to anything); we use this variable in this portfile to make
-# sure only internal paths (to the build) are searched by QMake.
-
-patchfiles-append   patch-qmake_project.cpp.diff
-
-# (13) In QMake: (a) enable correct "-framework foo,bar" parsing as
-# specified by Apple's LD; (b) disable "/Library/Frameworks" as a
-# default search path; use "PREFIX/Library/Frameworks" and replace
-# PREFIX in post-patch.  Also set "PREFIX/lib" as a default library
-# search path.
-
-patchfiles-append   patch-qmake_generators_unix_unixmakke.cpp.diff
-
-# (14) Allow easy replacement of MACOSX_DEPLOYMENT_TARGET: build for
-# just the user's current OS.
-
-patchfiles-append   \
-    patch-qmake_qmake.pri.diff \
-    patch-src_tools_bootstrap_bootstrap.pro.diff
-
-# (15) fix use of CARBON, found on PPC64; does not hurt others
-
-patchfiles-append   \
-    patch-src_3rdparty_webkit_Source_WebCore_plugins_PluginView.h.diff \
-    patch-src_3rdparty_webkit_Source_WebCore_plugins_mac_PluginViewMac.mm.diff
-
-# (16) fix the corewlan qmake file to use non-standard Developer SDK
-# location under 10.6 and newer, e.g., for some developers doing both
-# iOS and OSX.  This patch does not change behavior for 10.4 or 10.5.
-# Also include fix to use the correct SDK.
-
-patchfiles-append   patch-src_plugins_bearer_corewlan_corewlan.pro.diff
-
-# (17) Use the "target.path" for libdir for core libraries instead of
-# the standard QT_INSTALL_LIBS; allows us to set for library or
-# framework elsewhere and have the install still work here.
-
-patchfiles-append   patch-src_qbase.pri.diff
-
-# (18) (a) Disable explicit disabling of framework or static install;
-# i.e., install as a framework if that mode is selected, and as
-# library otherwise. (b) If installing as framework, use the new
-# QT_INSTALL_FRAMEWORKS directory; otherwise, use the old
-# QT_INSTALL_LIBS; (c) Get PKGCONFIG dependencies correct, hopefully;
-# (d) create and install .pc, .la, and .prl library description files,
-# including basic path replacement into DESTDIR; we couple this with a
-# post-patch to get the correct install location.
-
-patchfiles-append   \
-    patch-src_qt_install.pri.diff \
-    patch-tools_assistant_lib_fulltextsearch_fulltextsearch.pro.diff \
-    patch-tools_assistant_lib_lib.pro.diff \
-    patch-tools_designer_src_components_lib_lib.pro.diff \
-    patch-tools_designer_src_lib_lib.pro.diff \
-    patch-tools_designer_src_uitools_uitools.pro.diff \
-    patch-mkspecs_features_uitools.prf.diff
-
-# (19) fix 'macdeployqt' to look for the correct plugins location by
-# default.  This is paired with a "reinplace" in post-patch
-
-patchfiles-append   \
-    patch-tools_macdeployqt_macdeployqt_main.cpp.diff
-
-# (20) Under 10.4 only: patch QMake build files using just "-lQtHelp"
-# to do "-lQtHelp -lQtCLucene -lQtNetwork -lQtWebKit" instead.  For
-# some reason 10.5+ "knows" that how to do this correctly.
-
-platform darwin {
-    if {${MINOR} == 4} {
-        patchfiles-append patch-QtHelp_10.4_only.diff
+subport ${name}-transitional {
+	conflicts           qt3 qt3-mac
+    if {[file exists ${prefix}/Library/Frameworks/QtCore.framework/Versions/5/QtCore]} {
+        conflicts       qt5-mac
     }
+    universal_variant   no
+    depends_lib         port:qt4-mac
 }
-
-# (21) fix the Mac timer's use of "mach_timebase_info"
-
-patchfiles-append   \
-    patch-src_corelib_tools_qelapsedtimer-mac.cpp.diff
-
-# (22) Under 10.8 and 10.9: Patch to fix corelib linking
-
-platform darwin {
-    if {${MINOR} >= 8} {
-        patchfiles-append patch-src_corelib_corelib.pro.diff
-    }
-}
-
-# (23) fix Framework directory in MacDeployQt tool
-
-patchfiles-append   \
-    patch-tools_macdeployqt_shared_shared.cpp.diff
-
-# (24) minimum patches required for 10.10; squashed; temporary until 4.8.7.
-
-patchfiles-append   \
-    patch-10.10.diff
-
-# error out if trying to build on a new OSX version (> 10.10).
-
-platform darwin {
-    if {${MINOR} > 10} {
-        # This project needs to be updated to build with clang++ against libc++
-        depends_lib
-        depends_run
-        pre-fetch {
-            ui_error "$name does not currently build on OSX later than 10.10 'Yosemite'."
-            error "unsupported platform"
-        }
-    }
-}
-
-###############################################
-
-# disable CCACHE for now (ticket #34856)
-
-configure.ccache no
-
-# find a way to specify the SDK to use; Qt will use the 10.4u by
-# default which won't work on 10.6 since it is not supported.  Allow
-# the user to specify the SDK if desired.
-
-global SDK
-set SDK ${configure.sdkroot}
-if {${SDK} eq ""} {
-    # set SDK version depending on OS version
-    set sdk_version ""
-    if {${MINOR} == 4} {
-        # OSX 10.4 requires an additional 'u'
-        set sdk_version "10.4u"
-    } else {
-        set sdk_version "10.${MINOR}"
-    }
-    if {[vercmp ${xcodeversion} 4.3] < 0} {
-        set SDK ${developer_dir}/SDKs/MacOSX${sdk_version}.sdk
-    } else {
-        set SDK ${developer_dir}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${sdk_version}.sdk
-    }
-}
-
-post-patch {
-    # set ARCHES in configure (per the third patchfile above), for
-    # building QMake.  join any 2 or more arch entries with the GCC
-    # arch flag (join does not effect a single entry).  first "-arch"
-    # is already in place in the 'configure' script (since there has
-    # to be at least 1 arch).
-
-    set ARCHES ""
-    if {[variant_exists universal] && [variant_isset universal]} {
-        set ARCHES [join ${universal_archs} " -arch "]
-    } else {
-        set ARCHES ${build_arch}
-    }
-    reinplace "s|@ARCHES@|${ARCHES}|g" ${worksrcpath}/configure
-
-    # set MACOSX_DEPLOYMENT_TARGET version in various places.  These
-    # were all patched in (2) above, and can be easily changed or
-    # overridden by the user in a project-local qmake .pro script.
-
-    set TARGET "10.${MINOR}"
-    foreach fixfile {configure mkspecs/common/g++-macx.conf \
-                     mkspecs/common/mac.conf qmake/qmake.pri \
-                     src/tools/bootstrap/bootstrap.pro } {
-        reinplace "s|@MACOSX_DEPLOYMENT_TARGET@|${TARGET}|g" \
-            ${worksrcpath}/${fixfile}
-    }
-
-    # Fix OS version on Bearer CoreWLAN QMake file
-
-    reinplace "s|@MACOSX_VERSION_MINOR@|${MINOR}|g" \
-        ${worksrcpath}/src/plugins/bearer/corewlan/corewlan.pro
-
-    # Ensure that correct C/C++ compilers are used.
-
-    reinplace "s|@CXX@|${configure.cxx}|" \
-        ${worksrcpath}/mkspecs/common/g++-base.conf
-    reinplace "s|@CC@|${configure.cc}|"  \
-        ${worksrcpath}/mkspecs/common/g++-base.conf
-
-    # fix the corewlan .pro file to use the correct developer SDK
-
-    reinplace "s,@DEVELOPER_SDK@,${SDK},g" \
-        ${worksrcpath}/src/plugins/bearer/corewlan/corewlan.pro
-
-    # fix 'macdeployqt' to look for the correct
-    # plugins location by default.
-
-    reinplace "s,@QT_PLUGINS_DIR@,${qt_plugins_dir},g" \
-        ${worksrcpath}/tools/macdeployqt/macdeployqt/main.cpp
-
-    # fix PREFIX in QMake makefile generator
-
-    reinplace "s,@PREFIX@,${qt_dir},g" \
-        ${worksrcpath}/qmake/generators/unix/unixmake.cpp
-
-    # if no debug, then do not even build debug code
-
-    if {![variant_isset debug]} {
-        foreach fixfile { src/qbase.pri \
-                          src/3rdparty/webkit/Source/WebKit.pri \
-                          src/imports/qimportbase.pri \
-                          src/plugins/qpluginbase.pri \
-                          tools/designer/src/components/lib/lib.pro \
-                          tools/designer/src/lib/lib.pro \
-                          tools/designer/src/plugins/activeqt/activeqt.pro \
-                          tools/designer/src/plugins/plugins.pri \
-                          tools/designer/src/uitools/uitools.pro \
-                          src/3rdparty/webkit/Source/WebKit/qt/declarative/declarative.pro } {
-            reinplace "/+=/s@debug_and_release@@g" \
-                ${worksrcpath}/${fixfile}
-        }
-    }
-
-    # copy C++11 files into place, if that variant is set
-
-    if {[variant_isset cxx11]} {
-        copy ${filespath}/c++11.prf ${worksrcpath}/mkspecs/features
-        copy ${filespath}/c++11 ${worksrcpath}/config.tests/mac
-    }
-
-    # copy Objective C / CXX files into place
-
-    copy ${filespath}/objective_cxx.prf \
-        ${worksrcpath}/mkspecs/features/mac
-    copy ${filespath}/split_sources.prf \
-        ${worksrcpath}/mkspecs/features/mac
-
-    # copy extra compiler tests into place; these are patched into the
-    # configure script to the area before qmake is built.  If any
-    # fail, configure will fail quickly.
-
-    copy ${filespath}/fconstant_cfstrings.test \
-        ${worksrcpath}/config.tests/mac
-    copy ${filespath}/objc_block \
-        ${worksrcpath}/config.tests/mac
-    copy ${filespath}/cpath \
-        ${worksrcpath}/config.tests/mac
-    copy ${filespath}/library_path \
-        ${worksrcpath}/config.tests/mac
-}
-
-# Block various compilers:
-#
-# * The build process requires -Xarch, -fconstant-cfstring, and
-# Objective-C(++) blocks (^), which are not supported with vanilla GCC
-# as installed by MacPorts but are supported by all versions of CLANG
-# (both MacPorts' and Apple's).
-#
-# * Some older versions of CLANG do not honor the CPATH
-# environment variables, which is required for compiling
-# this port when using MacPorts.  The versions seem to be: MacPorts
-# CLANG 2.9 or earlier, and Apple CLANG 318.0.58 or older.
-#
-# * Some older versions of CLANG do not honor the LIBRARY_PATH
-# environment variables, which is required for compiling
-# this port when using MacPorts.  The versions seem to be: MacPorts
-# CLANG 3.0 or earlier, and Apple CLANG 318.0.61 or older.
-#
-# * qt4-creator-mac fails to build with GCC <= 4.0.
-#
-# See also:
-# < http://llvm.org/bugs/show_bug.cgi?id=8971 >,
-# < https://trac.macports.org/ticket/30271 >,
-# < https://trac.macports.org/ticket/31076 >,
-# < https://trac.macports.org/ticket/31638 >,
-# < https://trac.macports.org/ticket/37868 >, and
-# < https://trac.macports.org/ticket/40422 >.
-#
-# NOTE: qt4-mac augments the standard Qt4 configure script with
-# pre-qmake-build tests for CPATH, LIBRARY_PATH, -Xarch,
-# -fconstant-cfstring, Objective-C(++) blocks, and, if requested,
-# C++11.  The script will error out quickly if the compiler does not
-# seem to provide support for any one of these properties, no matter
-# this blacklist.
-#
-
-compiler.blacklist-append { clang <= 318.0.61 } \
-    gcc-3.3 *gcc-4.0 macports-gcc* \
-    macports-clang-2.9 macports-clang-3.0
-
-# --prefix is not recognized.
-configure.pre_args-delete       --prefix=${prefix}
-
-# --disable-dependency-tracking is not recognized.
-configure.universal_args-delete --disable-dependency-tracking
-
-# clear all arch-oriented flags since somehow they impact how qmake is
-# created, which in turn messes up LDFLAGS in most created Makefiles.
-
-configure.ld_archflags
-configure.cc_archflags
-configure.cxx_archflags
-configure.universal_ldflags
-configure.universal_cflags
-configure.universal_cxxflags
-configure.universal_cppflags
-configure.march
-configure.mtune
-
-# Use compiler.cpath and compiler.library_path for all -I and -L
-# entries, so-as to avoid conflicts with already-installed headers and
-# libraries (giving preference to internal-to-this-port first).  CPATH
-# is used instead of -I to avoid conflicts with other ports.
-#
-# See also:
-# < https://trac.macports.org/ticket/15219 >,
-# < https://trac.macports.org/ticket/18723 >, and
-# < https://trac.macports.org/ticket/25321 >.
-
-# set the default paths to include those for SQLITE3 and DBUS-1
-
-set header_path [ list ${prefix}/include/dbus-1.0 \
-                       ${prefix}/lib/dbus-1.0/include \
-                       ${prefix}/include ]
-
-set library_path [ list ${prefix}/lib ]
-
-# -dbus-linked prevends qt4 from trying to dynamically load libdbus-1,
-#     which it is not able to find in ${prefix}.
-#
-# -openssl-linked ensures that the MacPorts openssl is used.
-#
-# -framework ensures that this port is installed as frameworks
-#     (collections of {library, headers, resources}); in
-#     post-destroot, link headers and libraries from the frameworks
-#     into non-framework locations as if "-no-framework" were
-#     specified.  Some dependent projects will not work properly if Qt
-#     is installed as libraries by default, thus make it so #1.
-#
-# -no-phonon ensures that Qt does not install the 3rd-parth Phonon
-#     port or its backend to QuickTime 7; Phonon is now installed via
-#     the 'phonon' port, which is more up to date than that provided
-#     by Qt.
-
-configure.args                                            \
-    -v                                                    \
-    -confirm-license                                      \
-    -opensource                                           \
-    -prefix          ${qt_dir}                            \
-    -bindir          ${qt_bins_dir}                       \
-    -libdir          ${qt_libs_dir}                       \
-    -docdir          ${qt_docs_dir}                       \
-    -headerdir       ${qt_includes_dir}                   \
-    -plugindir       ${qt_plugins_dir}                    \
-    -importdir       ${qt_imports_dir}                    \
-    -datadir         ${qt_data_dir}                       \
-    -translationdir  ${qt_translations_dir}               \
-    -sysconfdir      ${qt_sysconf_dir}                    \
-    -examplesdir     ${qt_examples_dir}                   \
-    -demosdir        ${qt_demos_dir}                      \
-    -openssl-linked                                       \
-    -dbus-linked                                          \
-    -fast                                                 \
-    -optimized-qmake                                      \
-    -no-pch                                               \
-    -framework                                            \
-    -no-phonon                                            \
-    -no-phonon-backend
-
-# Stop configure script from searching for SQL Drivers
-#    not available from MacPorts.
-
-foreach driver {db2 ibase oci tds} {
-    configure.args-append -no-sql-${driver}
-}
-
-# Disable all remaining SQL Drivers.  These are available via the
-# ports qt4-mac-*-plugin.
-
-foreach driver {mysql odbc psql sqlite sqlite2} {
-    configure.args-append -no-sql-${driver}
-}
-
-pre-configure {
-
-    # use the corrected CPATH and LIBRARY_PATH for build
-
-    compiler.cpath [join ${header_path} :]
-    compiler.library_path [join ${library_path} :]
-
-    # for 10.4 or 10.5 32-bit PPC, build as Carbon only, not Cocoa
-
-    if {${MINOR} == 4} {
-
-        configure.args-append -carbon
-
-        # required linking flags?
-
-        configure.ldflags-append -lcrypto -ldbus-1 -ljpeg -llcms \
-            -lssl -lz
-
-    } elseif {${MINOR} == 5 &&
-              [llength ${qt_arch_types}] == 1 &&
-              [lsearch -exact ${qt_arch_types} ppc] == 0} {
-
-        configure.args-append -carbon
-
-    }
-
-    # set the arch type(s) to use, in Qt-speak
-
-    configure.args-append -arch \"${qt_arch_types}\"
-
-    # cannot use pre-compiled headers when compiling with more than 1
-    # arch type (typically +universal) or for X11
-
-    #if {[llength ${qt_arch_types}] != 1 || [variant_isset x11]}
-
-    # check to see if not compiling for the native machine hardware
-    # (e.g., compiling for just i386 but CPU is x86_64); optimization
-    # of QMake does not work in this circumstance.
-
-    if {[lsearch -exact ${qt_arch_types} ${os.arch}] == -1} {
-
-        # not building for native arch: disable optimizing qmake
-        configure.args-delete -optimized-qmake
-
-    } elseif {${MINOR} == 6 &&
-              [llength ${qt_arch_types}] == 1 &&
-              [lsearch -exact ${qt_arch_types} x86] == 0} {
-
-        # disable qmake optimization on 10.6 32-bit
-        configure.args-delete -optimized-qmake
-
-    }
-
-    # set the SDK, if it was found and exists
-
-    if {[file exists ${SDK}]} {
-        configure.args-append -sdk ${SDK}
-    }
-
-    # set which pkg-config to use
-
-    configure.env-append PKG_CONFIG=${prefix}/bin/pkg-config
-
-    # set which stdlib to use; clang only
-    if {[string match *clang* ${configure.compiler}]} {
-        configure.env-append QMAKE_STDLIB="-stdlib=${configure.cxx_stdlib}"
-        configure.ldflags-append -stdlib=${configure.cxx_stdlib}
-    }
-}
-
-post-configure {
-
-    # Remove any '-I' and '-L' string from the *FLAGS for SQLITE,
-    # DBUS, ODBC, and OPENSSL, so that what remains are just non-I/L
-    # flags; these paths are in compiler.cpath and
-    # compiler.library_path.  The header and library paths for all the
-    # other variants are not used by 'configure', and are already
-    # included in the compiler.cpath and compiler.library_path
-    # . during the 'build' stage, 'make' will rebuild the Makefiles
-    # that depend on any of these changed files.  These patches are
-    # sufficient to make sure local (to this build) paths are searched
-    # first, and then system paths last (via the compiler.X settings).
-    # Ideally, 'qmake' -- either via its mkspecs files or the
-    # project's build files -- would distinguish between "local" and
-    # "system" includes & libraries.
-
-    # SQLITE
-    reinplace "/SQLITE/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
-        ${worksrcpath}/.qmake.cache
-    reinplace "/SQLITE/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
-        ${worksrcpath}/.qmake.cache
-    # DBUS
-    reinplace "/DBUS/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
-        ${worksrcpath}/.qmake.cache
-    reinplace "/DBUS/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
-        ${worksrcpath}/.qmake.cache
-    # OPENSSL
-    reinplace "/OPENSSL/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
-        ${worksrcpath}/.qmake.cache
-    reinplace "/OPENSSL/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
-        ${worksrcpath}/.qmake.cache
-    # ODBC
-    reinplace "/ODBC/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
-        ${worksrcpath}/.qmake.cache
-    reinplace "/ODBC/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
-        ${worksrcpath}/.qmake.cache
-}
-
-pre-build {
-    # use the corrected CPATH and LIBRARY_PATH for build
-    compiler.cpath [join ${header_path} :]
-    compiler.library_path [join ${library_path} :]
-}
-
-# do not use DESTDIR directly in the destroot command; Qt uses DISTDIR
-# internally for other purposes, and instead uses INSTALL_ROOT for the
-# additional install root prefix.
-
-destroot.post_args
-
-post-destroot {
-
-    set destroot_qt ${destroot}${qt_dir}
-
-    # Fix .pc and .prl files by changing ${worksrcpath}\${prefix} to
-    # ${qt_dir}\${prefix} ("\" means 'take away').  Cannot use
-    # "find -E" since it is not necessarily portable.
-
-    regsub ${prefix} ${worksrcpath} "" from_dir
-    regsub ${prefix} ${qt_dir} "" to_dir
-    foreach fixfile [exec find ${destroot_qt} -name "*.pc"] {
-        reinplace "s|${from_dir}|${to_dir}|g" ${fixfile}
-    }
-    foreach fixfile [exec find ${destroot_qt} -name "*.prl"] {
-        reinplace "s|${from_dir}|${to_dir}|g" ${fixfile}
-    }
-
-    # fix .pc files
-
-    foreach fixfile [exec find ${destroot_qt} -name "*.pc"] {
-
-        # remove Libs.private; they can mess up linking
-
-        reinplace "/Libs\.private/d" ${fixfile}
-
-        # use ${prefix} correctly
-
-        reinplace "s|${prefix}/|\${prefix}/|g" ${fixfile}
-
-        # fix libdir
-
-        reinplace "/libdir=/s|Library/Frameworks|lib|" ${fixfile}
-
-        # fix Libs: to use -L instead of -F
-
-        reinplace "/Libs:/s|-F|-L|" ${fixfile}
-
-        # fix Libs: to use -lQt* instead of "-framework Qt*"
-        # depends on whether for release or debug
-
-        set fn [lindex [split ${fixfile} /] end]
-
-        if {[lsearch -regexp ${fn} debug] == 0} {
-
-            # debug; need to add that string to all Qt dependency libraries
-            reinplace "/Libs:/s|-framework Qt\\(\[^ \]*\\)|-lQt\\1_debug|" \
-                ${fixfile}
-
-        } else {
-
-            # no debug; just replace
-            reinplace "/Libs:/s|-framework Qt|-lQt|" ${fixfile}
-
-        }
-    }
-
-    # move .pc files from ${qt_frameworks_dir}/pkgconfig to
-    # ${qt_pkg_config_dir}
-
-    file delete -force ${destroot}${qt_pkg_config_dir}
-    xinstall -m 755 -d ${destroot}${qt_libs_dir}
-    move ${destroot}${qt_frameworks_dir}/pkgconfig \
-        ${destroot}${qt_libs_dir}
-
-    # move .la files from ${qt_frameworks_dir} to ${qt_libs_dir}
-
-    foreach laf [glob ${destroot}/${qt_frameworks_dir}/*.la] {
-        move ${laf} ${destroot}${qt_libs_dir}
-    }
-
-    # remove -L entries from .prl and .la files
-
-    foreach fixfile [exec find ${destroot_qt} -name "*.prl"] {
-        reinplace "/QMAKE_PRL_LIBS/s|-L\[^ \]*||g" ${fixfile}
-    }
-    foreach fixfile [exec find ${destroot_qt} -name "*.la"] {
-        reinplace "/dependency_libs/s|-L\[^ \]*||g" ${fixfile}
-    }
-
-    # remove redundant -F entries from .prl and .la files
-
-    foreach fixfile [exec find ${destroot_qt} -name "*.prl"] {
-        reinplace "/QMAKE_PRL_LIBS/s|-F\[^ \]*|FREPLACEME|1" \
-            ${fixfile}
-        reinplace "/QMAKE_PRL_LIBS/s|-F\[^ \]*||g" ${fixfile}
-        reinplace "s|FREPLACEME|-F${prefix}/Library/Frameworks|1" \
-            ${fixfile}
-    }
-    foreach fixfile [exec find ${destroot_qt} -name "*.la"] {
-        reinplace "/dependency_libs/s|-F\[^ \]*|FREPLACEME|1" \
-            ${fixfile}
-        reinplace "/dependency_libs/s|-F\[^ \]*||g" ${fixfile}
-        reinplace "s|FREPLACEME|-F${prefix}/Library/Frameworks|1" \
-            ${fixfile}
-    }
-
-    # get Qt's version numbers
-
-    set qt_vers [split ${version} "."]
-    set qt_major [lindex ${qt_vers} 0]
-    set qt_minor [lindex ${qt_vers} 1]
-    set qt_patch [lindex ${qt_vers} 2]
-
-    # link includes and libraries for each actual installed framework
-
-    foreach fixfile [exec find ${destroot}${qt_frameworks_dir} \
-                         -name "*.framework" | \
-                         sed -e "s@${destroot}@@g"] {
-
-        set tf_full [strsed ${fixfile} {s@\\.framework@@}]
-        set tf [strsed ${tf_full} {g@.*\/@@}]
-
-        # special for QtWebKit entries
-
-        set t_minor ${qt_minor}
-        set is_QtWebKit 0
-        if {[string compare ${tf} QtWebKit] == 0} {
-            set t_minor 9
-            set is_QtWebKit 1
-        }
-
-        # link headers into ${qt_includes_dir}, removing directories
-        # if they are already there first
-
-        set inc_file ${destroot}${qt_includes_dir}/${tf}
-        if {[file exists ${inc_file}]} {
-            file delete -force ${inc_file}
-        }
-        ln -s ${tf_full}.framework/Headers ${inc_file}
-
-        # link libraries into ${qt_libs_dir}, all 4 number variants
-
-        set dr_qt_libs_dir ${destroot}${qt_libs_dir}
-
-        ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.dylib
-        ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.dylib
-        ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.dylib
-        ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.${qt_patch}.dylib
-
-        # copy .prl file, then correct it for library usage
-
-        copy ${destroot}${tf_full}.framework/${tf}.prl ${dr_qt_libs_dir}/lib${tf}.prl
-
-        # fix TARGET in .prl file
-
-        reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}.prl
-
-        # fix PRL_LIBS -F -> -L in .prl file
-
-        reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}.prl
-
-        # fix "-framework Qt*" -> "-lQt*" in .prl file
-
-        reinplace "/QMAKE_PRL_LIBS/s|-framework Qt|-lQt|g" \
-            ${dr_qt_libs_dir}/lib${tf}.prl
-
-        # fix up .la files to work with ${prefix}/lib entries
-
-        # rename .la file
-
-        move ${dr_qt_libs_dir}/${tf}.la ${dr_qt_libs_dir}/lib${tf}.la
-
-        # fix "name that we can dlopen" in .la file
-
-        reinplace "s|dlname=''|dlname='lib${tf}.${qt_major}.${t_minor}.${qt_patch}.dylib'|" ${dr_qt_libs_dir}/lib${tf}.la
-
-        # fix "names of this library" in .la file
-
-        reinplace "s|library_names='\[^'\]*'|library_names='lib${tf}.${qt_major}.${t_minor}.${qt_patch}.dylib lib${tf}.${qt_major}.${t_minor}.dylib lib${tf}.${qt_major}.dylib lib${tf}.dylib'|" \
-            ${dr_qt_libs_dir}/lib${tf}.la
-
-        # fix "name of the static archive"; there is none in .la file
-
-        reinplace "s|old_library='\[^'\]*'|old_library=''|" \
-            ${dr_qt_libs_dir}/lib${tf}.la
-
-        # fix "libraries that this one depends upon" in .la file
-
-        reinplace "/dependency_libs/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|"  ${dr_qt_libs_dir}/lib${tf}.la
-        reinplace "/dependency_libs/s|-framework Qt|-lQt|g" \
-            ${dr_qt_libs_dir}/lib${tf}.la
-        reinplace "/dependency_libs/s| ${worksrcpath}\[^ \]*||g" \
-            ${dr_qt_libs_dir}/lib${tf}.la
-        reinplace "/dependency_libs/s| -lwebcore||" \
-            ${dr_qt_libs_dir}/lib${tf}.la
-        reinplace "/dependency_libs/s| -ljscore||" \
-            ${dr_qt_libs_dir}/lib${tf}.la
-
-        # fix "directory that this library needs to be installed in" in .la file
-
-        reinplace "/libdir/s|${qt_frameworks_dir}|${qt_libs_dir}|" \
-            ${dr_qt_libs_dir}/lib${tf}.la
-
-        # deal with debug files
-
-        if {[variant_isset debug]} {
-
-            # but not if QtWebKit and +universal, since that one does
-            # not exist (the 32-bit version of the debug library is
-            # larger than fits into the 32-bit filespace).
-
-            if {[variant_isset debug] && ${is_QtWebKit}} {
-                continue
-            }
-
-            # link libraries into ${qt_libs_dir}, all 4 number variants
-
-            ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.dylib
-            ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.dylib
-            ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.dylib
-            ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.${qt_patch}.dylib
-
-            # copy .prl file, then correct it for library usage
-
-            copy ${destroot}${tf_full}.framework/${tf}_debug.prl ${dr_qt_libs_dir}/lib${tf}_debug.prl
-
-            # fix TARGET in .prl file
-
-            reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}_debug.prl
-
-            # fix PRL_LIBS -F -> -L in .prl file
-
-            reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}_debug.prl
-
-            # fix "-framework Qt*" -> "-lQt*_debug" in .prl file
-
-            reinplace "/QMAKE_PRL_LIBS/s|-framework Qt\\(\[^ \]*\\)|-lQt\\1_debug|g" ${dr_qt_libs_dir}/lib${tf}_debug.prl
-
-            # fix up .la files to work with ${prefix}/lib entries
-
-            # rename .la file
-
-            move ${dr_qt_libs_dir}/${tf}_debug.la \
-                ${dr_qt_libs_dir}/lib${tf}_debug.la
-
-            # fix "name that we can dlopen" in .la file
-
-            reinplace "s|dlname=''|dlname='lib${tf}_debug.${qt_major}.${t_minor}.${qt_patch}.dylib'|" ${dr_qt_libs_dir}/lib${tf}_debug.la
-
-            # fix "names of this library" in .la file
-
-            reinplace "s|library_names='\[^'\]*'|library_names='lib${tf}_debug.${qt_major}.${t_minor}.${qt_patch}.dylib lib${tf}_debug.${qt_major}.${t_minor}.dylib lib${tf}_debug.${qt_major}.dylib lib${tf}_debug.dylib'|" \
-                ${dr_qt_libs_dir}/lib${tf}_debug.la
-
-            # fix "name of the static archive"; there is none in .la file
-
-            reinplace "s|old_library='\[^'\]*'|old_library=''|" \
-                ${dr_qt_libs_dir}/lib${tf}_debug.la
-
-            # fix "libraries that this one depends upon" in .la file
-
-            reinplace "/dependency_libs/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}_debug.la
-            reinplace "/dependency_libs/s|-framework Qt\\(\[^ \]*\\)|-lQt\\1_debug|g" ${dr_qt_libs_dir}/lib${tf}_debug.la
-            reinplace "/dependency_libs/s| ${worksrcpath}\[^ \]*||g" \
-                ${dr_qt_libs_dir}/lib${tf}_debug.la
-            reinplace "/dependency_libs/s| -lwebcored||" \
-                ${dr_qt_libs_dir}/lib${tf}_debug.la
-            reinplace "/dependency_libs/s| -ljscored||" \
-                ${dr_qt_libs_dir}/lib${tf}_debug.la
-
-            # fix "directory that this library needs to be installed in" in .la file
-
-            reinplace "/libdir/s|${qt_frameworks_dir}|${qt_libs_dir}|" \
-                ${dr_qt_libs_dir}/lib${tf}_debug.la
-
-        }
-    }
-
-    # Install documentation.
-
-    xinstall -m 755 -d ${worksrcpath}/${qt_docs_dir}
-    xinstall -m 644 -W ${worksrcpath} \
-        INSTALL LGPL_EXCEPTION.txt LICENSE.FDL \
-        LICENSE.GPL3 LICENSE.LGPL README \
-        ${destroot}${qt_docs_dir}
-
-    # Install private headers needed by QtCreator
-
-    foreach {src_dir include_dir} \
-    {corelib QtCore gui QtGui script QtScript declarative QtDeclarative} {
-        set dest_dir ${destroot}${qt_frameworks_dir}/${include_dir}.framework/Headers/private
-        xinstall -m 755 -d ${dest_dir}
-        set files [exec find ${worksrcpath}/src/${src_dir} -type f -name "*_p.h"]
-        eval xinstall -m 644 [split ${files}] ${dest_dir}
-    }
-
-    # Move .apps into the applications_dir, and link each .apps'
-    # executable back into ${qt_bins_dir}
-
-    set dr_qt_apps_dir ${destroot}${qt_apps_dir}
-    set dr_qt_bins_dir ${destroot}${qt_bins_dir}
-
-    xinstall -m 755 -d ${dr_qt_apps_dir}
-    foreach app [glob ${dr_qt_bins_dir}/*.app] {
-
-        # remove the leading stuff
-
-        set app [lindex [split ${app} /] end]
-
-        # move the .app
-
-        move ${dr_qt_bins_dir}/${app} ${dr_qt_apps_dir}
-
-        # link the app's executable back
-
-        set texe [strsed ${app} {g@\.app@@}]
-        ln -s ${qt_apps_dir}/${app}/Contents/MacOS/${texe} \
-            ${dr_qt_bins_dir}
-
-    }
-
-    # move tests to ${qt_data_dir}
-
-    xinstall -m 755 -d ${destroot}${qt_data_dir}
-    move ${destroot_qt}/tests/qt4 ${destroot}${qt_data_dir}/tests
-
-    # install ${qt_includes_dir}/Qt if not already and it exists in
-    # the build, for support of legacy projects
-
-    if {![file exists ${destroot}${qt_includes_dir}/Qt] &&
-        [file exists ${worksrcpath}/include/Qt]} {
-
-        # copy the Qt headers directory
-
-        copy ${worksrcpath}/include/Qt ${destroot}${qt_includes_dir}
-
-    }
-
-    # link in Resource to ${qt_libs_dir}
-
-    ln -s ${qt_frameworks_dir}/QtGui.framework/Resources \
-        ${destroot}${qt_libs_dir}
-
-}
-
-variant odbc description {Enable iODBC SQL Driver} {
-    depends_lib-append port:libiodbc
-    configure.args-delete -no-sql-odbc
-    configure.args-append -plugin-sql-odbc
-}
-
-variant raster description {Use raster graphics system by default} {
-    configure.args-append -graphicssystem raster
-}
-
-variant demos description {Build demos} {}
-
-if {![variant_isset demos]} {
-   configure.args-append -nomake demos
-}
-
-variant examples description {Build examples} {}
-
-if {![variant_isset examples]} {
-   configure.args-append -nomake examples
-}
-
-variant debug description {Build both release and debug library} {}
-
-if {[variant_isset debug]} {
-    configure.args-append -debug-and-release -declarative-debug
-} else {
-    configure.args-append -release -no-declarative-debug
-}
-
-variant openvg description {Build with support for OpenVG} {
-
-    depends_lib-append port:mesa
-
-    pre-configure {
-
-        # set OpenVG arg, for both testing and building
-
-        configure.env-append QMAKE_OPENVG_ARG=-lOpenVG
-
-    }
-}
-
-variant cxx11 description {Add library support for C++11 (EXPERIMENTAL; does not work with libc++)} {
-
-    # Block compilers that do not support C++11. This variant seems to
-    # work with MacPorts' clang 3.0 or newer and Apple clang newer
-    # than 318.0.58 (but, not that version, which is already blocked).
-
-    compiler.blacklist-append \
-        apple-gcc-4.2 gcc-4.2 llvm-gcc-4.2
-
-    pre-fetch {
-
-        # This variant does not work with Clang libc++
-
-        if {[info exists configure.cxx_stdlib] &&
-            ${configure.cxx_stdlib} eq "libc++" &&
-            [string match *clang* ${configure.cxx}]} {
-
-            ui_msg "\nERROR: C++11 support for Qt4 is not available when using Clang and libc++.\n"
-            error "unsupported platform for C++11 support"
-
-        }
-    }
-
-    pre-extract {
-
-        ui_msg "\nWARNING: You have enabled C++11 support for Qt4, which is EXPERIMENTAL.  Qt's libraries and applications (not including QMake) will be compiled using C++11.  That said, C++11 will NOT be enabled by default when using QMake.  You can enable C++11 by specifying, e.g. \'CONFIG += c++11\', in any QMake build file.\n"
-
-    }
-
-    # patches for C++11 only
-
-    patchfiles-append patch-cxx11.diff
-
-    # have configure test for C++11; our hooks
-    # will error out if C++11 is not found.
-
-    configure.args-append -c++11
-
-}
-
-post-activate {
-    ui_msg "NOTE: Qt database plugins for mysql55, postgresql91, and sqlite2 are NOT installed by this port\; they are installed by qt4-mac-*-plugin instead."
-}
-
-livecheck.type      regex
-livecheck.url       http://download.qt-project.org/official_releases/qt/${branch}/
-livecheck.regex     >(\[0-9.\]+)/<
diff --git a/aqua/qt4-mac/Portfile.qt4 b/aqua/qt4-mac/Portfile.qt4
new file mode 100644
index 0000000..600f92e
--- /dev/null
+++ b/aqua/qt4-mac/Portfile.qt4
@@ -0,0 +1,1185 @@
+# -*- 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 126922 2014-10-17 18:50:56Z ryandesign@macports.org $
+
+# use the qt4 group; set 'building_qt4' so that the portgroup
+# does not include certain parts
+set building_qt4    1
+
+PortGroup           qt4 1.0
+if {[variant_isset exclusive] && ![variant_isset libsymlinks]} {
+	# qt4-mac-devel is "replaced_by" this port,
+	# so this port cannot conflict with it.
+	#conflicts           qt3 qt3-mac qt4-mac-devel
+	conflicts           qt3 qt3-mac qt5-mac
+}
+
+PortGroup           xcodeversion 1.0
+PortGroup           compiler_blacklist_versions 1.0
+
+set branch          [join [lrange [split ${version} .] 0 1] .]
+
+categories          aqua
+platforms           macosx
+maintainers         michaelld openmaintainer
+license             {LGPL-2.1 GPL-3}
+
+homepage            http://qt-project.org
+description         Qt Tool Kit
+long_description    Qt Tool Kit: A cross-platform framework \
+                    (headers, data, and libraries) for writing \
+                    cross-platform GUI-based applications. \
+                    Installs to ${qt_dir}
+
+
+distname            qt-everywhere-opensource-src-${version}
+
+master_sites        http://download.qt-project.org/official_releases/qt/${branch}/${version}/
+
+checksums           rmd160  0220d4e76ac761c9ecfb8ddab6f2c1dc6ad70c33 \
+                    sha256  8b14dd91b52862e09b8e6a963507b74bc2580787d171feda197badfa7034032c
+
+minimum_xcodeversions   {8 2.5}
+
+depends_lib-append  port:zlib path:bin/dbus-daemon:dbus \
+                    port:openssl port:tiff \
+                    port:libpng port:libmng port:jpeg
+
+# find a way to specify the OS MINOR version.  For OSX 10.X, this
+# value will be X.  The type is this variable is integer, so we can
+# use "==" and so forth for comparison.
+
+global MINOR
+set MINOR ""
+
+# hopefully the MACOSX_DEPLOYMENT_TARGET exists and is set by now.  if
+# not, last resort (which is not desirable) is to use the os.version.
+
+if {${macosx_deployment_target} ne ""} {
+    set MINOR [lindex [split ${macosx_deployment_target} "."] 1]
+} else {
+    set MINOR [expr [lindex [split ${os.version} "."] 0] - 4]
+}
+
+###############################################
+# Patches are used to both fix compiling on various OS versions, and
+# to enhance the functionality of QMake and its build files.  Some of
+# these patches are 2-stage: use a file here, and the replace an
+# @VARIABLE@ in post-patch.  There are LOTS of patches, because Qt is
+# a large, complicated system.
+
+# (0) Fix the testing script to properly handle both +universal as
+# well as the native arch for both CXX and CC compiling; also make
+# sure it does not create a Mac app bundle.
+
+patchfiles-append   patch-config.tests_unix_compile.test.diff
+
+# (1) Test for Precompiled-headers support (a) requires a C++
+# compiler, but configure calls it, by default, with a C compiler;
+# thus, enable testing using the C compiler. (b) to work with ccache,
+# if used.
+
+patchfiles-append   patch-config.tests_unix_precomp.test.diff
+
+# (2) fix 'configure' script: (a) to allow easy replacement of arch
+# type(s). (b) to find the correct QMAKE CXX compiler by removing
+# possibilities that include the character "$". (c) to declare, use,
+# and set QT_INSTALL_FRAMEWORKS and QMAKE_FRAMEWORKDIR_QT, both here
+# and in the resulting .qmake.cache files. (d) to allow easy
+# replacement of MACOSX_DEPLOYMENT_TARGET: build for just the user's
+# current OS. (e) add hooks for C++11 testing.
+
+patchfiles-append   patch-configure.diff
+
+# (3) (a) Tweak various scripts to allow easy replacement of
+# MACOSX_DEPLOYMENT_TARGET: build for just the user's current OS.
+# (b) Assign initial OBJECTIVE_CXXFLAGS.
+
+patchfiles-append   patch-mkspecs_common_g++-macx.conf.diff
+
+# (4) (a) Allow easy replacement of MACOSX_DEPLOYMENT_TARGET: build
+# for just the user's current OS; (b) allow QMake to use 'ccache' via,
+# e.g., "qmake && make CCACHE=ccache".
+
+patchfiles-append   patch-mkspecs_common_mac.conf.diff
+
+# (5) Place the -I path for local moc-created headers -before-
+# all other -I paths.
+
+patchfiles-append   patch-mkspecs_features_moc.prf.diff
+
+# (6) Remove Qt's LIBDIR and INCDIR from various QMake internal
+# variables, since they are already included in the user-supplied
+# LIBS and INCLUDEPATH.
+
+patchfiles-append   patch-mkspecs_features_qt.prf.diff
+
+# (7) (a) Change placement of Qt's LIBDIR and INCDIR, to always be
+# after those supplied by the user's QMake (.pro) files.  By the time
+# QMake gets to the patched function, it is creating the Makefile
+# parts to find Qt's headers and libraries, so moving these paths to
+# this location should always work. (b) If the library is QtWebKit,
+# and the build is library (no-framework), universal, and debug, then
+# the linkage is just -lQtWebKit, not -lQtWebKit_debug because the
+# debug library for 32-bit system cannot be created (too large).
+
+patchfiles-append   patch-mkspecs_features_qt_functions.prf.diff
+
+# (8) (a) Change "gcc" and "g++" to @'s for replacement in
+# post-patch; (b) add hooks for C++11.
+
+patchfiles-append   patch-mkspecs_common_g++-base.conf.diff
+
+# (9) Add default QMake variables for Objective C++.
+
+patchfiles-append   patch-mkspecs_objective_cxx.diff
+
+# (10) Add "absolute_library_soname" to the default CONFIG variables,
+# so that when a DYLIB is created, if "target.path" is set for it then
+# that path is prepended to its "install_name".
+
+patchfiles-append   patch-mkspecs_macx-g++_qmake.conf.diff
+
+# (11) Add QT_INSTALL_FRAMEWORKS and related variables to QMake, to
+# provide a default variable for the location of QMake installed
+# frameworks.
+
+patchfiles-append   \
+    patch-qmake_option.h.diff \
+    patch-qmake_property.cpp.diff \
+    patch-src_corelib_global_qlibraryinfo.cpp.diff \
+    patch-src_corelib_global_qlibraryinfo.h.diff
+
+# (12) In QMake, disable default MKSPECS and FEATURES path
+# concatinations if the shell environment variable QMAKE_NO_DEFAULTS
+# is set (to anything); we use this variable in this portfile to make
+# sure only internal paths (to the build) are searched by QMake.
+
+patchfiles-append   patch-qmake_project.cpp.diff
+
+# (13) In QMake: (a) enable correct "-framework foo,bar" parsing as
+# specified by Apple's LD; (b) disable "/Library/Frameworks" as a
+# default search path; use "PREFIX/Library/Frameworks" and replace
+# PREFIX in post-patch.  Also set "PREFIX/lib" as a default library
+# search path.
+
+patchfiles-append   patch-qmake_generators_unix_unixmakke.cpp.diff
+
+# (14) Allow easy replacement of MACOSX_DEPLOYMENT_TARGET: build for
+# just the user's current OS.
+
+patchfiles-append   \
+    patch-qmake_qmake.pri.diff \
+    patch-src_tools_bootstrap_bootstrap.pro.diff
+
+# (15) fix use of CARBON, found on PPC64; does not hurt others
+
+patchfiles-append   \
+    patch-src_3rdparty_webkit_Source_WebCore_plugins_PluginView.h.diff \
+    patch-src_3rdparty_webkit_Source_WebCore_plugins_mac_PluginViewMac.mm.diff
+
+# (16) fix the corewlan qmake file to use non-standard Developer SDK
+# location under 10.6 and newer, e.g., for some developers doing both
+# iOS and OSX.  This patch does not change behavior for 10.4 or 10.5.
+# Also include fix to use the correct SDK.
+
+patchfiles-append   patch-src_plugins_bearer_corewlan_corewlan.pro.diff
+
+# (17) Use the "target.path" for libdir for core libraries instead of
+# the standard QT_INSTALL_LIBS; allows us to set for library or
+# framework elsewhere and have the install still work here.
+
+patchfiles-append   patch-src_qbase.pri.diff
+
+# (18) (a) Disable explicit disabling of framework or static install;
+# i.e., install as a framework if that mode is selected, and as
+# library otherwise. (b) If installing as framework, use the new
+# QT_INSTALL_FRAMEWORKS directory; otherwise, use the old
+# QT_INSTALL_LIBS; (c) Get PKGCONFIG dependencies correct, hopefully;
+# (d) create and install .pc, .la, and .prl library description files,
+# including basic path replacement into DESTDIR; we couple this with a
+# post-patch to get the correct install location.
+
+patchfiles-append   \
+    patch-src_qt_install.pri.diff \
+    patch-tools_assistant_lib_fulltextsearch_fulltextsearch.pro.diff \
+    patch-tools_assistant_lib_lib.pro.diff \
+    patch-tools_designer_src_components_lib_lib.pro.diff \
+    patch-tools_designer_src_lib_lib.pro.diff \
+    patch-tools_designer_src_uitools_uitools.pro.diff \
+    patch-mkspecs_features_uitools.prf.diff
+
+# (19) fix 'macdeployqt' to look for the correct plugins location by
+# default.  This is paired with a "reinplace" in post-patch
+
+patchfiles-append   \
+    patch-tools_macdeployqt_macdeployqt_main.cpp.diff
+
+# (20) Under 10.4 only: patch QMake build files using just "-lQtHelp"
+# to do "-lQtHelp -lQtCLucene -lQtNetwork -lQtWebKit" instead.  For
+# some reason 10.5+ "knows" that how to do this correctly.
+
+platform darwin {
+    if {${MINOR} == 4} {
+        patchfiles-append patch-QtHelp_10.4_only.diff
+    }
+}
+
+# (21) fix the Mac timer's use of "mach_timebase_info"
+
+patchfiles-append   \
+    patch-src_corelib_tools_qelapsedtimer-mac.cpp.diff
+
+# (22) Under 10.8 and 10.9: Patch to fix corelib linking
+
+platform darwin {
+    if {${MINOR} >= 8} {
+        patchfiles-append patch-src_corelib_corelib.pro.diff
+    }
+}
+
+# (23) fix Framework directory in MacDeployQt tool
+
+patchfiles-append   \
+    patch-tools_macdeployqt_shared_shared.cpp.diff
+
+# (24) minimum patches required for 10.10; squashed; temporary until 4.8.7.
+
+patchfiles-append   \
+    patch-10.10.diff
+
+# (25) avoid leaving zombies when starting an inexisting executable through QProcess
+patchfiles-append \
+    qprocess-nozombies.patch
+
+# error out if trying to build on a new OSX version (> 10.10).
+
+platform darwin {
+    if {${MINOR} > 10} {
+        # This project needs to be updated to build with clang++ against libc++
+        depends_lib
+        depends_run
+        pre-fetch {
+            ui_error "$name does not currently build on OSX later than 10.10 'Yosemite'."
+            error "unsupported platform"
+        }
+    }
+}
+
+###############################################
+
+# disable CCACHE for now (ticket #34856)
+
+configure.ccache no
+
+## The main port that installs Qt4:
+if {${subport} ne "${name}-transitional"} {
+
+    # find a way to specify the SDK to use; Qt will use the 10.4u by
+    # default which won't work on 10.6 since it is not supported.  Allow
+    # the user to specify the SDK if desired.
+
+    global SDK
+    set SDK ${configure.sdkroot}
+    if {${SDK} eq ""} {
+        # set SDK version depending on OS version
+        set sdk_version ""
+        if {${MINOR} == 4} {
+            # OSX 10.4 requires an additional 'u'
+            set sdk_version "10.4u"
+        } else {
+            set sdk_version "10.${MINOR}"
+        }
+        if {[vercmp ${xcodeversion} 4.3] < 0} {
+            set SDK ${developer_dir}/SDKs/MacOSX${sdk_version}.sdk
+        } else {
+            set SDK ${developer_dir}/Platforms/MacOSX.platform/Developer/SDKs/MacOSX${sdk_version}.sdk
+        }
+    }
+
+    post-patch {
+        # set ARCHES in configure (per the third patchfile above), for
+        # building QMake.  join any 2 or more arch entries with the GCC
+        # arch flag (join does not effect a single entry).  first "-arch"
+        # is already in place in the 'configure' script (since there has
+        # to be at least 1 arch).
+
+        set ARCHES ""
+        if {[variant_exists universal] && [variant_isset universal]} {
+            set ARCHES [join ${universal_archs} " -arch "]
+        } else {
+            set ARCHES ${build_arch}
+        }
+        reinplace "s|@ARCHES@|${ARCHES}|g" ${worksrcpath}/configure
+
+        # set MACOSX_DEPLOYMENT_TARGET version in various places.  These
+        # were all patched in (2) above, and can be easily changed or
+        # overridden by the user in a project-local qmake .pro script.
+
+        set TARGET "10.${MINOR}"
+        foreach fixfile {configure mkspecs/common/g++-macx.conf \
+                         mkspecs/common/mac.conf qmake/qmake.pri \
+                         src/tools/bootstrap/bootstrap.pro } {
+            reinplace "s|@MACOSX_DEPLOYMENT_TARGET@|${TARGET}|g" \
+                ${worksrcpath}/${fixfile}
+        }
+
+        # Fix OS version on Bearer CoreWLAN QMake file
+
+        reinplace "s|@MACOSX_VERSION_MINOR@|${MINOR}|g" \
+            ${worksrcpath}/src/plugins/bearer/corewlan/corewlan.pro
+
+        # Ensure that correct C/C++ compilers are used.
+
+        reinplace "s|@CXX@|${configure.cxx}|" \
+            ${worksrcpath}/mkspecs/common/g++-base.conf
+        reinplace "s|@CC@|${configure.cc}|"  \
+            ${worksrcpath}/mkspecs/common/g++-base.conf
+
+        # fix the corewlan .pro file to use the correct developer SDK
+
+        reinplace "s,@DEVELOPER_SDK@,${SDK},g" \
+            ${worksrcpath}/src/plugins/bearer/corewlan/corewlan.pro
+
+        # fix 'macdeployqt' to look for the correct
+        # plugins location by default.
+
+        reinplace "s,@QT_PLUGINS_DIR@,${qt_plugins_dir},g" \
+            ${worksrcpath}/tools/macdeployqt/macdeployqt/main.cpp
+
+        # fix PREFIX in QMake makefile generator
+
+        reinplace "s,@PREFIX@,${qt_dir},g" \
+            ${worksrcpath}/qmake/generators/unix/unixmake.cpp
+
+        # if no debug, then do not even build debug code
+
+        if {![variant_isset debug]} {
+            foreach fixfile { src/qbase.pri \
+                              src/3rdparty/webkit/Source/WebKit.pri \
+                              src/imports/qimportbase.pri \
+                              src/plugins/qpluginbase.pri \
+                              tools/designer/src/components/lib/lib.pro \
+                              tools/designer/src/lib/lib.pro \
+                              tools/designer/src/plugins/activeqt/activeqt.pro \
+                              tools/designer/src/plugins/plugins.pri \
+                              tools/designer/src/uitools/uitools.pro \
+                              src/3rdparty/webkit/Source/WebKit/qt/declarative/declarative.pro } {
+                reinplace "/+=/s@debug_and_release@@g" \
+                    ${worksrcpath}/${fixfile}
+            }
+        }
+
+        # copy C++11 files into place, if that variant is set
+
+        if {[variant_isset cxx11]} {
+            copy ${filespath}/c++11.prf ${worksrcpath}/mkspecs/features
+            copy ${filespath}/c++11 ${worksrcpath}/config.tests/mac
+        }
+
+        # copy Objective C / CXX files into place
+
+        copy ${filespath}/objective_cxx.prf \
+            ${worksrcpath}/mkspecs/features/mac
+        copy ${filespath}/split_sources.prf \
+            ${worksrcpath}/mkspecs/features/mac
+
+        # copy extra compiler tests into place; these are patched into the
+        # configure script to the area before qmake is built.  If any
+        # fail, configure will fail quickly.
+
+        copy ${filespath}/fconstant_cfstrings.test \
+            ${worksrcpath}/config.tests/mac
+        copy ${filespath}/objc_block \
+            ${worksrcpath}/config.tests/mac
+        copy ${filespath}/cpath \
+            ${worksrcpath}/config.tests/mac
+        copy ${filespath}/library_path \
+            ${worksrcpath}/config.tests/mac
+    }
+
+    # Block various compilers:
+    #
+    # * The build process requires -Xarch, -fconstant-cfstring, and
+    # Objective-C(++) blocks (^), which are not supported with vanilla GCC
+    # as installed by MacPorts but are supported by all versions of CLANG
+    # (both MacPorts' and Apple's).
+    #
+    # * Some older versions of CLANG do not honor the CPATH
+    # environment variables, which is required for compiling
+    # this port when using MacPorts.  The versions seem to be: MacPorts
+    # CLANG 2.9 or earlier, and Apple CLANG 318.0.58 or older.
+    #
+    # * Some older versions of CLANG do not honor the LIBRARY_PATH
+    # environment variables, which is required for compiling
+    # this port when using MacPorts.  The versions seem to be: MacPorts
+    # CLANG 3.0 or earlier, and Apple CLANG 318.0.61 or older.
+    #
+    # * qt4-creator-mac fails to build with GCC <= 4.0.
+    #
+    # See also:
+    # < http://llvm.org/bugs/show_bug.cgi?id=8971 >,
+    # < https://trac.macports.org/ticket/30271 >,
+    # < https://trac.macports.org/ticket/31076 >,
+    # < https://trac.macports.org/ticket/31638 >,
+    # < https://trac.macports.org/ticket/37868 >, and
+    # < https://trac.macports.org/ticket/40422 >.
+    #
+    # NOTE: qt4-mac augments the standard Qt4 configure script with
+    # pre-qmake-build tests for CPATH, LIBRARY_PATH, -Xarch,
+    # -fconstant-cfstring, Objective-C(++) blocks, and, if requested,
+    # C++11.  The script will error out quickly if the compiler does not
+    # seem to provide support for any one of these properties, no matter
+    # this blacklist.
+    #
+
+    compiler.blacklist-append { clang <= 318.0.61 } \
+        gcc-3.3 *gcc-4.0 macports-gcc* \
+        macports-clang-2.9 macports-clang-3.0
+
+    # --prefix is not recognized.
+    configure.pre_args-delete       --prefix=${prefix}
+
+    # --disable-dependency-tracking is not recognized.
+    configure.universal_args-delete --disable-dependency-tracking
+
+    # clear all arch-oriented flags since somehow they impact how qmake is
+    # created, which in turn messes up LDFLAGS in most created Makefiles.
+
+    configure.ld_archflags
+    configure.cc_archflags
+    configure.cxx_archflags
+    configure.universal_ldflags
+    configure.universal_cflags
+    configure.universal_cxxflags
+    configure.universal_cppflags
+    configure.march
+    configure.mtune
+
+    # Use compiler.cpath and compiler.library_path for all -I and -L
+    # entries, so-as to avoid conflicts with already-installed headers and
+    # libraries (giving preference to internal-to-this-port first).  CPATH
+    # is used instead of -I to avoid conflicts with other ports.
+    #
+    # See also:
+    # < https://trac.macports.org/ticket/15219 >,
+    # < https://trac.macports.org/ticket/18723 >, and
+    # < https://trac.macports.org/ticket/25321 >.
+
+    # set the default paths to include those for SQLITE3 and DBUS-1
+
+    set header_path [ list ${prefix}/include/dbus-1.0 \
+                           ${prefix}/lib/dbus-1.0/include \
+                           ${prefix}/include ]
+
+    set library_path [ list ${prefix}/lib ]
+
+    # -dbus-linked prevends qt4 from trying to dynamically load libdbus-1,
+    #     which it is not able to find in ${prefix}.
+    #
+    # -openssl-linked ensures that the MacPorts openssl is used.
+    #
+    # -framework ensures that this port is installed as frameworks
+    #     (collections of {library, headers, resources}); in
+    #     post-destroot, link headers and libraries from the frameworks
+    #     into non-framework locations as if "-no-framework" were
+    #     specified.  Some dependent projects will not work properly if Qt
+    #     is installed as libraries by default, thus make it so #1.
+    #
+    # -no-phonon ensures that Qt does not install the 3rd-parth Phonon
+    #     port or its backend to QuickTime 7; Phonon is now installed via
+    #     the 'phonon' port, which is more up to date than that provided
+    #     by Qt.
+
+    configure.args                                            \
+        -v                                                    \
+        -confirm-license                                      \
+        -opensource                                           \
+        -prefix          ${qt_dir}                            \
+        -bindir          ${qt_bins_dir}                       \
+        -libdir          ${qt_libs_dir}                       \
+        -docdir          ${qt_docs_dir}                       \
+        -headerdir       ${qt_includes_dir}                   \
+        -plugindir       ${qt_plugins_dir}                    \
+        -importdir       ${qt_imports_dir}                    \
+        -datadir         ${qt_data_dir}                       \
+        -translationdir  ${qt_translations_dir}               \
+        -sysconfdir      ${qt_sysconf_dir}                    \
+        -examplesdir     ${qt_examples_dir}                   \
+        -demosdir        ${qt_demos_dir}                      \
+        -openssl-linked                                       \
+        -dbus-linked                                          \
+        -fast                                                 \
+        -optimized-qmake                                      \
+        -no-pch                                               \
+        -framework                                            \
+        -no-phonon                                            \
+        -no-phonon-backend                                    \
+        -fontconfig -system-freetype
+
+    # Stop configure script from searching for SQL Drivers
+    #    not available from MacPorts.
+
+    foreach driver {db2 ibase oci tds} {
+        configure.args-append -no-sql-${driver}
+    }
+
+    # Disable all remaining SQL Drivers.  These are available via the
+    # ports qt4-mac-*-plugin.
+
+    foreach driver {mysql odbc psql sqlite sqlite2} {
+        configure.args-append -no-sql-${driver}
+    }
+
+    pre-configure {
+
+        # use the corrected CPATH and LIBRARY_PATH for build
+
+        compiler.cpath [join ${header_path} :]
+        compiler.library_path [join ${library_path} :]
+
+        # for 10.4 or 10.5 32-bit PPC, build as Carbon only, not Cocoa
+
+        if {${MINOR} == 4} {
+
+            configure.args-append -carbon
+
+            # required linking flags?
+
+            configure.ldflags-append -lcrypto -ldbus-1 -ljpeg -llcms \
+                -lssl -lz
+
+        } elseif {${MINOR} == 5 &&
+                  [llength ${qt_arch_types}] == 1 &&
+                  [lsearch -exact ${qt_arch_types} ppc] == 0} {
+
+            configure.args-append -carbon
+
+        }
+
+        # set the arch type(s) to use, in Qt-speak
+
+        configure.args-append -arch \"${qt_arch_types}\"
+
+        # cannot use pre-compiled headers when compiling with more than 1
+        # arch type (typically +universal) or for X11
+
+        #if {[llength ${qt_arch_types}] != 1 || [variant_isset x11]}
+
+        # check to see if not compiling for the native machine hardware
+        # (e.g., compiling for just i386 but CPU is x86_64); optimization
+        # of QMake does not work in this circumstance.
+
+        if {[lsearch -exact ${qt_arch_types} ${os.arch}] == -1} {
+
+            # not building for native arch: disable optimizing qmake
+            configure.args-delete -optimized-qmake
+
+        } elseif {${MINOR} == 6 &&
+                  [llength ${qt_arch_types}] == 1 &&
+                  [lsearch -exact ${qt_arch_types} x86] == 0} {
+
+            # disable qmake optimization on 10.6 32-bit
+            configure.args-delete -optimized-qmake
+
+        }
+
+        # set the SDK, if it was found and exists
+
+        if {[file exists ${SDK}]} {
+            configure.args-append -sdk ${SDK}
+        }
+
+        # set which pkg-config to use
+
+        configure.env-append PKG_CONFIG=${prefix}/bin/pkg-config
+
+        # set which stdlib to use; clang only
+        if {[string match *clang* ${configure.compiler}]} {
+            configure.env-append QMAKE_STDLIB="-stdlib=${configure.cxx_stdlib}"
+            configure.ldflags-append -stdlib=${configure.cxx_stdlib}
+        }
+    }
+
+    post-configure {
+
+        # Remove any '-I' and '-L' string from the *FLAGS for SQLITE,
+        # DBUS, ODBC, and OPENSSL, so that what remains are just non-I/L
+        # flags; these paths are in compiler.cpath and
+        # compiler.library_path.  The header and library paths for all the
+        # other variants are not used by 'configure', and are already
+        # included in the compiler.cpath and compiler.library_path
+        # . during the 'build' stage, 'make' will rebuild the Makefiles
+        # that depend on any of these changed files.  These patches are
+        # sufficient to make sure local (to this build) paths are searched
+        # first, and then system paths last (via the compiler.X settings).
+        # Ideally, 'qmake' -- either via its mkspecs files or the
+        # project's build files -- would distinguish between "local" and
+        # "system" includes & libraries.
+
+        # SQLITE
+        reinplace "/SQLITE/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
+            ${worksrcpath}/.qmake.cache
+        reinplace "/SQLITE/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
+            ${worksrcpath}/.qmake.cache
+        # DBUS
+        reinplace "/DBUS/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
+            ${worksrcpath}/.qmake.cache
+        reinplace "/DBUS/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
+            ${worksrcpath}/.qmake.cache
+        # OPENSSL
+        reinplace "/OPENSSL/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
+            ${worksrcpath}/.qmake.cache
+        reinplace "/OPENSSL/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
+            ${worksrcpath}/.qmake.cache
+        # ODBC
+        reinplace "/ODBC/s@-I${prefix}/\[^ \]*include\[^ \]*@@g" \
+            ${worksrcpath}/.qmake.cache
+        reinplace "/ODBC/s@-L${prefix}/\[^ \]*lib\[^ \]*@@g" \
+            ${worksrcpath}/.qmake.cache
+    }
+
+    pre-build {
+        # use the corrected CPATH and LIBRARY_PATH for build
+        compiler.cpath [join ${header_path} :]
+        compiler.library_path [join ${library_path} :]
+    }
+
+    # do not use DESTDIR directly in the destroot command; Qt uses DISTDIR
+    # internally for other purposes, and instead uses INSTALL_ROOT for the
+    # additional install root prefix.
+
+    destroot.post_args
+
+    pre-destroot {
+        # this isn't really nice if the user has 2nd thoughts and wants to install those html files after all
+        # (and knows how to get port to redo an install without cleaning and rebuilding everything).
+        # Let's hope that happens rarely enough to prefer speeding up the destroot step for the others
+        if {![variant_isset htmldocs]} {
+            if {[file exists ${worksrcpath}/doc/html/images]} {
+                ui_msg "cleaning out ${worksrcpath}/doc/html per your request"
+                delete file ${worksrcpath}/doc/html/images ${worksrcpath}/doc/html/scripts ${worksrcpath}/doc/html/style
+                eval file delete [glob ${worksrcpath}/doc/html/*.html]
+                eval file delete [glob ${worksrcpath}/doc/html/qt.*]
+            }
+        }
+    }
+
+    post-destroot {
+
+        set destroot_qt ${destroot}${qt_dir}
+
+        # Fix .pc and .prl files by changing ${worksrcpath}\${prefix} to
+        # ${qt_dir}\${prefix} ("\" means 'take away').  Cannot use
+        # "find -E" since it is not necessarily portable.
+
+        regsub ${prefix} ${worksrcpath} "" from_dir
+        regsub ${prefix} ${qt_dir} "" to_dir
+        foreach fixfile [exec find ${destroot_qt} -name "*.pc"] {
+            reinplace "s|${from_dir}|${to_dir}|g" ${fixfile}
+        }
+        foreach fixfile [exec find ${destroot_qt} -name "*.prl"] {
+            reinplace "s|${from_dir}|${to_dir}|g" ${fixfile}
+        }
+
+        # fix .pc files
+
+        foreach fixfile [exec find ${destroot_qt} -name "*.pc"] {
+
+            # remove Libs.private; they can mess up linking
+
+            reinplace "/Libs\.private/d" ${fixfile}
+
+            # use ${prefix} correctly
+
+            # RJVB:
+            # don't replace ${prefix} (e.g. /opt/local) with \${prefix}
+            # unless ${qt_dir} == ${prefix} (but I don't see the point at all...)
+            if {${prefix} eq ${qt_dir}} {
+                reinplace "s|${prefix}/|\${prefix}/|g" ${fixfile}
+            }
+
+            # fix libdir
+
+            reinplace "/libdir=/s|Library/Frameworks|lib|" ${fixfile}
+
+            # fix Libs: to use -L instead of -F
+
+            reinplace "/Libs:/s|-F|-L|" ${fixfile}
+
+            # fix Libs: to use -lQt* instead of "-framework Qt*"
+            # depends on whether for release or debug
+
+            set fn [lindex [split ${fixfile} /] end]
+
+            if {[lsearch -regexp ${fn} debug] == 0} {
+
+                # debug; need to add that string to all Qt dependency libraries
+                reinplace "/Libs:/s|-framework Qt\\(\[^ \]*\\)|-lQt\\1_debug|" \
+                    ${fixfile}
+
+            } else {
+
+                # no debug; just replace
+                reinplace "/Libs:/s|-framework Qt|-lQt|" ${fixfile}
+
+            }
+        }
+
+        # move .pc files from ${qt_frameworks_dir}/pkgconfig to
+        # ${qt_pkg_config_dir}
+
+        file delete -force ${destroot}${qt_pkg_config_dir}
+        xinstall -m 755 -d ${destroot}${qt_libs_dir}
+    #    move ${destroot}${qt_frameworks_dir}/pkgconfig \
+    #        ${destroot}${qt_libs_dir}
+    # RJVB: ${destroot}${qt_libs_dir} is NOT always equal to ${qt_pkg_config_dir} !!
+        move ${destroot}${qt_frameworks_dir}/pkgconfig \
+            ${destroot}${qt_pkg_config_dir}
+        if {![variant_isset exclusive]} {
+            # qt_pkg_config_dir==${prefix}/lib/pkgconfig; make a symlink to that place in
+            # ${qt_libs_dir} so that 3rd party .pc files end up where pkg-config can find them ...
+            ln -s ${qt_pkg_config_dir} ${destroot}${qt_libs_dir}/pkgconfig
+        }
+
+        # move .la files from ${qt_frameworks_dir} to ${qt_libs_dir}
+
+        foreach laf [glob ${destroot}/${qt_frameworks_dir}/*.la] {
+            move ${laf} ${destroot}${qt_libs_dir}
+        }
+
+        # remove -L entries from .prl and .la files
+
+        foreach fixfile [exec find ${destroot_qt} -name "*.prl"] {
+            reinplace "/QMAKE_PRL_LIBS/s|-L\[^ \]*||g" ${fixfile}
+        }
+        foreach fixfile [exec find ${destroot_qt} -name "*.la"] {
+            reinplace "/dependency_libs/s|-L\[^ \]*||g" ${fixfile}
+        }
+
+        # remove redundant -F entries from .prl and .la files
+
+        foreach fixfile [exec find ${destroot_qt} -name "*.prl"] {
+            reinplace "/QMAKE_PRL_LIBS/s|-F\[^ \]*|FREPLACEME|1" \
+                ${fixfile}
+            reinplace "/QMAKE_PRL_LIBS/s|-F\[^ \]*||g" ${fixfile}
+            reinplace "s|FREPLACEME|-F${prefix}/${qt_frameworks_dir_rel}|1" \
+                ${fixfile}
+            # also remove the QMAKE_PRL_BUILD_DIR lines
+            reinplace "/QMAKE_PRL_BUILD_DIR/d" ${fixfile}
+        }
+        foreach fixfile [exec find ${destroot_qt} -name "*.la"] {
+            reinplace "/dependency_libs/s|-F\[^ \]*|FREPLACEME|1" \
+                ${fixfile}
+            reinplace "/dependency_libs/s|-F\[^ \]*||g" ${fixfile}
+            reinplace "s|FREPLACEME|-F${prefix}/${qt_frameworks_dir_rel}|1" \
+                ${fixfile}
+        }
+
+        # get Qt's version numbers
+
+        set qt_vers [split ${version} "."]
+        set qt_major [lindex ${qt_vers} 0]
+        set qt_minor [lindex ${qt_vers} 1]
+        set qt_patch [lindex ${qt_vers} 2]
+
+        # link includes and libraries for each actual installed framework
+
+        # make sure that qt_includes_dir exist; apparently it will not have been created at this point,
+        # despite the -headerdir ${qt_includes_dir} argument to configure. Because of doing a framework build?
+        exec mkdir -p ${destroot}${qt_includes_dir}
+        foreach fixfile [exec find ${destroot}${qt_frameworks_dir} \
+                             -name "*.framework" | \
+                             sed -e "s@${destroot}@@g"] {
+
+            set tf_full [strsed ${fixfile} {s@\\.framework@@}]
+            set tf [strsed ${tf_full} {g@.*\/@@}]
+
+            # special for QtWebKit entries
+
+            set t_minor ${qt_minor}
+            set is_QtWebKit 0
+            if {[string compare ${tf} QtWebKit] == 0} {
+                set t_minor 9
+                set is_QtWebKit 1
+            }
+
+            # link headers into ${qt_includes_dir}, removing directories
+            # if they are already there first
+
+            set inc_file ${destroot}${qt_includes_dir}/${tf}
+            if {[file exists ${inc_file}]} {
+                file delete -force ${inc_file}
+            }
+            ln -s ${tf_full}.framework/Headers ${inc_file}
+
+            # link libraries into ${qt_libs_dir}, all 4 number variants
+
+            set dr_qt_libs_dir ${destroot}${qt_libs_dir}
+
+            ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.dylib
+            ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.dylib
+            ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.dylib
+            ln -s ${tf_full}.framework/${tf} ${dr_qt_libs_dir}/lib${tf}.${qt_major}.${t_minor}.${qt_patch}.dylib
+
+            # copy .prl file, then correct it for library usage
+
+            copy ${destroot}${tf_full}.framework/${tf}.prl ${dr_qt_libs_dir}/lib${tf}.prl
+
+            # fix TARGET in .prl file
+
+            reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}.prl
+
+            # fix PRL_LIBS -F -> -L in .prl file
+
+            reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}.prl
+
+            # fix "-framework Qt*" -> "-lQt*" in .prl file
+
+            reinplace "/QMAKE_PRL_LIBS/s|-framework Qt|-lQt|g" \
+                ${dr_qt_libs_dir}/lib${tf}.prl
+
+            # fix up .la files to work with ${prefix}/lib entries
+
+            # rename .la file
+
+            move ${dr_qt_libs_dir}/${tf}.la ${dr_qt_libs_dir}/lib${tf}.la
+
+            # fix "name that we can dlopen" in .la file
+
+            reinplace "s|dlname=''|dlname='lib${tf}.${qt_major}.${t_minor}.${qt_patch}.dylib'|" ${dr_qt_libs_dir}/lib${tf}.la
+
+            # fix "names of this library" in .la file
+
+            reinplace "s|library_names='\[^'\]*'|library_names='lib${tf}.${qt_major}.${t_minor}.${qt_patch}.dylib lib${tf}.${qt_major}.${t_minor}.dylib lib${tf}.${qt_major}.dylib lib${tf}.dylib'|" \
+                ${dr_qt_libs_dir}/lib${tf}.la
+
+            # fix "name of the static archive"; there is none in .la file
+
+            reinplace "s|old_library='\[^'\]*'|old_library=''|" \
+                ${dr_qt_libs_dir}/lib${tf}.la
+
+            # fix "libraries that this one depends upon" in .la file
+
+            reinplace "/dependency_libs/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|"  ${dr_qt_libs_dir}/lib${tf}.la
+            reinplace "/dependency_libs/s|-framework Qt|-lQt|g" \
+                ${dr_qt_libs_dir}/lib${tf}.la
+            reinplace "/dependency_libs/s| ${worksrcpath}\[^ \]*||g" \
+                ${dr_qt_libs_dir}/lib${tf}.la
+            reinplace "/dependency_libs/s| -lwebcore||" \
+                ${dr_qt_libs_dir}/lib${tf}.la
+            reinplace "/dependency_libs/s| -ljscore||" \
+                ${dr_qt_libs_dir}/lib${tf}.la
+
+            # fix "directory that this library needs to be installed in" in .la file
+
+            reinplace "/libdir/s|${qt_frameworks_dir}|${qt_libs_dir}|" \
+                ${dr_qt_libs_dir}/lib${tf}.la
+
+            # deal with debug files
+
+            if {[variant_isset debug]} {
+
+                # but not if QtWebKit and +universal, since that one does
+                # not exist (the 32-bit version of the debug library is
+                # larger than fits into the 32-bit filespace).
+
+                if {[variant_isset debug] && ${is_QtWebKit}} {
+                    continue
+                }
+
+                # link libraries into ${qt_libs_dir}, all 4 number variants
+
+                ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.dylib
+                ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.dylib
+                ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.dylib
+                ln -s ${tf_full}.framework/${tf}_debug ${dr_qt_libs_dir}/lib${tf}_debug.${qt_major}.${t_minor}.${qt_patch}.dylib
+
+                # copy .prl file, then correct it for library usage
+
+                copy ${destroot}${tf_full}.framework/${tf}_debug.prl ${dr_qt_libs_dir}/lib${tf}_debug.prl
+
+                # fix TARGET in .prl file
+
+                reinplace "/QMAKE_PRL_TARGET/s|Qt\\(\[^ \]*\\)|libQt\\1.${qt_major}.${t_minor}.${qt_patch}.dylib|" ${dr_qt_libs_dir}/lib${tf}_debug.prl
+
+                # fix PRL_LIBS -F -> -L in .prl file
+
+                reinplace "/QMAKE_PRL_LIBS/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}_debug.prl
+
+                # fix "-framework Qt*" -> "-lQt*_debug" in .prl file
+
+                reinplace "/QMAKE_PRL_LIBS/s|-framework Qt\\(\[^ \]*\\)|-lQt\\1_debug|g" ${dr_qt_libs_dir}/lib${tf}_debug.prl
+
+                # fix up .la files to work with ${prefix}/lib entries
+
+                # rename .la file
+
+                move ${dr_qt_libs_dir}/${tf}_debug.la \
+                    ${dr_qt_libs_dir}/lib${tf}_debug.la
+
+                # fix "name that we can dlopen" in .la file
+
+                reinplace "s|dlname=''|dlname='lib${tf}_debug.${qt_major}.${t_minor}.${qt_patch}.dylib'|" ${dr_qt_libs_dir}/lib${tf}_debug.la
+
+                # fix "names of this library" in .la file
+
+                reinplace "s|library_names='\[^'\]*'|library_names='lib${tf}_debug.${qt_major}.${t_minor}.${qt_patch}.dylib lib${tf}_debug.${qt_major}.${t_minor}.dylib lib${tf}_debug.${qt_major}.dylib lib${tf}_debug.dylib'|" \
+                    ${dr_qt_libs_dir}/lib${tf}_debug.la
+
+                # fix "name of the static archive"; there is none in .la file
+
+                reinplace "s|old_library='\[^'\]*'|old_library=''|" \
+                    ${dr_qt_libs_dir}/lib${tf}_debug.la
+
+                # fix "libraries that this one depends upon" in .la file
+
+                reinplace "/dependency_libs/s|-F${qt_frameworks_dir}|-L${qt_libs_dir}|" ${dr_qt_libs_dir}/lib${tf}_debug.la
+                reinplace "/dependency_libs/s|-framework Qt\\(\[^ \]*\\)|-lQt\\1_debug|g" ${dr_qt_libs_dir}/lib${tf}_debug.la
+                reinplace "/dependency_libs/s| ${worksrcpath}\[^ \]*||g" \
+                    ${dr_qt_libs_dir}/lib${tf}_debug.la
+                reinplace "/dependency_libs/s| -lwebcored||" \
+                    ${dr_qt_libs_dir}/lib${tf}_debug.la
+                reinplace "/dependency_libs/s| -ljscored||" \
+                    ${dr_qt_libs_dir}/lib${tf}_debug.la
+
+                # fix "directory that this library needs to be installed in" in .la file
+
+                reinplace "/libdir/s|${qt_frameworks_dir}|${qt_libs_dir}|" \
+                    ${dr_qt_libs_dir}/lib${tf}_debug.la
+
+            }
+        }
+
+        # Install documentation.
+
+        xinstall -m 755 -d ${worksrcpath}/${qt_docs_dir}
+        xinstall -m 644 -W ${worksrcpath} \
+            INSTALL LGPL_EXCEPTION.txt LICENSE.FDL \
+            LICENSE.GPL3 LICENSE.LGPL README \
+            ${destroot}${qt_docs_dir}
+
+        # Install private headers needed by QtCreator
+
+        foreach {src_dir include_dir} \
+        {corelib QtCore gui QtGui script QtScript declarative QtDeclarative} {
+            set dest_dir ${destroot}${qt_frameworks_dir}/${include_dir}.framework/Headers/private
+            xinstall -m 755 -d ${dest_dir}
+            set files [exec find ${worksrcpath}/src/${src_dir} -type f -name "*_p.h"]
+            eval xinstall -m 644 [split ${files}] ${dest_dir}
+        }
+
+        # Move .apps into the applications_dir, and link each .apps'
+        # executable back into ${qt_bins_dir}
+
+        set dr_qt_apps_dir ${destroot}${qt_apps_dir}
+        set dr_qt_bins_dir ${destroot}${qt_bins_dir}
+
+        xinstall -m 755 -d ${dr_qt_apps_dir}
+        foreach app [glob ${dr_qt_bins_dir}/*.app] {
+
+            # remove the leading stuff
+
+            set app [lindex [split ${app} /] end]
+
+            # move the .app
+
+            move ${dr_qt_bins_dir}/${app} ${dr_qt_apps_dir}
+
+            # link the app's executable back
+
+            set texe [strsed ${app} {g@\.app@@}]
+            ln -s ${qt_apps_dir}/${app}/Contents/MacOS/${texe} \
+                ${dr_qt_bins_dir}
+
+        }
+
+        # move tests to ${qt_data_dir}
+
+        xinstall -m 755 -d ${destroot}${qt_data_dir}
+        move ${destroot_qt}/tests/qt4 ${destroot}${qt_data_dir}/tests
+
+        # install ${qt_includes_dir}/Qt if not already and it exists in
+        # the build, for support of legacy projects
+
+        if {![file exists ${destroot}${qt_includes_dir}/Qt] &&
+            [file exists ${worksrcpath}/include/Qt]} {
+
+            # copy the Qt headers directory
+
+            copy ${worksrcpath}/include/Qt ${destroot}${qt_includes_dir}
+
+        }
+
+        # link in Resource to ${qt_libs_dir}
+
+        ln -s ${qt_frameworks_dir}/QtGui.framework/Resources \
+            ${destroot}${qt_libs_dir}
+
+        if {![variant_isset exclusive]} {
+            ln -s ${qt_qmake_cmd} ${destroot}/${prefix}/bin/qmake${qt_major}.${qt_minor}
+            ln -s ${qt_moc_cmd} ${destroot}/${prefix}/bin/moc${qt_major}.${qt_minor}
+            ln -s ${qt_uic_cmd} ${destroot}/${prefix}/bin/uic${qt_major}.${qt_minor}
+            ln -s ${qt_lrelease_cmd} ${destroot}/${prefix}/bin/lrelease${qt_major}.${qt_minor}
+        }
+        if {[variant_isset KDE]} {
+            # expose KDE4 styles to Qt4:
+            ln -s ${prefix}/lib/kde4/plugins/styles ${destroot}${qt_plugins_dir}/
+        }
+        if {[variant_isset noexceptions ]} {
+            # building with -no-exceptions will add a section to QtCore/qconfig.h that has to be removed
+            # given that we did NOT build QtCore WITHOUT exceptions...
+            exec patch -d ${destroot}${qt_frameworks_dir} -Np0 -i ${filespath}/qconfig-remove-EXCEPTIONS.diff
+        }
+    }
+
+    variant odbc description {Enable iODBC SQL Driver} {
+        depends_lib-append port:libiodbc
+        configure.args-delete -no-sql-odbc
+        configure.args-append -plugin-sql-odbc
+    }
+
+    variant raster description {Use raster graphics system by default} {
+        configure.args-append -graphicssystem raster
+    }
+
+    variant demos description {Build demos} {}
+
+    if {![variant_isset demos]} {
+       configure.args-append -nomake demos
+    }
+
+    variant examples description {Build examples} {}
+
+    if {![variant_isset examples]} {
+       configure.args-append -nomake examples
+    }
+
+    variant debug description {Build both release and debug library} {}
+
+    if {[variant_isset debug]} {
+        configure.args-append -debug-and-release -declarative-debug
+    } else {
+        configure.args-append -release -no-declarative-debug
+    }
+
+    variant openvg description {Build with *experimental* support for OpenVG} {
+
+        depends_lib-append port:mesa
+
+        pre-configure {
+
+            # set OpenVG arg, for both testing and building
+
+            configure.env-append QMAKE_OPENVG_ARG=-lOpenVG
+
+        }
+    }
+
+    variant cxx11 description {Add library support for C++11 (EXPERIMENTAL; does not work with libc++)} {
+
+        # Block compilers that do not support C++11. This variant seems to
+        # work with MacPorts' clang 3.0 or newer and Apple clang newer
+        # than 318.0.58 (but, not that version, which is already blocked).
+
+        compiler.blacklist-append \
+            apple-gcc-4.2 gcc-4.2 llvm-gcc-4.2
+
+        pre-fetch {
+
+            # This variant does not work with Clang libc++
+
+            if {[info exists configure.cxx_stdlib] &&
+                ${configure.cxx_stdlib} eq "libc++" &&
+                [string match *clang* ${configure.cxx}]} {
+
+                ui_msg "\nERROR: C++11 support for Qt4 is not available when using Clang and libc++.\n"
+                error "unsupported platform for C++11 support"
+
+            }
+        }
+
+        pre-extract {
+
+            ui_msg "\nWARNING: You have enabled C++11 support for Qt4, which is EXPERIMENTAL.  Qt's libraries and applications (not including QMake) will be compiled using C++11.  That said, C++11 will NOT be enabled by default when using QMake.  You can enable C++11 by specifying, e.g. \'CONFIG += c++11\', in any QMake build file.\n"
+
+        }
+
+        # patches for C++11 only
+
+        patchfiles-append patch-cxx11.diff
+
+        # have configure test for C++11; our hooks
+        # will error out if C++11 is not found.
+
+        configure.args-append -c++11
+
+    }
+
+    variant htmldocs description {Install HTML documentation (>200Mb)} {}
+
+    post-activate {
+        ui_msg "NOTE: Qt database plugins for mysql55, postgresql91, and sqlite2 are NOT installed by this port\; they are installed by qt4-mac-*-plugin instead."
+    }
+
+    variant KDE description {Include RJVB's patches for use with KDE} {
+        patchfiles-append  qt4-correct-systraymenu-iconhandling.patch \
+                           qt4-deactivate-menurole-heuristics.patch \
+                           prevent_addTitleRelated_crash.patch \
+                           debug-negative-qtimerint.patch \
+                           silence-qfilesystemwatcher.patch \
+                           patch-QAction_isEnabled.diff
+    }
+
+    variant noexceptions description {build without using exceptions internally} {
+        # (26) don't build with exceptions, which gives a completely ABI-compatible build
+        patchfiles-append       disable-exceptions.patch
+        configure.args-append   -no-exceptions
+    }
+
+}
+
+## The convenience subport that installs the symlinks which allow ports built against qt4-mac +exclusive
+## to keep functioning after installing qt4-mac in the new concurrent mode, without rebuilding them.
+## It can be uninstalled after all Qt4 "client" ports have been rebuilt.
+if { ${subport} eq "${name}-transitional" } {
+    if {[variant_isset exclusive]} {
+            return -code error "\n\nERROR:\n\
+    ${name}-transitional is available only when qt4-mac has been installed without +exclusive\n"
+    }
+    fetch {
+        if {![info exists qt4_is_concurrent]} {
+            return -code error "\n\nERROR:\n\
+    ${name}-transitional is available only when qt4-mac has been installed without +exclusive\n"
+        }
+    }
+    if {[file exists ${prefix}/Library/Frameworks/QtCore.framework/Versions/5/Headers/QtCore]} {
+        conflicts-append    qt5-mac
+    }
+    checksum {}
+    extract {}
+    patch {}
+    post-patch {}
+    configure {}
+    build {}
+    destroot {
+        set qt_vers [split ${version} "."]
+        set qt_major [lindex ${qt_vers} 0]
+        set qt_minor [lindex ${qt_vers} 1]
+        set qt_patch [lindex ${qt_vers} 2]
+        exec mkdir -p ${destroot}/${prefix}/lib ${destroot}/${prefix}/Library/Frameworks
+        foreach fixfile [exec find ${qt_frameworks_dir} \
+                             -name "*.framework"] {
+
+            set tf_full [strsed ${fixfile} {s@\\.framework@@}]
+            set tf [strsed ${tf_full} {g@.*\/@@}]
+            ln -s ${tf_full}.framework/${tf} ${destroot}/${prefix}/lib/lib${tf}.${qt_major}.dylib
+            ln -s ${tf_full}.framework/${tf} ${destroot}/${prefix}/lib/lib${tf}.${qt_major}.${qt_minor}.dylib
+            ln -s ${tf_full}.framework/${tf} ${destroot}/${prefix}/lib/lib${tf}.${qt_major}.${qt_minor}.${qt_patch}.dylib
+            ln -s ${tf_full}.framework       ${destroot}/${prefix}/Library/Frameworks/${tf}.framework
+        }
+    }
+}
+
+livecheck.type      regex
+livecheck.url       http://download.qt-project.org/official_releases/qt/${branch}/
+livecheck.regex     >(\[0-9.\]+)/<
diff --git a/aqua/qt4-mac/files/debug-negative-qtimerint.patch b/aqua/qt4-mac/files/debug-negative-qtimerint.patch
new file mode 100644
index 0000000..d2897dd
--- /dev/null
+++ b/aqua/qt4-mac/files/debug-negative-qtimerint.patch
@@ -0,0 +1,87 @@
+--- src/corelib/kernel/orig.qobject.cpp	2014-04-10 20:37:11.000000000 +0200
++++ src/corelib/kernel/qobject.cpp	2014-12-09 00:43:41.000000000 +0100
+@@ -1597,12 +1597,83 @@
+     \sa timerEvent(), killTimer(), QTimer::singleShot()
+ */
+ 
++#include <unistd.h>
++#include <execinfo.h>
++#include <cxxabi.h>
++
++static QString maybeDemangledName(char *name)
++{
++    const int len = strlen(name);
++    QByteArray in = QByteArray::fromRawData(name, len);
++#ifdef Q_OS_MAC
++    const int mangledNameStart = in.indexOf(" _"), startOffset = 1;
++#elif defined(__FreeBSD__)
++    const int mangledNameStart = in.indexOf(" <_"), startOffset = 2;
++#elif defined(__sun) && defined(__SVR4)
++    const int mangledNameStart = in.indexOf("'"), startOffset = 0;
++#else
++    const int mangledNameStart = in.indexOf("(_"), startOffset = 1;
++#endif
++    if (mangledNameStart >= 0) {
++        int mangledNameEnd = in.indexOf('+', mangledNameStart + 2);
++        // check for and suppress trailing whitespace:
++        if (mangledNameEnd > 1 && isspace(name[mangledNameEnd-1])) {
++            mangledNameEnd -= 1;
++            while (mangledNameEnd > 1 && isspace(name[mangledNameEnd-1])) {
++                --mangledNameEnd;
++            }
++        }
++        if (mangledNameEnd >= 0) {
++            int status;
++            // if we forget about this line and the one that undoes its effect we don't change the
++            // internal data of the QByteArray::fromRawData() ;)
++            const char endChar = name[mangledNameEnd];
++            name[mangledNameEnd] = 0;
++            char *demangled = abi::__cxa_demangle(name + mangledNameStart + startOffset, 0, 0, &status);
++            name[mangledNameEnd] = endChar;
++            if (demangled) {
++                QString ret = QString::fromLatin1(name, mangledNameStart + startOffset) +
++                              QString::fromLatin1(demangled) +
++                              QString::fromLatin1(name + mangledNameEnd, len - mangledNameEnd);
++                free(demangled);
++                return ret;
++            }
++        }
++    }
++    return QString::fromLatin1(name);
++}
++
++QString kRealBacktrace(int levels)
++{
++    QString s;
++    void* trace[256];
++    int n = backtrace(trace, 256);
++    if (!n)
++	return s;
++    char** strings = backtrace_symbols (trace, n);
++
++    if ( levels != -1 )
++        n = qMin( n, levels );
++    s = QLatin1String("[\n");
++
++    for (int i = 0; i < n; ++i)
++        s += QString::number(i) + QLatin1String(": ") +
++             maybeDemangledName(strings[i]) + QLatin1Char('\n');
++    s += QLatin1String("]\n");
++    if (strings)
++        free (strings);
++    return s;
++}
++
++
+ int QObject::startTimer(int interval)
+ {
+     Q_D(QObject);
+ 
+     if (interval < 0) {
+-        qWarning("QObject::startTimer: QTimer cannot have a negative interval");
++        //qWarning("QObject::startTimer: QTimer cannot have a negative interval");
++        qWarning() << "QObject::startTimer: QTimer" << this << "cannot have a negative interval" << interval << "pid=" << getpid()
++	   	<< kRealBacktrace(-1);
+         return 0;
+     }
+ 
diff --git a/aqua/qt4-mac/files/disable-exceptions.patch b/aqua/qt4-mac/files/disable-exceptions.patch
new file mode 100644
index 0000000..569d6d4
--- /dev/null
+++ b/aqua/qt4-mac/files/disable-exceptions.patch
@@ -0,0 +1,71 @@
+--- orig.configure	2014-12-09 00:30:18.000000000 +0100
++++ configure	2014-12-11 21:38:33.000000000 +0100
+@@ -7881,15 +7881,15 @@
+     QT_CONFIG="$QT_CONFIG concurrent"
+ fi
+ 
+-if [ "$CFG_XMLPATTERNS" = "yes" -a "$CFG_EXCEPTIONS" = "no" ]; then
+-    echo "QtXmlPatterns was requested, but it can't be built due to exceptions being disabled."
+-    exit 1
+-fi
+-if [ "$CFG_XMLPATTERNS" = "auto" -a "$CFG_EXCEPTIONS" != "no" ]; then
++#if [ "$CFG_XMLPATTERNS" = "yes" -a "$CFG_EXCEPTIONS" = "no" ]; then
++#    echo "QtXmlPatterns was requested, but it can't be built due to exceptions being disabled."
++#    exit 1
++#fi
++#if [ "$CFG_XMLPATTERNS" = "auto" -a "$CFG_EXCEPTIONS" != "no" ]; then
+     CFG_XMLPATTERNS="$canBuildQtXmlPatterns"
+-elif [ "$CFG_EXCEPTIONS" = "no" ]; then
+-    CFG_XMLPATTERNS="no"
+-fi
++#elif [ "$CFG_EXCEPTIONS" = "no" ]; then
++#    CFG_XMLPATTERNS="no"
++#fi
+ if [ "$CFG_XMLPATTERNS" = "yes" ]; then
+     QT_CONFIG="$QT_CONFIG xmlpatterns"
+ else
+--- src/xmlpatterns/utils/orig.qpatternistlocale_p.h	2014-04-10 20:37:12.000000000 +0200
++++ src/xmlpatterns/utils/qpatternistlocale_p.h	2014-12-11 23:58:30.000000000 +0100
+@@ -274,7 +274,8 @@
+ #endif
+ 
+ #ifdef QT_NO_EXCEPTIONS
+-#error "Patternist uses exceptions and cannot be built without."
++// #error "Patternist uses exceptions and cannot be built without."
++#warning "Patternist uses exceptions and will ignore the fact QtCore is built without"
+ #endif
+ 
+ QT_END_NAMESPACE
+--- src/xmlpatterns/orig.xmlpatterns.pro	2014-12-16 13:58:27.000000000 +0100
++++ src/xmlpatterns/xmlpatterns.pro	2014-12-16 13:59:46.000000000 +0100
+@@ -2,8 +2,13 @@
+ QPRO_PWD = $$PWD
+ QT = core \
+     network
++DEFINES -= QT_NO_EXCEPTIONS
+ DEFINES += QT_BUILD_XMLPATTERNS_LIB \
+-    QT_NO_USING_NAMESPACE
++    QT_NO_USING_NAMESPACE QT_EXCEPTIONS
++QMAKE_CXXFLAGS_EXCEPTIONS_OFF -= -fno-exceptions
++QMAKE_CFLAGS -= -fno-exceptions
++QMAKE_CXXFLAGS -= -fno-exceptions
++QMAKE_LFLAGS -= -fno-exceptions
+ win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x61000000
+ unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore \
+     QtNetwork
+--- src/corelib/orig.corelib.pro	2014-12-16 13:46:18.000000000 +0100
++++ src/corelib/corelib.pro	2014-12-16 13:47:05.000000000 +0100
+@@ -1,7 +1,12 @@
+ TARGET	   = QtCore
+ QPRO_PWD   = $$PWD
+ QT         =
+-DEFINES   += QT_BUILD_CORE_LIB QT_NO_USING_NAMESPACE
++DEFINES   -= QT_NO_EXCEPTIONS
++DEFINES   += QT_BUILD_CORE_LIB QT_NO_USING_NAMESPACE QT_EXCEPTIONS
++QMAKE_CXXFLAGS_EXCEPTIONS_OFF -= -fno-exceptions
++QMAKE_CFLAGS -= -fno-exceptions
++QMAKE_CXXFLAGS -= -fno-exceptions
++QMAKE_LFLAGS -= -fno-exceptions
+ win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x67000000
+ irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
+ 
diff --git a/aqua/qt4-mac/files/patch-QAction_isEnabled.diff b/aqua/qt4-mac/files/patch-QAction_isEnabled.diff
new file mode 100644
index 0000000..6a3b353
--- /dev/null
+++ b/aqua/qt4-mac/files/patch-QAction_isEnabled.diff
@@ -0,0 +1,11 @@
+--- src/gui/kernel/orig.qaction.cpp	2015-01-06 02:45:31.000000000 +0100
++++ src/gui/kernel/qaction.cpp	2015-01-06 02:32:22.000000000 +0100
+@@ -1127,7 +1127,7 @@
+ bool QAction::isEnabled() const
+ {
+     Q_D(const QAction);
+-    return d->enabled;
++    return d ? d->enabled : false;
+ }
+ 
+ /*!
diff --git a/aqua/qt4-mac/files/prevent_addTitleRelated_crash.patch b/aqua/qt4-mac/files/prevent_addTitleRelated_crash.patch
new file mode 100644
index 0000000..168eb3d
--- /dev/null
+++ b/aqua/qt4-mac/files/prevent_addTitleRelated_crash.patch
@@ -0,0 +1,11 @@
+--- src/gui/kernel/orig.qwidget_mac.mm	2014-10-03 15:06:54.000000000 +0200
++++ src/gui/kernel/qwidget_mac.mm	2014-10-03 15:08:07.000000000 +0200
+@@ -4619,7 +4619,7 @@
+ 
+         setWSGeometry(false, oldRect);
+ 
+-        if (isResize && QApplicationPrivate::graphicsSystem())
++        if (isResize && q->parentWidget() && QApplicationPrivate::graphicsSystem())
+             invalidateBuffer_resizeHelper(oldp, olds);
+     }
+ 
diff --git a/aqua/qt4-mac/files/qconfig-remove-EXCEPTIONS.diff b/aqua/qt4-mac/files/qconfig-remove-EXCEPTIONS.diff
new file mode 100644
index 0000000..03cce47
--- /dev/null
+++ b/aqua/qt4-mac/files/qconfig-remove-EXCEPTIONS.diff
@@ -0,0 +1,15 @@
+--- QtCore.framework/Headers/orig.qconfig.h	2014-12-16 21:48:09.000000000 +0100
++++ QtCore.framework/Headers/qconfig.h	2015-01-01 11:36:10.000000000 +0100
+@@ -74,12 +74,6 @@
+ # define QT_NO_EGL
+ #endif
+ 
+-#if defined(QT_NO_EXCEPTIONS) && defined(QT_EXCEPTIONS)
+-# undef QT_NO_EXCEPTIONS
+-#elif !defined(QT_NO_EXCEPTIONS) && !defined(QT_EXCEPTIONS)
+-# define QT_NO_EXCEPTIONS
+-#endif
+-
+ #if defined(QT_NO_FREETYPE) && defined(QT_FREETYPE)
+ # undef QT_NO_FREETYPE
+ #elif !defined(QT_NO_FREETYPE) && !defined(QT_FREETYPE)
diff --git a/aqua/qt4-mac/files/qprocess-nozombies.patch b/aqua/qt4-mac/files/qprocess-nozombies.patch
new file mode 100644
index 0000000..b91a21f
--- /dev/null
+++ b/aqua/qt4-mac/files/qprocess-nozombies.patch
@@ -0,0 +1,23 @@
+--- src/corelib/io/orig.qprocess_unix.cpp	2014-04-10 20:37:11.000000000 +0200
++++ src/corelib/io/qprocess_unix.cpp	2014-12-11 17:03:26.000000000 +0100
+@@ -1296,17 +1296,18 @@
+     processManager()->remove(q);
+ }
+ 
++//https://codereview.qt-project.org/#/c/61294/
+ bool QProcessPrivate::waitForDeadChild()
+ {
+     Q_Q(QProcess);
+ 
+     // read a byte from the death pipe
+     char c;
+-    qt_safe_read(deathPipe[0], &c, 1);
++    qint64 readcount = qt_safe_read(deathPipe[0], &c, 1);
+ 
+     // check if our process is dead
+     int exitStatus;
+-    if (qt_safe_waitpid(pid_t(pid), &exitStatus, WNOHANG) > 0) {
++    if (qt_safe_waitpid(pid_t(pid), &exitStatus, readcount > 0 ? WNOHANG : 0) > 0) {
+         processManager()->remove(q);
+         crashed = !WIFEXITED(exitStatus);
+         exitCode = WEXITSTATUS(exitStatus);
diff --git a/aqua/qt4-mac/files/qt4-correct-systraymenu-iconhandling.patch b/aqua/qt4-mac/files/qt4-correct-systraymenu-iconhandling.patch
new file mode 100644
index 0000000..7996304
--- /dev/null
+++ b/aqua/qt4-mac/files/qt4-correct-systraymenu-iconhandling.patch
@@ -0,0 +1,21 @@
+--- src/gui/util/orig.qsystemtrayicon_mac.mm	2014-04-10 20:37:12.000000000 +0200
++++ src/gui/util/qsystemtrayicon_mac.mm	2014-09-15 19:48:07.000000000 +0200
+@@ -341,7 +341,7 @@
+ -(void)mousePressed:(NSEvent *)mouseEvent button:(Qt::MouseButton)mouseButton
+ {
+     down = YES;
+-    int clickCount = [mouseEvent clickCount];  
++    int clickCount = [mouseEvent clickCount];
+     [self setNeedsDisplay:YES];
+ 
+ #ifndef QT_MAC_USE_COCOA
+@@ -532,7 +532,8 @@
+             [item setState:action->isChecked() ? NSOnState : NSOffState];
+             [item setToolTip:(NSString*)QCFString::toCFStringRef(action->toolTip())];
+             const QIcon icon = action->icon();
+-            if(!icon.isNull()) {
++		  // RJVB 20140915: don't forget to check against isIconVisibleInMenu()!
++            if(!icon.isNull() && action->isIconVisibleInMenu()) {
+ #ifndef QT_MAC_USE_COCOA
+                 const short scale = GetMBarHeight();
+ #else
diff --git a/aqua/qt4-mac/files/qt4-deactivate-menurole-heuristics.patch b/aqua/qt4-mac/files/qt4-deactivate-menurole-heuristics.patch
new file mode 100644
index 0000000..81cc723
--- /dev/null
+++ b/aqua/qt4-mac/files/qt4-deactivate-menurole-heuristics.patch
@@ -0,0 +1,45 @@
+--- src/gui/widgets/orig.qmenu_mac.mm	2014-04-10 20:37:12.000000000 +0200
++++ src/gui/widgets/qmenu_mac.mm	2014-09-16 16:25:00.000000000 +0200
+@@ -638,7 +638,7 @@
+ 
+ static NSMenuItem *createNSMenuItem(const QString &title)
+ {
+-    NSMenuItem *item = [[NSMenuItem alloc] 
++    NSMenuItem *item = [[NSMenuItem alloc]
+                          initWithTitle:qt_mac_QStringToNSString(title)
+                          action:@selector(qtDispatcherToQAction:) keyEquivalent:@""];
+     [item setTarget:nil];
+@@ -852,32 +852,7 @@
+ #endif
+         break;
+     case QAction::TextHeuristicRole: {
+-        QString aboutString = QMenuBar::tr("About").toLower();
+-        if (t.startsWith(aboutString) || t.endsWith(aboutString)) {
+-            if (t.indexOf(QRegExp(QString::fromLatin1("qt$"), Qt::CaseInsensitive)) == -1) {
+-#ifndef QT_MAC_USE_COCOA
+-                ret = kHICommandAbout;
+-#else
+-                ret = [loader aboutMenuItem];
+-#endif
+-            } else {
+-#ifndef QT_MAC_USE_COCOA
+-                ret = kHICommandAboutQt;
+-#else
+-                ret = [loader aboutQtMenuItem];
+-#endif
+-            }
+-        } else if (t.startsWith(QMenuBar::tr("Config").toLower())
+-                   || t.startsWith(QMenuBar::tr("Preference").toLower())
+-                   || t.startsWith(QMenuBar::tr("Options").toLower())
+-                   || t.startsWith(QMenuBar::tr("Setting").toLower())
+-                   || t.startsWith(QMenuBar::tr("Setup").toLower())) {
+-#ifndef QT_MAC_USE_COCOA
+-            ret = kHICommandPreferences;
+-#else
+-            ret = [loader preferencesMenuItem];
+-#endif
+-        } else if (t.startsWith(QMenuBar::tr("Quit").toLower())
++	   if (t.startsWith(QMenuBar::tr("Quit").toLower())
+                    || t.startsWith(QMenuBar::tr("Exit").toLower())) {
+ #ifndef QT_MAC_USE_COCOA
+             ret = kHICommandQuit;
diff --git a/aqua/qt4-mac/files/silence-qfilesystemwatcher.patch b/aqua/qt4-mac/files/silence-qfilesystemwatcher.patch
new file mode 100644
index 0000000..171ff8d
--- /dev/null
+++ b/aqua/qt4-mac/files/silence-qfilesystemwatcher.patch
@@ -0,0 +1,15 @@
+--- src/corelib/io/orig.qfilesystemwatcher.cpp	2014-04-10 20:37:11.000000000 +0200
++++ src/corelib/io/qfilesystemwatcher.cpp	2014-12-11 13:33:27.000000000 +0100
+@@ -544,9 +544,9 @@
+     if(engine)
+         p = engine->addPaths(p, &d->files, &d->directories);
+ 
+-    if (!p.isEmpty())
+-        qWarning("QFileSystemWatcher: failed to add paths: %s",
+-                 qPrintable(p.join(QLatin1String(", "))));
++//     if (!p.isEmpty())
++//         qWarning("QFileSystemWatcher: failed to add paths: %s",
++//                  qPrintable(p.join(QLatin1String(", "))));
+ }
+ 
+ /*!
diff --git a/devel/qca-ossl/Portfile b/devel/qca-ossl/Portfile
index 84ad599..240d89e 100644
--- a/devel/qca-ossl/Portfile
+++ b/devel/qca-ossl/Portfile
@@ -6,7 +6,7 @@ PortGroup           qt4 1.0
 
 name                qca-ossl
 version             2.0.0-beta3
-revision            4
+revision            5
 categories          devel crypto security
 license             LGPL-2.1+
 maintainers         michaelld openmaintainer
@@ -60,7 +60,7 @@ post-patch {
 
 post-destroot {
     # fix library path of installed library/ies
-    foreach fixfile [exec find ${destroot}${qt_dir} -name "*.dylib" | \
+    foreach fixfile [exec find ${destroot}${qt_plugins_dir} -name "*.dylib" | \
                          sed -e "s@${destroot}@@g"] {
         system "install_name_tool -id ${fixfile} ${destroot}${fixfile}"
     }
diff --git a/devel/qca/Portfile b/devel/qca/Portfile
index c6a1a32..b6663e1 100644
--- a/devel/qca/Portfile
+++ b/devel/qca/Portfile
@@ -6,7 +6,7 @@ PortGroup           qt4 1.0
 
 name                qca
 version             2.0.3
-revision            1
+revision            2
 set branch          [join [lrange [split ${version} .] 0 1] .]
 categories          devel crypto security
 maintainers         michaelld openmaintainer
@@ -27,6 +27,10 @@ checksums            md5     fc15bd4da22b8096c51fcfe52d2fa309 \
                      sha1    9c868b05b81dce172c41b813de4de68554154c60 \
                      rmd160  333cfdce91fedfaec09c205528de52d7b569c521
 
+if {[info exists qt4_is_concurrent]} {
+    variant libsymlinks description {Allows existing Qt4 applications to function without rebuilding} {}
+}
+
 # (1) correct pkgconfig file for framework install, if selected.
 # (2) allow for 'debug' and 'framework' options at the same time.
 #     This change is needed to allow for +debug [+framework] --
@@ -59,6 +63,7 @@ configure.pre_args   --prefix=${qt_dir}
 # use variants to change everything except framework
 configure.args        --verbose         \
                       --qtdir=${qt_dir} \
+                      --includedir=${qt_includes_dir} \
                       --release         \
                       --no-framework
 
@@ -90,6 +95,13 @@ post-destroot {
     xinstall -d -m 755 ${destroot}${qt_cmake_module_dir}
     xinstall -m 644 -W ${filespath} FindQCA2.cmake \
         ${destroot}${qt_cmake_module_dir}
+    if {[info exists qt4_is_concurrent]} {
+        # is there an official way to test if a port has been installed, qt4-mac-transitional in this case?
+        if {[file exists ${prefix}/lib/libQtCore.4.dylib]} {
+            ln -s ${qt_libs_dir}/libqca.2.dylib ${destroot}${prefix}/lib
+        }
+        move ${destroot}${qt_libs_dir}/pkgconfig/qca2.pc ${destroot}/${qt_pkg_config_dir}
+    }
 }
 
 variant debug description \
