diff --git a/aqua/qt4-mac-devel/Portfile b/aqua/qt4-mac-devel/Portfile
index 073952a..ccad104 100644
--- a/aqua/qt4-mac-devel/Portfile
+++ b/aqua/qt4-mac-devel/Portfile
@@ -1,32 +1,20 @@
-# -*- 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 99527 2012-11-08 14:30:05Z michaelld@macports.org $
+# -*- 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:nomodify
+# $Id: Portfile 126922 2014-10-17 18:50:56Z ryandesign@macports.org $
 
 PortSystem          1.0
 
 name                qt4-mac-devel
-set ver_nums        4.8.3
-version             ${ver_nums}
-revision            1
-categories          aqua
-platforms           macosx
-maintainers         michaelld openmaintainer
-license             {LGPL-2.1 GPL-3}
+version             4.8.7
 
-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.
-
-# disable this port for now
-
-replaced_by qt4-mac
-
-livecheck.type      none
-
-pre-configure {
-    ui_error "This port has been temporarily replaced by 'qt4-mac'; it will be updated to 5.0 beta or a release candidate hopefully soon."
-    return -code error
+if {[catch {source "${portpath}/Portfile.qt487"} err]} {
+    puts stderr "Error reading Portfile.qt487: $err"
+    return 1; 
 }
 
-distfiles
+subport ${name}-transitional {
+	conflicts           qt3 qt3-mac qt4-mac qt4-mac-sqlite3-plugin qt4-mac-transitional
+    if {[file exists ${prefix}/Library/Frameworks/QtCore.framework/Versions/5/QtCore]} {
+        conflicts       qt5-mac
+    }
+    universal_variant   no
+}
diff --git a/aqua/qt4-mac-devel/Portfile.qt487 b/aqua/qt4-mac-devel/Portfile.qt487
new file mode 100644
index 0000000..5d1690a
--- /dev/null
+++ b/aqua/qt4-mac-devel/Portfile.qt487
@@ -0,0 +1,1262 @@
+# -*- 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:nomodified
+# kate: backspace-indents true; indent-pasted-text true; indent-width 4; keep-extra-spaces true; remove-trailing-spaces modified; replace-tabs true; replace-tabs-save true; syntax Tcl/Tk; tab-indents true; tab-width 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]} {
+    # 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          [qt_branch]
+
+categories          aqua
+platforms           macosx
+maintainers         michaelld gmail.com:rjvbertin openmaintainer
+license             {LGPL-2.1 GPL-3}
+
+homepage            http://qt.io
+set snapshot        2015-04-07-6
+description         Qt Tool Kit, snapshot ${snapshot}
+long_description    Qt Tool Kit (snapshot ${snapshot}): 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}
+distfiles           qt-everywhere-opensource-src-${version}-${snapshot}${extract.suffix}
+
+master_sites        http://download.qt.io/snapshots/qt/${branch}/${version}/${snapshot}
+
+checksums           rmd160  45800f580ea8e20dee30142b14581133307ad4ad \
+                    sha256  d260ea96436510ee7d45ce65eff93e31d23abdca143a40c37345b70dd5813731
+
+# Qt4 is large enough to extend "base" behaviour transparently, enabling HFS compression.
+depends_extract-append      port:libarchive
+extract.post_args           "| bsdtar -x -k --hfsCompression"
+
+# post-extract {
+#     ui_msg "patchfiles:\n${patchfiles}"
+# }
+
+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]
+}
+
+if {${subport} eq ${name}} {
+
+    PortGroup           select 1.0
+    select.group        qt
+    select.file         ${filespath}/qt4
+
+    ###############################################
+    # 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
+
+    # (26) don't build with exceptions, which gives a completely ABI-compatible build
+    patchfiles-append       disable-exceptions.patch
+
+    # (27) build the qtconfig tool
+    patchfiles-append       patch-tools-build_qtconfig.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
+
+## The main port that installs Qt4:
+if {${subport} eq "${name}"} {
+
+    # 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.
+    # the sqlite3 plugin ("sqlite") has been re-absorbed into the main port however
+    configure.args-append -system-sqlite
+    depends_lib-append port:sqlite3
+    foreach driver {mysql odbc psql sqlite2} {
+        configure.args-append -no-sql-${driver}
+    }
+
+    configure.args-append   -no-exceptions
+
+    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}/[string tolower ${texe}]
+
+        }
+        if {![variant_isset examples]} {
+            file delete -force ${qt_apps_dir}/examples
+        }
+
+        # 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${qt_major}
+            ln -s ${qt_moc_cmd} ${destroot}/${prefix}/bin/moc-qt${qt_major}
+            ln -s ${qt_uic_cmd} ${destroot}/${prefix}/bin/uic-qt${qt_major}
+            ln -s ${qt_lrelease_cmd} ${destroot}/${prefix}/bin/lrelease-qt${qt_major}
+        }
+        if {[variant_isset KDE]} {
+            # expose KDE4 styles to Qt4:
+            ln -s ${prefix}/lib/kde4/plugins/styles ${destroot}${qt_plugins_dir}/
+        }
+        if {![variant_isset exceptions ]} {
+            # 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-deactivate-menurole-heuristics.patch \
+                           prevent_addTitleRelated_crash.patch \
+                           debug-negative-qtimerint.patch \
+                           silence-qfilesystemwatcher.patch \
+                           patch-QAction_isEnabled.diff
+    }
+
+    variant exceptions description {build using exceptions internally (useless, but traditional)} {
+        patchfiles-delete       disable-exceptions.patch
+        configure.args-delete   -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
+        }
+    }
+}
+
+# this code copied from the qt4-mac-sqlite2-plugin Portfile:
+subport ${name}-sqlite3-plugin {
+    set DB              sqlite2
+
+    description         Qt sqlite database plugin for sqlite2
+    long_description    ${description}
+    conflicts-append    qt4-mac-sqlite2-plugin
+    depends_lib-append  port:sqlite2
+    configure.args-append \
+                        INCLUDEPATH+=${worksrcpath}/include \
+                        LIBS+="-L${prefix}/lib -lsqlite"
+
+    configure.post_args sqlite2.pro
+
+    variant debug description {Build both release and debug plugin} {}
+
+    pre-configure {
+        configure.args-append CONFIG+=\"${qt_arch_types}\"
+    }
+
+    post-patch {
+        if {![variant_isset debug]} {
+            reinplace "s@debug_and_release@release@" \
+                ${worksrcpath}/src/plugins/qpluginbase.pri
+        }
+    }
+
+    set DRIVER          src/sql/drivers/${DB}
+    set PLUGIN          src/plugins/sqldrivers/${DB}
+
+    extract.post_args   | tar -xf - \
+                        ${distname}/${DRIVER} \
+                        ${distname}/${PLUGIN} \
+                        ${distname}/src/plugins/sqldrivers/qsqldriverbase.pri \
+                        ${distname}/src/plugins/qpluginbase.pri \
+                        ${distname}/src/qt_targets.pri \
+                        ${distname}/include/QtSql/private \
+                        ${distname}/src/sql/kernel
+
+    configure.dir       ${worksrcpath}/${PLUGIN}
+    configure.env-append \
+                        QMAKESPEC=${qt_mkspecs_dir}/${qt_qmake_spec}
+
+    configure.cmd       ${qt_qmake_cmd}
+    configure.pre_args  PREFIX=${prefix}
+
+    build.dir           ${worksrcpath}/${PLUGIN}
+    build.target        {}
+}
+
+livecheck.type      regex
+livecheck.url       http://download.qt.io/official_releases/qt/${branch}/
+livecheck.regex     >(\[0-9.\]+)/<
diff --git a/aqua/qt4-mac-devel/files/c++11.prf b/aqua/qt4-mac-devel/files/c++11.prf
new file mode 100644
index 0000000..a6509d9
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/c++11.prf
@@ -0,0 +1,3 @@
+QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_CXX11
+QMAKE_OBJECTIVE_CXXFLAGS += $$QMAKE_OBJECTIVE_CXXFLAGS_CXX11
+QMAKE_LFLAGS += $$QMAKE_LFLAGS_CXX11
diff --git a/aqua/qt4-mac-devel/files/c++11/c++11.test b/aqua/qt4-mac-devel/files/c++11/c++11.test
new file mode 100755
index 0000000..fd39829
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/c++11/c++11.test
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+CXX11_SUPPORT=no
+COMPILER=$1
+VERBOSE=$2
+WORKDIR=$3
+
+cd $3
+
+if "$COMPILER" -std=c++11 -c c++11_test.cpp 2>/dev/null 1>&2; then
+    CXX11_SUPPORT=yes
+fi
+rm -f c++11_test.o
+
+if [ "$CXX11_SUPPORT" != "yes" ]; then
+    [ "$VERBOSE" = "yes" ] && echo "C++11 support not detected"
+    exit 0
+else
+    [ "$VERBOSE" = "yes" ] && echo "C++11 support detected"
+    exit 1
+fi
diff --git a/aqua/qt4-mac-devel/files/c++11/c++11_test.cpp b/aqua/qt4-mac-devel/files/c++11/c++11_test.cpp
new file mode 100644
index 0000000..6f134e6
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/c++11/c++11_test.cpp
@@ -0,0 +1,12 @@
+// from Qt 5.0
+
+#if __cplusplus >= 201103L || defined(__GXX_EXPERIMENTAL_CXX0X__)
+#else
+#  error "__cplusplus must be >= 201103L, or __GXX_EXPERIMENTAL_CXX0X__ must be defined"
+#endif
+
+constexpr int get_five() {return 5;}
+
+int some_value[get_five() + 7];
+
+int main(int, char **) { return 0; }
diff --git a/aqua/qt4-mac-devel/files/cpath/cpath.test b/aqua/qt4-mac-devel/files/cpath/cpath.test
new file mode 100755
index 0000000..c6da16d
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/cpath/cpath.test
@@ -0,0 +1,34 @@
+#!/bin/sh
+
+CPATH_SUPPORT=no
+COMPILER=$1
+VERBOSE=$2
+WORKDIR=$3
+
+done=no
+cd $3
+unset CPATH
+
+# (1) do the test, without CPATH; should fail
+if "$COMPILER" -nostdinc -c cpath_test.c 2>/dev/null 1>&2; then
+    echo "Compile seems to work even with CPATH not set; assuming CPATH does not work"
+    done=0
+else
+    # (2) do the test, with CPATH set; should pass
+    export CPATH=.
+    if "$COMPILER" -nostdinc -c cpath_test.c 2>/dev/null 1>&2; then
+	CPATH_SUPPORT=yes
+    fi
+fi
+rm -f cpath_test.o
+
+# if done above, assume it works and exit
+[ "$done" != "no" ] && exit $done
+
+if [ "$CPATH_SUPPORT" != "yes" ]; then
+    [ "$VERBOSE" = "yes" ] && echo "CPATH support not detected"
+    exit 0
+else
+    [ "$VERBOSE" = "yes" ] && echo "CPATH support detected"
+    exit 1
+fi
diff --git a/aqua/qt4-mac-devel/files/cpath/cpath_test.c b/aqua/qt4-mac-devel/files/cpath/cpath_test.c
new file mode 100644
index 0000000..421000c
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/cpath/cpath_test.c
@@ -0,0 +1,8 @@
+#include <cpath_test.h>
+
+int test_cpath = 1;
+
+int main (void) {
+    (void) test_cpath;
+    return (0);
+}
diff --git a/aqua/qt4-mac-devel/files/cpath/cpath_test.h b/aqua/qt4-mac-devel/files/cpath/cpath_test.h
new file mode 100644
index 0000000..9ebc53a
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/cpath/cpath_test.h
@@ -0,0 +1 @@
+extern int test_cpath;
diff --git a/aqua/qt4-mac-devel/files/debug-negative-qtimerint.patch b/aqua/qt4-mac-devel/files/debug-negative-qtimerint.patch
new file mode 100644
index 0000000..d2897dd
--- /dev/null
+++ b/aqua/qt4-mac-devel/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-devel/files/disable-exceptions.patch b/aqua/qt4-mac-devel/files/disable-exceptions.patch
new file mode 100644
index 0000000..569d6d4
--- /dev/null
+++ b/aqua/qt4-mac-devel/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-devel/files/disable-exceptions2.patch b/aqua/qt4-mac-devel/files/disable-exceptions2.patch
new file mode 100644
index 0000000..64f23cf
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/disable-exceptions2.patch
@@ -0,0 +1,17 @@
+--- 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
diff --git a/aqua/qt4-mac-devel/files/fconstant_cfstrings.test b/aqua/qt4-mac-devel/files/fconstant_cfstrings.test
new file mode 100755
index 0000000..d3ce4dc
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/fconstant_cfstrings.test
@@ -0,0 +1,26 @@
+#!/bin/sh
+
+FCONSTANT_CFSTRINGS_SUPPORT=no
+COMPILER=$1
+VERBOSE=$2
+WORKDIR=$3
+
+cd $3
+touch fconstant_cfstrings.c
+
+if "$COMPILER" -fconstant-cfstrings -c fconstant_cfstrings.c 2>/dev/null 1>&2; then
+    if "$COMPILER" -fconstant-cfstrings -c fconstant_cfstrings.c 2>&1 | grep "unrecognized" >/dev/null ; then
+        true
+    else
+        FCONSTANT_CFSTRINGS_SUPPORT=yes
+    fi
+fi
+rm -f fconstant_cfstrings.c fconstant_cfstrings.o
+
+if [ "$FCONSTANT_CFSTRINGS_SUPPORT" != "yes" ]; then
+    [ "$VERBOSE" = "yes" ] && echo "compiler flag -fconstant-cfstrings support not detected"
+    exit 0
+else
+    [ "$VERBOSE" = "yes" ] && echo "compiler flag -fconstant-cfstrings support detected"
+    exit 1
+fi
diff --git a/aqua/qt4-mac-devel/files/library_path/library_path.test b/aqua/qt4-mac-devel/files/library_path/library_path.test
new file mode 100755
index 0000000..9c3486a
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/library_path/library_path.test
@@ -0,0 +1,41 @@
+#!/bin/sh
+
+LIBRARY_PATH_SUPPORT=no
+COMPILER=$1
+VERBOSE=$2
+WORKDIR=$3
+
+done=no
+cd $3
+unset LIBRARY_PATH
+
+# (1) make the library
+if "$COMPILER" -dynamiclib -o library_path_lib.dylib library_path_lib.c 2>/dev/null 1>&2; then
+    # (2) do the test, without LIBRARY_PATH; should fail
+    if "$COMPILER" -nostdinc -I. -o library_path_test library_path_test.c -lrary_path_lib 2>/dev/null 1>&2; then
+	echo "Compile seems to work even with LIBRARY_PATH not set; assuming LIBRARY_PATH does not work"
+	done=0
+    else
+	# (3) do the test, with LIBRARY_PATH set; should pass
+	export LIBRARY_PATH=.
+	if "$COMPILER" -nostdinc -I. -o library_path_test library_path_test.c -lrary_path_lib 2>/dev/null 1>&2; then
+	    LIBRARY_PATH_SUPPORT=yes
+	fi
+    fi
+    rm -f library_path_test.o library_path_test
+else
+    echo "Unable to compile library; please fix this issue"
+    done=0
+fi
+rm -f library_path_lib.dylib library_path_lib.o
+
+# if done above, assume it works and exit
+[ "$done" != "no" ] && exit $done
+
+if [ "$LIBRARY_PATH_SUPPORT" != "yes" ]; then
+    [ "$VERBOSE" = "yes" ] && echo "LIBRARY_PATH support not detected"
+    exit 0
+else
+    [ "$VERBOSE" = "yes" ] && echo "LIBRARY_PATH support detected"
+    exit 1
+fi
diff --git a/aqua/qt4-mac-devel/files/library_path/library_path_lib.c b/aqua/qt4-mac-devel/files/library_path/library_path_lib.c
new file mode 100644
index 0000000..9a19658
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/library_path/library_path_lib.c
@@ -0,0 +1 @@
+int test_cpath;
diff --git a/aqua/qt4-mac-devel/files/library_path/library_path_lib.h b/aqua/qt4-mac-devel/files/library_path/library_path_lib.h
new file mode 100644
index 0000000..9ebc53a
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/library_path/library_path_lib.h
@@ -0,0 +1 @@
+extern int test_cpath;
diff --git a/aqua/qt4-mac-devel/files/library_path/library_path_test.c b/aqua/qt4-mac-devel/files/library_path/library_path_test.c
new file mode 100644
index 0000000..73379c8
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/library_path/library_path_test.c
@@ -0,0 +1,6 @@
+#include <library_path_lib.h>
+
+int main (void) {
+  test_cpath = 1;
+  return (0);
+}
diff --git a/aqua/qt4-mac-devel/files/objc_block/objc_block.test b/aqua/qt4-mac-devel/files/objc_block/objc_block.test
new file mode 100755
index 0000000..e2dcff9
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/objc_block/objc_block.test
@@ -0,0 +1,21 @@
+#!/bin/sh
+
+OBJC_BLOCK_SUPPORT=no
+COMPILER=$1
+VERBOSE=$2
+WORKDIR=$3
+
+cd $3
+
+if "$COMPILER" -c objc_block_test.m 2>/dev/null 1>&2; then
+    OBJC_BLOCK_SUPPORT=yes
+fi
+rm -f objc_block_test.o
+
+if [ "$OBJC_BLOCK_SUPPORT" != "yes" ]; then
+    [ "$VERBOSE" = "yes" ] && echo "Objective-C block (^) support not detected"
+    exit 0
+else
+    [ "$VERBOSE" = "yes" ] && echo "Objective-C block (^) support detected"
+    exit 1
+fi
diff --git a/aqua/qt4-mac-devel/files/objc_block/objc_block_test.m b/aqua/qt4-mac-devel/files/objc_block/objc_block_test.m
new file mode 100644
index 0000000..2b0ea34
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/objc_block/objc_block_test.m
@@ -0,0 +1,10 @@
+double (^multiplyTwoValues)(double, double) =
+  ^(double firstValue, double secondValue) {
+  return firstValue * secondValue;
+};
+
+int main () {
+  double result = multiplyTwoValues(2,4);
+  (void) result;
+  return (0);
+}
diff --git a/aqua/qt4-mac-devel/files/objective_cxx.prf b/aqua/qt4-mac-devel/files/objective_cxx.prf
new file mode 100644
index 0000000..3a89947
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/objective_cxx.prf
@@ -0,0 +1,18 @@
+# Add compiler directives for Objective C++ (.mm) only
+#
+# OBJECTIVE_CXX_SOURCES has already been set in "split_sources"
+
+isEmpty(QMAKE_OBJECTIVE_CXX):QMAKE_OBJECTIVE_CXX = $$QMAKE_CXX
+
+OBJECTIVE_CXX_OBJECTS_DIR = $$OBJECTS_DIR
+isEmpty(OBJECTIVE_CXX_OBJECTS_DIR):OBJECTIVE_CXX_OBJECTS_DIR = .
+isEmpty(QMAKE_EXT_OBJECTIVE_CXX):QMAKE_EXT_OBJECTIVE_CXX = .mm
+
+objective_cxx.dependency_type = TYPE_C
+objective_cxx.variables = QMAKE_OBJECTIVE_CXXFLAGS
+objective_cxx.commands = $$QMAKE_OBJECTIVE_CXX -c $(QMAKE_COMP_QMAKE_OBJECTIVE_CXXFLAGS) $(DEFINES) $(INCPATH) -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
+objective_cxx.output = $$OBJECTIVE_CXX_OBJECTS_DIR/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
+objective_cxx.input = OBJECTIVE_CXX_SOURCES
+objective_cxx.name = Compile ${QMAKE_FILE_IN}
+silent:objective_cxx.commands = @echo objective-cxx ${QMAKE_FILE_IN} && $$objective_cxx.commands
+QMAKE_EXTRA_COMPILERS += objective_cxx
diff --git a/aqua/qt4-mac-devel/files/patch-10.10.diff b/aqua/qt4-mac-devel/files/patch-10.10.diff
new file mode 100644
index 0000000..773f825
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-10.10.diff
@@ -0,0 +1,984 @@
+--- src/corelib/global/qglobal.cpp.orig
++++ src/corelib/global/qglobal.cpp
+@@ -1185,6 +1185,7 @@ bool qSharedBuild()
+     \value MV_10_7     OS X 10.7
+     \value MV_10_8     OS X 10.8
+     \value MV_10_9     OS X 10.9
++    \value MV_10_10    OS X 10.10
+     \value MV_Unknown  An unknown and currently unsupported platform
+ 
+     \value MV_CHEETAH  Apple codename for MV_10_0
+@@ -1197,6 +1198,7 @@ bool qSharedBuild()
+     \value MV_LION     Apple codename for MV_10_7
+     \value MV_MOUNTAINLION Apple codename for MV_10_8
+     \value MV_MAVERICKS    Apple codename for MV_10_9
++    \value MV_YOSEMITE     Apple codename for MV_10_10
+ 
+     \sa WinVersion, SymbianVersion
+ */
+@@ -1674,8 +1676,9 @@ static QSysInfo::MacVersion macVersion()
+ {
+ #if !defined(Q_OS_IOS)
+     SInt32 gestalt_version;
+-    if (Gestalt(gestaltSystemVersion, &gestalt_version) == noErr) {
+-        return QSysInfo::MacVersion(((gestalt_version & 0x00F0) >> 4) + 2);
++    if (Gestalt(gestaltSystemVersionMinor, &gestalt_version) == noErr) {
++        // add 2 because OS X 10.0 is 0x02 in the enum
++        return QSysInfo::MacVersion(gestalt_version + 2);
+     }
+ #endif
+     return QSysInfo::MV_Unknown;
+--- src/corelib/global/qglobal.h.orig
++++ src/corelib/global/qglobal.h
+@@ -304,31 +304,69 @@ namespace QT_NAMESPACE {}
+ #endif
+ 
+ #ifdef Q_OS_DARWIN
+-#  ifdef MAC_OS_X_VERSION_MIN_REQUIRED
+-#    undef MAC_OS_X_VERSION_MIN_REQUIRED
+-#  endif
+-#  define MAC_OS_X_VERSION_MIN_REQUIRED MAC_OS_X_VERSION_10_4
+ #  include <AvailabilityMacros.h>
+-#  if !defined(MAC_OS_X_VERSION_10_3)
+-#     define MAC_OS_X_VERSION_10_3 MAC_OS_X_VERSION_10_2 + 1
++#
++#  // Availability.h was introduced with the OS X 10.6 SDK
++#  if (defined(__MAC_OS_X_VERSION_MAX_ALLOWED) && __MAC_OS_X_VERSION_MAX_ALLOWED >= 1060) || \
++      (defined(MAC_OS_X_VERSION_MAX_ALLOWED) && MAC_OS_X_VERSION_MAX_ALLOWED >= 1060)
++#    include <Availability.h>
++#  endif
++#
++#  ifdef Q_OS_MACX
++#    if !defined(__MAC_OS_X_VERSION_MIN_REQUIRED) || __MAC_OS_X_VERSION_MIN_REQUIRED < 1040
++#       undef __MAC_OS_X_VERSION_MIN_REQUIRED
++#       define __MAC_OS_X_VERSION_MIN_REQUIRED 1040
++#    endif
++#    if !defined(MAC_OS_X_VERSION_MIN_REQUIRED) || MAC_OS_X_VERSION_MIN_REQUIRED < 1040
++#       undef MAC_OS_X_VERSION_MIN_REQUIRED
++#       define MAC_OS_X_VERSION_MIN_REQUIRED 1040
++#    endif
++#  endif
++#
++#  // Numerical checks are preferred to named checks, but to be safe
++#  // we define the missing version names in case Qt uses them.
++#
++#  if !defined(__MAC_10_4)
++#       define __MAC_10_4 1040
++#  endif
++#  if !defined(__MAC_10_5)
++#       define __MAC_10_5 1050
++#  endif
++#  if !defined(__MAC_10_6)
++#       define __MAC_10_6 1060
++#  endif
++#  if !defined(__MAC_10_7)
++#       define __MAC_10_7 1070
++#  endif
++#  if !defined(__MAC_10_8)
++#       define __MAC_10_8 1080
++#  endif
++#  if !defined(__MAC_10_9)
++#       define __MAC_10_9 1090
++#  endif
++#  if !defined(__MAC_10_10)
++#       define __MAC_10_10 101000
+ #  endif
+ #  if !defined(MAC_OS_X_VERSION_10_4)
+-#       define MAC_OS_X_VERSION_10_4 MAC_OS_X_VERSION_10_3 + 1
++#       define MAC_OS_X_VERSION_10_4 1040
+ #  endif
+ #  if !defined(MAC_OS_X_VERSION_10_5)
+-#       define MAC_OS_X_VERSION_10_5 MAC_OS_X_VERSION_10_4 + 1
++#       define MAC_OS_X_VERSION_10_5 1050
+ #  endif
+ #  if !defined(MAC_OS_X_VERSION_10_6)
+-#       define MAC_OS_X_VERSION_10_6 MAC_OS_X_VERSION_10_5 + 1
++#       define MAC_OS_X_VERSION_10_6 1060
+ #  endif
+ #  if !defined(MAC_OS_X_VERSION_10_7)
+-#       define MAC_OS_X_VERSION_10_7 MAC_OS_X_VERSION_10_6 + 1
++#       define MAC_OS_X_VERSION_10_7 1070
+ #  endif
+ #  if !defined(MAC_OS_X_VERSION_10_8)
+-#       define MAC_OS_X_VERSION_10_8 MAC_OS_X_VERSION_10_7 + 1
++#       define MAC_OS_X_VERSION_10_8 1080
+ #  endif
+ #  if !defined(MAC_OS_X_VERSION_10_9)
+-#       define MAC_OS_X_VERSION_10_9 MAC_OS_X_VERSION_10_8 + 1
++#       define MAC_OS_X_VERSION_10_9 1090
++#  endif
++#  if !defined(MAC_OS_X_VERSION_10_10)
++#       define MAC_OS_X_VERSION_10_10 101000
+ #  endif
+ #endif
+ 
+@@ -1630,6 +1668,7 @@ public:
+         MV_10_7 = 0x0009,
+         MV_10_8 = 0x000A,
+         MV_10_9 = 0x000B,
++        MV_10_10 = 0x000C,
+ 
+         /* codenames */
+         MV_CHEETAH = MV_10_0,
+@@ -1641,7 +1680,8 @@ public:
+         MV_SNOWLEOPARD = MV_10_6,
+         MV_LION = MV_10_7,
+         MV_MOUNTAINLION = MV_10_8,
+-        MV_MAVERICKS = MV_10_9
++        MV_MAVERICKS = MV_10_9,
++        MV_YOSEMITE = MV_10_10
+     };
+     static const MacVersion MacintoshVersion;
+ #endif
+--- src/gui/dialogs/qcolordialog_mac.mm.orig
++++ src/gui/dialogs/qcolordialog_mac.mm
+@@ -318,7 +318,7 @@ QT_USE_NAMESPACE
+         // It's important that the modal event loop is stopped before
+         // we accept/reject QColorDialog, since QColorDialog has its
+         // own event loop that needs to be stopped last. 
+-        [NSApp stopModalWithCode:code];
++        [[NSApplication sharedApplication] stopModalWithCode:code];
+     } else {
+         // Since we are not in a modal event loop, we can safely close
+         // down QColorDialog
+@@ -350,7 +350,7 @@ QT_USE_NAMESPACE
+     while (!modalEnded) {
+ #ifndef QT_NO_EXCEPTIONS
+         @try {
+-            [NSApp runModalForWindow:mColorPanel];
++            [[NSApplication sharedApplication] runModalForWindow:mColorPanel];
+             modalEnded = true;
+         } @catch (NSException *) {
+             // For some reason, NSColorPanel throws an exception when
+@@ -358,7 +358,7 @@ QT_USE_NAMESPACE
+             // palette (tab three).
+         }
+ #else
+-        [NSApp runModalForWindow:mColorPanel];
++        [[NSApplication sharedApplication] runModalForWindow:mColorPanel];
+         modalEnded = true;
+ #endif
+     }
+@@ -469,10 +469,10 @@ void QColorDialogPrivate::mac_nativeDialogModalHelp()
+     // Do a queued meta-call to open the native modal dialog so it opens after the new
+     // event loop has started to execute (in QDialog::exec). Using a timer rather than
+     // a queued meta call is intentional to ensure that the call is only delivered when
+-    // [NSApp run] runs (timers are handeled special in cocoa). If NSApp is not
++    // [NSApplication run] runs (timers are handeled special in cocoa). If NSApplication is not
+     // running (which is the case if e.g a top-most QEventLoop has been
+     // interrupted, and the second-most event loop has not yet been reactivated (regardless
+-    // if [NSApp run] is still on the stack)), showing a native modal dialog will fail.
++    // if [NSApplication run] is still on the stack)), showing a native modal dialog will fail.
+     if (delegate){
+         Q_Q(QColorDialog);
+         QTimer::singleShot(1, q, SLOT(_q_macRunNativeAppModalPanel()));
+--- src/gui/dialogs/qfiledialog_mac.mm.orig
++++ src/gui/dialogs/qfiledialog_mac.mm
+@@ -229,7 +229,7 @@ QT_USE_NAMESPACE
+     if ([mSavePanel respondsToSelector:@selector(close)])
+         [mSavePanel close];
+     if ([mSavePanel isSheet])
+-        [NSApp endSheet: mSavePanel];
++        [[NSApplication sharedApplication] endSheet: mSavePanel];
+ }
+ 
+ - (void)showModelessPanel
+@@ -1162,10 +1162,10 @@ void QFileDialogPrivate::mac_nativeDialogModalHelp()
+     // Do a queued meta-call to open the native modal dialog so it opens after the new
+     // event loop has started to execute (in QDialog::exec). Using a timer rather than
+     // a queued meta call is intentional to ensure that the call is only delivered when
+-    // [NSApp run] runs (timers are handeled special in cocoa). If NSApp is not
++    // [NSApplication run] runs (timers are handeled special in cocoa). If NSApplication is not
+     // running (which is the case if e.g a top-most QEventLoop has been
+     // interrupted, and the second-most event loop has not yet been reactivated (regardless
+-    // if [NSApp run] is still on the stack)), showing a native modal dialog will fail.
++    // if [NSApplication run] is still on the stack)), showing a native modal dialog will fail.
+     if (nativeDialogInUse){
+         Q_Q(QFileDialog);
+         QTimer::singleShot(1, q, SLOT(_q_macRunNativeAppModalPanel()));
+--- src/gui/dialogs/qfontdialog_mac.mm.orig
++++ src/gui/dialogs/qfontdialog_mac.mm
+@@ -230,7 +230,7 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
+     mAppModal = true;
+     NSWindow *ourPanel = [mStolenContentView window];
+     [ourPanel setReleasedWhenClosed:NO];
+-    [NSApp runModalForWindow:ourPanel];
++    [[NSApplication sharedApplication] runModalForWindow:ourPanel];
+     QAbstractEventDispatcher::instance()->interrupt();
+ 
+     if (mReturnCode == NSOKButton)
+@@ -256,7 +256,7 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
+ 
+     mAppModal = false;
+     NSWindow *ourPanel = [mStolenContentView window];
+-    [NSApp beginSheet:ourPanel
++    [[NSApplication sharedApplication] beginSheet:ourPanel
+         modalForWindow:window
+         modalDelegate:0
+         didEndSelector:0
+@@ -456,7 +456,7 @@ static QFont qfontForCocoaFont(NSFont *cocoaFont, const QFont &resolveFont)
+ 
+     if (mAppModal) {
+         mReturnCode = code;
+-        [NSApp stopModalWithCode:code];
++        [[NSApplication sharedApplication] stopModalWithCode:code];
+     } else {
+         if (code == NSOKButton)
+             mPriv->fontDialog()->accept();
+@@ -636,10 +636,10 @@ void QFontDialogPrivate::mac_nativeDialogModalHelp()
+     // Do a queued meta-call to open the native modal dialog so it opens after the new
+     // event loop has started to execute (in QDialog::exec). Using a timer rather than
+     // a queued meta call is intentional to ensure that the call is only delivered when
+-    // [NSApp run] runs (timers are handeled special in cocoa). If NSApp is not
++    // [NSApplication run] runs (timers are handeled special in cocoa). If NSApplication is not
+     // running (which is the case if e.g a top-most QEventLoop has been
+     // interrupted, and the second-most event loop has not yet been reactivated (regardless
+-    // if [NSApp run] is still on the stack)), showing a native modal dialog will fail.
++    // if [NSApplication run] is still on the stack)), showing a native modal dialog will fail.
+     if (nativeDialogInUse) {
+         Q_Q(QFontDialog);
+         QTimer::singleShot(1, q, SLOT(_q_macRunNativeAppModalPanel()));
+--- src/gui/kernel/qapplication_mac.mm.orig
++++ src/gui/kernel/qapplication_mac.mm
+@@ -468,7 +468,7 @@ void qt_mac_set_app_icon(const QPixmap &pixmap)
+         image = static_cast<NSImage *>(qt_mac_create_nsimage(pixmap));
+     }
+ 
+-    [NSApp setApplicationIconImage:image];
++    [[NSApplication sharedApplication] setApplicationIconImage:image];
+     [image release];
+ #endif
+ }
+@@ -750,7 +750,7 @@ void qt_event_request_showsheet(QWidget *w)
+     Q_ASSERT(qt_mac_is_macsheet(w));
+ #ifdef QT_MAC_USE_COCOA
+     w->repaint();
+-    [NSApp beginSheet:qt_mac_window_for(w) modalForWindow:qt_mac_window_for(w->parentWidget())
++    [[NSApplication sharedApplication] beginSheet:qt_mac_window_for(w) modalForWindow:qt_mac_window_for(w->parentWidget())
+         modalDelegate:nil didEndSelector:nil contextInfo:0];
+ #else
+     qt_mac_event_remove(request_showsheet_pending);
+@@ -992,7 +992,7 @@ Q_GUI_EXPORT void qt_mac_set_dock_menu(QMenu *menu)
+ {
+     qt_mac_dock_menu = menu;
+ #ifdef QT_MAC_USE_COCOA
+-    [NSApp setDockMenu:menu->macMenu()];
++    [[NSApplication sharedApplication] setDockMenu:menu->macMenu()];
+ #else
+     SetApplicationDockTileMenu(menu->macMenu());
+ #endif
+@@ -1011,7 +1011,7 @@ void qt_mac_event_release(QWidget *w)
+ #ifndef QT_MAC_USE_COCOA
+             SetApplicationDockTileMenu(0);
+ #else
+-            [NSApp setDockMenu:0];
++            [[NSApplication sharedApplication] setDockMenu:0];
+ #endif
+         }
+     }
+@@ -1463,7 +1463,7 @@ QWidget *QApplication::topLevelAt(const QPoint &p)
+     NSWindowList(windowCount, windowList.data());
+     int firstQtWindowFound = -1;
+     for (int i = 0; i < windowCount; ++i) {
+-        NSWindow *window = [NSApp windowWithWindowNumber:windowList[i]];
++        NSWindow *window = [[NSApplication sharedApplication] windowWithWindowNumber:windowList[i]];
+         if (window) {
+             QWidget *candidateWindow = [window QT_MANGLE_NAMESPACE(qt_qwidget)];
+             if (candidateWindow && firstQtWindowFound == -1)
+@@ -3071,7 +3071,7 @@ bool QApplicationPrivate::canQuit()
+ #else
+     Q_Q(QApplication);
+ #ifdef QT_MAC_USE_COCOA
+-    [[NSApp mainMenu] cancelTracking];
++    [[[NSApplication sharedApplication] mainMenu] cancelTracking];
+ #else
+     HiliteMenu(0);
+ #endif
+@@ -3146,7 +3146,7 @@ void onApplicationChangedActivation( bool activated )
+         }
+ 
+         if (!app->activeWindow()) {
+-            OSWindowRef wp = [NSApp keyWindow];
++            OSWindowRef wp = [[NSApplication sharedApplication] keyWindow];
+             if (QWidget *tmp_w = qt_mac_find_window(wp))
+                 app->setActiveWindow(tmp_w);
+         }
+--- src/gui/kernel/qcocoaapplication_mac.mm.orig
++++ src/gui/kernel/qcocoaapplication_mac.mm
+@@ -147,7 +147,7 @@ QT_USE_NAMESPACE
+     if ([event type] == NSApplicationDefined) {
+         switch ([event subtype]) {
+             case QtCocoaEventSubTypePostMessage:
+-                [NSApp QT_MANGLE_NAMESPACE(qt_sendPostedMessage):event];
++                [[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_sendPostedMessage):event];
+                 return true;
+             default:
+                 break;
+@@ -174,7 +174,7 @@ QT_USE_NAMESPACE
+     // be called instead of sendEvent if redirection occurs.
+     // 'self' will then be an instance of NSApplication
+     // (and not QNSApplication)
+-    if (![NSApp QT_MANGLE_NAMESPACE(qt_filterEvent):event])
++    if (![[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_filterEvent):event])
+         [self QT_MANGLE_NAMESPACE(qt_sendEvent_original):event];
+ }
+ 
+@@ -182,7 +182,7 @@ QT_USE_NAMESPACE
+ {
+     // This method will be called if
+     // no redirection occurs
+-    if (![NSApp QT_MANGLE_NAMESPACE(qt_filterEvent):event])
++    if (![[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_filterEvent):event])
+         [super sendEvent:event];
+ }
+ 
+@@ -194,7 +194,7 @@ QT_USE_NAMESPACE
+     // visible on screen. Note: If Qt is used as a plugin, Qt will not use a 
+     // native menu bar. Hence, we will also not need to do any redirection etc. as 
+     // we do with sendEvent.
+-    [[NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender];
++    [[[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender];
+ }
+ 
+ @end
+@@ -203,7 +203,7 @@ QT_BEGIN_NAMESPACE
+ 
+ void qt_redirectNSApplicationSendEvent()
+ {
+-    if ([NSApp isMemberOfClass:[QT_MANGLE_NAMESPACE(QNSApplication) class]]) {
++    if ([[NSApplication sharedApplication] isMemberOfClass:[QT_MANGLE_NAMESPACE(QNSApplication) class]]) {
+         // No need to change implementation since Qt
+         // already controls a subclass of NSApplication
+         return;
+--- src/gui/kernel/qcocoaapplicationdelegate_mac.mm.orig
++++ src/gui/kernel/qcocoaapplicationdelegate_mac.mm
+@@ -122,7 +122,7 @@ static void cleanupCocoaApplicationDelegate()
+     [dockMenu release];
+     [qtMenuLoader release];
+     if (reflectionDelegate) {
+-        [NSApp setDelegate:reflectionDelegate];
++        [[NSApplication sharedApplication] setDelegate:reflectionDelegate];
+         [reflectionDelegate release];
+     }
+     [super dealloc];
+@@ -183,7 +183,7 @@ static void cleanupCocoaApplicationDelegate()
+     return [[qtMenuLoader retain] autorelease];
+ }
+ 
+-// This function will only be called when NSApp is actually running. Before
++// This function will only be called when NSApplication is actually running. Before
+ // that, the kAEQuitApplication Apple event will be sent to
+ // QApplicationPrivate::globalAppleEventProcessor in qapplication_mac.mm
+ - (NSApplicationTerminateReply)applicationShouldTerminate:(NSApplication *)sender
+@@ -249,7 +249,7 @@ static void cleanupCocoaApplicationDelegate()
+         && [reflectionDelegate respondsToSelector:
+                             @selector(applicationShouldTerminateAfterLastWindowClosed:)])
+         return [reflectionDelegate applicationShouldTerminateAfterLastWindowClosed:sender];
+-    return NO; // Someday qApp->quitOnLastWindowClosed(); when QApp and NSApp work closer together.
++    return NO; // Someday qApp->quitOnLastWindowClosed(); when qApp and NSApplication work closer together.
+ }
+ 
+ 
+@@ -289,13 +289,26 @@ static void cleanupCocoaApplicationDelegate()
+     qt_button_down = 0;
+ }
+ 
++- (BOOL)applicationShouldHandleReopen:(NSApplication *)theApplication hasVisibleWindows:(BOOL)flag
++{
++    Q_UNUSED(theApplication);
++    Q_UNUSED(flag);
++    // The reflection delegate gets precedence
++    if (reflectionDelegate
++        && [reflectionDelegate respondsToSelector:@selector(applicationShouldHandleReopen:hasVisibleWindows:)])
++        return [reflectionDelegate applicationShouldHandleReopen:theApplication hasVisibleWindows:flag];
++
++    onApplicationChangedActivation(true);
++    return NO;
++}
++
+ - (void)applicationDidChangeScreenParameters:(NSNotification *)notification
+ {
+     Q_UNUSED(notification);
+     QDesktopWidgetImplementation::instance()->onResize();
+ }
+ 
+-- (void)setReflectionDelegate:(NSObject <NSApplicationDelegate> *)oldDelegate
++- (void)setReflectionDelegate:(id <NSApplicationDelegate>)oldDelegate
+ {
+     [oldDelegate retain];
+     [reflectionDelegate release];
+@@ -342,12 +355,12 @@ static void cleanupCocoaApplicationDelegate()
+ {
+     Q_UNUSED(event);
+     Q_UNUSED(replyEvent);
+-    [NSApp terminate:self];
++    [[NSApplication sharedApplication] terminate:self];
+ }
+ 
+ - (void)qtDispatcherToQAction:(id)sender
+ {
+-    [[NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender];
++    [[[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)] qtDispatcherToQAction:sender];
+ }
+ 
+ @end
+--- src/gui/kernel/qcocoaapplicationdelegate_mac_p.h.orig
++++ src/gui/kernel/qcocoaapplicationdelegate_mac_p.h
+@@ -113,7 +113,7 @@ QT_FORWARD_DECLARE_CLASS(QApplicationPrivate);
+     QApplicationPrivate *qtPrivate;
+     NSMenu *dockMenu;
+     QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *qtMenuLoader;
+-    NSObject <NSApplicationDelegate> *reflectionDelegate;
++    id <NSApplicationDelegate> reflectionDelegate;
+     bool inLaunch;
+ }
+ + (QT_MANGLE_NAMESPACE(QCocoaApplicationDelegate)*)sharedDelegate;
+@@ -122,7 +122,7 @@ QT_FORWARD_DECLARE_CLASS(QApplicationPrivate);
+ - (QApplicationPrivate *)qAppPrivate;
+ - (void)setMenuLoader:(QT_MANGLE_NAMESPACE(QCocoaMenuLoader)*)menuLoader;
+ - (QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *)menuLoader;
+-- (void)setReflectionDelegate:(NSObject <NSApplicationDelegate> *)oldDelegate;
++- (void)setReflectionDelegate:(id <NSApplicationDelegate>)oldDelegate;
+ - (void)getUrl:(NSAppleEventDescriptor *)event withReplyEvent:(NSAppleEventDescriptor *)replyEvent;
+ @end
+ #endif
+--- src/gui/kernel/qcocoamenuloader_mac.mm.orig
++++ src/gui/kernel/qcocoamenuloader_mac.mm
+@@ -92,8 +92,8 @@ QT_USE_NAMESPACE
+     // 'Quit' item. When changing menu bar (e.g when switching between
+     // windows with different menu bars), we never recreate this menu, but
+     // instead pull it out the current menu bar and place into the new one:
+-    NSMenu *mainMenu = [NSApp mainMenu];
+-    if ([NSApp mainMenu] == menu)
++    NSMenu *mainMenu = [[NSApplication sharedApplication] mainMenu];
++    if ([[NSApplication sharedApplication] mainMenu] == menu)
+         return; // nothing to do (menu is the current menu bar)!
+ 
+ #ifndef QT_NAMESPACE
+@@ -201,27 +201,27 @@ QT_USE_NAMESPACE
+ 
+ - (void)terminate:(id)sender
+ {
+-    [NSApp terminate:sender];
++    [[NSApplication sharedApplication] terminate:sender];
+ }
+ 
+ - (void)orderFrontStandardAboutPanel:(id)sender
+ {
+-    [NSApp orderFrontStandardAboutPanel:sender];
++    [[NSApplication sharedApplication] orderFrontStandardAboutPanel:sender];
+ }
+ 
+ - (void)hideOtherApplications:(id)sender
+ {
+-    [NSApp hideOtherApplications:sender];
++    [[NSApplication sharedApplication] hideOtherApplications:sender];
+ }
+ 
+ - (void)unhideAllApplications:(id)sender
+ {
+-    [NSApp unhideAllApplications:sender];
++    [[NSApplication sharedApplication] unhideAllApplications:sender];
+ }
+ 
+ - (void)hide:(id)sender
+ {
+-    [NSApp hide:sender];
++    [[NSApplication sharedApplication] hide:sender];
+ }
+ 
+ - (void)qtUpdateMenubar
+@@ -258,7 +258,7 @@ QT_USE_NAMESPACE
+ 
+  - (void)orderFrontCharacterPalette:(id)sender
+  {
+-     [NSApp orderFrontCharacterPalette:sender];
++     [[NSApplication sharedApplication] orderFrontCharacterPalette:sender];
+  }
+ 
+ - (BOOL)validateMenuItem:(NSMenuItem*)menuItem
+@@ -266,7 +266,7 @@ QT_USE_NAMESPACE
+     if ([menuItem action] == @selector(hide:)
+         || [menuItem action] == @selector(hideOtherApplications:)
+         || [menuItem action] == @selector(unhideAllApplications:)) {
+-        return [NSApp validateMenuItem:menuItem];
++        return [[NSApplication sharedApplication] validateMenuItem:menuItem];
+     } else {
+         return [menuItem isEnabled];
+     }
+--- src/gui/kernel/qcocoasharedwindowmethods_mac_p.h.orig
++++ src/gui/kernel/qcocoasharedwindowmethods_mac_p.h
+@@ -143,7 +143,7 @@ QT_END_NAMESPACE
+ {
+     // This function is called from the quit item in the menubar when this window
+     // is in the first responder chain (see also qtDispatcherToQAction above)
+-    [NSApp terminate:sender];
++    [[NSApplication sharedApplication] terminate:sender];
+ }
+ 
+ - (void)setLevel:(NSInteger)windowLevel
+@@ -364,7 +364,7 @@ QT_END_NAMESPACE
+ 
+     if ([sender draggingSource] != nil) {
+         // modifier flags might have changed, update it here since we don't send any input events.
+-        QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[NSApp currentEvent] modifierFlags]);
++        QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[[NSApplication sharedApplication] currentEvent] modifierFlags]);
+         modifiers = QApplication::keyboardModifiers();
+     } else {
+         // when the source is from another application the above technique will not work.
+@@ -456,7 +456,7 @@ QT_END_NAMESPACE
+ 
+     // Update modifiers:
+     if ([sender draggingSource] != nil) {
+-        QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[NSApp currentEvent] modifierFlags]);
++        QApplicationPrivate::modifier_buttons = qt_cocoaModifiers2QtModifiers([[[NSApplication sharedApplication] currentEvent] modifierFlags]);
+         modifiers = QApplication::keyboardModifiers();
+     } else {
+         modifiers = qt_cocoaDragOperation2QtModifiers(nsActions);
+--- src/gui/kernel/qeventdispatcher_mac.mm.orig
++++ src/gui/kernel/qeventdispatcher_mac.mm
+@@ -461,7 +461,7 @@ static bool qt_mac_send_event(QEventLoop::ProcessEventsFlags, OSEventRef event,
+     if (pt)
+         [pt sendEvent:event];
+     else
+-        [NSApp sendEvent:event];
++        [[NSApplication sharedApplication] sendEvent:event];
+     return true;
+ #endif
+ }
+@@ -521,12 +521,12 @@ static inline void qt_mac_waitForMoreEvents()
+     // (and free up cpu time) until at least one event occur.
+     // This implementation is a bit on the edge, but seems to
+     // work fine:
+-    NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
++    NSEvent* event = [[NSApplication sharedApplication] nextEventMatchingMask:NSAnyEventMask
+         untilDate:[NSDate distantFuture]
+         inMode:NSDefaultRunLoopMode
+         dequeue:YES];
+     if (event)
+-        [NSApp postEvent:event atStart:YES];
++        [[NSApplication sharedApplication] postEvent:event atStart:YES];
+ #endif
+ }
+ 
+@@ -537,12 +537,12 @@ static inline void qt_mac_waitForMoreModalSessionEvents()
+     // (and free up cpu time) until at least one event occur.
+     // This implementation is a bit on the edge, but seems to
+     // work fine:
+-    NSEvent* event = [NSApp nextEventMatchingMask:NSAnyEventMask
++    NSEvent* event = [[NSApplication sharedApplication] nextEventMatchingMask:NSAnyEventMask
+         untilDate:[NSDate distantFuture]
+         inMode:NSModalPanelRunLoopMode
+         dequeue:YES];
+     if (event)
+-        [NSApp postEvent:event atStart:YES];
++        [[NSApplication sharedApplication] postEvent:event atStart:YES];
+ }
+ #endif
+ 
+@@ -588,23 +588,23 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
+         // done from the application itself. And if processEvents is called
+         // manually (rather than from a QEventLoop), we cannot enter a tight
+         // loop and block this call, but instead we need to return after one flush.
+-        // Finally, if we are to exclude user input events, we cannot call [NSApp run]
++        // Finally, if we are to exclude user input events, we cannot call [NSApplication run]
+         // as we then loose control over which events gets dispatched:
+-        const bool canExec_3rdParty = d->nsAppRunCalledByQt || ![NSApp isRunning];
++        const bool canExec_3rdParty = d->nsAppRunCalledByQt || ![[NSApplication sharedApplication] isRunning];
+         const bool canExec_Qt = !excludeUserEvents &&
+                 (flags & QEventLoop::DialogExec || flags & QEventLoop::EventLoopExec) ;
+ 
+         if (canExec_Qt && canExec_3rdParty) {
+             // We can use exec-mode, meaning that we can stay in a tight loop until
+             // interrupted. This is mostly an optimization, but it allow us to use
+-            // [NSApp run], which is the normal code path for cocoa applications.
++            // [NSApplication run], which is the normal code path for cocoa applications.
+             if (NSModalSession session = d->currentModalSession()) {
+                 QBoolBlocker execGuard(d->currentExecIsNSAppRun, false);
+-                while ([NSApp runModalSession:session] == NSRunContinuesResponse && !d->interrupt)
++                while ([[NSApplication sharedApplication] runModalSession:session] == NSRunContinuesResponse && !d->interrupt)
+                     qt_mac_waitForMoreModalSessionEvents();
+ 
+                 if (!d->interrupt && session == d->currentModalSessionCached) {
+-                    // Someone called [NSApp stopModal:] from outside the event
++                    // Someone called [[NSApplication sharedApplication] stopModal:] from outside the event
+                     // dispatcher (e.g to stop a native dialog). But that call wrongly stopped
+                     // 'session' as well. As a result, we need to restart all internal sessions:
+                     d->temporarilyStopAllModalSessions();
+@@ -612,7 +612,7 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
+             } else {
+                 d->nsAppRunCalledByQt = true;
+                 QBoolBlocker execGuard(d->currentExecIsNSAppRun, true);
+-                [NSApp run];
++                [[NSApplication sharedApplication] run];
+             }
+             retVal = true;
+         } else {
+@@ -626,9 +626,9 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
+                     // to use cocoa's native way of running modal sessions:
+                     if (flags & QEventLoop::WaitForMoreEvents)
+                         qt_mac_waitForMoreModalSessionEvents();
+-                    NSInteger status = [NSApp runModalSession:session];
++                    NSInteger status = [[NSApplication sharedApplication] runModalSession:session];
+                     if (status != NSRunContinuesResponse && session == d->currentModalSessionCached) {
+-                        // INVARIANT: Someone called [NSApp stopModal:] from outside the event
++                        // INVARIANT: Someone called [NSApplication stopModal:] from outside the event
+                         // dispatcher (e.g to stop a native dialog). But that call wrongly stopped
+                         // 'session' as well. As a result, we need to restart all internal sessions:
+                         d->temporarilyStopAllModalSessions();
+@@ -637,8 +637,8 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
+                 } else do {
+                     // Dispatch all non-user events (but que non-user events up for later). In
+                     // this case, we need more control over which events gets dispatched, and
+-                    // cannot use [NSApp runModalSession:session]:
+-                    event = [NSApp nextEventMatchingMask:NSAnyEventMask
++                    // cannot use [NSApplication runModalSession:session]:
++                    event = [[NSApplication sharedApplication] nextEventMatchingMask:NSAnyEventMask
+                     untilDate:nil
+                     inMode:NSModalPanelRunLoopMode
+                     dequeue: YES];
+@@ -655,7 +655,7 @@ bool QEventDispatcherMac::processEvents(QEventLoop::ProcessEventsFlags flags)
+                 } while (!d->interrupt && event != nil);
+             } else do {
+                 // INVARIANT: No modal window is executing.
+-                event = [NSApp nextEventMatchingMask:NSAnyEventMask
++                event = [[NSApplication sharedApplication] nextEventMatchingMask:NSAnyEventMask
+                 untilDate:nil
+                 inMode:NSDefaultRunLoopMode
+                 dequeue: YES];
+@@ -798,12 +798,12 @@ void QEventDispatcherMacPrivate::ensureNSAppInitialized()
+     // we let Cocoa finish the initialization it seems to need. We'll only
+     // apply this trick at most once for any application, and we avoid doing it
+     // for the common case where main just starts QApplication::exec.
+-    if (nsAppRunCalledByQt || [NSApp isRunning])
++    if (nsAppRunCalledByQt || [[NSApplication sharedApplication] isRunning])
+         return;
+     nsAppRunCalledByQt = true;
+     QBoolBlocker block1(interrupt, true);
+     QBoolBlocker block2(currentExecIsNSAppRun, true);
+-    [NSApp run];
++    [[NSApplication sharedApplication] run];
+ }
+ 
+ void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions()
+@@ -812,8 +812,8 @@ void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions()
+     // such, make them pending again. The next call to
+     // currentModalSession will recreate them again. The
+     // reason to stop all session like this is that otherwise
+-    // a call [NSApp stop] would not stop NSApp, but rather
+-    // the current modal session. So if we need to stop NSApp
++    // a call [NSApplication stop] would not stop NSApplication, but rather
++    // the current modal session. So if we need to stop NSApplication
+     // we need to stop all the modal session first. To avoid changing
+     // the stacking order of the windows while doing so, we put
+     // up a block that is used in QCocoaWindow and QCocoaPanel:
+@@ -821,7 +821,7 @@ void QEventDispatcherMacPrivate::temporarilyStopAllModalSessions()
+     for (int i=0; i<stackSize; ++i) {
+         QCocoaModalSessionInfo &info = cocoaModalSessionStack[i];
+         if (info.session) {
+-            [NSApp endModalSession:info.session];
++            [[NSApplication sharedApplication] endModalSession:info.session];
+             info.session = 0;
+         }
+     }
+@@ -856,7 +856,7 @@ NSModalSession QEventDispatcherMacPrivate::currentModalSession()
+             info.nswindow = window;
+             [(NSWindow*) info.nswindow retain];
+             int levelBeforeEnterModal = [window level];
+-            info.session = [NSApp beginModalSessionForWindow:window];
++            info.session = [[NSApplication sharedApplication] beginModalSessionForWindow:window];
+             // Make sure we don't stack the window lower that it was before
+             // entering modal, in case it e.g. had the stays-on-top flag set:
+             if (levelBeforeEnterModal > [window level])
+@@ -926,7 +926,7 @@ void QEventDispatcherMacPrivate::cleanupModalSessions()
+         cocoaModalSessionStack.remove(i);
+         currentModalSessionCached = 0;
+         if (info.session) {
+-            [NSApp endModalSession:info.session];
++            [[NSApplication sharedApplication] endModalSession:info.session];
+             [(NSWindow *)info.nswindow release];
+         }
+     }
+@@ -1057,7 +1057,7 @@ inline static void processPostedEvents(QEventDispatcherMacPrivate *const d, cons
+             // pending cocoa events first).
+             if (d->currentModalSessionCached)
+                 d->temporarilyStopAllModalSessions();
+-            [NSApp stop:NSApp];
++            [[NSApplication sharedApplication] stop:[NSApplication sharedApplication]];
+             d->cancelWaitForMoreEvents();
+         }
+ #endif
+@@ -1093,7 +1093,8 @@ void QEventDispatcherMacPrivate::cancelWaitForMoreEvents()
+     // In case the event dispatcher is waiting for more
+     // events somewhere, we post a dummy event to wake it up:
+     QMacCocoaAutoReleasePool pool;
+-    [NSApp postEvent:[NSEvent otherEventWithType:NSApplicationDefined location:NSZeroPoint
++    [[NSApplication sharedApplication] postEvent:[NSEvent otherEventWithType:NSApplicationDefined
++        location:NSZeroPoint
+         modifierFlags:0 timestamp:0. windowNumber:0 context:0
+         subtype:QtCocoaEventSubTypeWakeup data1:0 data2:0] atStart:NO];
+ }
+@@ -1110,7 +1111,7 @@ void QEventDispatcherMac::interrupt()
+ #else
+     // We do nothing more here than setting d->interrupt = true, and
+     // poke the event loop if it is sleeping. Actually stopping
+-    // NSApp, or the current modal session, is done inside the send
++    // NSApplication, or the current modal session, is done inside the send
+     // posted events callback. We do this to ensure that all current pending
+     // cocoa events gets delivered before we stop. Otherwise, if we now stop
+     // the last event loop recursion, cocoa will just drop pending posted
+@@ -1165,7 +1166,7 @@ QtMacInterruptDispatcherHelp::QtMacInterruptDispatcherHelp() : cancelled(false)
+     // The whole point of this class is that we enable a way to interrupt
+     // the event dispatcher when returning back to a lower recursion level
+     // than where interruptLater was called. This is needed to detect if
+-    // [NSApp run] should still be running at the recursion level it is at.
++    // [NSApplication run] should still be running at the recursion level it is at.
+     // Since the interrupt is canceled if processEvents is called before
+     // this object gets deleted, we also avoid interrupting unnecessary.
+     deleteLater();
+--- src/gui/kernel/qt_cocoa_helpers_mac.mm.orig
++++ src/gui/kernel/qt_cocoa_helpers_mac.mm
+@@ -1697,7 +1697,7 @@ void qt_cocoaPostMessage(id target, SEL selector, int argCount, id arg1, id arg2
+     NSEvent *e = [NSEvent otherEventWithType:NSApplicationDefined
+         location:NSZeroPoint modifierFlags:0 timestamp:0 windowNumber:0
+         context:nil subtype:QtCocoaEventSubTypePostMessage data1:lower data2:upper];
+-    [NSApp postEvent:e atStart:NO];
++    [[NSApplication sharedApplication] postEvent:e atStart:NO];
+ }
+ 
+ void qt_cocoaPostMessageAfterEventLoopExit(id target, SEL selector, int argCount, id arg1, id arg2)
+@@ -1727,7 +1727,7 @@ void qt_mac_post_retranslateAppMenu()
+ {
+ #ifdef QT_MAC_USE_COCOA
+     QMacCocoaAutoReleasePool pool;
+-    qt_cocoaPostMessage([NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)], @selector(qtTranslateApplicationMenu));
++    qt_cocoaPostMessage([[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)], @selector(qtTranslateApplicationMenu));
+ #endif
+ }
+ 
+--- src/gui/kernel/qt_mac_p.h.orig
++++ src/gui/kernel/qt_mac_p.h
+@@ -75,6 +75,62 @@
+ 
+ #include <Carbon/Carbon.h>
+ 
++#if !defined(QT_MAC_USE_COCOA) && defined(MAC_OS_X_VERSION_10_7) && MAC_OS_X_VERSION_MAX_ALLOWED >= MAC_OS_X_VERSION_10_7
++    // Some deprecated functions have been removed from the the 10.7 SDK, but the symbols are
++    // still exported by the 32-bit QD.framework (a subframework of ApplicationServices).
++    extern "C" {
++        // from QuickdrawAPI.h
++        // https://developer.apple.com/legacy/library/documentation/Carbon/reference/QuickDraw_Ref/QuickDraw_Ref.pdf
++        void          CopyBits(const BitMap *srcBits, const BitMap *dstBits, const Rect *srcRect, const Rect *dstRect, short mode, RgnHandle maskRgn);
++        void          CopyRgn(RgnHandle srcRgn, RgnHandle dstRgn);
++        void          DisposeRgn(RgnHandle rgn);
++        GDHandle      GetMainDevice(void);
++        const BitMap *GetPortBitMapForCopyBits(CGrafPtr port);
++        Rect         *GetRegionBounds(RgnHandle region, Rect *bounds);
++        RgnHandle     NewRgn(void);
++        OSStatus      QDRegionToRects(RgnHandle rgn, QDRegionParseDirection dir, RegionToRectsUPP proc, void *userData);
++        void          SetEmptyRgn(RgnHandle rgn);
++        void          SetRect(Rect* r, short left, short top, short right, short bottom);
++        void          SetRectRgn(RgnHandle rgn, short left, short top, short right, short bottom);
++        void          UnionRgn(RgnHandle srcRgnA, RgnHandle srcRgnB, RgnHandle dstRgn);
++        enum {
++            kQDRegionToRectsMsgInit       = 1,
++            kQDRegionToRectsMsgParse      = 2,
++            kQDRegionToRectsMsgTerminate  = 3
++        };
++        enum {
++            kQDParseRegionFromTop         = (1 << 0),
++            kQDParseRegionFromBottom      = (1 << 1),
++            kQDParseRegionFromLeft        = (1 << 2),
++            kQDParseRegionFromRight       = (1 << 3),
++            kQDParseRegionFromTopLeft     = kQDParseRegionFromTop | kQDParseRegionFromLeft,
++            kQDParseRegionFromBottomRight = kQDParseRegionFromBottom | kQDParseRegionFromRight
++        };
++
++        // from Fonts.h
++        // https://developer.apple.com/legacy/library/documentation/Carbon/reference/Font_Manager/fm_reference.pdf
++        OSStatus         FMCreateFontIterator(const FMFilter *iFilter, void *iRefCon, OptionBits iOptions, FMFontIterator *ioIterator);
++        OSStatus         FMDisposeFontIterator(FMFontIterator *ioIterator);
++        ATSFontFamilyRef FMGetATSFontFamilyRefFromFont(FMFontFamily iFamily);
++        ATSFontFamilyRef FMGetATSFontFamilyRefFromFontFamily(FMFontFamily iFamily);
++        ATSFontRef       FMGetATSFontRefFromFont(FMFont iFont);
++        OSStatus         FMGetFontFamilyInstanceFromFont(FMFont iFont, FMFontFamily *oFontFamily, FMFontStyle *oStyle);
++        FMFontFamily     FMGetFontFamilyFromATSFontFamilyRef(ATSFontFamilyRef iFamily);
++        FMFont           FMGetFontFromATSFontRef(ATSFontRef iFont);
++        OSStatus         FMGetFontFromFontFamilyInstance(FMFontFamily iFontFamily, FMFontStyle iStyle, FMFont *oFont, FMFontStyle *oIntrinsicStyle);
++        OSStatus         FMGetNextFont(FMFontIterator *ioIterator, FMFont *oFont);
++        enum {
++            kFMUseGlobalScopeOption       = 0x00000001
++        };
++        enum {
++            commandMark                   = 17,
++            checkMark                     = 18,
++            diamondMark                   = 19,
++            appleMark                     = 20
++        };
++    }
++#endif
++
+ QT_BEGIN_NAMESPACE
+ class QWidget;
+ class QDragMoveEvent;
+--- src/gui/kernel/qwidget_mac.mm.orig
++++ src/gui/kernel/qwidget_mac.mm
+@@ -220,7 +220,7 @@ static QSize qt_mac_desktopSize()
+ static NSDrawer *qt_mac_drawer_for(const QWidget *widget)
+ {
+     NSView *widgetView = reinterpret_cast<NSView *>(widget->window()->effectiveWinId());
+-    NSArray *windows = [NSApp windows];
++    NSArray *windows = [[NSApplication sharedApplication] windows];
+     for (NSWindow *window in windows) {
+         NSArray *drawers = [window drawers];
+         for (NSDrawer *drawer in drawers) {
+@@ -254,7 +254,7 @@ static void qt_mac_destructWindow(OSWindowRef window)
+ {
+ #ifdef QT_MAC_USE_COCOA
+     if ([window isVisible] && [window isSheet]){
+-        [NSApp endSheet:window];
++        [[NSApplication sharedApplication] endSheet:window];
+         [window orderOut:window];
+     }
+ 
+@@ -2439,7 +2439,7 @@ void QWidgetPrivate::recreateMacWindow()
+     }
+     if ([oldWindow isVisible]){
+         if ([oldWindow isSheet])
+-            [NSApp endSheet:oldWindow];
++            [[NSApplication sharedApplication] endSheet:oldWindow];
+         [oldWindow orderOut:oldWindow];
+         show_sys();
+     }
+@@ -3554,7 +3554,7 @@ void QWidgetPrivate::show_sys()
+     }
+ 
+ #ifdef QT_MAC_USE_COCOA
+-    if ([NSApp isActive] && !qt_button_down && !QWidget::mouseGrabber()){
++    if ([[NSApplication sharedApplication] isActive] && !qt_button_down && !QWidget::mouseGrabber()){
+         // Update enter/leave immidiatly, don't wait for a move event. But only
+         // if no grab exists (even if the grab points to this widget, it seems, ref X11)
+         QPoint qlocal, qglobal;
+@@ -3605,7 +3605,7 @@ void QWidgetPrivate::hide_sys()
+             else
+                 HideSheetWindow(window);
+ #else
+-            [NSApp endSheet:window];
++            [[NSApplication sharedApplication] endSheet:window];
+             [window orderOut:window];
+ #endif
+         } else if(qt_mac_is_macdrawer(q)) {
+@@ -3716,7 +3716,7 @@ void QWidgetPrivate::hide_sys()
+     }
+ 
+ #ifdef QT_MAC_USE_COCOA
+-    if ([NSApp isActive] && !qt_button_down && !QWidget::mouseGrabber()){
++    if ([[NSApplication sharedApplication] isActive] && !qt_button_down && !QWidget::mouseGrabber()){
+         // Update enter/leave immidiatly, don't wait for a move event. But only
+         // if no grab exists (even if the grab points to this widget, it seems, ref X11)
+         QPoint qlocal, qglobal;
+--- src/gui/styles/qmacstyle_mac.mm.orig
++++ src/gui/styles/qmacstyle_mac.mm
+@@ -780,7 +780,7 @@ static QSize qt_aqua_get_known_size(QStyle::ContentsType ct, const QWidget *widg
+             if (!GetThemeMenuBarHeight(&size))
+                 ret = QSize(-1, size);
+ #else
+-            ret = QSize(-1, [[NSApp mainMenu] menuBarHeight]);
++            ret = QSize(-1, [[[NSApplication sharedApplication] mainMenu] menuBarHeight]);
+             // In the qt_mac_set_native_menubar(false) case,
+             // we come it here with a zero-height main menu,
+             // preventing the in-window menu from displaying.
+@@ -3024,16 +3024,14 @@ void QMacStyle::drawPrimitive(PrimitiveElement pe, const QStyleOption *opt, QPai
+                 fdi.version = qt_mac_hitheme_version;
+                 fdi.state = tds;
+                 SInt32 frame_size;
+-                if (pe == PE_FrameLineEdit) {
+-                    fdi.kind = kHIThemeFrameTextFieldSquare;
+-                    GetThemeMetric(kThemeMetricEditTextFrameOutset, &frame_size);
+-                    if ((frame->state & State_ReadOnly) || !(frame->state & State_Enabled))
+-                        fdi.state = kThemeStateInactive;
+-                } else {
+-                    baseColor = QColor(150, 150, 150); //hardcoded since no query function --Sam
+-                    fdi.kind = kHIThemeFrameListBox;
+-                    GetThemeMetric(kThemeMetricListBoxFrameOutset, &frame_size);
+-                }
++                fdi.kind = kHIThemeFrameTextFieldSquare;
++                GetThemeMetric(kThemeMetricEditTextFrameOutset, &frame_size);
++                if ((frame->state & State_ReadOnly) || !(frame->state & State_Enabled))
++                    fdi.state = kThemeStateInactive;
++                else if (fdi.state == kThemeStatePressed)
++                    // This pressed state doesn't make sense for a line edit frame.
++                    // And Yosemite agrees with us. Otherwise it starts showing yellow pixels.
++                    fdi.state = kThemeStateActive;
+                 fdi.isFocused = (frame->state & State_HasFocus);
+                 int lw = frame->lineWidth;
+                 if (lw <= 0)
+--- src/gui/util/qsystemtrayicon_mac.mm.orig
++++ src/gui/util/qsystemtrayicon_mac.mm
+@@ -536,7 +536,7 @@ private:
+ #ifndef QT_MAC_USE_COCOA
+                 const short scale = GetMBarHeight();
+ #else
+-                const short scale = [[NSApp mainMenu] menuBarHeight];
++                const short scale = [[[NSApplication sharedApplication] mainMenu] menuBarHeight];
+ #endif
+                 NSImage *nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(icon.pixmap(QSize(scale, scale))));
+                 [item setImage: nsimage];
+--- src/gui/widgets/qcocoamenu_mac.mm.orig
++++ src/gui/widgets/qcocoamenu_mac.mm
+@@ -202,7 +202,7 @@ QT_USE_NAMESPACE
+      static SEL selForOFCP = NSSelectorFromString(@"orderFrontCharacterPalette:");
+      if (index == -1 && selForOFCP == actionSelector) {
+          // Check if the 'orderFrontCharacterPalette' SEL exists for QCocoaMenuLoader object
+-         QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];
++         QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = [[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];
+          return [super indexOfItemWithTarget:loader andAction:actionSelector];
+      }
+      return index;
+--- src/gui/widgets/qmenu_mac.mm.orig
++++ src/gui/widgets/qmenu_mac.mm
+@@ -179,7 +179,7 @@ static void cancelAllMenuTracking()
+ {
+ #ifdef QT_MAC_USE_COCOA
+     QMacCocoaAutoReleasePool pool;
+-    NSMenu *mainMenu = [NSApp mainMenu];
++    NSMenu *mainMenu = [[NSApplication sharedApplication] mainMenu];
+     [mainMenu cancelTracking];
+     for (NSMenuItem *item in [mainMenu itemArray]) {
+         if ([item submenu]) {
+@@ -633,7 +633,7 @@ static inline void syncMenuBarItemsVisiblity(const QMenuBarPrivate::QMacMenuBarP
+ 
+ static inline QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *getMenuLoader()
+ {
+-    return [NSApp QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];
++    return [[NSApplication sharedApplication] QT_MANGLE_NAMESPACE(qt_qcocoamenuLoader)];
+ }
+ 
+ static NSMenuItem *createNSMenuItem(const QString &title)
+@@ -2033,7 +2033,7 @@ void qt_mac_clear_menubar()
+     QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader();
+     NSMenu *menu = [loader menu];
+     [loader ensureAppMenuInMenu:menu];
+-    [NSApp setMainMenu:menu];
++    [[NSApplication sharedApplication] setMainMenu:menu];
+     const bool modal = qt_mac_should_disable_menu(0);
+     if (qt_mac_current_menubar.qmenubar || modal != qt_mac_current_menubar.modal)
+         qt_mac_set_modal_state(menu, modal);
+@@ -2100,7 +2100,7 @@ bool QMenuBarPrivate::macUpdateMenuBarImmediatly()
+ #else
+             QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader();
+             [loader ensureAppMenuInMenu:menu];
+-            [NSApp setMainMenu:menu];
++            [[NSApplication sharedApplication] setMainMenu:menu];
+             syncMenuBarItemsVisiblity(mb->d_func()->mac_menubar);
+ 
+             if (OSMenuRef tmpMerge = QMenuPrivate::mergeMenuHash.value(menu)) {
+@@ -2140,7 +2140,7 @@ bool QMenuBarPrivate::macUpdateMenuBarImmediatly()
+ #else
+                 QT_MANGLE_NAMESPACE(QCocoaMenuLoader) *loader = getMenuLoader();
+                 [loader ensureAppMenuInMenu:menu];
+-                [NSApp setMainMenu:menu];
++                [[NSApplication sharedApplication] setMainMenu:menu];
+                 syncMenuBarItemsVisiblity(qt_mac_current_menubar.qmenubar->d_func()->mac_menubar);
+ #endif
+                 qt_mac_set_modal_state(menu, modal);
diff --git a/aqua/qt4-mac-devel/files/patch-PluginView-no-carbon.diff b/aqua/qt4-mac-devel/files/patch-PluginView-no-carbon.diff
deleted file mode 100644
index 687bdbc..0000000
--- a/aqua/qt4-mac-devel/files/patch-PluginView-no-carbon.diff
+++ /dev/null
@@ -1,24 +0,0 @@
---- src/3rdparty/webkit/WebCore/plugins/PluginView.h.orig	2011-04-02 12:26:20.000000000 -0400
-+++ src/3rdparty/webkit/WebCore/plugins/PluginView.h	2011-04-02 12:26:42.000000000 -0400
-@@ -360,7 +360,9 @@
- 
-         Point m_lastMousePos;
-         void setNPWindowIfNeeded();
-+#ifndef NP_NO_CARBON
-         void nullEventTimerFired(Timer<PluginView>*);
-+#endif
-         Point globalMousePosForPlugin() const;
-         Point mousePosForPlugin(MouseEvent* event = 0) const;
- #endif
---- src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.mm.orig	2011-04-02 12:26:06.000000000 -0400
-+++ src/3rdparty/webkit/WebCore/plugins/mac/PluginViewMac.mm	2011-04-02 12:30:07.000000000 -0400
-@@ -233,7 +233,9 @@
-         setNPWindowIfNeeded();
- 
-     // TODO: Implement null timer throttling depending on plugin activation
-+#ifndef NP_NO_CARBON
-     m_nullEventTimer.set(new Timer<PluginView>(this, &PluginView::nullEventTimerFired));
-+#endif
-     m_nullEventTimer->startRepeating(0.02);
- 
-     m_lastMousePos.h = m_lastMousePos.v = 0;
diff --git a/aqua/qt4-mac-devel/files/patch-QAction_isEnabled.diff b/aqua/qt4-mac-devel/files/patch-QAction_isEnabled.diff
new file mode 100644
index 0000000..6a3b353
--- /dev/null
+++ b/aqua/qt4-mac-devel/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-devel/files/patch-QtHelp_10.4_only.diff b/aqua/qt4-mac-devel/files/patch-QtHelp_10.4_only.diff
index 62b6bef..0725e11 100644
--- a/aqua/qt4-mac-devel/files/patch-QtHelp_10.4_only.diff
+++ b/aqua/qt4-mac-devel/files/patch-QtHelp_10.4_only.diff
@@ -1,6 +1,6 @@
 --- tools/assistant/tools/assistant/assistant.pro.orig	2011-01-10 09:05:05.000000000 -0500
 +++ tools/assistant/tools/assistant/assistant.pro	2011-01-10 09:05:55.000000000 -0500
-@@ -116,3 +116,30 @@
+@@ -120,3 +120,30 @@
          DEFINES += USE_STATIC_SQLITE_PLUGIN
      }
  }
@@ -33,7 +33,7 @@
 +
 --- tools/assistant/tools/qcollectiongenerator/qcollectiongenerator.pro.orig	2011-01-10 09:05:05.000000000 -0500
 +++ tools/assistant/tools/qcollectiongenerator/qcollectiongenerator.pro	2011-01-10 09:05:55.000000000 -0500
-@@ -15,3 +15,27 @@
+@@ -19,3 +19,27 @@
      ../shared/collectionconfiguration.cpp
  HEADERS += ../shared/helpgenerator.h \
      ../shared/collectionconfiguration.h
@@ -63,7 +63,7 @@
 +LIBS_PRIVATE += -l$$qcwebkit
 --- tools/assistant/tools/qhelpconverter/qhelpconverter.pro.orig	2011-01-10 09:05:05.000000000 -0500
 +++ tools/assistant/tools/qhelpconverter/qhelpconverter.pro	2011-01-10 09:05:55.000000000 -0500
-@@ -45,3 +45,27 @@
+@@ -49,3 +49,27 @@
             outputpage.ui
  
  RESOURCES += qhelpconverter.qrc
@@ -93,7 +93,7 @@
 +LIBS_PRIVATE += -l$$qcwebkit
 --- tools/assistant/tools/qhelpgenerator/qhelpgenerator.pro.orig	2011-01-10 09:05:05.000000000 -0500
 +++ tools/assistant/tools/qhelpgenerator/qhelpgenerator.pro	2011-01-10 09:05:55.000000000 -0500
-@@ -12,3 +12,27 @@
+@@ -17,3 +17,27 @@
             main.cpp
  
  HEADERS += ../shared/helpgenerator.h
diff --git a/aqua/qt4-mac-devel/files/patch-config.tests_unix_compile.test.diff b/aqua/qt4-mac-devel/files/patch-config.tests_unix_compile.test.diff
index 6592163..cce49b1 100644
--- a/aqua/qt4-mac-devel/files/patch-config.tests_unix_compile.test.diff
+++ b/aqua/qt4-mac-devel/files/patch-config.tests_unix_compile.test.diff
@@ -1,11 +1,11 @@
---- config.tests/unix/compile.test.orig	2010-11-01 10:05:07.000000000 -0400
-+++ config.tests/unix/compile.test	2010-11-01 10:05:41.000000000 -0400
-@@ -68,7 +68,7 @@
- # Make sure output from possible previous tests is gone
+--- config.tests/unix/compile.test.orig	2013-07-06 14:39:26.000000000 -0400
++++ config.tests/unix/compile.test	2013-07-06 14:39:44.000000000 -0400
+@@ -73,7 +73,7 @@
  rm -f "$EXE" "${EXE}.exe"
  
--"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "CONFIG-=debug_and_release" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile"
-+"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "CONFIG-=debug_and_release app_bundle" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CFLAGS*=$CXXFLAGS" "QMAKE_CFLAGS+=$MAC_ARCH_CXXFLAGS" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "QT_BUILD_TREE=$OUTDIR" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile"
+ echo "QT_BUILD_TREE = $OUTDIR" > "$OUTDIR/$TEST/.qmake.cache"
+-"$OUTDIR/bin/qmake" -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "CONFIG-=debug_and_release" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile"
++"$OUTDIR/bin/qmake" -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "CONFIG-=debug_and_release app_bundle" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CFLAGS*=$CXXFLAGS" "QMAKE_CFLAGS+=$MAC_ARCH_CXXFLAGS" "QMAKE_OBJECTIVE_CFLAGS*=$CXXFLAGS" "QMAKE_OBJECTIVE_CFLAGS+=$MAC_ARCH_CXXFLAGS" "QMAKE_OBJECTIVE_CXXFLAGS*=$CXXFLAGS" "QMAKE_OBJECTIVE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile"
  
  if [ "$VERBOSE" = "yes" ]; then
      $MAKE
diff --git a/aqua/qt4-mac-devel/files/patch-config.tests_unix_precomp.test.diff b/aqua/qt4-mac-devel/files/patch-config.tests_unix_precomp.test.diff
new file mode 100644
index 0000000..d4ec6b0
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-config.tests_unix_precomp.test.diff
@@ -0,0 +1,22 @@
+--- config.tests/unix/precomp.test.orig	2012-04-23 14:49:04.000000000 -0400
++++ config.tests/unix/precomp.test	2012-04-17 14:38:16.000000000 -0400
+@@ -4,7 +4,7 @@
+ COMPILER=$1
+ VERBOSE=$2
+ 
+-case "$COMPILER" in
++case $COMPILER in
+ icpc)
+     cat >header.h <<EOF
+ #define HEADER_H
+@@ -27,8 +27,8 @@
+     rm -f header.pchi header.o source.o
+     ;;
+ 
+-*g++*|c++|*qcc*)
+-    case `"$COMPILER" -dumpversion 2>/dev/null` in
++*g++*|c++|*qcc*|*gcc*|cc)
++    case `$COMPILER -dumpversion 2>/dev/null` in
+     3.*)
+         ;;
+     *)
diff --git a/aqua/qt4-mac-devel/files/patch-configure-arch.diff b/aqua/qt4-mac-devel/files/patch-configure-arch.diff
deleted file mode 100644
index 4c12b4a..0000000
--- a/aqua/qt4-mac-devel/files/patch-configure-arch.diff
+++ /dev/null
@@ -1,28 +0,0 @@
---- configure_orig	2010-10-13 21:13:01.000000000 -0400
-+++ configure	2010-10-13 21:15:36.000000000 -0400
-@@ -4893,20 +4893,11 @@
-             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(CARBON_CFLAGS)"
-             EXTRA_OBJS="qsettings_mac.o qcore_mac.o"
-             EXTRA_SRCS="\"$relpath/src/corelib/io/qsettings_mac.cpp\" \"$relpath/src/corelib/kernel/qcore_mac.cpp\""
--	    if echo "$CFG_MAC_ARCHS" | grep x86 > /dev/null 2>&1; then # matches both x86 and x86_64
--		X86_CFLAGS="-arch i386"
--		X86_LFLAGS="-arch i386"
--		EXTRA_CFLAGS="$X86_CFLAGS $EXTRA_CFLAGS"
--		EXTRA_CXXFLAGS="$X86_CFLAGS $EXTRA_CXXFLAGS"
--                EXTRA_LFLAGS="$EXTRA_LFLAGS $X86_LFLAGS"
--            fi
--	    if echo "$CFG_MAC_ARCHS" | grep ppc > /dev/null 2>&1; then # matches both ppc and ppc64
--		PPC_CFLAGS="-arch ppc"
--		PPC_LFLAGS="-arch ppc"
--		EXTRA_CFLAGS="$PPC_CFLAGS $EXTRA_CFLAGS"
--		EXTRA_CXXFLAGS="$PPC_CFLAGS $EXTRA_CXXFLAGS"
--                EXTRA_LFLAGS="$EXTRA_LFLAGS $PPC_LFLAGS"
--            fi
-+           ARCH_CFLAGS="-arch @ARCHES@"
-+           ARCH_LFLAGS="-arch @ARCHES@"
-+           EXTRA_CFLAGS="$ARCH_CFLAGS $EXTRA_CFLAGS"
-+           EXTRA_CXXFLAGS="$ARCH_CFLAGS $EXTRA_CXXFLAGS"
-+           EXTRA_LFLAGS="$EXTRA_LFLAGS $ARCH_LFLAGS"
- 	    if [ '!' -z "$CFG_SDK" ]; then
- 		echo "SDK_LFLAGS =-Wl,-syslibroot,$CFG_SDK" >>"$mkfile"
- 		echo "SDK_CFLAGS =-isysroot $CFG_SDK" >>"$mkfile"
diff --git a/aqua/qt4-mac-devel/files/patch-configure.diff b/aqua/qt4-mac-devel/files/patch-configure.diff
new file mode 100644
index 0000000..3f85343
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-configure.diff
@@ -0,0 +1,353 @@
+--- configure.orig	2014-04-25 09:50:32.000000000 -0400
++++ configure	2014-04-25 10:04:24.000000000 -0400
+@@ -924,12 +924,14 @@
+ CFG_ICU=auto
+ CFG_SYSTEM_PROXIES=no
+ CFG_SLOG2=auto
++CFG_CXX11=no
+ 
+ # initalize variables used for installation
+ QT_INSTALL_PREFIX=
+ QT_INSTALL_DOCS=
+ QT_INSTALL_HEADERS=
+ QT_INSTALL_LIBS=
++QT_INSTALL_FRAMEWORKS=
+ QT_INSTALL_BINS=
+ QT_INSTALL_PLUGINS=
+ QT_INSTALL_IMPORTS=
+@@ -1143,7 +1145,7 @@
+         VAL=no
+         ;;
+     #Qt style yes options
+-    -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-harfbuzz|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-declarative-debug|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-s60|-usedeffiles|-icu)
++    -incremental|-qvfb|-profile|-shared|-static|-sm|-xinerama|-xshape|-xsync|-xinput|-egl|-reduce-exports|-pch|-separate-debug-info|-stl|-freetype|-xcursor|-xfixes|-xrandr|-xrender|-mitshm|-fontconfig|-xkb|-nis|-qdbus|-dbus|-dbus-linked|-glib|-gstreamer|-gtkstyle|-cups|-iconv|-largefile|-h|-help|-v|-verbose|-debug|-release|-fast|-accessibility|-confirm-license|-gnumake|-framework|-qt3support|-debug-and-release|-exceptions|-cocoa|-carbon|-universal|-harfbuzz|-prefix-install|-silent|-armfpa|-optimized-qmake|-dwarf2|-reduce-relocations|-sse|-openssl|-openssl-linked|-ptmalloc|-xmlpatterns|-phonon|-phonon-backend|-multimedia|-audio-backend|-svg|-declarative|-declarative-debug|-javascript-jit|-script|-scripttools|-rpath|-force-pkg-config|-s60|-usedeffiles|-icu|-c++11)
+         VAR=`echo $1 | sed "s,^-\(.*\),\1,"`
+         VAL=yes
+         ;;
+@@ -1398,6 +1400,9 @@
+     libdir)
+         QT_INSTALL_LIBS="$VAL"
+         ;;
++    frameworkdir)
++        QT_INSTALL_FRAMEWORKS="$VAL"
++        ;;
+     qtnamespace)
+         QT_NAMESPACE="$VAL"
+         ;;
+@@ -2515,6 +2520,13 @@
+             UNKNOWN_OPT=yes
+         fi
+         ;;
++    c++11)
++        if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
++            CFG_CXX11="$VAL"
++        else
++            UNKNOWN_OPT=yes
++        fi
++        ;;
+     system-proxies)
+         if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then
+             CFG_SYSTEM_PROXIES="$VAL"
+@@ -3456,6 +3468,53 @@
+     CFG_MAC_XARCH=no
+ fi
+ 
++# detect required support for CPATH
++if "$mactests/cpath/cpath.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests/cpath" ; then
++    echo >&2 "error: The compiler ($TEST_COMPILER) does not seem to support the CPATH environment variable, which is required to compile qt4-mac using MacPorts when compiling on Mac OS X."
++    exit 1
++fi
++
++# detect required support for LIBRARY_PATH
++if "$mactests/library_path/library_path.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests/library_path" ; then
++    echo >&2 "error: The compiler ($TEST_COMPILER) does not seem to support the LIBRARY_PATH environment variable, which is required to compile qt4-mac using MacPorts when compiling on Mac OS X."
++    exit 1
++fi
++
++# detect required support for -fconstant-cfstrings
++if "$mactests/fconstant_cfstrings.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
++    echo >&2 "error: The compiler ($TEST_COMPILER) does not seem to support the -fconstant-cfstrings flag, which is used extensively by the Qt build system when compiling on Mac OS X."
++    exit 1
++fi
++
++# detect required support for Objective-C blocks (^) on the mac,
++# but only on 10.6 ("uname -r" == 10.X) and newer
++case "$UNAME_SYSTEM:$UNAME_RELEASE" in
++    Darwin:[0-9].*)
++	;;
++    Darwin*)
++	if "$mactests/objc_block/objc_block.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests/objc_block" ; then
++	    echo >&2 "error: The compiler ($TEST_COMPILER) does not seem to support the Objective-C blocks (^), which are used by Qt when compiling on Mac OS X 10.6 and newer."
++	    exit 1
++	fi
++	;;
++    *)
++	;;
++esac
++
++# Detect C++11 support, only if requested
++if [ "$CFG_CXX11" = "yes" ]; then
++    if "$mactests/c++11/c++11.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests/c++11" ; then
++	echo >&2 "error: C++11 support was requested, but the compiler ($TEST_COMPILER) does not seem to support C++11."
++        exit 1
++    fi
++fi
++
++# detect required support for -Xarch
++if "$mactests/xarch.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
++    echo >&2 "error: The compiler ($TEST_COMPILER) does not seem to support the -Xarch flag, which is used extensively by the Qt build system when compiling on Mac OS X."
++    exit 1
++fi
++
+ #auto-detect DWARF2 on the mac
+ if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_DWARF2" = "auto" ]; then
+     if "$mactests/dwarf2.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" $MAC_CONFIG_TEST_COMMANDLINE; then
+@@ -3465,15 +3524,6 @@
+     fi
+ fi
+ 
+-# auto-detect support for -Xarch on the mac
+-if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" = "auto" ]; then
+-    if "$mactests/xarch.test" "$TEST_COMPILER" "$OPT_VERBOSE" "$mactests" ; then
+-        CFG_MAC_XARCH=no
+-    else
+-        CFG_MAC_XARCH=yes
+-    fi
+-fi
+-
+ # don't autodetect support for separate debug info on objcopy when
+ # cross-compiling as lots of toolchains seems to have problems with this
+ if [ "$QT_CROSS_COMPILE" = "yes" ] && [ "$CFG_SEPARATE_DEBUG_INFO" = "auto" ]; then
+@@ -3700,6 +3750,19 @@
+     fi
+     QT_INSTALL_LIBS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_LIBS"`
+ 
++    #frameworks
++    if [ -z "$QT_INSTALL_FRAMEWORKS" ]; then #default
++        if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
++	    if [ "$PLATFORM_MAC" = "yes" ]; then
++	        if [ "$CFG_FRAMEWORK" = "yes" ]; then
++		    QT_INSTALL_FRAMEWORKS="/Libraries/Frameworks"
++                fi
++            fi
++        fi
++        [ -z "$QT_INSTALL_FRAMEWORKS" ] && QT_INSTALL_FRAMEWORKS="$QT_INSTALL_PREFIX/Library/Frameworks" #fallback
++    fi
++    QT_INSTALL_FRAMEWORKS=`"$relpath/config.tests/unix/makeabs" "$QT_INSTALL_FRAMEWORKS"`
++
+     #bins
+     if [ -z "$QT_INSTALL_BINS" ]; then #default
+         if [ "$CFG_PREFIX_INSTALL" = "no" ]; then
+@@ -4768,6 +4831,7 @@
+ DOCUMENTATION_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_docspath=$QT_INSTALL_DOCS"`
+ HEADERS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_hdrspath=$QT_INSTALL_HEADERS"`
+ LIBRARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_libspath=$QT_INSTALL_LIBS"`
++FRAMEWORKS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_frameworkspath=$QT_INSTALL_FRAMEWORKS"`
+ BINARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_binspath=$QT_INSTALL_BINS"`
+ PLUGINS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_plugpath=$QT_INSTALL_PLUGINS"`
+ IMPORTS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_impspath=$QT_INSTALL_IMPORTS"`
+@@ -4793,6 +4857,7 @@
+     HOSTDOCUMENTATION_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_docspath=$QT_HOST_PREFIX/doc"`
+     HOSTHEADERS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_hdrspath=$QT_HOST_PREFIX/include"`
+     HOSTLIBRARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_libspath=$QT_HOST_PREFIX/lib"`
++    HOSTFRAMEWORKS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_frameworkspath=$QT_HOST_PREFIX/Library/Frameworks"`
+     HOSTBINARIES_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_binspath=$QT_HOST_PREFIX/bin"`
+     HOSTPLUGINS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_plugpath=$QT_HOST_PREFIX/plugins"`
+     HOSTIMPORTS_PATH_STR=`"$relpath/config.tests/unix/padstring" 268 "qt_impspath=$QT_HOST_PREFIX/IMPORTS"`
+@@ -4810,6 +4875,7 @@
+ static const char qt_configure_documentation_path_str[256 + 12] = "$HOSTDOCUMENTATION_PATH_STR";
+ static const char qt_configure_headers_path_str      [256 + 12] = "$HOSTHEADERS_PATH_STR";
+ static const char qt_configure_libraries_path_str    [256 + 12] = "$HOSTLIBRARIES_PATH_STR";
++static const char qt_configure_frameworks_path_str   [256 + 12] = "$HOSTFRAMEWORKS_PATH_STR";
+ static const char qt_configure_binaries_path_str     [256 + 12] = "$HOSTBINARIES_PATH_STR";
+ static const char qt_configure_plugins_path_str      [256 + 12] = "$HOSTPLUGINS_PATH_STR";
+ static const char qt_configure_imports_path_str      [256 + 12] = "$HOSTIMPORTS_PATH_STR";
+@@ -4828,6 +4894,7 @@
+ static const char qt_configure_documentation_path_str[256 + 12] = "$DOCUMENTATION_PATH_STR";
+ static const char qt_configure_headers_path_str      [256 + 12] = "$HEADERS_PATH_STR";
+ static const char qt_configure_libraries_path_str    [256 + 12] = "$LIBRARIES_PATH_STR";
++static const char qt_configure_frameworks_path_str   [256 + 18] = "$FRAMEWORKS_PATH_STR";
+ static const char qt_configure_binaries_path_str     [256 + 12] = "$BINARIES_PATH_STR";
+ static const char qt_configure_plugins_path_str      [256 + 12] = "$PLUGINS_PATH_STR";
+ static const char qt_configure_imports_path_str      [256 + 12] = "$IMPORTS_PATH_STR";
+@@ -4853,6 +4920,7 @@
+ #define QT_CONFIGURE_DOCUMENTATION_PATH qt_configure_documentation_path_str + 12;
+ #define QT_CONFIGURE_HEADERS_PATH qt_configure_headers_path_str + 12;
+ #define QT_CONFIGURE_LIBRARIES_PATH qt_configure_libraries_path_str + 12;
++#define QT_CONFIGURE_FRAMEWORKS_PATH qt_configure_frameworks_path_str + 18;
+ #define QT_CONFIGURE_BINARIES_PATH qt_configure_binaries_path_str + 12;
+ #define QT_CONFIGURE_PLUGINS_PATH qt_configure_plugins_path_str + 12;
+ #define QT_CONFIGURE_IMPORTS_PATH qt_configure_imports_path_str + 12;
+@@ -4965,7 +5033,7 @@
+         EXTRA_OBJS=
+         EXTRA_SRCS=
+         EXTRA_CFLAGS="\$(QMAKE_CFLAGS)"
+-        EXTRA_CXXFLAGS="\$(QMAKE_CXXFLAGS)"
++        EXTRA_CXXFLAGS="$QMAKE_STDLIB \$(QMAKE_CXXFLAGS)"
+         EXTRA_LFLAGS="\$(QMAKE_LFLAGS)"
+ 
+         if [ "$PLATFORM" = "irix-cc" ] || [ "$PLATFORM" = "irix-cc-64" ]; then
+@@ -5009,8 +5077,8 @@
+                 # Avoid overriding the default configuration settings when building with clang/libc++
+                 ;;
+             *)
+-                # For all other configurations require a minimum of 10.5
+-                echo "export MACOSX_DEPLOYMENT_TARGET = 10.5" >> "$mkfile"
++                # For all other configurations require a minimum of @MACOSX_DEPLOYMENT_TARGET@
++                echo "export MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@" >> "$mkfile"
+                 ;;
+             esac
+ 
+@@ -5021,20 +5089,11 @@
+             EXTRA_CXXFLAGS="$EXTRA_CXXFLAGS \$(CARBON_CFLAGS)"
+             EXTRA_OBJS="qsettings_mac.o qcore_mac.o"
+             EXTRA_SRCS="\"$relpath/src/corelib/io/qsettings_mac.cpp\" \"$relpath/src/corelib/kernel/qcore_mac.cpp\""
+-	    if echo "$CFG_MAC_ARCHS" | grep x86 > /dev/null 2>&1; then # matches both x86 and x86_64
+-		X86_CFLAGS="-arch i386"
+-		X86_LFLAGS="-arch i386"
+-		EXTRA_CFLAGS="$X86_CFLAGS $EXTRA_CFLAGS"
+-		EXTRA_CXXFLAGS="$X86_CFLAGS $EXTRA_CXXFLAGS"
+-                EXTRA_LFLAGS="$EXTRA_LFLAGS $X86_LFLAGS"
+-            fi
+-	    if echo "$CFG_MAC_ARCHS" | grep ppc > /dev/null 2>&1; then # matches both ppc and ppc64
+-		PPC_CFLAGS="-arch ppc"
+-		PPC_LFLAGS="-arch ppc"
+-		EXTRA_CFLAGS="$PPC_CFLAGS $EXTRA_CFLAGS"
+-		EXTRA_CXXFLAGS="$PPC_CFLAGS $EXTRA_CXXFLAGS"
+-                EXTRA_LFLAGS="$EXTRA_LFLAGS $PPC_LFLAGS"
+-            fi
++            ARCH_CFLAGS="-arch @ARCHES@"
++            ARCH_LFLAGS="-arch @ARCHES@"
++            EXTRA_CFLAGS="$ARCH_CFLAGS $EXTRA_CFLAGS"
++            EXTRA_CXXFLAGS="$ARCH_CFLAGS $EXTRA_CXXFLAGS"
++            EXTRA_LFLAGS="$EXTRA_LFLAGS $ARCH_LFLAGS"
+ 	    if [ '!' -z "$CFG_SDK" ]; then
+ 		echo "SDK_LFLAGS =-Wl,-syslibroot,$CFG_SDK" >>"$mkfile"
+ 		echo "SDK_CFLAGS =-isysroot $CFG_SDK" >>"$mkfile"
+@@ -6997,7 +7056,7 @@
+ 
+ # detect OpenVG support
+ if [ "$CFG_OPENVG" != "no" ] && [ "$XPLATFORM_SYMBIAN_SBSV2" = "no" ]; then
+-    if compileTest "unix/openvg" "OpenVG"; then
++    if compileTest "unix/openvg" "OpenVG" $QMAKE_OPENVG_ARG; then
+         if [ "$CFG_OPENVG" = "auto" ]; then
+             CFG_OPENVG=yes
+         fi
+@@ -7028,7 +7087,7 @@
+             CFG_OPENVG=no
+         fi
+     fi
+-    if [ "$CFG_OPENVG" = "yes" ] && compileTest "unix/shivavg" "ShivaVG" $CONFIG_ARG; then
++    if [ "$CFG_OPENVG" = "yes" ] && compileTest "unix/shivavg" "ShivaVG" $QMAKE_OPENVG_ARG; then
+         CFG_OPENVG_SHIVA=yes
+     fi
+ fi
+@@ -7219,19 +7278,7 @@
+ 
+ # set the global Mac deployment target. This is overridden on an arch-by-arch basis
+ # in some cases, see code further down
+-case "$PLATFORM,$CFG_MAC_COCOA" in
+-*macx-clang-libc++,yes)
+-    # Avoid overriding the default configuration setting when building with clang/libc++
+-    ;;
+-macx*,yes)
+-    # Cocoa
+-    QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.5
+-    ;;
+-macx*,no)
+-    # gcc, Carbon
+-    QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.4
+-    ;;
+-esac
++QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET @MACOSX_DEPLOYMENT_TARGET@
+ 
+ # disable Qt 3 support on VxWorks, Symbian and INTEGRITY
+ case "$XPLATFORM" in
+@@ -7510,6 +7557,10 @@
+     QCONFIG_FLAGS="$QCONFIG_FLAGS QT_NO_GUI"
+ fi
+ 
++if [ "$CFG_CXX11" = "yes" ]; then
++    QT_CONFIG="$QT_CONFIG c++11"
++    QMAKE_CONFIG="$QMAKE_CONFIG c++11"
++fi
+ 
+ if [ "x$PLATFORM_MAC" = "xyes" ] && [ "$XPLATFORM_MINGW" != "yes" ] && [ "$XPLATFORM_SYMBIAN" != "yes" ]; then
+     #On Mac we implicitly link against libz, so we
+@@ -7981,28 +8032,32 @@
+         ;;
+     *)
+         if echo "$CFG_MAC_ARCHS" | grep '\<x86\>' > /dev/null 2>&1; then
+-            QMakeVar add QMAKE_CFLAGS "-Xarch_i386 -mmacosx-version-min=10.4"
+-            QMakeVar add QMAKE_CXXFLAGS "-Xarch_i386 -mmacosx-version-min=10.4"
+-            QMakeVar add QMAKE_LFLAGS "-Xarch_i386 -mmacosx-version-min=10.4"
+-            QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86 "-arch i386 -Xarch_i386 -mmacosx-version-min=10.4"
++            QMakeVar add QMAKE_CFLAGS "-Xarch_i386 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
++            QMakeVar add QMAKE_CXXFLAGS "-Xarch_i386 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
++            QMakeVar add QMAKE_LFLAGS "-Xarch_i386 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
++            QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86 "-arch i386 -Xarch_i386 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
++            QMakeVar add QMAKE_OBJECTIVE_CXXFLAGS_X86 "-arch i386 -Xarch_i386 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
+         fi
+         if echo "$CFG_MAC_ARCHS" | grep '\<ppc\>' > /dev/null 2>&1; then
+-            QMakeVar add QMAKE_CFLAGS "-Xarch_ppc -mmacosx-version-min=10.4"
+-            QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc -mmacosx-version-min=10.4"
+-            QMakeVar add QMAKE_LFLAGS "-Xarch_ppc -mmacosx-version-min=10.4"
+-            QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC "-arch ppc -Xarch_ppc -mmacosx-version-min=10.4"
++            QMakeVar add QMAKE_CFLAGS "-Xarch_ppc -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
++            QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
++            QMakeVar add QMAKE_LFLAGS "-Xarch_ppc -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
++            QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC "-arch ppc -Xarch_ppc -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
++            QMakeVar add QMAKE_OBJECTIVE_CXXFLAGS_PPC "-arch ppc -Xarch_ppc -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
+         fi
+         if echo "$CFG_MAC_ARCHS" | grep '\<x86_64\>' > /dev/null 2>&1; then
+-            QMakeVar add QMAKE_CFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5"
+-            QMakeVar add QMAKE_CXXFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5"
+-            QMakeVar add QMAKE_LFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5"
+-            QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86_64 "-arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5"
++            QMakeVar add QMAKE_CFLAGS "-Xarch_x86_64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
++            QMakeVar add QMAKE_CXXFLAGS "-Xarch_x86_64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
++            QMakeVar add QMAKE_LFLAGS "-Xarch_x86_64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
++            QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86_64 "-arch x86_64 -Xarch_x86_64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
++            QMakeVar add QMAKE_OBJECTIVE_CXXFLAGS_X86_64 "-arch x86_64 -Xarch_x86_64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
+         fi
+         if echo "$CFG_MAC_ARCHS" | grep '\<ppc64\>' > /dev/null 2>&1; then
+-            QMakeVar add QMAKE_CFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5"
+-            QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5"
+-            QMakeVar add QMAKE_LFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5"
+-            QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC_64 "-arch ppc64 -Xarch_ppc64 -mmacosx-version-min=10.5"
++            QMakeVar add QMAKE_CFLAGS "-Xarch_ppc64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
++            QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
++            QMakeVar add QMAKE_LFLAGS "-Xarch_ppc64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
++            QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC_64 "-arch ppc64 -Xarch_ppc64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
++            QMakeVar add QMAKE_OBJECTIVE_CXXFLAGS_PPC_64 "-arch ppc64 -Xarch_ppc64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
+         fi
+         ;;
+     esac
+@@ -8762,6 +8817,7 @@
+ QMAKE_RCC        = \$\$QT_BUILD_TREE/bin/rcc
+ QMAKE_QDBUSXML2CPP = \$\$QT_BUILD_TREE/bin/qdbusxml2cpp
+ QMAKE_INCDIR_QT  = \$\$QT_BUILD_TREE/include
++QMAKE_FRAMEWORKDIR_QT = \$\$QT_BUILD_TREE/Library/Frameworks
+ QMAKE_LIBDIR_QT  = \$\$QT_BUILD_TREE/lib
+ 
+ EOF
+@@ -8800,6 +8856,11 @@
+     echo "DEFINES *= QT_EDITION=QT_EDITION_DESKTOP" >> "$CACHEFILE.tmp"
+ fi
+ 
++#dump in the OPENVG_LIBS info
++if [ "$CFG_OPENVG" = "yes" ]; then
++   echo "QMAKE_LIBS_OPENVG = $QMAKE_OPENVG_ARG" >> "$CACHEFILE.tmp"
++fi
++
+ #dump in the OPENSSL_LIBS info
+ if [ '!' -z "$OPENSSL_LIBS" ]; then
+     echo "OPENSSL_LIBS = $OPENSSL_LIBS" >> "$CACHEFILE.tmp"
+@@ -8959,6 +9020,7 @@
+ else
+    echo "Debug .................. $CFG_DEBUG"
+ fi
++echo "C++11 support .......... $CFG_CXX11"
+ echo "Qt 3 compatibility ..... $CFG_QT3SUPPORT"
+ [ "$CFG_DBUS" = "no" ]     && echo "QtDBus module .......... no"
+ [ "$CFG_DBUS" = "yes" ]    && echo "QtDBus module .......... yes (run-time)"
diff --git a/aqua/qt4-mac-devel/files/patch-cxx11.diff b/aqua/qt4-mac-devel/files/patch-cxx11.diff
new file mode 100644
index 0000000..8cbe2e1
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-cxx11.diff
@@ -0,0 +1,616 @@
+--- src/gui/kernel/qcursor_mac.mm.orig	2013-01-22 16:04:44.000000000 -0500
++++ src/gui/kernel/qcursor_mac.mm	2013-01-22 16:05:57.000000000 -0500
+@@ -367,7 +367,7 @@
+     type = QCursorData::TYPE_ImageCursor;
+     curs.cp.my_cursor = true;
+     QPixmap bmCopy = QPixmap::fromImage(finalCursor);
+-    NSPoint hotSpot = { hx, hy };
++    NSPoint hotSpot = { (CGFloat) hx, (CGFloat) hy };
+     nsimage = static_cast<NSImage*>(qt_mac_create_nsimage(bmCopy));
+     curs.cp.nscursor = [[NSCursor alloc] initWithImage:nsimage hotSpot: hotSpot];
+     [nsimage release];
+@@ -377,7 +377,7 @@
+ {
+     type = QCursorData::TYPE_ImageCursor;
+     curs.cp.my_cursor = true;
+-    NSPoint hotSpot = { hx, hy };
++    NSPoint hotSpot = { (CGFloat) hx, (CGFloat) hy };
+     NSImage *nsimage;
+     nsimage = static_cast<NSImage *>(qt_mac_create_nsimage(pixmap));
+     curs.cp.nscursor = [[NSCursor alloc] initWithImage:nsimage hotSpot: hotSpot];
+--- src/gui/kernel/qcocoaview_mac.mm.orig	2013-01-22 16:04:44.000000000 -0500
++++ src/gui/kernel/qcocoaview_mac.mm	2013-01-22 16:05:57.000000000 -0500
+@@ -1352,7 +1352,7 @@
+     // Save supported actions:
+     [theView setSupportedActions: qt_mac_mapDropActions(dragPrivate()->possible_actions)];
+     QPoint pointInView = [theView qt_qwidget]->mapFromGlobal(dndParams->globalPoint);
+-    NSPoint imageLoc = {pointInView.x() - hotspot.x(), pointInView.y() + pix.height() - hotspot.y()};
++    NSPoint imageLoc = {(CGFloat)(pointInView.x() - hotspot.x()), (CGFloat)(pointInView.y() + pix.height() - hotspot.y())};
+     NSSize mouseOffset = {0.0, 0.0};
+     NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
+     dragPrivate()->executed_action = Qt::ActionMask;
+--- src/gui/kernel/qt_cocoa_helpers_mac.mm.orig	2013-01-22 16:04:44.000000000 -0500
++++ src/gui/kernel/qt_cocoa_helpers_mac.mm	2013-01-22 16:05:57.000000000 -0500
+@@ -459,17 +459,17 @@
+ {
+     NSEvent *proximityEvent = static_cast<NSEvent *>(tabletEvent);
+     // simply construct a Carbon proximity record and handle it all in one spot.
+-    TabletProximityRec carbonProximityRec = { [proximityEvent vendorID],
+-                                              [proximityEvent tabletID],
+-                                              [proximityEvent pointingDeviceID],
+-                                              [proximityEvent deviceID],
+-                                              [proximityEvent systemTabletID],
+-                                              [proximityEvent vendorPointingDeviceType],
+-                                              [proximityEvent pointingDeviceSerialNumber],
++    TabletProximityRec carbonProximityRec = {(UInt16) [proximityEvent vendorID],
++                                              (UInt16) [proximityEvent tabletID],
++                                              (UInt16) [proximityEvent pointingDeviceID],
++                                              (UInt16) [proximityEvent deviceID],
++                                              (UInt16) [proximityEvent systemTabletID],
++                                              (UInt16) [proximityEvent vendorPointingDeviceType],
++                                              (UInt32) [proximityEvent pointingDeviceSerialNumber],
+                                               [proximityEvent uniqueID],
+-                                              [proximityEvent capabilityMask],
+-                                              [proximityEvent pointingDeviceType],
+-                                              [proximityEvent isEnteringProximity] };
++                                              (UInt32) [proximityEvent capabilityMask],
++					      (UInt8) [proximityEvent pointingDeviceType],
++					      (UInt8) [proximityEvent isEnteringProximity] };
+     qt_dispatchTabletProximityEvent(carbonProximityRec);
+ }
+ #endif // QT_MAC_USE_COCOA
+--- src/gui/accessible/qaccessible_mac.mm.orig	2013-01-22 16:04:44.000000000 -0500
++++ src/gui/accessible/qaccessible_mac.mm	2013-01-22 16:05:57.000000000 -0500
+@@ -266,129 +266,129 @@
+     int qt;
+     QAXRoleType mac;
+     bool settable;
+-} text_bindings[][10] = {
++} text_bindings[][3] = {
+     { { QAccessible::MenuItem, QAXMenuItemRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::MenuBar, QAXMenuBarRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::ScrollBar, QAXScrollBarRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::Grip, QAXGrowAreaRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::Window, QAXWindowRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::Dialog, QAXWindowRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::AlertMessage, QAXWindowRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::ToolTip, QAXWindowRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::HelpBalloon, QAXWindowRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::PopupMenu, QAXMenuRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::Application, QAXApplicationRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::Pane, QAXGroupRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::Grouping, QAXGroupRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::Separator, QAXSplitterRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::ToolBar, QAXToolbarRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::PageTab, QAXRadioButtonRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::ButtonMenu, QAXMenuButtonRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::ButtonDropDown, QAXPopUpButtonRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::SpinBox, QAXIncrementorRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::Slider, QAXSliderRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::ProgressBar, QAXProgressIndicatorRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::ComboBox, QAXPopUpButtonRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::RadioButton, QAXRadioButtonRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::CheckBox, QAXCheckBoxRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::StaticText, QAXStaticTextRole, false },
+       { QAccessible::Name, QAXValueAttribute, false },
+       { -1, 0, false }
+     },
+     { { QAccessible::Table, QAXTableRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::StatusBar, QAXStaticTextRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::Column, QAXColumnRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::ColumnHeader, QAXColumnRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::Row, QAXRowRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::RowHeader, QAXRowRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::Cell, QAXTextFieldRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::PushButton, QAXButtonRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::EditableText, QAXTextFieldRole, true },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::Link, QAXTextFieldRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::Indicator, QAXValueIndicatorRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::Splitter, QAXSplitGroupRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::List, QAXListRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::ListItem, QAXStaticTextRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+     { { QAccessible::Cell, QAXStaticTextRole, false },
+-      { -1, 0, false }
++      { -1, 0, false }, { -1, 0, false }
+     },
+-    { { -1, 0, false } }
++    { { -1, 0, false }, { -1, 0, false }, { -1, 0, false } }
+ };
+ 
+ class QAInterface;
+--- src/gui/styles/qmacstyle_mac.mm.orig	2013-01-22 19:50:08.000000000 -0500
++++ src/gui/styles/qmacstyle_mac.mm	2013-01-22 19:55:50.000000000 -0500
+@@ -3468,8 +3468,8 @@
+                     tti.version = qt_mac_hitheme_version;
+                     tti.state = tds;
+                     QColor textColor = btn->palette.buttonText().color();
+-                    CGFloat colorComp[] = { textColor.redF(), textColor.greenF(),
+-                                          textColor.blueF(), textColor.alphaF() };
++                    CGFloat colorComp[] = { CGFloat(textColor.redF()), CGFloat(textColor.greenF()),
++					    CGFloat(textColor.blueF()), CGFloat(textColor.alphaF()) };
+                     CGContextSetFillColorSpace(cg, QCoreGraphicsPaintEngine::macGenericColorSpace());
+                     CGContextSetFillColor(cg, colorComp);
+                     tti.fontID = themeId;
+@@ -3701,8 +3701,8 @@
+                 tti.version = qt_mac_hitheme_version;
+                 tti.state = tds;
+                 QColor textColor = myTab.palette.windowText().color();
+-                CGFloat colorComp[] = { textColor.redF(), textColor.greenF(),
+-                                        textColor.blueF(), textColor.alphaF() };
++                CGFloat colorComp[] = { CGFloat(textColor.redF()), CGFloat(textColor.greenF()),
++                                        CGFloat(textColor.blueF()), CGFloat(textColor.alphaF()) };
+                 CGContextSetFillColorSpace(cg, QCoreGraphicsPaintEngine::macGenericColorSpace());
+                 CGContextSetFillColor(cg, colorComp);
+                 switch (d->aquaSizeConstrain(opt, w)) {
+@@ -3882,8 +3882,8 @@
+                 CGContextSetShouldAntialias(cg, true);
+                 CGContextSetShouldSmoothFonts(cg, true);
+                 QColor textColor = p->pen().color();
+-                CGFloat colorComp[] = { textColor.redF(), textColor.greenF(),
+-                                      textColor.blueF(), textColor.alphaF() };
++                CGFloat colorComp[] = { CGFloat(textColor.redF()), CGFloat(textColor.greenF()),
++					CGFloat(textColor.blueF()), CGFloat(textColor.alphaF()) };
+                 CGContextSetFillColorSpace(cg, QCoreGraphicsPaintEngine::macGenericColorSpace());
+                 CGContextSetFillColor(cg, colorComp);
+                 HIThemeTextInfo tti;
+@@ -5018,8 +5018,8 @@
+                 tti.version = qt_mac_hitheme_version;
+                 tti.state = tds;
+                 QColor textColor = groupBox->palette.windowText().color();
+-                CGFloat colorComp[] = { textColor.redF(), textColor.greenF(),
+-                                      textColor.blueF(), textColor.alphaF() };
++                CGFloat colorComp[] = { CGFloat(textColor.redF()), CGFloat(textColor.greenF()),
++					CGFloat(textColor.blueF()), CGFloat(textColor.alphaF()) };
+                 CGContextSetFillColorSpace(cg, QCoreGraphicsPaintEngine::macGenericColorSpace());
+                 CGContextSetFillColor(cg, colorComp);
+                 tti.fontID = checkable ? kThemeSystemFont : kThemeSmallSystemFont;
+--- src/gui/text/qtextdocument_p.cpp.orig	2013-01-22 16:04:44.000000000 -0500
++++ src/gui/text/qtextdocument_p.cpp	2013-01-22 16:05:57.000000000 -0500
+@@ -63,7 +63,15 @@
+ // The VxWorks DIAB compiler crashes when initializing the anonymouse union with { a7 }
+ #if !defined(Q_CC_DIAB)
+ #  define QT_INIT_TEXTUNDOCOMMAND(c, a1, a2, a3, a4, a5, a6, a7, a8) \
+-          QTextUndoCommand c = { a1, a2, 0, 0, quint8(a3), a4, quint32(a5), quint32(a6), { int(a7) }, quint32(a8) }
++  QTextUndoCommand c; \
++  c.command = a1; \
++  c.block_part = a2; \
++  c.operation = a3; \
++  c.format = a4; \
++  c.strPos = a5; \
++  c.pos = a6; \
++  c.length = a7; \
++  c.revision = a8;
+ #else
+ #  define QT_INIT_TEXTUNDOCOMMAND(c, a1, a2, a3, a4, a5, a6, a7, a8) \
+           QTextUndoCommand c = { a1, a2, 0, 0, a3, a4, a5, a6 }; c.blockFormat = a7; c.revision = a8
+--- src/gui/widgets/qdialogbuttonbox.cpp.orig	2013-01-22 16:04:44.000000000 -0500
++++ src/gui/widgets/qdialogbuttonbox.cpp	2013-01-22 16:05:57.000000000 -0500
+@@ -212,7 +212,7 @@
+     return QDialogButtonBox::InvalidRole;
+ }
+ 
+-static const uint layouts[2][5][14] =
++static const UInt32 layouts[2][5][14] =
+ {
+     // Qt::Horizontal
+     {
+@@ -407,7 +407,7 @@
+             tmpPolicy = 4;  // Mac modeless
+     }
+ 
+-    const uint *currentLayout = layouts[orientation == Qt::Vertical][tmpPolicy];
++    const UInt32 *currentLayout = layouts[orientation == Qt::Vertical][tmpPolicy];
+ 
+     if (center)
+         buttonLayout->addStretch();
+@@ -415,7 +415,7 @@
+     QList<QAbstractButton *> acceptRoleList = buttonLists[AcceptRole];
+ 
+     while (*currentLayout != EOL) {
+-        int role = (*currentLayout & ~Reverse);
++        UInt32 role = (*currentLayout & ~Reverse);
+         bool reverse = (*currentLayout & Reverse);
+ 
+         switch (role) {
+--- src/qt3support/other/q3dragobject.cpp.orig	2013-01-22 16:04:44.000000000 -0500
++++ src/qt3support/other/q3dragobject.cpp	2013-01-22 16:05:57.000000000 -0500
+@@ -1495,9 +1495,9 @@
+ 
+ void Q3ColorDrag::setColor(const QColor &col)
+ {
+-    short r = (col.red()   << 8) | col.red();
+-    short g = (col.green() << 8) | col.green();
+-    short b = (col.blue()  << 8) | col.blue();
++    ushort r = (col.red()   << 8) | col.red();
++    ushort g = (col.green() << 8) | col.green();
++    ushort b = (col.blue()  << 8) | col.blue();
+ 
+     // make sure we transmit data in network order
+     r = htons(r);
+--- src/openvg/qpaintengine_vg.cpp.orig	2013-01-22 16:04:44.000000000 -0500
++++ src/openvg/qpaintengine_vg.cpp	2013-01-22 16:05:57.000000000 -0500
+@@ -971,23 +971,23 @@
+     yRadius = qMin(yRadius, rect.height() / 2);
+ 
+     VGfloat pts[] = {
+-        x1 + xRadius, y1,                   // MoveTo
+-        x2 - xRadius, y1,                   // LineTo
+-        x2 - (1 - KAPPA) * xRadius, y1,     // CurveTo
+-        x2, y1 + (1 - KAPPA) * yRadius,
+-        x2, y1 + yRadius,
+-        x2, y2 - yRadius,                   // LineTo
+-        x2, y2 - (1 - KAPPA) * yRadius,     // CurveTo
+-        x2 - (1 - KAPPA) * xRadius, y2,
+-        x2 - xRadius, y2,
+-        x1 + xRadius, y2,                   // LineTo
+-        x1 + (1 - KAPPA) * xRadius, y2,     // CurveTo
+-        x1, y2 - (1 - KAPPA) * yRadius,
+-        x1, y2 - yRadius,
+-        x1, y1 + yRadius,                   // LineTo
+-        x1, y1 + (1 - KAPPA) * yRadius,     // CurveTo
+-        x1 + (1 - KAPPA) * xRadius, y1,
+-        x1 + xRadius, y1
++      VGfloat(x1 + xRadius), VGfloat(y1),                   // MoveTo
++      VGfloat(x2 - xRadius), VGfloat(y1),                   // LineTo
++      VGfloat(x2 - (1 - KAPPA) * xRadius), VGfloat(y1),     // CurveTo
++      VGfloat(x2), VGfloat(y1 + (1 - KAPPA) * yRadius),
++      VGfloat(x2), VGfloat(y1 + yRadius),
++      VGfloat(x2), VGfloat(y2 - yRadius),                   // LineTo
++      VGfloat(x2), VGfloat(y2 - (1 - KAPPA) * yRadius),     // CurveTo
++      VGfloat(x2 - (1 - KAPPA) * xRadius), VGfloat(y2),
++      VGfloat(x2 - xRadius), VGfloat(y2),
++      VGfloat(x1 + xRadius), VGfloat(y2),                   // LineTo
++      VGfloat(x1 + (1 - KAPPA) * xRadius), VGfloat(y2),     // CurveTo
++      VGfloat(x1), VGfloat(y2 - (1 - KAPPA) * yRadius),
++      VGfloat(x1), VGfloat(y2 - yRadius),
++      VGfloat(x1), VGfloat(y1 + yRadius),                   // LineTo
++      VGfloat(x1), VGfloat(y1 + (1 - KAPPA) * yRadius),     // CurveTo
++      VGfloat(x1 + (1 - KAPPA) * xRadius), VGfloat(y1),
++      VGfloat(x1 + xRadius), VGfloat(y1)
+     };
+ 
+ #if !defined(QVG_NO_MODIFY_PATH)
+@@ -3207,7 +3207,7 @@
+         1.0f, 0.0f, 0.0f, 0.0f,
+         0.0f, 1.0f, 0.0f, 0.0f,
+         0.0f, 0.0f, 1.0f, 0.0f,
+-        0.0f, 0.0f, 0.0f, d->opacity,
++        0.0f, 0.0f, 0.0f, VGfloat(d->opacity),
+         0.0f, 0.0f, 0.0f, 0.0f
+     };
+     VGImage tileWithOpacity = VG_INVALID_HANDLE;
+--- src/openvg/qpixmapdata_vg.cpp.orig	2013-01-22 16:04:44.000000000 -0500
++++ src/openvg/qpixmapdata_vg.cpp	2013-01-22 16:05:57.000000000 -0500
+@@ -421,7 +421,7 @@
+             1.0f, 0.0f, 0.0f, 0.0f,
+             0.0f, 1.0f, 0.0f, 0.0f,
+             0.0f, 0.0f, 1.0f, 0.0f,
+-            0.0f, 0.0f, 0.0f, opacity,
++            0.0f, 0.0f, 0.0f, VGfloat(opacity),
+             0.0f, 0.0f, 0.0f, 0.0f
+         };
+         vgColorMatrix(vgImageOpacity, vgImage, matrix);
+--- src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.h.orig	2013-01-22 16:04:44.000000000 -0500
++++ src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.h	2013-01-22 16:05:57.000000000 -0500
+@@ -176,7 +176,7 @@
+             // Node::emitCode assumes that dst, if provided, is either a local or a referenced temporary.
+             ASSERT(!dst || dst == ignoredResult() || !dst->isTemporary() || dst->refCount());
+             if (!m_codeBlock->numberOfLineInfos() || m_codeBlock->lastLineInfo().lineNumber != n->lineNo()) {
+-                LineInfo info = { instructions().size(), n->lineNo() };
++	      LineInfo info = { uint32_t(instructions().size()), int32_t(n->lineNo()) };
+                 m_codeBlock->addLineInfo(info);
+             }
+             if (m_emitNodeDepth >= s_maxEmitNodeDepth)
+@@ -195,7 +195,7 @@
+         void emitNodeInConditionContext(ExpressionNode* n, Label* trueTarget, Label* falseTarget, bool fallThroughMeansTrue)
+         {
+             if (!m_codeBlock->numberOfLineInfos() || m_codeBlock->lastLineInfo().lineNumber != n->lineNo()) {
+-                LineInfo info = { instructions().size(), n->lineNo() };
++	      LineInfo info = { uint32_t(instructions().size()), int32_t(n->lineNo()) };
+                 m_codeBlock->addLineInfo(info);
+             }
+             if (m_emitNodeDepth >= s_maxEmitNodeDepth)
+--- src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp.orig	2013-01-22 16:04:44.000000000 -0500
++++ src/3rdparty/javascriptcore/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp	2013-01-22 16:05:57.000000000 -0500
+@@ -1835,7 +1835,7 @@
+ RegisterID* BytecodeGenerator::emitCatch(RegisterID* targetRegister, Label* start, Label* end)
+ {
+ #if ENABLE(JIT)
+-    HandlerInfo info = { start->bind(0, 0), end->bind(0, 0), instructions().size(), m_dynamicScopeDepth + m_baseScopeDepth, CodeLocationLabel() };
++  HandlerInfo info = { uint32_t(start->bind(0, 0)), uint32_t(end->bind(0, 0)), uint32_t(instructions().size()), uint32_t(m_dynamicScopeDepth + m_baseScopeDepth), CodeLocationLabel() };
+ #else
+     HandlerInfo info = { start->bind(0, 0), end->bind(0, 0), instructions().size(), m_dynamicScopeDepth + m_baseScopeDepth };
+ #endif
+@@ -1889,7 +1889,7 @@
+ 
+ void BytecodeGenerator::beginSwitch(RegisterID* scrutineeRegister, SwitchInfo::SwitchType type)
+ {
+-    SwitchInfo info = { instructions().size(), type };
++  SwitchInfo info = { uint32_t(instructions().size()), type };
+     switch (type) {
+         case SwitchInfo::SwitchImmediate:
+             emitOpcode(op_switch_imm);
+--- src/3rdparty/javascriptcore/JavaScriptCore/runtime/Identifier.cpp.orig	2013-01-22 16:04:44.000000000 -0500
++++ src/3rdparty/javascriptcore/JavaScriptCore/runtime/Identifier.cpp	2013-01-22 16:05:57.000000000 -0500
+@@ -195,7 +195,7 @@
+         UString::Rep::empty().hash();
+         return &UString::Rep::empty();
+     }
+-    UCharBuffer buf = {s, length}; 
++    UCharBuffer buf = {s, (unsigned int) length}; 
+     pair<HashSet<UString::Rep*>::iterator, bool> addResult = globalData->identifierTable->add<UCharBuffer, UCharBufferTranslator>(buf);
+ 
+     // If the string is newly-translated, then we need to adopt it.
+--- src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSONObject.cpp.orig	2014-05-01 10:03:45.000000000 -0400
++++ src/3rdparty/javascriptcore/JavaScriptCore/runtime/JSONObject.cpp	2014-05-01 10:06:59.000000000 -0400
+@@ -320,7 +320,7 @@
+             default:
+                 static const char hexDigits[] = "0123456789abcdef";
+                 UChar ch = data[i];
+-                UChar hex[] = { '\\', 'u', hexDigits[(ch >> 12) & 0xF], hexDigits[(ch >> 8) & 0xF], hexDigits[(ch >> 4) & 0xF], hexDigits[ch & 0xF] };
++                UChar hex[] = { '\\', 'u', (UChar) hexDigits[(ch >> 12) & 0xF], (UChar) hexDigits[(ch >> 8) & 0xF], (UChar) hexDigits[(ch >> 4) & 0xF], (UChar) hexDigits[ch & 0xF] };
+                 builder.append(hex, sizeof(hex) / sizeof(UChar));
+                 break;
+         }
+--- src/3rdparty/webkit/Source/JavaScriptCore/wtf/NullPtr.h.orig	2014-04-10 14:37:11.000000000 -0400
++++ src/3rdparty/webkit/Source/JavaScriptCore/wtf/NullPtr.h	2014-05-01 10:22:02.000000000 -0400
+@@ -31,16 +31,22 @@
+ // nullptr_t type and nullptr object. They are defined in the same namespaces they
+ // would be in compiler and library that had the support.
+ 
+-#ifndef __has_feature
+-    #define __has_feature(feature) 0
+-#endif
++#if (__cplusplus >= 201103L) || defined(__GXX_EXPERIMENTAL_CXX0X__)
++
++#include <cstddef>
+ 
+-#if __has_feature(cxx_nullptr) || (GCC_VERSION_AT_LEAST(4, 6, 0) && defined(__GXX_EXPERIMENTAL_CXX0X__)) || (defined(_MSC_VER) && _MSC_VER >= 1600 && !COMPILER(INTEL)) || defined(_LIBCPP_VERSION)
++// libstdc++ supports nullptr_t starting with gcc 4.6.
++#if defined(__GLIBCXX__) && __GLIBCXX__ < 20110325
++namespace std {
++typedef decltype(nullptr) nullptr_t;
++}
++#endif
+ 
+ #define HAVE_NULLPTR 1
+ 
+ #else
+ 
++#warning "reverting to non NULLPTR"
+ namespace std {
+     class nullptr_t { };
+ }
+--- src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/AtomicString.cpp.orig	2013-01-22 16:04:44.000000000 -0500
++++ src/3rdparty/webkit/Source/JavaScriptCore/wtf/text/AtomicString.cpp	2013-01-22 16:05:57.000000000 -0500
+@@ -301,7 +301,7 @@
+     if (!length)
+         return StringImpl::empty();
+ 
+-    UCharBuffer buffer = { s, length };
++    UCharBuffer buffer = { s, (unsigned int) length };
+     return addToStringTable<UCharBuffer, UCharBufferTranslator>(buffer);
+ }
+ 
+--- src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp.orig	2013-01-22 16:04:44.000000000 -0500
++++ src/3rdparty/webkit/Source/JavaScriptCore/bytecompiler/BytecodeGenerator.cpp	2013-01-22 16:05:57.000000000 -0500
+@@ -2058,7 +2058,7 @@
+ {
+     m_usesExceptions = true;
+ #if ENABLE(JIT)
+-    HandlerInfo info = { start->bind(0, 0), end->bind(0, 0), instructions().size(), m_dynamicScopeDepth + m_baseScopeDepth, CodeLocationLabel() };
++    HandlerInfo info = { uint32_t(start->bind(0, 0)), uint32_t(end->bind(0, 0)), uint32_t(instructions().size()), uint32_t(m_dynamicScopeDepth + m_baseScopeDepth), CodeLocationLabel() };
+ #else
+     HandlerInfo info = { start->bind(0, 0), end->bind(0, 0), instructions().size(), m_dynamicScopeDepth + m_baseScopeDepth };
+ #endif
+@@ -2107,7 +2107,7 @@
+ 
+ void BytecodeGenerator::beginSwitch(RegisterID* scrutineeRegister, SwitchInfo::SwitchType type)
+ {
+-    SwitchInfo info = { instructions().size(), type };
++    SwitchInfo info = { uint32_t(instructions().size()), type };
+     switch (type) {
+         case SwitchInfo::SwitchImmediate:
+             emitOpcode(op_switch_imm);
+--- src/3rdparty/webkit/Source/JavaScriptCore/runtime/Identifier.cpp.orig	2013-01-22 16:04:44.000000000 -0500
++++ src/3rdparty/webkit/Source/JavaScriptCore/runtime/Identifier.cpp	2013-01-22 16:05:57.000000000 -0500
+@@ -222,7 +222,7 @@
+     }
+     if (!length)
+         return StringImpl::empty();
+-    UCharBuffer buf = {s, length}; 
++    UCharBuffer buf = {s, (unsigned int) length}; 
+     pair<HashSet<StringImpl*>::iterator, bool> addResult = globalData->identifierTable->add<UCharBuffer, IdentifierUCharBufferTranslator>(buf);
+ 
+     // If the string is newly-translated, then we need to adopt it.
+--- src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringPrototype.cpp.orig	2013-01-22 16:04:44.000000000 -0500
++++ src/3rdparty/webkit/Source/JavaScriptCore/runtime/StringPrototype.cpp	2013-01-22 16:05:57.000000000 -0500
+@@ -463,7 +463,7 @@
+     }
+     
+     size_t matchEnd = matchPos + matchLen;
+-    int ovector[2] = { matchPos, matchEnd };
++    int ovector[2] = { int (matchPos), int (matchEnd) };
+     return JSValue::encode(jsString(exec, source.substringSharingImpl(0, matchPos), substituteBackreferences(replacementString, source, ovector, 0), source.substringSharingImpl(matchEnd)));
+ }
+ 
+--- src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSONObject.cpp.orig	2014-05-01 10:33:20.000000000 -0400
++++ src/3rdparty/webkit/Source/JavaScriptCore/runtime/JSONObject.cpp	2014-05-01 10:34:03.000000000 -0400
+@@ -335,7 +335,7 @@
+             default:
+                 static const char hexDigits[] = "0123456789abcdef";
+                 UChar ch = data[i];
+-                UChar hex[] = { '\\', 'u', hexDigits[(ch >> 12) & 0xF], hexDigits[(ch >> 8) & 0xF], hexDigits[(ch >> 4) & 0xF], hexDigits[ch & 0xF] };
++                UChar hex[] = { '\\', 'u', (UChar) hexDigits[(ch >> 12) & 0xF], (UChar) hexDigits[(ch >> 8) & 0xF], (UChar) hexDigits[(ch >> 4) & 0xF], (UChar) hexDigits[ch & 0xF] };
+                 builder.append(hex, WTF_ARRAY_LENGTH(hex));
+                 break;
+         }
+--- src/3rdparty/webkit/Source/WebCore/dom/DocumentMarkerController.cpp.orig	2013-01-22 16:04:44.000000000 -0500
++++ src/3rdparty/webkit/Source/WebCore/dom/DocumentMarkerController.cpp	2013-01-22 16:05:57.000000000 -0500
+@@ -59,7 +59,7 @@
+     for (TextIterator markedText(range); !markedText.atEnd(); markedText.advance()) {
+         RefPtr<Range> textPiece = markedText.range();
+         int exception = 0;
+-        DocumentMarker marker = {type, textPiece->startOffset(exception), textPiece->endOffset(exception), description, false};
++        DocumentMarker marker = {type, (unsigned int) textPiece->startOffset(exception), (unsigned int) textPiece->endOffset(exception), description, false};
+         addMarker(textPiece->startContainer(exception), marker);
+     }
+ }
+--- src/3rdparty/webkit/Source/WebCore/dom/Element.cpp.orig	2014-05-01 10:46:05.000000000 -0400
++++ src/3rdparty/webkit/Source/WebCore/dom/Element.cpp	2014-05-01 10:52:18.000000000 -0400
+@@ -1080,7 +1080,7 @@
+ {
+     // Ref currentStyle in case it would otherwise be deleted when setRenderStyle() is called.
+     RefPtr<RenderStyle> currentStyle(renderStyle());
+-    bool hasParentStyle = parentNodeForRenderingAndStyle() ? parentNodeForRenderingAndStyle()->renderStyle() : false;
++    bool hasParentStyle = parentNodeForRenderingAndStyle() ? (parentNodeForRenderingAndStyle()->renderStyle() != NULL) : false;
+     bool hasDirectAdjacentRules = currentStyle && currentStyle->childrenAffectedByDirectAdjacentRules();
+     bool hasIndirectAdjacentRules = currentStyle && currentStyle->childrenAffectedByForwardPositionalRules();
+ 
+--- src/plugins/accessible/widgets/itemviews.cpp.orig	2014-05-01 12:08:45.000000000 -0400
++++ src/plugins/accessible/widgets/itemviews.cpp	2014-05-01 12:28:22.000000000 -0400
+@@ -393,7 +393,7 @@
+     QModelIndex index = view()->model()->index(0, column, view()->rootIndex());
+     if (!index.isValid() || view()->selectionMode() & QAbstractItemView::NoSelection)
+         return false;
+-    view()->selectionModel()->select(index, QItemSelectionModel::Columns & QItemSelectionModel::Deselect);
++    view()->selectionModel()->select(index, QItemSelectionModel::SelectionFlags(QItemSelectionModel::Columns & QItemSelectionModel::Deselect));
+     return true;
+ }
+ 
+--- tools/designer/src/lib/shared/previewmanager.cpp.orig	2014-05-01 12:33:00.000000000 -0400
++++ tools/designer/src/lib/shared/previewmanager.cpp	2014-05-01 12:33:16.000000000 -0400
+@@ -817,7 +817,7 @@
+ {
+     typedef PreviewManagerPrivate::PreviewDataList PreviewDataList;
+     if (d->m_previews.empty())
+-        return false;
++        return 0;
+ 
+     // find matching window
+     const PreviewDataList::const_iterator cend =  d->m_previews.constEnd();
+--- src/scripttools/debugging/qscriptdebuggerconsole.cpp.orig	2014-05-01 13:47:57.000000000 -0400
++++ src/scripttools/debugging/qscriptdebuggerconsole.cpp	2014-05-01 13:48:11.000000000 -0400
+@@ -489,7 +489,7 @@
+     d->input += QLatin1Char('\n');
+     QScriptSyntaxCheckResult check = QScriptEngine::checkSyntax(d->input);
+     if (check.state() == QScriptSyntaxCheckResult::Intermediate)
+-        return false;
++        return 0;
+     d->input.chop(1); // remove the last \n
+     cmd = QString();
+     cmd.append(d->commandPrefix);
diff --git a/aqua/qt4-mac-devel/files/patch-macosx-deployment-target.diff b/aqua/qt4-mac-devel/files/patch-macosx-deployment-target.diff
deleted file mode 100644
index e4f22ef..0000000
--- a/aqua/qt4-mac-devel/files/patch-macosx-deployment-target.diff
+++ /dev/null
@@ -1,120 +0,0 @@
---- configure_orig	2010-10-13 09:42:43.000000000 -0400
-+++ configure	2010-10-12 09:44:40.000000000 -0400
-@@ -4885,7 +4885,7 @@
-             done
-         fi
-         if [ "$BUILD_ON_MAC" = "yes" ]; then
--            echo "export MACOSX_DEPLOYMENT_TARGET = 10.5" >> "$mkfile"
-+            echo "export MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@" >> "$mkfile"
-             echo "CARBON_LFLAGS =-framework ApplicationServices" >>"$mkfile"
-             echo "CARBON_CFLAGS =-fconstant-cfstrings" >>"$mkfile"
-             EXTRA_LFLAGS="$EXTRA_LFLAGS \$(CARBON_LFLAGS)"
-@@ -6965,16 +6965,7 @@
- 
- # set the global Mac deployment target. This is overridden on an arch-by-arch basis
- # in some cases, see code further down
--case "$PLATFORM,$CFG_MAC_COCOA" in
--    macx*,yes)
--	# Cocoa
--	QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.5
--	;;
--    macx*,no)
--	# gcc, Carbon
--	QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET 10.4
--	;;
--esac
-+QMakeVar set QMAKE_MACOSX_DEPLOYMENT_TARGET @MACOSX_DEPLOYMENT_TARGET@
- 
- # disable Qt 3 support on VxWorks and Symbian
- case "$XPLATFORM" in
-@@ -7696,28 +7678,28 @@
- # env. variable. 
- if [ "$PLATFORM_MAC" = "yes" ] && [ "$CFG_MAC_XARCH" != "no" ] ; then
-     if echo "$CFG_MAC_ARCHS" | grep '\<x86\>' > /dev/null 2>&1; then
--        QMakeVar add QMAKE_CFLAGS "-Xarch_i386 -mmacosx-version-min=10.4"
--        QMakeVar add QMAKE_CXXFLAGS "-Xarch_i386 -mmacosx-version-min=10.4"
--        QMakeVar add QMAKE_LFLAGS "-Xarch_i386 -mmacosx-version-min=10.4"
--        QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86 "-arch i386 -Xarch_i386 -mmacosx-version-min=10.4"
-+        QMakeVar add QMAKE_CFLAGS "-Xarch_i386 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
-+        QMakeVar add QMAKE_CXXFLAGS "-Xarch_i386 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
-+        QMakeVar add QMAKE_LFLAGS "-Xarch_i386 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
-+        QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86 "-arch i386 -Xarch_i386 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
-     fi
-     if echo "$CFG_MAC_ARCHS" | grep '\<ppc\>' > /dev/null 2>&1; then
--        QMakeVar add QMAKE_CFLAGS "-Xarch_ppc -mmacosx-version-min=10.4"
--        QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc -mmacosx-version-min=10.4"
--        QMakeVar add QMAKE_LFLAGS "-Xarch_ppc -mmacosx-version-min=10.4"
--        QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC "-arch ppc -Xarch_ppc -mmacosx-version-min=10.4"
-+        QMakeVar add QMAKE_CFLAGS "-Xarch_ppc -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
-+        QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
-+        QMakeVar add QMAKE_LFLAGS "-Xarch_ppc -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
-+        QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC "-arch ppc -Xarch_ppc -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
-     fi
-     if echo "$CFG_MAC_ARCHS" | grep '\<x86_64\>' > /dev/null 2>&1; then
--        QMakeVar add QMAKE_CFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5"
--        QMakeVar add QMAKE_CXXFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5"
--        QMakeVar add QMAKE_LFLAGS "-Xarch_x86_64 -mmacosx-version-min=10.5"
--        QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86_64 "-arch x86_64 -Xarch_x86_64 -mmacosx-version-min=10.5"
-+        QMakeVar add QMAKE_CFLAGS "-Xarch_x86_64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
-+        QMakeVar add QMAKE_CXXFLAGS "-Xarch_x86_64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
-+        QMakeVar add QMAKE_LFLAGS "-Xarch_x86_64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
-+        QMakeVar add QMAKE_OBJECTIVE_CFLAGS_X86_64 "-arch x86_64 -Xarch_x86_64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
-     fi
-     if echo "$CFG_MAC_ARCHS" | grep '\<ppc64\>' > /dev/null 2>&1; then
--        QMakeVar add QMAKE_CFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5"
--        QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5"
--        QMakeVar add QMAKE_LFLAGS "-Xarch_ppc64 -mmacosx-version-min=10.5"
--        QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC_64 "-arch ppc64 -Xarch_ppc64 -mmacosx-version-min=10.5"
-+        QMakeVar add QMAKE_CFLAGS "-Xarch_ppc64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
-+        QMakeVar add QMAKE_CXXFLAGS "-Xarch_ppc64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
-+        QMakeVar add QMAKE_LFLAGS "-Xarch_ppc64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
-+        QMakeVar add QMAKE_OBJECTIVE_CFLAGS_PPC_64 "-arch ppc64 -Xarch_ppc64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@"
-     fi
- fi
- 
---- mkspecs/common/g++-macx.conf_orig	2010-10-13 09:42:49.000000000 -0400
-+++ mkspecs/common/g++-macx.conf	2010-10-12 09:39:33.000000000 -0400
-@@ -16,8 +16,8 @@
- 
- QMAKE_LFLAGS_STATIC_LIB += -all_load
- 
--QMAKE_CFLAGS_X86_64 += -Xarch_x86_64 -mmacosx-version-min=10.5
--QMAKE_CFLAGS_PPC_64 += -Xarch_ppc64 -mmacosx-version-min=10.5
-+QMAKE_CFLAGS_X86_64 += -Xarch_x86_64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@
-+QMAKE_CFLAGS_PPC_64 += -Xarch_ppc64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@
- 
- QMAKE_CXXFLAGS_X86_64         = $$QMAKE_CFLAGS_X86_64
- QMAKE_CXXFLAGS_PPC_64         = $$QMAKE_CFLAGS_PPC_64
---- mkspecs/common/mac.conf_orig	2010-10-13 09:42:49.000000000 -0400
-+++ mkspecs/common/mac.conf	2010-10-12 09:38:52.000000000 -0400
-@@ -38,7 +38,7 @@
- QMAKE_DEL_DIR		= rmdir
- QMAKE_CHK_DIR_EXISTS	= test -d
- QMAKE_MKDIR		= mkdir -p
--QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 # overridden to 10.5 for Cocoa on the compiler command line
-+QMAKE_MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@
- 
- 
- include(unix.conf)
---- qmake/qmake.pri_orig	2010-10-13 09:42:50.000000000 -0400
-+++ qmake/qmake.pri	2010-10-13 10:04:18.000000000 -0400
-@@ -134,7 +134,7 @@
-         mac {
-           SOURCES += qfilesystemengine_mac.cpp
-           SOURCES += qcore_mac.cpp qsettings_mac.cpp
--          QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 #enables weak linking for 10.4 (exported)
-+          QMAKE_MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@
-           LIBS += -framework ApplicationServices
-         }
-     } else:win32 {
---- src/tools/bootstrap/bootstrap.pro_orig	2010-10-13 09:42:57.000000000 -0400
-+++ src/tools/bootstrap/bootstrap.pro	2010-10-13 10:04:19.000000000 -0400
-@@ -104,7 +104,7 @@
- else:win32:SOURCES += ../../corelib/tools/qlocale_win.cpp
- 
- macx: {
--   QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 #enables weak linking for 10.4 (exported)
-+   QMAKE_MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@
-    SOURCES += ../../corelib/io/qfilesystemengine_mac.cpp
-    SOURCES += ../../corelib/kernel/qcore_mac.cpp
-    LIBS += -framework CoreServices
diff --git a/aqua/qt4-mac-devel/files/patch-mkspecs-features-moc.prf.diff b/aqua/qt4-mac-devel/files/patch-mkspecs-features-moc.prf.diff
deleted file mode 100644
index 8726d88..0000000
--- a/aqua/qt4-mac-devel/files/patch-mkspecs-features-moc.prf.diff
+++ /dev/null
@@ -1,18 +0,0 @@
---- mkspecs/features/moc.prf	2010-09-10 05:04:49.000000000 -0400
-+++ /opt/local/share/qt4/mkspecs/features/moc.prf	2010-10-30 21:39:56.000000000 -0400
-@@ -83,8 +83,13 @@
- #make sure we can include these files
- moc_dir_short = $$MOC_DIR
- contains(QMAKE_HOST.os,Windows):moc_dir_short ~= s,^.:,/,
--contains(moc_dir_short, ^[/\\\\].*):INCLUDEPATH += $$MOC_DIR
--else:INCLUDEPATH += $$OUT_PWD/$$MOC_DIR
-+
-+# order the local moc path -before- the others, since its headers
-+# should -always be found locally so we want that path first.
-+contains(moc_dir_short, ^[/\\\\].*):INCLUDEPATH = $$MOC_DIR $$INCLUDEPATH
-+else:INCLUDEPATH = $$OUT_PWD/$$MOC_DIR $$INCLUDEPATH
-+
-+# message(MOC_DIR is $$MOC_DIR)
- 
- # Backwards compatibility: Make shadow builds with default MOC_DIR work
- # if the user did not add the source dir explicitly.
diff --git a/aqua/qt4-mac-devel/files/patch-mkspecs-features-qt.prf.diff b/aqua/qt4-mac-devel/files/patch-mkspecs-features-qt.prf.diff
deleted file mode 100644
index 947e0f9..0000000
--- a/aqua/qt4-mac-devel/files/patch-mkspecs-features-qt.prf.diff
+++ /dev/null
@@ -1,62 +0,0 @@
---- mkspecs/features/qt.prf.orig	2010-09-10 05:04:49.000000000 -0400
-+++ mkspecs/features/qt.prf	2010-11-02 14:28:24.000000000 -0400
-@@ -131,7 +131,15 @@
- #specific module settings
- !isEmpty(QT_BUILD_TREE):QMAKE_LIBDIR = $$QT_BUILD_TREE/lib $$QMAKE_LIBDIR #as above, prepending prevents us from picking up "stale" libs
- QMAKE_LIBDIR += $$QMAKE_LIBDIR_QT
-+
- for(QTLIB, $$list($$lower($$unique(QT)))) {
-+
-+#   message('LIBS' qt before $$QTLIB is '$${LIBS}')
-+#   message('INCLUDEPATH' qt before $$QTLIB is '$${INCLUDEPATH}')
-+#   message('QMAKE_LFLAGS' qt before $$QTLIB is '$${QMAKE_LFLAGS}')
-+#   message('QMAKE_CFLAGS' qt before $$QTLIB is '$${QMAKE_CFLAGS}')
-+#   message('QMAKE_CXXFLAGS' qt before $$QTLIB is '$${QMAKE_CXXFLAGS}')
-+
-    unset(qlib_style)
-    !qt_debug:!qt_release {
-       CONFIG(debug, debug|release):qlib_style = debug
-@@ -191,8 +199,43 @@
-      qtAddLibrary($$qlib)
-       }
-    }
-+#   message('LIBS' qt after $$QTLIB is '$${LIBS}')
-+#   message('INCLUDEPATH' qt after $$QTLIB is '$${INCLUDEPATH}')
-+#   message('QMAKE_LFLAGS' qt after $$QTLIB is '$${QMAKE_LFLAGS}')
-+#   message('QMAKE_CFLAGS' qt after $$QTLIB is '$${QMAKE_CFLAGS}')
-+#   message('QMAKE_CXXFLAGS' qt after $$QTLIB is '$${QMAKE_CXXFLAGS}')
-+}
-+
-+# remove Qt's libdir from various flags; it is already part of LIBS,
-+# and should be used only to find Qt's libraries.  Qt puts LIBDIR
-+# before all other paths, so it is critical that this variable not
-+# contain anything questionable.
-+QMAKE_LIBDIR -= $$QMAKE_LIBDIR_QT
-+QMAKE_LFLAGS -= -L$$QMAKE_LIBDIR_QT
-+!isEqual($$QMAKE_LIBDIR_QT, $$[QT_INSTALL_PREFIX]/lib) {
-+  QMAKE_LFLAGS -= -L$$[QT_INSTALL_PREFIX]/lib
-+}
-+
-+# remove Qt's incdir from various flags; it is already part of
-+# INCLUDEPATH.  C*FLAGS come before the INCPATH build from
-+# INCLUDEPATH, so they should never have this -I in it (or, reall, any
-+# other -I but instead just remove the the obvious choices)
-+QMAKE_CFLAGS -= -I$$QMAKE_INCDIR_QT
-+QMAKE_CXXFLAGS -= -I$$QMAKE_INCDIR_QT
-+QMAKE_OBJECTIVE_CFLAGS -= -I$$QMAKE_INCDIR_QT
-+QMAKE_OBJECTIVE_CXXFLAGS -= -I$$QMAKE_INCDIR_QT
-+!isEqual($$QMAKE_INCDIR_QT, $$[QT_INSTALL_PREFIX]/include) {
-+  QMAKE_CFLAGS -= -I$$[QT_INSTALL_PREFIX]/include
-+  QMAKE_CXXFLAGS -= -I$$[QT_INSTALL_PREFIX]/include
-+  QMAKE_OBJECTIVE_CFLAGS -= -I$$[QT_INSTALL_PREFIX]/include
-+  QMAKE_OBJECTIVE_CXXFLAGS -= -I$$[QT_INSTALL_PREFIX]/include
- }
- 
-+#message(QMAKE_CFLAGS at end is $${QMAKE_CFLAGS})
-+#message(QMAKE_CXXFLAGS at end is $${QMAKE_CXXFLAGS})
-+#message(QMAKE_OBJECTIVE_CFLAGS at end is $${QMAKE_OBJECTIVE_CFLAGS})
-+#message(QMAKE_OBJECTIVE_CXXFLAGS at end is $${QMAKE_OBJECTIVE_CXXFLAGS})
-+
- qt_compat {
-    !qt_compat_no_warning:QTDIR_build:warning(***USE of COMPAT inside of QTDIR!**) #just for us
-    INCLUDEPATH *= $$QMAKE_INCDIR_QT/Qt
diff --git a/aqua/qt4-mac-devel/files/patch-mkspecs-features-qt_functions.prf.diff b/aqua/qt4-mac-devel/files/patch-mkspecs-features-qt_functions.prf.diff
deleted file mode 100644
index 1228a31..0000000
--- a/aqua/qt4-mac-devel/files/patch-mkspecs-features-qt_functions.prf.diff
+++ /dev/null
@@ -1,32 +0,0 @@
---- mkspecs/features/qt_functions.prf.orig	2010-09-10 05:04:49.000000000 -0400
-+++ mkspecs/features/qt_functions.prf	2010-11-02 14:23:13.000000000 -0400
-@@ -16,8 +16,18 @@
- }
- 
- defineTest(qtAddLibrary) {
-+#    message('LIBS' before $$1 is '$${LIBS}')
-+#    message('INCLUDEPATH' before $$1 is '$${INCLUDEPATH}')
-+#    message('QMAKE_LFLAGS' before $$1 is '$${QMAKE_LFLAGS}')
-+
-+    # reorder the includes path: user, this library, Qt headers
-+    INCLUDEPATH -= $$QMAKE_INCDIR_QT
-     INCLUDEPATH -= $$QMAKE_INCDIR_QT/$$1
--    INCLUDEPATH = $$QMAKE_INCDIR_QT/$$1 $$INCLUDEPATH
-+    INCLUDEPATH += $$QMAKE_INCDIR_QT/$$1 $$QMAKE_INCDIR_QT
-+
-+    # first time through, append the path for Qt's installed libraries:
-+    # -after- all of the other necessary libraries and paths
-+    !contains(LIBS,-L$$QMAKE_LIBDIR_QT):LIBS = $$LIBS -L$$QMAKE_LIBDIR_QT
- 
-     LIB_NAME = $$1
-     unset(LINKAGE)
-@@ -85,6 +95,9 @@
-         QMAKE_LFLAGS *= --lsb-shared-libs=$${LIB_NAME}$${QT_LIBINFIX}
-     }
-     LIBS += $$LINKAGE
-+#    message('LIBS' after $$1 is now '$${LIBS}')
-+#    message('INCLUDEPATH' after $$1 is now '$${INCLUDEPATH}')
-+#    message('QMAKE_LFLAGS' after $$1 is now '$${QMAKE_LFLAGS}')
-     export(LIBS)
-     export(INCLUDEPATH)
-     export(QMAKE_FRAMEWORKPATH)
diff --git a/aqua/qt4-mac-devel/files/patch-mkspecs-macx-g++-qmake.prf.diff b/aqua/qt4-mac-devel/files/patch-mkspecs-macx-g++-qmake.prf.diff
deleted file mode 100644
index 3fe8ff6..0000000
--- a/aqua/qt4-mac-devel/files/patch-mkspecs-macx-g++-qmake.prf.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- mkspecs/macx-g++/qmake.conf.orig	2010-10-31 13:46:05.000000000 -0400
-+++ mkspecs/macx-g++/qmake.conf	2010-10-31 13:46:08.000000000 -0400
-@@ -9,7 +9,7 @@
- MAKEFILE_GENERATOR	= UNIX
- TARGET_PLATFORM		= macx
- TEMPLATE		= app
--CONFIG			+= qt warn_on release app_bundle incremental global_init_link_order lib_version_first plugin_no_soname link_prl
-+CONFIG			+= qt warn_on release app_bundle incremental global_init_link_order lib_version_first plugin_no_soname link_prl absolute_library_soname
- QT			+= core gui
- QMAKE_INCREMENTAL_STYLE = sublib
- 
diff --git a/aqua/qt4-mac-devel/files/patch-mkspecs_common_g++-base.conf.diff b/aqua/qt4-mac-devel/files/patch-mkspecs_common_g++-base.conf.diff
index b604f08..fb1748b 100644
--- a/aqua/qt4-mac-devel/files/patch-mkspecs_common_g++-base.conf.diff
+++ b/aqua/qt4-mac-devel/files/patch-mkspecs_common_g++-base.conf.diff
@@ -1,11 +1,11 @@
---- mkspecs/common/g++-base.conf.orig	2011-08-09 01:57:28.000000000 -0400
-+++ mkspecs/common/g++-base.conf	2011-08-09 01:57:34.000000000 -0400
+--- mkspecs/common/g++-base.conf.orig	2013-01-22 16:04:48.000000000 -0500
++++ mkspecs/common/g++-base.conf	2013-01-23 20:54:44.000000000 -0500
 @@ -8,14 +8,14 @@
  # you can use the manual test in tests/manual/mkspecs.
  #
  
 -QMAKE_CC = gcc
-+QMAKE_CC = @CONFIGURE_CC@
++QMAKE_CC = @CC@
  
  QMAKE_LINK_C       = $$QMAKE_CC
  QMAKE_LINK_C_SHLIB = $$QMAKE_CC
@@ -13,7 +13,14 @@
  QMAKE_CFLAGS_RELEASE_WITH_DEBUGINFO += -O2 -g
  
 -QMAKE_CXX = g++
-+QMAKE_CXX = @CONFIGURE_CXX@
++QMAKE_CXX = @CXX@
  
  QMAKE_LINK       = $$QMAKE_CXX
  QMAKE_LINK_SHLIB = $$QMAKE_CXX
+@@ -28,3 +28,6 @@
+ QMAKE_CFLAGS_USE_PRECOMPILE   = -include ${QMAKE_PCH_OUTPUT_BASE}
+ QMAKE_CXXFLAGS_PRECOMPILE     = -x c++-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT}
+ QMAKE_CXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
++
++QMAKE_CXXFLAGS_CXX11 = -std=c++11
++QMAKE_LFLAGS_CXX11   =
diff --git a/aqua/qt4-mac-devel/files/patch-mkspecs_common_g++-macx.conf.diff b/aqua/qt4-mac-devel/files/patch-mkspecs_common_g++-macx.conf.diff
new file mode 100644
index 0000000..fd5dd31
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-mkspecs_common_g++-macx.conf.diff
@@ -0,0 +1,25 @@
+--- mkspecs/common/g++-macx.conf.orig	2013-01-22 16:04:48.000000000 -0500
++++ mkspecs/common/g++-macx.conf	2013-01-23 20:55:09.000000000 -0500
+@@ -16,16 +16,20 @@
+ 
+ QMAKE_LFLAGS_STATIC_LIB += -all_load
+ 
+-QMAKE_CFLAGS_X86_64 += -Xarch_x86_64 -mmacosx-version-min=10.5
+-QMAKE_CFLAGS_PPC_64 += -Xarch_ppc64 -mmacosx-version-min=10.5
++QMAKE_CFLAGS_X86_64 += -Xarch_x86_64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@
++QMAKE_CFLAGS_PPC_64 += -Xarch_ppc64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@
+ 
+ QMAKE_CXXFLAGS_X86_64         = $$QMAKE_CFLAGS_X86_64
+ QMAKE_CXXFLAGS_PPC_64         = $$QMAKE_CFLAGS_PPC_64
+ QMAKE_OBJECTIVE_CFLAGS_X86_64 = $$QMAKE_CFLAGS_X86_64
+ QMAKE_OBJECTIVE_CFLAGS_PPC_64 = $$QMAKE_CFLAGS_PPC_64
++QMAKE_OBJECTIVE_CXXFLAGS_X86_64 = $$QMAKE_CFLAGS_X86_64
++QMAKE_OBJECTIVE_CXXFLAGS_PPC_64 = $$QMAKE_CFLAGS_PPC_64
+ QMAKE_LFLAGS_X86_64           = $$QMAKE_CFLAGS_X86_64
+ QMAKE_LFLAGS_PPC_64           = $$QMAKE_CFLAGS_PPC_64
+ 
++QMAKE_OBJECTIVE_CXXFLAGS_CXX11 = $$QMAKE_CXXFLAGS_CXX11
++
+ QMAKE_OBJCFLAGS_PRECOMPILE       = -x objective-c-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT}
+ QMAKE_OBJCFLAGS_USE_PRECOMPILE   = $$QMAKE_CFLAGS_USE_PRECOMPILE
+ QMAKE_OBJCXXFLAGS_PRECOMPILE     = -x objective-c++-header -c ${QMAKE_PCH_INPUT} -o ${QMAKE_PCH_OUTPUT}
diff --git a/aqua/qt4-mac-devel/files/patch-mkspecs_common_mac.conf.diff b/aqua/qt4-mac-devel/files/patch-mkspecs_common_mac.conf.diff
index fa7bdf3..bb53f11 100644
--- a/aqua/qt4-mac-devel/files/patch-mkspecs_common_mac.conf.diff
+++ b/aqua/qt4-mac-devel/files/patch-mkspecs_common_mac.conf.diff
@@ -1,8 +1,19 @@
---- mkspecs/common/mac.conf.orig	2010-11-02 10:44:30.000000000 -0400
-+++ mkspecs/common/mac.conf	2010-11-02 10:48:37.000000000 -0400
-@@ -40,5 +40,9 @@
+--- mkspecs/common/mac.conf.orig	2012-08-14 15:49:12.000000000 -0400
++++ mkspecs/common/mac.conf	2012-08-14 15:49:25.000000000 -0400
+@@ -9,6 +9,7 @@
+ QMAKE_LIBDIR		=
+ QMAKE_INCDIR_QT		= $$[QT_INSTALL_HEADERS]
+ QMAKE_LIBDIR_QT		= $$[QT_INSTALL_LIBS]
++QMAKE_FRAMEWORKDIR_QT	= $$[QT_INSTALL_FRAMEWORKS]
+ QMAKE_INCDIR_OPENGL	= /System/Library/Frameworks/OpenGL.framework/Headers \
+ 	/System/Library/Frameworks/AGL.framework/Headers/
+ 
+@@ -38,7 +39,11 @@
+ QMAKE_DEL_DIR		= rmdir
+ QMAKE_CHK_DIR_EXISTS	= test -d
  QMAKE_MKDIR		= mkdir -p
- QMAKE_MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@
+-QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 # overridden to 10.5 for Cocoa on the compiler command line
++QMAKE_MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@
  
 +# allow CC and CXX to use CCACHE;
 +# use "make CCACHE=ccache" when building
diff --git a/aqua/qt4-mac-devel/files/patch-mkspecs_darwin-g++_qmake.conf.diff b/aqua/qt4-mac-devel/files/patch-mkspecs_darwin-g++_qmake.conf.diff
index 9d4bc0a..d8828a5 100644
--- a/aqua/qt4-mac-devel/files/patch-mkspecs_darwin-g++_qmake.conf.diff
+++ b/aqua/qt4-mac-devel/files/patch-mkspecs_darwin-g++_qmake.conf.diff
@@ -50,7 +50,7 @@
  QMAKE_CFLAGS_USE_PRECOMPILE += -include ${QMAKE_PCH_OUTPUT_BASE}
  
  QMAKE_CXX		= c++
-@@ -43,7 +48,25 @@
+@@ -43,7 +48,48 @@
  QMAKE_CXXFLAGS_STATIC_LIB = $$QMAKE_CFLAGS_STATIC_LIB
  QMAKE_CXXFLAGS_YACC	= $$QMAKE_CFLAGS_YACC
  QMAKE_CXXFLAGS_HIDESYMS	+= $$QMAKE_CFLAGS_HIDESYMS -fvisibility-inlines-hidden
@@ -74,18 +74,63 @@
 +QMAKE_OBJCXXFLAGS_USE_PRECOMPILE = $$QMAKE_CFLAGS_USE_PRECOMPILE
 +
 +QMAKE_PCH_OUTPUT_EXT    = .gch
++
++QMAKE_LINK		= $$QMAKE_CXX
++QMAKE_LINK_SHLIB	= $$QMAKE_CXX
++QMAKE_LINK_C	        = $$QMAKE_CC
++QMAKE_LINK_C_SHLIB      = $$QMAKE_CC
++QMAKE_LFLAGS		+= -headerpad_max_install_names
++QMAKE_LFLAGS_RELEASE	+=
++QMAKE_LFLAGS_DEBUG	+=
++QMAKE_LFLAGS_APP        +=
++QMAKE_LFLAGS_SHLIB	+= -dynamiclib -single_module
++QMAKE_LFLAGS_PLUGIN	+= $$QMAKE_LFLAGS_SHLIB
++QMAKE_LFLAGS_THREAD	+=
++QMAKE_LFLAGS_INCREMENTAL+= -undefined suppress -flat_namespace
++QMAKE_LFLAGS_SONAME	+= -install_name$${LITERAL_WHITESPACE}
++QMAKE_LFLAGS_PPC_64     += -arch ppc64 -Xarch_ppc64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@
++QMAKE_LFLAGS_X86_64     += -arch x86_64 -Xarch_x86_64 -mmacosx-version-min=@MACOSX_DEPLOYMENT_TARGET@
++QMAKE_LFLAGS_PPC        += -arch ppc
++QMAKE_LFLAGS_X86        += -arch i386
++QMAKE_LFLAGS_VERSION    += -current_version$${LITERAL_WHITESPACE}
++QMAKE_LFLAGS_COMPAT_VERSION += -compatibility_version$${LITERAL_WHITESPACE}
++# -all_load requred to make Objective-C categories work in static builds.
++QMAKE_LFLAGS_STATIC_LIB += -all_load
++QMAKE_LFLAGS_RPATH	+=
  
  QMAKE_INCDIR		=
  QMAKE_LIBDIR		=
-@@ -76,7 +99,6 @@
+@@ -54,29 +100,11 @@
+ QMAKE_INCDIR_OPENGL	= /usr/X11R6/include
+ QMAKE_LIBDIR_OPENGL	= /usr/X11R6/lib
+ 
+-QMAKE_LINK		= c++
+-QMAKE_LINK_SHLIB	= c++
+-QMAKE_LFLAGS		+= -headerpad_max_install_names
+-QMAKE_LFLAGS		=
+-QMAKE_LFLAGS_RELEASE	=
+-QMAKE_LFLAGS_DEBUG	=
+-QMAKE_LFLAGS_APP        = -prebind
+-QMAKE_LFLAGS_SHLIB	= -prebind -dynamiclib -single_module
+-QMAKE_LFLAGS_PLUGIN	= -prebind -bundle
+-QMAKE_LFLAGS_THREAD	=
+-QMAKE_LFLAGS_SONAME	+= -install_name$${LITERAL_WHITESPACE}
+-
+-QMAKE_LFLAGS_VERSION    = -current_version$${LITERAL_WHITESPACE}
+-QMAKE_LFLAGS_COMPAT_VERSION = -compatibility_version$${LITERAL_WHITESPACE}
+-
+-QMAKE_LFLAGS_RPATH	=
+-
+ QMAKE_LIBS_DYNLOAD	=
+ QMAKE_LIBS_X11		= -lXext -lX11 -lm
  QMAKE_LIBS_X11SM	= -lSM -lICE
- QMAKE_LIBS_OPENGL	= -lGL
+ QMAKE_LIBS_OPENGL	= -lGLU -lGL
  QMAKE_LIBS_OPENGL_QT	= -lGL
 -QMAKE_LIBS_THREAD	=
  
  QMAKE_MOC		= $$[QT_INSTALL_BINS]/moc
  QMAKE_UIC		= $$[QT_INSTALL_BINS]/uic
-@@ -88,19 +110,19 @@
+@@ -88,19 +116,19 @@
  QMAKE_TAR		= tar -cf
  QMAKE_GZIP		= gzip -9f
  
diff --git a/aqua/qt4-mac-devel/files/patch-mkspecs_features_moc.prf.diff b/aqua/qt4-mac-devel/files/patch-mkspecs_features_moc.prf.diff
new file mode 100644
index 0000000..69620a3
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-mkspecs_features_moc.prf.diff
@@ -0,0 +1,18 @@
+--- mkspecs/features/moc.prf.orig	2012-04-24 08:27:50.000000000 -0400
++++ mkspecs/features/moc.prf	2012-04-24 08:27:55.000000000 -0400
+@@ -83,8 +83,13 @@
+ #make sure we can include these files
+ moc_dir_short = $$MOC_DIR
+ contains(QMAKE_HOST.os,Windows):moc_dir_short ~= s,^.:,/,
+-contains(moc_dir_short, ^[/\\\\].*):INCLUDEPATH += $$MOC_DIR
+-else:INCLUDEPATH += $$OUT_PWD/$$MOC_DIR
++
++# order the local moc path -before- the others, since its headers
++# should -always be found locally so we want that path first.
++contains(moc_dir_short, ^[/\\\\].*):INCLUDEPATH = $$MOC_DIR $$INCLUDEPATH
++else:INCLUDEPATH = $$OUT_PWD/$$MOC_DIR $$INCLUDEPATH
++
++# message(MOC_DIR is $$MOC_DIR)
+ 
+ # Backwards compatibility: Make shadow builds with default MOC_DIR work
+ # if the user did not add the source dir explicitly.
diff --git a/aqua/qt4-mac-devel/files/patch-mkspecs_features_qt.prf.diff b/aqua/qt4-mac-devel/files/patch-mkspecs_features_qt.prf.diff
new file mode 100644
index 0000000..eee91d7
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-mkspecs_features_qt.prf.diff
@@ -0,0 +1,62 @@
+--- mkspecs/features/qt.prf.orig	2013-07-06 14:28:19.000000000 -0400
++++ mkspecs/features/qt.prf	2013-07-06 14:28:33.000000000 -0400
+@@ -145,7 +145,15 @@
+ #specific module settings
+ !isEmpty(QT_BUILD_TREE):QMAKE_LIBDIR = $$QT_BUILD_TREE/lib $$QMAKE_LIBDIR #as above, prepending prevents us from picking up "stale" libs
+ QMAKE_LIBDIR += $$QMAKE_LIBDIR_QT
++
+ for(QTLIB, $$list($$lower($$unique(QT)))) {
++
++#   message(qt: 'LIBS' qt before $$QTLIB is '$${LIBS}')
++#   message(qt: 'INCLUDEPATH' qt before $$QTLIB is '$${INCLUDEPATH}')
++#   message(qt: 'QMAKE_LFLAGS' qt before $$QTLIB is '$${QMAKE_LFLAGS}')
++#   message(qt: 'QMAKE_CFLAGS' qt before $$QTLIB is '$${QMAKE_CFLAGS}')
++#   message(qt: 'QMAKE_CXXFLAGS' qt before $$QTLIB is '$${QMAKE_CXXFLAGS}')
++
+    unset(qlib_style)
+    !qt_debug:!qt_release {
+       CONFIG(debug, debug|release):qlib_style = debug
+@@ -206,8 +214,43 @@
+      qtAddLibrary($$qlib)
+       }
+    }
++#   message(qt: 'LIBS' qt after $$QTLIB is '$${LIBS}')
++#   message(qt: 'INCLUDEPATH' qt after $$QTLIB is '$${INCLUDEPATH}')
++#   message(qt: 'QMAKE_LFLAGS' qt after $$QTLIB is '$${QMAKE_LFLAGS}')
++#   message(qt: 'QMAKE_CFLAGS' qt after $$QTLIB is '$${QMAKE_CFLAGS}')
++#   message(qt: 'QMAKE_CXXFLAGS' qt after $$QTLIB is '$${QMAKE_CXXFLAGS}')
++}
++
++# remove Qt's libdir from various flags; it is already part of LIBS,
++# and should be used only to find Qt's libraries.  Qt puts LIBDIR
++# before all other paths, so it is critical that this variable not
++# contain anything questionable.
++QMAKE_LIBDIR -= $$QMAKE_LIBDIR_QT
++QMAKE_LFLAGS -= -L$$QMAKE_LIBDIR_QT
++!isEqual($$QMAKE_LIBDIR_QT, $$[QT_INSTALL_PREFIX]/lib) {
++  QMAKE_LFLAGS -= -L$$[QT_INSTALL_PREFIX]/lib
++}
++
++# remove Qt's incdir from various flags; it is already part of
++# INCLUDEPATH.  C*FLAGS come before the INCPATH build from
++# INCLUDEPATH, so they should never have this -I in it (or, reall, any
++# other -I but instead just remove the the obvious choices)
++QMAKE_CFLAGS -= -I$$QMAKE_INCDIR_QT
++QMAKE_CXXFLAGS -= -I$$QMAKE_INCDIR_QT
++QMAKE_OBJECTIVE_CFLAGS -= -I$$QMAKE_INCDIR_QT
++QMAKE_OBJECTIVE_CXXFLAGS -= -I$$QMAKE_INCDIR_QT
++!isEqual($$QMAKE_INCDIR_QT, $$[QT_INSTALL_PREFIX]/include) {
++  QMAKE_CFLAGS -= -I$$[QT_INSTALL_PREFIX]/include
++  QMAKE_CXXFLAGS -= -I$$[QT_INSTALL_PREFIX]/include
++  QMAKE_OBJECTIVE_CFLAGS -= -I$$[QT_INSTALL_PREFIX]/include
++  QMAKE_OBJECTIVE_CXXFLAGS -= -I$$[QT_INSTALL_PREFIX]/include
+ }
+ 
++#message(qt: QMAKE_CFLAGS at end is $${QMAKE_CFLAGS})
++#message(qt: QMAKE_CXXFLAGS at end is $${QMAKE_CXXFLAGS})
++#message(qt: QMAKE_OBJECTIVE_CFLAGS at end is $${QMAKE_OBJECTIVE_CFLAGS})
++#message(qt: QMAKE_OBJECTIVE_CXXFLAGS at end is $${QMAKE_OBJECTIVE_CXXFLAGS})
++
+ qt_compat {
+    !qt_compat_no_warning:QTDIR_build:warning(***USE of COMPAT inside of QTDIR!**) #just for us
+    INCLUDEPATH *= $$QMAKE_INCDIR_QT/Qt
diff --git a/aqua/qt4-mac-devel/files/patch-mkspecs_features_qt_functions.prf.diff b/aqua/qt4-mac-devel/files/patch-mkspecs_features_qt_functions.prf.diff
new file mode 100644
index 0000000..0185498
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-mkspecs_features_qt_functions.prf.diff
@@ -0,0 +1,204 @@
+--- mkspecs/features/qt_functions.prf.orig	2013-02-11 08:39:31.000000000 -0500
++++ mkspecs/features/qt_functions.prf	2013-02-12 10:57:03.000000000 -0500
+@@ -16,35 +16,108 @@
+ }
+ 
+ defineTest(qtAddLibrary) {
++#    message(qtAddLibrary: 'LIBS' before $$1 is '$${LIBS}')
++#    message(qtAddLibrary: 'INCLUDEPATH' before $$1 is '$${INCLUDEPATH}')
++#    message(qtAddLibrary: 'QMAKE_LFLAGS' before $$1 is '$${QMAKE_LFLAGS}')
++
++    # reorder the includes path: user, this library, Qt headers
++    INCLUDEPATH -= $$QMAKE_INCDIR_QT
+     INCLUDEPATH -= $$QMAKE_INCDIR_QT/$$1
+-    INCLUDEPATH = $$QMAKE_INCDIR_QT/$$1 $$INCLUDEPATH
++    INCLUDEPATH += $$QMAKE_INCDIR_QT/$$1 $$QMAKE_INCDIR_QT
++
++    # first time through, append the path for Qt's installed libraries:
++    # -after- all of the other necessary libraries and paths
++
++    mac:!static:contains(QT_CONFIG, qt_framework) {
++      isEmpty(QMAKE_FRAMEWORKDIR_QT) {
++         !contains(LIBS,-F$$[QT_INSTALL_PREFIX]/Library/Frameworks) {
++	   LIBS = $$LIBS -F$$[QT_INSTALL_PREFIX]/Library/Frameworks
++	 }
++      } else {
++        !contains(LIBS,-F$$QMAKE_FRAMEWORKDIR_QT) {
++ 	  LIBS = $$LIBS -F$$QMAKE_FRAMEWORKDIR_QT
++	}
++      }
++      isEmpty(QMAKE_LIBDIR_QT) {
++         !contains(LIBS,-F$$[QT_INSTALL_PREFIX]/lib) {
++	   LIBS = $$LIBS -F$$[QT_INSTALL_PREFIX]/lib
++	 }
++      } else {
++        !contains(LIBS,-F$$QMAKE_LIBDIR_QT) {
++ 	  LIBS = $$LIBS -F$$QMAKE_LIBDIR_QT
++	}
++      }
++    }
++    isEmpty(QMAKE_LIBDIR_QT) {
++       !contains(LIBS,-L$$[QT_INSTALL_PREFIX]/lib) {
++         LIBS = $$LIBS -L$$[QT_INSTALL_PREFIX]/lib
++       }
++    } else {
++      !contains(LIBS,-L$$QMAKE_LIBDIR_QT) {
++        LIBS = $$LIBS -L$$QMAKE_LIBDIR_QT
++      }
++    }
+ 
+     LIB_NAME = $$1
+     unset(LINKAGE)
+-    mac {
+-       CONFIG(qt_framework, qt_framework|qt_no_framework) { #forced
+-          QMAKE_FRAMEWORKPATH *= $${QMAKE_LIBDIR_QT}
+-          FRAMEWORK_INCLUDE = $$QMAKE_LIBDIR_QT/$${LIB_NAME}.framework/Headers
+-          !qt_no_framework_direct_includes:exists($$FRAMEWORK_INCLUDE) {
+-             INCLUDEPATH -= $$FRAMEWORK_INCLUDE
+-             INCLUDEPATH = $$FRAMEWORK_INCLUDE $$INCLUDEPATH
+-           }
+-           LINKAGE = -framework $${LIB_NAME}$${QT_LIBINFIX}
+-        } else:!qt_no_framework { #detection
+-           for(frmwrk_dir, $$list($$QMAKE_LIBDIR_QT $$QMAKE_LIBDIR $$(DYLD_FRAMEWORK_PATH) /Library/Frameworks)) {
+-       	      exists($${frmwrk_dir}/$${LIB_NAME}.framework) {
+-                QMAKE_FRAMEWORKPATH *= $${frmwrk_dir}
++
++    # see if the framework, and exists in the current known paths
++
++    # add LIBS entries QMAKE_FRAMEWORKPATH, as appropriate
++
++    all_frmwrks = $$find(LIBS, -F.*) $$find(QMAKE_LFLAGS, -F.*)
++#    message(qtAddLibrary: all frameworks is $$all_frmwrks)
++
++    for(frmwrk_dir, all_frmwrks) {
++
++#      message(qtAddLibrary: this frmwrk_dir is $$frmwrk_dir)
++      tfp = $$frmwrk_dir
++      tfp ~= s,-F,,
++      QMAKE_FRAMEWORKPATH *= $$tfp
++#      message(qtAddLibrary: this frmwrk_path is $$tfp)
++
++    }
++
++    mac:!qt_no_framework {
++       for(frmwrk_dir, $$list($$QMAKE_FRAMEWORKPATH $$QMAKE_FRAMEWORKDIR_QT $$QMAKE_LIBDIR_QT $$QMAKE_LIBDIR $$(DYLD_FRAMEWORK_PATH))) {
++
++#           message(qtAddLibrary: looking for framework $$LIB_NAME in directory $$frmwrk_dir)
++           exists($${frmwrk_dir}/$${LIB_NAME}.framework) {
++
++                message(qtAddLibrary: found framework $$LIB_NAME in directory $$frmwrk_dir)
+     	        FRAMEWORK_INCLUDE = $$frmwrk_dir/$${LIB_NAME}.framework/Headers
+     	        !qt_no_framework_direct_includes:exists($$FRAMEWORK_INCLUDE) {
+     	          INCLUDEPATH -= $$FRAMEWORK_INCLUDE
+     	          INCLUDEPATH = $$FRAMEWORK_INCLUDE $$INCLUDEPATH
+                 }
+     	        LINKAGE = -framework $${LIB_NAME}
++
++# Apple's ld has provided "-framework name,option" since at least
++# 10.4, allowing linking with a framework's option name if it exists
++# -- but defaulting to the basic name if it exists (and if neither
++# exists, then generating an error).  All GCC, LLVM, CLANG, and Apple
++# compilers available in Xcode or MacPorts back to 10.4 seem to parse
++# this feature correctly when compiling, as well as pass it through to
++# Apple's ld.  Apple used to provide debug kernel frameworks and
++# libraries that could be used by setting the shell environment variable:
++#    DYLD_IMAGE_SUFFIX=_debug
++# but Apple hasn't done so since 10.6, and does not look to be doing
++# so any time soon.  Hence, the below use of the optional framework
++# name is really the best way to link to and use debug frameworks.  For
++# QtWebKit, which has no debug version, only the main library will
++# ever be found and used.
++
++		if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
++			LINKAGE = $${LINKAGE},_debug
++		}
+        	        break()
++
+               }
+-           }
+-       }
++         }
+     }
++
++    # special for symbian
++
+     symbian {
+         isEqual(LIB_NAME, QtCore) {
+             #workaround for dependency from f32file.h on e32svr.h which has moved location in symbian3
+@@ -70,10 +143,56 @@
+         export(TARGET.EPOCHEAPSIZE)
+         export(TARGET.CAPABILITY)
+     }
++
+     isEmpty(LINKAGE) {
++
++      # not a framework or symbian
++      # see if the library exists in the current known paths
++
++      # add LIBS entries QMAKE_LIBPATH, as appropriate
++
++      all_libs = $$find(LIBS, -L.*) $$find(QMAKE_LFLAGS, -L.*)
++#      message(qtAddLibrary: all library paths is $$all_libs)
++
++      for(lib_dir, all_libs) {
++
++#        message(qtAddLibrary: this lib_dir is $$lib_dir)
++        tlp = $$lib_dir
++        tlp ~= s,-L,,
++        QMAKE_LIBPATH *= $$tlp
++#        message(qtAddLibrary: this lib_path is $$tlp)
++
++      }
++
++      for(lib_dir, $$list($$QMAKE_LIBPATH $$QMAKE_LIBDIR_QT $$QMAKE_LIBDIR)) {
++
++#           message(qtAddLibrary: looking for library $${LIB_NAME}$${QT_LIBINFIX} in directory $$lib_dir)
++           exists($${lib_dir}/lib$${LIB_NAME}$${QT_LIBINFIX}.*) {
++
++                message(qtAddLibrary: found library $${LIB_NAME}$${QT_LIBINFIX} in directory $$lib_dir)
++    	        LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}
++       	        break()
++
++              }
++         }
++    }
++
++    isEmpty(LINKAGE) {
++
++       message(WARNING: Could not find library or framework $$LIB_NAME in the current known search directories; assuming a default library.)
++
+        if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
+            win32:LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}d
+-           mac:LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}_debug
++	   # special for mac: cannot build QtWebKit as debug,
++	   # no-framework, and universal.  If things got here,
++	   # then this is no-framwork; just take care of the rest.
++	   mac {
++	       contains(QT_CONFIG, x86):contains(QT_CONFIG, x86_64):isEqual(LIB_NAME, QtWebKit) {
++	           LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}
++	       } else {
++                   LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}_debug
++               }
++           }
+        }
+        isEmpty(LINKAGE):LINKAGE = -l$${LIB_NAME}$${QT_LIBINFIX}
+     }
+@@ -83,9 +202,13 @@
+         QMAKE_LFLAGS *= --lsb-shared-libs=$${LIB_NAME}$${QT_LIBINFIX}
+     }
+     LIBS += $$LINKAGE
++#    message(qtAddLibrary: 'LIBS' after $$1 is now '$${LIBS}')
++#    message(qtAddLibrary: 'INCLUDEPATH' after $$1 is now '$${INCLUDEPATH}')
++#    message(qtAddLibrary: 'QMAKE_LFLAGS' after $$1 is now '$${QMAKE_LFLAGS}')
+     export(LIBS)
+     export(INCLUDEPATH)
+     export(QMAKE_FRAMEWORKPATH)
++    export(QMAKE_LIBPATH)
+     export(QMAKE_LFLAGS)
+     return(true)
+ }
+@@ -119,4 +242,3 @@
+ 
+     return(true)
+ }
+-
diff --git a/aqua/qt4-mac-devel/files/patch-mkspecs_features_uitools.prf.diff b/aqua/qt4-mac-devel/files/patch-mkspecs_features_uitools.prf.diff
new file mode 100644
index 0000000..05f8a70
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-mkspecs_features_uitools.prf.diff
@@ -0,0 +1,29 @@
+--- mkspecs/features/uitools.prf.orig	2012-04-26 11:40:22.000000000 -0400
++++ mkspecs/features/uitools.prf	2012-04-26 11:42:42.000000000 -0400
+@@ -2,13 +2,21 @@
+ qt:load(qt)
+ 
+ # Include the correct version of the UiLoader library
+-symbian: QTUITOOLS_LINKAGE = -lQtUiTools.lib
+-else: QTUITOOLS_LINKAGE = -lQtUiTools$${QT_LIBINFIX}
+ 
+-CONFIG(debug, debug|release) {
+-    mac: QTUITOOLS_LINKAGE = -lQtUiTools$${QT_LIBINFIX}_debug
+-    win32: QTUITOOLS_LINKAGE = -lQtUiTools$${QT_LIBINFIX}d
++#mac frameworks, for both debug and release
++mac:!static:contains(QT_CONFIG, qt_framework) {
++   QTUITOOLS_LINKAGE = -framework QtUiTools
++} else {
++
++  symbian: QTUITOOLS_LINKAGE = -lQtUiTools.lib
++  else: QTUITOOLS_LINKAGE = -lQtUiTools$${QT_LIBINFIX}
++
++  CONFIG(debug, debug|release) {
++      mac: QTUITOOLS_LINKAGE = -lQtUiTools$${QT_LIBINFIX}_debug
++      win32: QTUITOOLS_LINKAGE = -lQtUiTools$${QT_LIBINFIX}d
++  }
+ }
++
+ LIBS += $$QTUITOOLS_LINKAGE
+ 
+ INCLUDEPATH = $$QMAKE_INCDIR_QT/QtUiTools $$INCLUDEPATH
diff --git a/aqua/qt4-mac-devel/files/patch-mkspecs_macx-g++_qmake.conf.diff b/aqua/qt4-mac-devel/files/patch-mkspecs_macx-g++_qmake.conf.diff
new file mode 100644
index 0000000..3bc4275
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-mkspecs_macx-g++_qmake.conf.diff
@@ -0,0 +1,11 @@
+--- mkspecs/macx-g++/qmake.conf.orig	2012-04-23 14:49:04.000000000 -0400
++++ mkspecs/macx-g++/qmake.conf	2012-04-17 14:38:16.000000000 -0400
+@@ -9,7 +9,7 @@
+ MAKEFILE_GENERATOR	= UNIX
+ TARGET_PLATFORM		= macx
+ TEMPLATE		= app
+-CONFIG			+= qt warn_on release app_bundle incremental global_init_link_order lib_version_first plugin_no_soname link_prl
++CONFIG			+= qt warn_on release app_bundle incremental global_init_link_order lib_version_first plugin_no_soname link_prl absolute_library_soname
+ QT			+= core gui
+ QMAKE_INCREMENTAL_STYLE = sublib
+ 
diff --git a/aqua/qt4-mac-devel/files/patch-mkspecs_objective_cxx.diff b/aqua/qt4-mac-devel/files/patch-mkspecs_objective_cxx.diff
new file mode 100644
index 0000000..3f27a78
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-mkspecs_objective_cxx.diff
@@ -0,0 +1,166 @@
+--- mkspecs/common/gcc-base-macx.conf.orig	2013-01-24 08:20:57.000000000 -0500
++++ mkspecs/common/gcc-base-macx.conf	2013-01-24 08:25:21.000000000 -0500
+@@ -29,12 +29,23 @@
+ QMAKE_OBJECTIVE_CFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF
+ QMAKE_OBJECTIVE_CFLAGS_DEBUG    = $$QMAKE_CFLAGS_DEBUG
+ QMAKE_OBJECTIVE_CFLAGS_RELEASE  = $$QMAKE_CFLAGS_RELEASE
+-QMAKE_OBJECTIVE_CFLAGS_HIDESYMS = $$QMAKE_CXXFLAGS_HIDESYMS
++QMAKE_OBJECTIVE_CFLAGS_HIDESYMS = $$QMAKE_CFLAGS_HIDESYMS
+ QMAKE_OBJECTIVE_CFLAGS_X86      = $$QMAKE_CFLAGS_X86
+ QMAKE_OBJECTIVE_CFLAGS_X86_64   = $$QMAKE_CFLAGS_X86_64
+ QMAKE_OBJECTIVE_CFLAGS_PPC      = $$QMAKE_CFLAGS_PPC
+ QMAKE_OBJECTIVE_CFLAGS_PPC_64   = $$QMAKE_CFLAGS_PPC_64
+ 
++QMAKE_OBJECTIVE_CXXFLAGS          = $$QMAKE_CXXFLAGS
++QMAKE_OBJECTIVE_CXXFLAGS_WARN_ON  = $$QMAKE_CXXFLAGS_WARN_ON
++QMAKE_OBJECTIVE_CXXFLAGS_WARN_OFF = $$QMAKE_CXXFLAGS_WARN_OFF
++QMAKE_OBJECTIVE_CXXFLAGS_DEBUG    = $$QMAKE_CXXFLAGS_DEBUG
++QMAKE_OBJECTIVE_CXXFLAGS_RELEASE  = $$QMAKE_CXXFLAGS_RELEASE
++QMAKE_OBJECTIVE_CXXFLAGS_HIDESYMS = $$QMAKE_CXXFLAGS_HIDESYMS
++QMAKE_OBJECTIVE_CXXFLAGS_X86      = $$QMAKE_CXXFLAGS_X86
++QMAKE_OBJECTIVE_CXXFLAGS_X86_64   = $$QMAKE_CXXFLAGS_X86_64
++QMAKE_OBJECTIVE_CXXFLAGS_PPC      = $$QMAKE_CXXFLAGS_PPC
++QMAKE_OBJECTIVE_CXXFLAGS_PPC_64   = $$QMAKE_CXXFLAGS_PPC_64
++
+ QMAKE_LFLAGS_X86    += $$QMAKE_CFLAGS_X86
+ QMAKE_LFLAGS_X86_64 += $$QMAKE_CFLAGS_X86_64
+ QMAKE_LFLAGS_PPC    += $$QMAKE_CFLAGS_PPC
+--- mkspecs/features/debug.prf.orig	2013-01-24 08:20:57.000000000 -0500
++++ mkspecs/features/debug.prf	2013-01-24 08:25:21.000000000 -0500
+@@ -3,6 +3,7 @@
+ QMAKE_CFLAGS += $$QMAKE_CFLAGS_DEBUG
+ QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_DEBUG
+ QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_DEBUG
++QMAKE_OBJECTIVE_CXXFLAGS += $$QMAKE_OBJECTIVE_CXXFLAGS_DEBUG
+ QMAKE_LFLAGS += $$QMAKE_LFLAGS_DEBUG
+ QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_DEBUG
+ !debug_and_release:fix_output_dirs:fixExclusiveOutputDirs(debug, release)
+--- mkspecs/features/mac/default_post.prf.orig	2013-01-24 08:20:57.000000000 -0500
++++ mkspecs/features/mac/default_post.prf	2013-01-24 08:25:21.000000000 -0500
+@@ -1,5 +1,5 @@
+ load(default_post)
+-!no_objective_c:CONFIG += objective_c
++!no_objective_c:CONFIG += split_sources objective_c objective_cxx
+ 
+ # Pick a suitable default architecture for qmake-based applications.
+ # If the Qt package contains one of x86 and x86_64, pick that one. If it
+--- mkspecs/features/mac/objective_c.prf.orig	2013-01-24 08:20:57.000000000 -0500
++++ mkspecs/features/mac/objective_c.prf	2013-01-24 09:48:39.000000000 -0500
+@@ -1,23 +1,18 @@
+-
+-for(source, SOURCES) {
+-    contains(source,.*\\.mm?$) {
+-        warning(Objective-C source \'$$source\' found in SOURCES but should be in OBJECTIVE_SOURCES)
+-        SOURCES -= $$source
+-        OBJECTIVE_SOURCES += $$source
+-    }
+-}
++# Add compiler directives for Objective C (.m) only
++#
++# OBJECTIVE_C_SOURCES has already been set in "split_sources"
+ 
+ isEmpty(QMAKE_OBJECTIVE_CC):QMAKE_OBJECTIVE_CC = $$QMAKE_CC
+ 
+ OBJECTIVE_C_OBJECTS_DIR = $$OBJECTS_DIR
+ isEmpty(OBJECTIVE_C_OBJECTS_DIR):OBJECTIVE_C_OBJECTS_DIR = .
+-isEmpty(QMAKE_EXT_OBJECTIVE_C):QMAKE_EXT_OBJECTIVE_C = .mm .m
++isEmpty(QMAKE_EXT_OBJECTIVE_C):QMAKE_EXT_OBJECTIVE_C = .m
+ 
+ objective_c.dependency_type = TYPE_C
+ objective_c.variables = QMAKE_OBJECTIVE_CFLAGS
+-objective_c.commands = $$QMAKE_OBJECTIVE_CC -c $(QMAKE_COMP_QMAKE_OBJECTIVE_CFLAGS) $(DEFINES) $(INCPATH) ${QMAKE_FILE_IN} -o ${QMAKE_FILE_OUT}
++objective_c.commands = $$QMAKE_OBJECTIVE_CC -c $(QMAKE_COMP_QMAKE_OBJECTIVE_CFLAGS) $(DEFINES) $(INCPATH) -o ${QMAKE_FILE_OUT} ${QMAKE_FILE_IN}
+ objective_c.output = $$OBJECTIVE_C_OBJECTS_DIR/${QMAKE_FILE_BASE}$${first(QMAKE_EXT_OBJ)}
+-objective_c.input = OBJECTIVE_SOURCES
++objective_c.input = OBJECTIVE_C_SOURCES
+ objective_c.name = Compile ${QMAKE_FILE_IN}
+ silent:objective_c.commands = @echo objective-c ${QMAKE_FILE_IN} && $$objective_c.commands
+ QMAKE_EXTRA_COMPILERS += objective_c
+--- mkspecs/features/mac/ppc.prf.orig	2013-01-24 08:20:57.000000000 -0500
++++ mkspecs/features/mac/ppc.prf	2013-01-24 08:25:21.000000000 -0500
+@@ -2,6 +2,7 @@
+ } else {
+     QMAKE_CFLAGS += $$QMAKE_CFLAGS_PPC
+     QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_PPC
++    QMAKE_OBJECTIVE_CXXFLAGS += $$QMAKE_OBJECTIVE_CXXFLAGS_PPC
+     QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_PPC
+     QMAKE_LFLAGS += $$QMAKE_LFLAGS_PPC
+ }
+--- mkspecs/features/mac/ppc64.prf.orig	2013-01-24 08:20:57.000000000 -0500
++++ mkspecs/features/mac/ppc64.prf	2013-01-24 08:25:21.000000000 -0500
+@@ -2,6 +2,7 @@
+ } else {
+     QMAKE_CFLAGS += $$QMAKE_CFLAGS_PPC_64
+     QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_PPC_64
++    QMAKE_OBJECTIVE_CXXFLAGS += $$QMAKE_OBJECTIVE_CXXFLAGS_PPC_64
+     QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_PPC_64
+     QMAKE_LFLAGS += $$QMAKE_LFLAGS_PPC_64
+ }
+--- mkspecs/features/mac/sdk.prf.orig	2013-01-24 08:20:57.000000000 -0500
++++ mkspecs/features/mac/sdk.prf	2013-01-24 08:25:21.000000000 -0500
+@@ -2,6 +2,7 @@
+     !macx-xcode:!macx-pbuilder {
+         QMAKE_CFLAGS += -isysroot $$QMAKE_MAC_SDK
+         QMAKE_OBJECTIVE_CFLAGS += -isysroot $$QMAKE_MAC_SDK
++        QMAKE_OBJECTIVE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK
+         QMAKE_CXXFLAGS += -isysroot $$QMAKE_MAC_SDK
+         QMAKE_LFLAGS += -Wl,-syslibroot,$$QMAKE_MAC_SDK
+     }
+--- mkspecs/features/mac/x86.prf.orig	2013-01-24 08:20:57.000000000 -0500
++++ mkspecs/features/mac/x86.prf	2013-01-24 08:25:21.000000000 -0500
+@@ -2,6 +2,7 @@
+ } else {
+    QMAKE_CFLAGS += $$QMAKE_CFLAGS_X86
+    QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_X86
++   QMAKE_OBJECTIVE_CXXFLAGS += $$QMAKE_OBJECTIVE_CXXFLAGS_X86
+    QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_X86
+    QMAKE_LFLAGS += $$QMAKE_LFLAGS_X86
+ }
+--- mkspecs/features/mac/x86_64.prf.orig	2013-01-24 08:20:57.000000000 -0500
++++ mkspecs/features/mac/x86_64.prf	2013-01-24 08:25:21.000000000 -0500
+@@ -2,6 +2,7 @@
+ } else {
+    QMAKE_CFLAGS += $$QMAKE_CFLAGS_X86_64
+    QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_X86_64
++   QMAKE_OBJECTIVE_CXXFLAGS += $$QMAKE_OBJECTIVE_CXXFLAGS_X86_64
+    QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_X86_64
+    QMAKE_LFLAGS += $$QMAKE_LFLAGS_X86_64
+ }
+--- mkspecs/features/release.prf.orig	2013-01-24 08:20:57.000000000 -0500
++++ mkspecs/features/release.prf	2013-01-24 08:25:21.000000000 -0500
+@@ -2,6 +2,7 @@
+ QMAKE_CFLAGS += $$QMAKE_CFLAGS_RELEASE
+ QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_RELEASE
+ QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_RELEASE
++QMAKE_OBJECTIVE_CXXFLAGS += $$QMAKE_OBJECTIVE_CXXFLAGS_RELEASE
+ QMAKE_LFLAGS += $$QMAKE_LFLAGS_RELEASE
+ QMAKE_LIBFLAGS += $$QMAKE_LIBFLAGS_RELEASE
+-!debug_and_release:fix_output_dirs:fixExclusiveOutputDirs(release, debug)
+\ No newline at end of file
++!debug_and_release:fix_output_dirs:fixExclusiveOutputDirs(release, debug)
+--- mkspecs/features/unix/hide_symbols.prf.orig	2013-01-24 08:20:57.000000000 -0500
++++ mkspecs/features/unix/hide_symbols.prf	2013-01-24 08:25:21.000000000 -0500
+@@ -1,4 +1,5 @@
+ QMAKE_CFLAGS += $$QMAKE_CFLAGS_HIDESYMS
+ QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_HIDESYMS
+ QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_HIDESYMS
++QMAKE_OBJECTIVE_CXXFLAGS += $$QMAKE_OBJECTIVE_CXXFLAGS_HIDESYMS
+ QMAKE_LFLAGS += $$QMAKE_LFLAGS_HIDESYMS
+--- mkspecs/features/warn_off.prf.orig	2013-01-24 08:20:57.000000000 -0500
++++ mkspecs/features/warn_off.prf	2013-01-24 08:25:21.000000000 -0500
+@@ -1,4 +1,5 @@
+ CONFIG -= warn_on
+ QMAKE_CFLAGS += $$QMAKE_CFLAGS_WARN_OFF
+ QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_WARN_OFF
+-QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_WARN_OFF
+\ No newline at end of file
++QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_WARN_OFF
++QMAKE_OBJECTIVE_CXXFLAGS += $$QMAKE_OBJECTIVE_CXXFLAGS_WARN_OFF
+--- mkspecs/features/warn_on.prf.orig	2013-01-24 08:20:57.000000000 -0500
++++ mkspecs/features/warn_on.prf	2013-01-24 08:25:21.000000000 -0500
+@@ -2,4 +2,4 @@
+ QMAKE_CFLAGS += $$QMAKE_CFLAGS_WARN_ON
+ QMAKE_CXXFLAGS += $$QMAKE_CXXFLAGS_WARN_ON
+ QMAKE_OBJECTIVE_CFLAGS += $$QMAKE_OBJECTIVE_CFLAGS_WARN_ON
+-
++QMAKE_OBJECTIVE_CXXFLAGS += $$QMAKE_OBJECTIVE_CXXFLAGS_WARN_ON
diff --git a/aqua/qt4-mac-devel/files/patch-precomp.test.diff b/aqua/qt4-mac-devel/files/patch-precomp.test.diff
deleted file mode 100644
index a390829..0000000
--- a/aqua/qt4-mac-devel/files/patch-precomp.test.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- config.tests/unix/precomp.test.orig	2009-02-25 16:09:14.000000000 -0500
-+++ config.tests/unix/precomp.test	2009-03-10 16:49:45.000000000 -0400
-@@ -27,7 +27,7 @@
-     rm -f header.pchi header.o source.o
-     ;;
- 
--*g++*|c++)
-+*g++*|c++|*gcc*|cc)
-     case `"$COMPILER" -dumpversion 2>/dev/null` in
-     3.*)
-         ;;
diff --git a/aqua/qt4-mac-devel/files/patch-qmake_generators_unix_unixmakke.cpp.diff b/aqua/qt4-mac-devel/files/patch-qmake_generators_unix_unixmakke.cpp.diff
new file mode 100644
index 0000000..1a93310
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-qmake_generators_unix_unixmakke.cpp.diff
@@ -0,0 +1,108 @@
+--- qmake/generators/unix/unixmake.cpp.orig	2013-02-24 21:46:23.000000000 -0500
++++ qmake/generators/unix/unixmake.cpp	2013-02-25 11:40:24.000000000 -0500
+@@ -472,8 +472,9 @@
+ UnixMakefileGenerator::findLibraries()
+ {
+     QList<QMakeLocalFileName> libdirs, frameworkdirs;
++    frameworkdirs.append(QMakeLocalFileName("@PREFIX@/Library/Frameworks"));
+     frameworkdirs.append(QMakeLocalFileName("/System/Library/Frameworks"));
+-    frameworkdirs.append(QMakeLocalFileName("/Library/Frameworks"));
++    libdirs.append(QMakeLocalFileName("@PREFIX@/lib"));
+     const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_FRAMEWORKPATH_FLAGS", "QMAKE_LFLAGS", "QMAKE_LIBS", "QMAKE_LIBS_PRIVATE", QString() };
+     for(int i = 0; !lflags[i].isNull(); i++) {
+         QStringList &l = project->values(lflags[i]);
+@@ -583,7 +584,9 @@
+ UnixMakefileGenerator::processPrlFiles()
+ {
+     QList<QMakeLocalFileName> libdirs, frameworkdirs;
++    frameworkdirs.append(QMakeLocalFileName("@PREFIX@/Library/Frameworks"));
+     frameworkdirs.append(QMakeLocalFileName("/System/Library/Frameworks"));
++    libdirs.append(QMakeLocalFileName("@PREFIX@/lib"));
+     const QString lflags[] = { "QMAKE_LIBDIR_FLAGS", "QMAKE_FRAMEWORKPATH_FLAGS", "QMAKE_LFLAGS", "QMAKE_LIBS", QString() };
+     for(int i = 0; !lflags[i].isNull(); i++) {
+         QStringList &l = project->values(lflags[i]);
+@@ -627,13 +630,78 @@
+                     else
+                         opt = l.at(++lit);
+                     opt = opt.trimmed();
+-                    const QList<QMakeLocalFileName> dirs = frameworkdirs + libdirs;
+-                    for(int dep_i = 0; dep_i < dirs.size(); ++dep_i) {
++
++		    // See if this framework is specified as
++		    // "foo,bar", which to Apple's LD means to look
++		    // for "foo" with the addition "bar" first in all
++		    // paths, then if not found do the same for just
++		    // "foo".  Tricky looking for "," but not "\,"
++
++#if 0
++		    warn_msg(WarnLogic, "out before: '%s'\n", opt.toLatin1().constData());
++#endif
++		    int num_cs = 0;
++		    int loc_1 = -1;
++		    int loc = opt.indexOf(",");
++		    bool found = false;
++		    while (!found && (loc != -1)) { 
++		      found = (loc == 0);
++		      if (!found) {
++			found = (opt[loc-1] != '\\');
++		      }
++		      if (found) {
++			if (loc_1 == -1) {
++			  loc_1 = loc;
++			}
++			++num_cs;
++		      } else {
++			loc = opt.indexOf(",", loc);
++		      }
++		    }
++#if 0
++		    warn_msg(WarnLogic, "found == %s, loc == %d\n",
++			     (found ? "true" : "false"), loc);
++#endif
++		    if (found) {
++		      // split into name and extension
++		      if (num_cs > 1) {
++			warn_msg(WarnLogic, "When parsing -framework '%s', found more than one ',' in the name.  Assuming the first ',' is used to delineate between the framework name and the optional extension.\n", opt.toLatin1().constData());
++		      }
++		      QString ext = opt.mid(loc_1+1);
++		      opt = opt.left(loc_1);
++		      found = false;
++		      const QList<QMakeLocalFileName> dirs = frameworkdirs + libdirs;
++		      for(int dep_i = 0; dep_i < dirs.size(); ++dep_i) {
++                        QString prl = dirs[dep_i].local() + "/" + opt + ".framework/" + opt + ext + Option::prl_ext;
++#if 0
++			warn_msg(WarnLogic, "Looking for PRL '%s'\n", prl.toLatin1().constData());
++#endif
++                        if(processPrlFile(prl)) {
++#if 0
++			  warn_msg(WarnLogic, "Found PRL for framework '%s' with optional extension '%s': '%s'\n", opt.toLatin1().constData(), ext.toLatin1().constData(), prl.toLatin1().constData());
++#endif
++			  found = true;
++			  break;
++			}
++		      }
++		    }
++		    // if not found yet, try the primary name
++		    if (!found) {
++		      const QList<QMakeLocalFileName> dirs = frameworkdirs + libdirs;
++		      for(int dep_i = 0; dep_i < dirs.size(); ++dep_i) {
+                         QString prl = dirs[dep_i].local() + "/" + opt + ".framework/" + opt + Option::prl_ext;
+-                        if(processPrlFile(prl))
+-                            break;
+-                    }
+-                }
++#if 0
++			warn_msg(WarnLogic, "Looking for PRL '%s'\n", prl.toLatin1().constData());
++#endif
++                        if(processPrlFile(prl)) {
++#if 0
++			  warn_msg(WarnLogic, "Found PRL for framework '%s': '%s'\n", opt.toLatin1().constData(), prl.toLatin1().constData());
++#endif
++			  break;
++			}
++		      }
++		    }
++		}
+             } else if(!opt.isNull()) {
+                 QString lib = opt;
+                 processPrlFile(lib);
diff --git a/aqua/qt4-mac-devel/files/patch-qmake_option.h.diff b/aqua/qt4-mac-devel/files/patch-qmake_option.h.diff
new file mode 100644
index 0000000..b8e49f8
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-qmake_option.h.diff
@@ -0,0 +1,10 @@
+--- qmake/option.h.orig	2012-04-23 14:49:04.000000000 -0400
++++ qmake/option.h	2012-04-20 23:03:15.000000000 -0400
+@@ -214,6 +214,7 @@
+         DocumentationPath,
+         HeadersPath,
+         LibrariesPath,
++        FrameworksPath,
+         BinariesPath,
+         PluginsPath,
+         DataPath,
diff --git a/aqua/qt4-mac-devel/files/patch-qmake_project.cpp.diff b/aqua/qt4-mac-devel/files/patch-qmake_project.cpp.diff
new file mode 100644
index 0000000..5f8a4e6
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-qmake_project.cpp.diff
@@ -0,0 +1,37 @@
+--- qmake/project.cpp.orig	2012-04-23 14:49:04.000000000 -0400
++++ qmake/project.cpp	2012-04-17 14:38:16.000000000 -0400
+@@ -596,14 +596,17 @@
+             }
+         }
+     }
+-    for(QStringList::Iterator concat_it = concat.begin();
+-        concat_it != concat.end(); ++concat_it)
++    QByteArray qmake_no_defaults = qgetenv("QMAKE_NO_DEFAULTS");
++    if (qmake_no_defaults.isNull()) {
++      for(QStringList::Iterator concat_it = concat.begin();
++	  concat_it != concat.end(); ++concat_it)
+         feature_roots << (QLibraryInfo::location(QLibraryInfo::PrefixPath) +
+                           mkspecs_concat + (*concat_it));
+-    for(QStringList::Iterator concat_it = concat.begin();
+-        concat_it != concat.end(); ++concat_it)
++      for(QStringList::Iterator concat_it = concat.begin();
++	  concat_it != concat.end(); ++concat_it)
+         feature_roots << (QLibraryInfo::location(QLibraryInfo::DataPath) +
+                           mkspecs_concat + (*concat_it));
++    }
+     return feature_roots;
+ }
+ 
+@@ -617,8 +620,10 @@
+         for(QStringList::ConstIterator it = lst.begin(); it != lst.end(); ++it)
+             ret << ((*it) + concat);
+     }
+-    ret << QLibraryInfo::location(QLibraryInfo::DataPath) + concat;
+-
++    QByteArray qmake_no_defaults = qgetenv("QMAKE_NO_DEFAULTS");
++    if (qmake_no_defaults.isNull()) {
++      ret << QLibraryInfo::location(QLibraryInfo::DataPath) + concat;
++    }
+     return ret;
+ }
+ 
diff --git a/aqua/qt4-mac-devel/files/patch-qmake_property.cpp.diff b/aqua/qt4-mac-devel/files/patch-qmake_property.cpp.diff
new file mode 100644
index 0000000..e8e87eb
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-qmake_property.cpp.diff
@@ -0,0 +1,19 @@
+--- qmake/property.cpp.orig	2012-04-23 14:49:04.000000000 -0400
++++ qmake/property.cpp	2012-04-20 22:56:47.000000000 -0400
+@@ -91,6 +91,8 @@
+         return QLibraryInfo::location(QLibraryInfo::HeadersPath);
+     else if(v == "QT_INSTALL_LIBS")
+         return QLibraryInfo::location(QLibraryInfo::LibrariesPath);
++    else if(v == "QT_INSTALL_FRAMEWORKS")
++        return QLibraryInfo::location(QLibraryInfo::FrameworksPath);
+     else if(v == "QT_INSTALL_BINS")
+         return QLibraryInfo::location(QLibraryInfo::BinariesPath);
+     else if(v == "QT_INSTALL_PLUGINS")
+@@ -198,6 +200,7 @@
+             specialProps.append("QT_INSTALL_DOCS");
+             specialProps.append("QT_INSTALL_HEADERS");
+             specialProps.append("QT_INSTALL_LIBS");
++            specialProps.append("QT_INSTALL_FRAMEWORKS");
+             specialProps.append("QT_INSTALL_BINS");
+             specialProps.append("QT_INSTALL_PLUGINS");
+             specialProps.append("QT_INSTALL_IMPORTS");
diff --git a/aqua/qt4-mac-devel/files/patch-qmake_qmake.pri.diff b/aqua/qt4-mac-devel/files/patch-qmake_qmake.pri.diff
new file mode 100644
index 0000000..b868b90
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-qmake_qmake.pri.diff
@@ -0,0 +1,11 @@
+--- qmake/qmake.pri.orig	2014-04-10 14:37:13.000000000 -0400
++++ qmake/qmake.pri	2014-05-01 08:39:42.000000000 -0400
+@@ -135,7 +135,7 @@
+         SOURCES += qfilesystemengine_unix.cpp qfilesystemiterator_unix.cpp qfsfileengine_unix.cpp
+         mac {
+           SOURCES += qcore_mac.cpp qsettings_mac.cpp
+-          QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 #enables weak linking for 10.4 (exported)
++          QMAKE_MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@
+           LIBS += -framework ApplicationServices
+         }
+     } else:win32 {
diff --git a/aqua/qt4-mac-devel/files/patch-src-plugins-bearer-corewlan-corewlan.pro.diff b/aqua/qt4-mac-devel/files/patch-src-plugins-bearer-corewlan-corewlan.pro.diff
deleted file mode 100644
index 15b59ca..0000000
--- a/aqua/qt4-mac-devel/files/patch-src-plugins-bearer-corewlan-corewlan.pro.diff
+++ /dev/null
@@ -1,11 +0,0 @@
---- src/plugins/bearer/corewlan/corewlan.pro.orig	2011-10-03 23:44:31.000000000 -0400
-+++ src/plugins/bearer/corewlan/corewlan.pro	2011-10-13 20:46:49.000000000 -0400
-@@ -5,7 +5,7 @@
- LIBS += -framework Foundation -framework SystemConfiguration
- 
- contains(QT_CONFIG, corewlan) {
--    isEmpty(QMAKE_MAC_SDK)|contains(QMAKE_MAC_SDK, "/Developer/SDKs/MacOSX10\.[67]\.sdk") {
-+    isEmpty(QMAKE_MAC_SDK)|contains(QMAKE_MAC_SDK, "@DEVELOPER_DIR@/SDKs/MacOSX10.@MACOSX_VERSION_MINOR@.sdk") {
-          LIBS += -framework CoreWLAN -framework Security
-     }
- }
diff --git a/aqua/qt4-mac-devel/files/patch-src_3rdparty_webkit_Source_WebCore_plugins_PluginView.h.diff b/aqua/qt4-mac-devel/files/patch-src_3rdparty_webkit_Source_WebCore_plugins_PluginView.h.diff
new file mode 100644
index 0000000..138f429
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-src_3rdparty_webkit_Source_WebCore_plugins_PluginView.h.diff
@@ -0,0 +1,12 @@
+--- src/3rdparty/webkit/Source/WebCore/plugins/PluginView.h.orig	2012-04-23 14:49:04.000000000 -0400
++++ src/3rdparty/webkit/Source/WebCore/plugins/PluginView.h	2012-04-23 14:51:28.000000000 -0400
+@@ -411,7 +411,9 @@
+ 
+         Point m_lastMousePos;
+         void setNPWindowIfNeeded();
++#ifndef NP_NO_CARBON
+         void nullEventTimerFired(Timer<PluginView>*);
++#endif
+         Point globalMousePosForPlugin() const;
+         Point mousePosForPlugin(MouseEvent* event = 0) const;
+ #endif
diff --git a/aqua/qt4-mac-devel/files/patch-src_3rdparty_webkit_Source_WebCore_plugins_mac_PluginViewMac.mm.diff b/aqua/qt4-mac-devel/files/patch-src_3rdparty_webkit_Source_WebCore_plugins_mac_PluginViewMac.mm.diff
new file mode 100644
index 0000000..d7df5f2
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-src_3rdparty_webkit_Source_WebCore_plugins_mac_PluginViewMac.mm.diff
@@ -0,0 +1,13 @@
+--- src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginViewMac.mm.orig	2012-04-23 14:49:04.000000000 -0400
++++ src/3rdparty/webkit/Source/WebCore/plugins/mac/PluginViewMac.mm	2012-04-23 14:51:28.000000000 -0400
+@@ -233,8 +233,10 @@
+         setNPWindowIfNeeded();
+ 
+     // TODO: Implement null timer throttling depending on plugin activation
++#ifndef NP_NO_CARBON
+     m_nullEventTimer = adoptPtr(new Timer<PluginView>(this, &PluginView::nullEventTimerFired));
+     m_nullEventTimer->startRepeating(0.02);
++#endif
+ 
+     m_lastMousePos.h = m_lastMousePos.v = 0;
+ 
diff --git a/aqua/qt4-mac-devel/files/patch-src_corelib_corelib.pro.diff b/aqua/qt4-mac-devel/files/patch-src_corelib_corelib.pro.diff
new file mode 100644
index 0000000..b9c3025
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-src_corelib_corelib.pro.diff
@@ -0,0 +1,11 @@
+--- src/corelib/corelib.pro.orig	2012-09-17 15:22:14.000000000 -0400
++++ src/corelib/corelib.pro	2012-09-17 15:22:22.000000000 -0400
+@@ -25,7 +25,7 @@
+         LIBS_PRIVATE += -framework CoreServices -framework Security
+     }
+ } else:mac|darwin {
+-        LIBS_PRIVATE += -framework CoreFoundation -framework Security
++        LIBS_PRIVATE += -framework CoreFoundation -framework Security -framework Foundation
+ }
+ mac:lib_bundle:DEFINES += QT_NO_DEBUG_PLUGIN_CHECK
+ win32:DEFINES-=QT_NO_CAST_TO_ASCII
diff --git a/aqua/qt4-mac-devel/files/patch-src_corelib_global_qlibraryinfo.cpp.diff b/aqua/qt4-mac-devel/files/patch-src_corelib_global_qlibraryinfo.cpp.diff
new file mode 100644
index 0000000..0e34fee
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-src_corelib_global_qlibraryinfo.cpp.diff
@@ -0,0 +1,25 @@
+--- src/corelib/global/qlibraryinfo.cpp.orig	2012-04-23 14:49:04.000000000 -0400
++++ src/corelib/global/qlibraryinfo.cpp	2012-04-20 22:59:34.000000000 -0400
+@@ -262,6 +262,11 @@
+             path = QT_CONFIGURE_LIBRARIES_PATH;
+             break;
+ #endif
++#ifdef QT_CONFIGURE_FRAMEWORKS_PATH
++        case FrameworksPath:
++            path = QT_CONFIGURE_FRAMEWORKS_PATH;
++            break;
++#endif
+ #ifdef QT_CONFIGURE_BINARIES_PATH
+         case BinariesPath:
+             path = QT_CONFIGURE_BINARIES_PATH;
+@@ -327,6 +332,10 @@
+             key = QLatin1String("Libraries");
+             defaultValue = QLatin1String("lib");
+             break;
++        case FrameworksPath:
++            key = QLatin1String("Frameworks");
++            defaultValue = QLatin1String("Library/Frameworks");
++            break;
+         case BinariesPath:
+             key = QLatin1String("Binaries");
+             defaultValue = QLatin1String("bin");
diff --git a/aqua/qt4-mac-devel/files/patch-src_corelib_global_qlibraryinfo.h.diff b/aqua/qt4-mac-devel/files/patch-src_corelib_global_qlibraryinfo.h.diff
new file mode 100644
index 0000000..d600213
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-src_corelib_global_qlibraryinfo.h.diff
@@ -0,0 +1,10 @@
+--- src/corelib/global/qlibraryinfo.h.orig	2012-04-23 14:49:04.000000000 -0400
++++ src/corelib/global/qlibraryinfo.h	2012-04-20 22:56:57.000000000 -0400
+@@ -70,6 +70,7 @@
+         DocumentationPath,
+         HeadersPath,
+         LibrariesPath,
++	FrameworksPath,
+         BinariesPath,
+         PluginsPath,
+         DataPath,
diff --git a/aqua/qt4-mac-devel/files/patch-src_corelib_tools_qelapsedtimer-mac.cpp.diff b/aqua/qt4-mac-devel/files/patch-src_corelib_tools_qelapsedtimer-mac.cpp.diff
new file mode 100644
index 0000000..5946e86
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-src_corelib_tools_qelapsedtimer-mac.cpp.diff
@@ -0,0 +1,11 @@
+--- src/corelib/tools/qelapsedtimer_mac.cpp.orig	2011-09-12 08:49:29.000000000 +0200
++++ src/corelib/tools/qelapsedtimer_mac.cpp	2012-02-02 21:30:46.000000000 +0100
+@@ -62,7 +62,7 @@
+ {
+     if (info.denom == 0)
+         mach_timebase_info(&info);
+-    qint64 nsecs = cpuTime * info.numer / info.denom;
++    qint64 nsecs = (qint64)(((double) cpuTime) * ((double) info.numer) / ((double) info.denom));
+     return nsecs;
+ }
+ 
diff --git a/aqua/qt4-mac-devel/files/patch-src_plugins_bearer_corewlan_corewlan.pro.diff b/aqua/qt4-mac-devel/files/patch-src_plugins_bearer_corewlan_corewlan.pro.diff
new file mode 100644
index 0000000..a22ae53
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-src_plugins_bearer_corewlan_corewlan.pro.diff
@@ -0,0 +1,11 @@
+--- src/plugins/bearer/corewlan/corewlan.pro.orig	2012-03-14 10:01:12.000000000 -0400
++++ src/plugins/bearer/corewlan/corewlan.pro	2012-04-24 09:23:47.000000000 -0400
+@@ -7,7 +7,7 @@ LIBS += -framework Foundation -framework SystemConfiguration
+ contains(QT_CONFIG, corewlan) {
+     LIBS += -framework CoreWLAN
+ 
+-    isEmpty(QMAKE_MAC_SDK)|contains(QMAKE_MAC_SDK, ".*OSX10\.[6789]\.sdk/?$") {
++    isEmpty(QMAKE_MAC_SDK)|contains(QMAKE_MAC_SDK, "@DEVELOPER_SDK@/?$") {
+          LIBS += -framework Security
+     }
+ }
diff --git a/aqua/qt4-mac-devel/files/patch-src_qbase.pri.diff b/aqua/qt4-mac-devel/files/patch-src_qbase.pri.diff
new file mode 100644
index 0000000..d065ce6
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-src_qbase.pri.diff
@@ -0,0 +1,30 @@
+--- src/qbase.pri.orig	2012-04-23 14:49:04.000000000 -0400
++++ src/qbase.pri	2012-04-18 22:49:14.000000000 -0400
+@@ -137,14 +137,14 @@
+ 
+ unix|win32-g++*:!symbian {
+    CONFIG += create_pc
+-   QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS]
++   QMAKE_PKGCONFIG_LIBDIR = $$target.path
+    QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET
+    QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS]
+    QMAKE_PKGCONFIG_DESTDIR = pkgconfig
+    include_replace.match = $$QMAKE_INCDIR_QT
+    include_replace.replace = $$[QT_INSTALL_HEADERS]
+    lib_replace.match = $$QMAKE_LIBDIR_QT
+-   lib_replace.replace = $$[QT_INSTALL_LIBS]
++   lib_replace.replace = $$target.path
+    prefix_replace.match = $$QT_BUILD_TREE
+    prefix_replace.replace = $$[QT_INSTALL_PREFIX]
+    QMAKE_PKGCONFIG_INSTALL_REPLACE += include_replace lib_replace prefix_replace
+@@ -152,8 +152,8 @@
+ 
+ unix:!symbian {
+    CONFIG += create_libtool explicitlib
+-   QMAKE_LIBTOOL_LIBDIR = $$[QT_INSTALL_LIBS]
+-   QMAKE_PRL_LIBDIR = $$[QT_INSTALL_LIBS]
++   QMAKE_LIBTOOL_LIBDIR = $$target.path
++   QMAKE_PRL_LIBDIR = $$target.path
+    QMAKE_PRL_INSTALL_REPLACE += include_replace lib_replace
+    QMAKE_LIBTOOL_INSTALL_REPLACE += include_replace lib_replace
+ }
diff --git a/aqua/qt4-mac-devel/files/patch-src_qt_install.pri.diff b/aqua/qt4-mac-devel/files/patch-src_qt_install.pri.diff
new file mode 100644
index 0000000..55815ba
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-src_qt_install.pri.diff
@@ -0,0 +1,16 @@
+--- src/qt_install.pri.orig	2012-04-23 14:49:04.000000000 -0400
++++ src/qt_install.pri	2012-04-20 23:50:49.000000000 -0400
+@@ -3,7 +3,12 @@
+    dlltarget.path=$$[QT_INSTALL_BINS]
+    INSTALLS += dlltarget
+ }
+-target.path=$$[QT_INSTALL_LIBS]
++# install mac frameworks differently than libraries
++mac:!static:contains(QT_CONFIG, qt_framework) {
++    target.path=$$[QT_INSTALL_FRAMEWORKS]
++} else {
++    target.path=$$[QT_INSTALL_LIBS]
++}
+ INSTALLS += target
+ 
+ #headers
diff --git a/aqua/qt4-mac-devel/files/patch-src_tools_bootstrap_bootstrap.pro.diff b/aqua/qt4-mac-devel/files/patch-src_tools_bootstrap_bootstrap.pro.diff
new file mode 100644
index 0000000..e757047
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-src_tools_bootstrap_bootstrap.pro.diff
@@ -0,0 +1,11 @@
+--- src/tools/bootstrap/bootstrap.pro.orig	2012-04-23 14:49:04.000000000 -0400
++++ src/tools/bootstrap/bootstrap.pro	2012-04-17 14:38:16.000000000 -0400
+@@ -103,7 +103,7 @@
+ else:win32:SOURCES += ../../corelib/tools/qlocale_win.cpp
+ 
+ macx: {
+-   QMAKE_MACOSX_DEPLOYMENT_TARGET = 10.4 #enables weak linking for 10.4 (exported)
++   QMAKE_MACOSX_DEPLOYMENT_TARGET = @MACOSX_DEPLOYMENT_TARGET@
+    SOURCES += ../../corelib/kernel/qcore_mac.cpp
+    LIBS += -framework CoreServices
+ }
diff --git a/aqua/qt4-mac-devel/files/patch-tools-build_qtconfig.diff b/aqua/qt4-mac-devel/files/patch-tools-build_qtconfig.diff
new file mode 100644
index 0000000..56cadc1
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-tools-build_qtconfig.diff
@@ -0,0 +1,19 @@
+--- tools/orig.tools.pro	2014-04-10 20:37:12.000000000 +0200
++++ tools/tools.pro	2015-03-21 21:58:01.000000000 +0100
+@@ -20,7 +20,7 @@
+                 SUBDIRS += designer
+             }
+         }
+-        unix:!symbian:!mac:!embedded:!qpa:SUBDIRS += qtconfig
++        unix:!symbian:!embedded:!qpa:SUBDIRS += qtconfig
+         win32:!wince*:SUBDIRS += activeqt
+     }
+     contains(QT_CONFIG, declarative) {
+@@ -33,6 +33,7 @@
+ 
+ mac {
+     SUBDIRS += macdeployqt
++    SUBDIRS += qconfig
+ }
+ 
+ embedded:SUBDIRS += kmap2qmap
diff --git a/aqua/qt4-mac-devel/files/patch-tools_assistant_lib_fulltextsearch_fulltextsearch.pro.diff b/aqua/qt4-mac-devel/files/patch-tools_assistant_lib_fulltextsearch_fulltextsearch.pro.diff
new file mode 100644
index 0000000..b8057c5
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-tools_assistant_lib_fulltextsearch_fulltextsearch.pro.diff
@@ -0,0 +1,14 @@
+--- tools/assistant/lib/fulltextsearch/fulltextsearch.pro.orig	2012-04-23 14:49:04.000000000 -0400
++++ tools/assistant/lib/fulltextsearch/fulltextsearch.pro	2012-04-23 12:29:24.000000000 -0400
+@@ -6,9 +6,9 @@
+ mac:!static:contains(QT_CONFIG, qt_framework) { 
+    CONFIG(debug, debug|release) { 
+       !build_pass:CONFIG += build_all 
+-   } 
++   }
+ }
+-QT_CONFIG -= qt_framework 
++# QT_CONFIG -= qt_framework 
+ QT -= gui
+ TEMPLATE = lib
+ TARGET = QtCLucene
diff --git a/aqua/qt4-mac-devel/files/patch-tools_assistant_lib_lib.pro.diff b/aqua/qt4-mac-devel/files/patch-tools_assistant_lib_lib.pro.diff
new file mode 100644
index 0000000..9e62ef8
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-tools_assistant_lib_lib.pro.diff
@@ -0,0 +1,26 @@
+--- tools/assistant/lib/lib.pro.orig	2012-03-14 10:01:12.000000000 -0400
++++ tools/assistant/lib/lib.pro	2012-04-25 12:32:49.000000000 -0400
+@@ -12,16 +12,15 @@
+     application \
+     framework.
+ DEFINES -= QT_ASCII_CAST_WARNINGS
+-qclucene = QtCLucene$${QT_LIBINFIX}
+-if(!debug_and_release|build_pass):CONFIG(debug, debug|release) { 
+-    mac:qclucene = $${qclucene}_debug
+-    win32:qclucene = $${qclucene}d
+-}
+-linux-lsb-g++:LIBS_PRIVATE += --lsb-shared-libs=$$qclucene
++
++qtAddLibrary(QtCLucene)
++
+ unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES += QtNetwork \
+     QtSql \
+-    QtXml
+-LIBS_PRIVATE += -l$$qclucene
++    QtGui \
++    QtCore \
++    QtCLucene
++
+ RESOURCES += helpsystem.qrc
+ SOURCES += qhelpenginecore.cpp \
+     qhelpengine.cpp \
diff --git a/aqua/qt4-mac-devel/files/patch-tools_designer_src_components_lib_lib.pro.diff b/aqua/qt4-mac-devel/files/patch-tools_designer_src_components_lib_lib.pro.diff
new file mode 100644
index 0000000..e814560
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-tools_designer_src_components_lib_lib.pro.diff
@@ -0,0 +1,44 @@
+--- tools/designer/src/components/lib/lib.pro.orig	2012-04-23 14:49:04.000000000 -0400
++++ tools/designer/src/components/lib/lib.pro	2012-04-22 14:42:03.000000000 -0400
+@@ -64,12 +64,38 @@
+ include(../../sharedcomponents.pri)
+ include(../component.pri)
+ 
+-unix|win32-g++* {
+-    QMAKE_PKGCONFIG_REQUIRES = QtCore QtDesigner QtGui QtXml
++# install mac frameworks differently than libraries
++mac:!static:contains(QT_CONFIG, qt_framework) {
++    target.path=$$[QT_INSTALL_FRAMEWORKS]
++} else {
++    target.path=$$[QT_INSTALL_LIBS]
++}
++
++unix|win32-g++*:!symbian {
++   CONFIG += create_pc
++   QMAKE_PKGCONFIG_LIBDIR = $$target.path
++   QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET
++   QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS]
++   QMAKE_PKGCONFIG_DESTDIR = pkgconfig
++   QMAKE_PKGCONFIG_REQUIRES += QtCore QtDesigner QtXml
+     contains(QT_CONFIG, script): QMAKE_PKGCONFIG_REQUIRES += QtScript
++   include_replace.match = $$QMAKE_INCDIR_QT
++   include_replace.replace = $$[QT_INSTALL_HEADERS]
++   lib_replace.match = $$QMAKE_LIBDIR_QT
++   lib_replace.replace = $$target.path
++   prefix_replace.match = $$QT_BUILD_TREE
++   prefix_replace.replace = $$[QT_INSTALL_PREFIX]
++   QMAKE_PKGCONFIG_INSTALL_REPLACE += include_replace lib_replace prefix_replace
++}
++
++unix:!symbian {
++   CONFIG += create_libtool explicitlib
++   QMAKE_LIBTOOL_LIBDIR = $$target.path
++   QMAKE_PRL_LIBDIR = $$target.path
++   QMAKE_PRL_INSTALL_REPLACE += include_replace lib_replace
++   QMAKE_LIBTOOL_INSTALL_REPLACE += include_replace lib_replace
+ }
+ 
+-target.path=$$[QT_INSTALL_LIBS]
+ INSTALLS        += target
+ win32 {
+     dlltarget.path=$$[QT_INSTALL_BINS]
diff --git a/aqua/qt4-mac-devel/files/patch-tools_designer_src_lib_lib.pro.diff b/aqua/qt4-mac-devel/files/patch-tools_designer_src_lib_lib.pro.diff
new file mode 100644
index 0000000..dbdf210
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-tools_designer_src_lib_lib.pro.diff
@@ -0,0 +1,55 @@
+--- tools/designer/src/lib/lib.pro.orig	2012-04-23 14:49:04.000000000 -0400
++++ tools/designer/src/lib/lib.pro	2012-04-22 14:41:19.000000000 -0400
+@@ -13,8 +13,6 @@
+    VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
+ }
+ 
+-unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES += QtXml
+-
+ include(../../../../src/qt_targets.pri)
+ QMAKE_TARGET_PRODUCT = Designer
+ QMAKE_TARGET_DESCRIPTION = Graphical user interface designer.
+@@ -63,13 +61,42 @@
+ include(../sharedcomponents.pri)
+ include(../components/component.pri)
+ 
+-target.path=$$[QT_INSTALL_LIBS]
++# install mac frameworks differently than libraries
++mac:!static:contains(QT_CONFIG, qt_framework) {
++    target.path=$$[QT_INSTALL_FRAMEWORKS]
++} else {
++    target.path=$$[QT_INSTALL_LIBS]
++}
+ INSTALLS        += target
+ win32 {
+     dlltarget.path=$$[QT_INSTALL_BINS]
+     INSTALLS += dlltarget
+ }
+ 
++unix|win32-g++*:!symbian {
++   CONFIG += create_pc
++   QMAKE_PKGCONFIG_LIBDIR = $$target.path
++   QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET
++   QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS]
++   QMAKE_PKGCONFIG_DESTDIR = pkgconfig
++   QMAKE_PKGCONFIG_REQUIRES += QtCore QtGui QtXml
++   contains(QT_CONFIG, script): QMAKE_PKGCONFIG_REQUIRES += QtScript
++   include_replace.match = $$QMAKE_INCDIR_QT
++   include_replace.replace = $$[QT_INSTALL_HEADERS]
++   lib_replace.match = $$QMAKE_LIBDIR_QT
++   lib_replace.replace = $$target.path
++   prefix_replace.match = $$QT_BUILD_TREE
++   prefix_replace.replace = $$[QT_INSTALL_PREFIX]
++   QMAKE_PKGCONFIG_INSTALL_REPLACE += include_replace lib_replace prefix_replace
++}
++
++unix:!symbian {
++   CONFIG += create_libtool explicitlib
++   QMAKE_LIBTOOL_LIBDIR = $$target.path
++   QMAKE_PRL_LIBDIR = $$target.path
++   QMAKE_PRL_INSTALL_REPLACE += include_replace lib_replace
++   QMAKE_LIBTOOL_INSTALL_REPLACE += include_replace lib_replace
++}
+ 
+ qt_install_headers {
+     designer_headers.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
diff --git a/aqua/qt4-mac-devel/files/patch-tools_designer_src_uitools_uitools.pro.diff b/aqua/qt4-mac-devel/files/patch-tools_designer_src_uitools_uitools.pro.diff
new file mode 100644
index 0000000..debcf74
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-tools_designer_src_uitools_uitools.pro.diff
@@ -0,0 +1,88 @@
+--- tools/designer/src/uitools/uitools.pro.orig	2012-03-14 10:01:12.000000000 -0400
++++ tools/designer/src/uitools/uitools.pro	2012-04-25 14:57:29.000000000 -0400
+@@ -1,7 +1,7 @@
+ TEMPLATE = lib
+ TARGET = QtUiTools
+ QT += xml
+-CONFIG += qt staticlib
++CONFIG += qt qt_install_headers
+ DESTDIR = ../../../../lib
+ DLLDESTDIR = ../../../../bin
+ 
+@@ -28,20 +28,68 @@
+ SOURCES += quiloader.cpp
+ 
+ include($$QT_BUILD_TREE/include/QtUiTools/headers.pri, "", true)
+-quitools_headers.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
+-quitools_headers.path = $$[QT_INSTALL_HEADERS]/QtUiTools
+-INSTALLS        += quitools_headers
+ 
+-target.path=$$[QT_INSTALL_LIBS]
++#mac frameworks
++mac:!static:contains(QT_CONFIG, qt_framework) {
++   #QMAKE_FRAMEWORK_VERSION = 4.0
++   CONFIG += lib_bundle qt_no_framework_direct_includes qt_framework
++   CONFIG(debug, debug|release) {
++      !build_pass:CONFIG += debug_and_release build_all
++   } else { #release
++      !debug_and_release|build_pass {
++	  CONFIG -= qt_install_headers #no need to install these as well
++	  FRAMEWORK_HEADERS.version = Versions
++	  FRAMEWORK_HEADERS.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
++      	  FRAMEWORK_HEADERS.path = Headers
++      }
++      QMAKE_BUNDLE_DATA += FRAMEWORK_HEADERS
++   }
++}
++
++mac {
++   CONFIG += explicitlib
++   macx-g++ {
++       QMAKE_CFLAGS += -fconstant-cfstrings
++       QMAKE_CXXFLAGS += -fconstant-cfstrings
++   }
++}
++
++# install mac frameworks differently than libraries
++mac:!static:contains(QT_CONFIG, qt_framework) {
++    target.path=$$[QT_INSTALL_FRAMEWORKS]
++} else {
++    target.path=$$[QT_INSTALL_LIBS]
++}
+ INSTALLS        += target
+ 
+-unix|win32-g++* {
+-   CONFIG     += create_pc
+-   QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS]
++unix|win32-g++*:!symbian {
++   CONFIG += create_pc
++   QMAKE_PKGCONFIG_LIBDIR = $$target.path
+    QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET
+    QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS]
+    QMAKE_PKGCONFIG_DESTDIR = pkgconfig
+-   QMAKE_PKGCONFIG_REQUIRES += QtXml
++   QMAKE_PKGCONFIG_REQUIRES += QtXml QtCore QtGui
++   include_replace.match = $$QMAKE_INCDIR_QT
++   include_replace.replace = $$[QT_INSTALL_HEADERS]
++   lib_replace.match = $$QMAKE_LIBDIR_QT
++   lib_replace.replace = $$target.path
++   prefix_replace.match = $$QT_BUILD_TREE
++   prefix_replace.replace = $$[QT_INSTALL_PREFIX]
++   QMAKE_PKGCONFIG_INSTALL_REPLACE += include_replace lib_replace prefix_replace
++}
++
++unix:!symbian {
++   CONFIG += create_libtool explicitlib
++   QMAKE_LIBTOOL_LIBDIR = $$target.path
++   QMAKE_PRL_LIBDIR = $$target.path
++   QMAKE_PRL_INSTALL_REPLACE += include_replace lib_replace
++   QMAKE_LIBTOOL_INSTALL_REPLACE += include_replace lib_replace
++}
++
++qt_install_headers {
++    quitools_headers.files = $$SYNCQT.HEADER_FILES $$SYNCQT.HEADER_CLASSES
++    quitools_headers.path = $$[QT_INSTALL_HEADERS]/QtUiTools
++    INSTALLS        += quitools_headers
+ }
+ 
+ TARGET = $$qtLibraryTarget($$TARGET$$QT_LIBINFIX) #do this towards the end
diff --git a/aqua/qt4-mac-devel/files/patch-tools_macdeployqt_macdeployqt_main.cpp.diff b/aqua/qt4-mac-devel/files/patch-tools_macdeployqt_macdeployqt_main.cpp.diff
new file mode 100644
index 0000000..7350ee8
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-tools_macdeployqt_macdeployqt_main.cpp.diff
@@ -0,0 +1,11 @@
+--- tools/macdeployqt/macdeployqt/main.cpp.orig	2012-04-23 14:49:04.000000000 -0400
++++ tools/macdeployqt/macdeployqt/main.cpp	2012-04-17 14:38:16.000000000 -0400
+@@ -127,7 +127,7 @@
+ 
+     if (plugins) {
+         if (deploymentInfo.qtPath.isEmpty())
+-            deploymentInfo.pluginPath = "/Developer/Applications/Qt/plugins"; // Assume binary package.
++            deploymentInfo.pluginPath = "@QT_PLUGINS_DIR@"; // Assume binary package.
+         else
+             deploymentInfo.pluginPath = deploymentInfo.qtPath + "/plugins";
+ 
diff --git a/aqua/qt4-mac-devel/files/patch-tools_macdeployqt_shared_shared.cpp.diff b/aqua/qt4-mac-devel/files/patch-tools_macdeployqt_shared_shared.cpp.diff
new file mode 100644
index 0000000..6aa620b
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/patch-tools_macdeployqt_shared_shared.cpp.diff
@@ -0,0 +1,11 @@
+--- tools/macdeployqt/shared/shared.cpp.orig	2012-08-12 19:01:35.000000000 -0400
++++ tools/macdeployqt/shared/shared.cpp	2012-08-12 19:01:55.000000000 -0400
+@@ -141,7 +141,7 @@
+                 state = DylibName;
+                 continue;
+             } else if (part < parts.count() && parts.at(part).endsWith(".framework")) {
+-                info.installName += "/" + (qtPath + "lib/").simplified();
++                info.installName += "/" + (qtPath + "Frameworks/").simplified();
+                 info.frameworkDirectory = info.installName;
+                 state = FrameworkName;
+                 continue;
diff --git a/aqua/qt4-mac-devel/files/prevent_addTitleRelated_crash.patch b/aqua/qt4-mac-devel/files/prevent_addTitleRelated_crash.patch
new file mode 100644
index 0000000..168eb3d
--- /dev/null
+++ b/aqua/qt4-mac-devel/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-devel/files/qconfig-remove-EXCEPTIONS.diff b/aqua/qt4-mac-devel/files/qconfig-remove-EXCEPTIONS.diff
new file mode 100644
index 0000000..03cce47
--- /dev/null
+++ b/aqua/qt4-mac-devel/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-devel/files/qprocess-nozombies.patch b/aqua/qt4-mac-devel/files/qprocess-nozombies.patch
new file mode 100644
index 0000000..b91a21f
--- /dev/null
+++ b/aqua/qt4-mac-devel/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-devel/files/qt4 b/aqua/qt4-mac-devel/files/qt4
new file mode 100644
index 0000000..29dc48f
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/qt4
@@ -0,0 +1,10 @@
+libexec/qt4/bin/qmake
+libexec/qt4/bin/moc
+libexec/qt4/bin/uic
+libexec/qt4/bin/lrelease
+libexec/qt4/bin/lupdate
+libexec/qt4/bin/macdeployqt
+libexec/qt4/bin/qhelpconverter
+libexec/qt4/bin/qhelpgenerator
+libexec/qt4/bin/xmlpatterns
+libexec/qt4/bin/xmlpatternsvalidator
diff --git a/aqua/qt4-mac-devel/files/qt4-correct-systraymenu-iconhandling.patch b/aqua/qt4-mac-devel/files/qt4-correct-systraymenu-iconhandling.patch
new file mode 100644
index 0000000..7996304
--- /dev/null
+++ b/aqua/qt4-mac-devel/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-devel/files/qt4-deactivate-menurole-heuristics.patch b/aqua/qt4-mac-devel/files/qt4-deactivate-menurole-heuristics.patch
new file mode 100644
index 0000000..81cc723
--- /dev/null
+++ b/aqua/qt4-mac-devel/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-devel/files/qt4-prevent-mousevent-for-deleted-object.diff b/aqua/qt4-mac-devel/files/qt4-prevent-mousevent-for-deleted-object.diff
new file mode 100644
index 0000000..25205b4
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/qt4-prevent-mousevent-for-deleted-object.diff
@@ -0,0 +1,33 @@
+--- src/gui/kernel/orig.qt_cocoa_helpers_mac.mm	2015-01-17 15:43:32.000000000 +0100
++++ src/gui/kernel/qt_cocoa_helpers_mac.mm	2015-02-10 19:19:43.000000000 +0100
+@@ -91,6 +91,8 @@
+ #include <private/qwidget_p.h>
+ #include <private/qcocoawindow_mac_p.h>
+ 
++#include <string.h>
++
+ QT_BEGIN_NAMESPACE
+ 
+ #ifdef QT_MAC_USE_COCOA
+@@ -1280,8 +1282,19 @@
+         // released. We therefore need to re-check if should send (delayed) enter leave events:
+         // qt_button_down has now become NULL since the call at the top of the function. Also, since
+         // the relase might have closed a window, we dont give the nativeWidget hint
+-        qt_mac_getTargetForMouseEvent(0, QEvent::None, localPoint, globalPoint, nativeWidget, &widgetUnderMouse);
+-        qt_mac_checkEnterLeaveForNativeWidgets(widgetUnderMouse);
++        //qt_mac_getTargetForMouseEvent(0, QEvent::None, localPoint, globalPoint, nativeWidget, &widgetUnderMouse);
++        //RJVB:
++//         ProcessSerialNumber current, front;
++//         GetCurrentProcess(&current);
++//         GetFrontProcess(&front);
++        qt_mac_getTargetForMouseEvent(0, QEvent::None, localPoint, globalPoint, NULL, &widgetUnderMouse);
++        if ( [[NSApplication sharedApplication] isActive] /*memcmp(&current, &front, sizeof(ProcessSerialNumber)) == 0*/) {
++            qt_mac_checkEnterLeaveForNativeWidgets(widgetUnderMouse);
++        }
++        else if (widgetUnderMouse) {
++            qDebug() << "Background application does not deliver mouse button release event to" << widgetUnderMouse
++                << "at" << globalPoint;
++        }
+     }
+ 
+     previousButton = button;
diff --git a/aqua/qt4-mac-devel/files/series b/aqua/qt4-mac-devel/files/series
new file mode 100644
index 0000000..4b58d44
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/series
@@ -0,0 +1,43 @@
+patch-config.tests_unix_compile.test.diff
+patch-config.tests_unix_precomp.test.diff
+patch-configure.diff
+patch-mkspecs_common_g++-macx.conf.diff
+patch-mkspecs_common_mac.conf.diff
+patch-mkspecs_features_moc.prf.diff
+patch-mkspecs_features_qt.prf.diff
+patch-mkspecs_features_qt_functions.prf.diff
+patch-mkspecs_common_g++-base.conf.diff
+patch-mkspecs_objective_cxx.diff
+patch-mkspecs_macx-g++_qmake.conf.diff
+patch-qmake_option.h.diff
+patch-qmake_property.cpp.diff
+patch-src_corelib_global_qlibraryinfo.cpp.diff
+patch-src_corelib_global_qlibraryinfo.h.diff
+patch-qmake_project.cpp.diff
+patch-qmake_generators_unix_unixmakke.cpp.diff
+patch-qmake_qmake.pri.diff
+patch-src_tools_bootstrap_bootstrap.pro.diff
+patch-src_3rdparty_webkit_Source_WebCore_plugins_PluginView.h.diff
+patch-src_3rdparty_webkit_Source_WebCore_plugins_mac_PluginViewMac.mm.diff
+patch-src_plugins_bearer_corewlan_corewlan.pro.diff
+patch-src_qbase.pri.diff
+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
+patch-tools_macdeployqt_macdeployqt_main.cpp.diff
+patch-src_corelib_tools_qelapsedtimer-mac.cpp.diff
+patch-src_corelib_corelib.pro.diff
+patch-tools_macdeployqt_shared_shared.cpp.diff
+qprocess-nozombies.patch
+disable-exceptions.patch
+patch-tools-build_qtconfig.diff
+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
diff --git a/aqua/qt4-mac-devel/files/silence-qfilesystemwatcher.patch b/aqua/qt4-mac-devel/files/silence-qfilesystemwatcher.patch
new file mode 100644
index 0000000..171ff8d
--- /dev/null
+++ b/aqua/qt4-mac-devel/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/aqua/qt4-mac-devel/files/split_sources.prf b/aqua/qt4-mac-devel/files/split_sources.prf
new file mode 100644
index 0000000..7851cf6
--- /dev/null
+++ b/aqua/qt4-mac-devel/files/split_sources.prf
@@ -0,0 +1,52 @@
+# move Obective C and C++ files from SOURCES to OBJECTIVE_SOURCES
+
+for(source, SOURCES) {
+    contains(source,.*\\.m$) {
+        warning(Objective-C source \'$$source\' found in SOURCES but should be in OBJECTIVE_SOURCES)
+        SOURCES -= $$source
+        OBJECTIVE_SOURCES += $$source
+    } else {
+        contains(source,.*\\.mm$) {
+            warning(Objective-C++ source \'$$source\' found in SOURCES but should be in OBJECTIVE_SOURCES)
+            SOURCES -= $$source
+            OBJECTIVE_SOURCES += $$source
+ 	}
+    }
+}
+
+# move C and C++ files from OBJECTIVE_SOURCES to SOURCES
+
+for(source, OBJECTIVE_SOURCES) {
+    contains(source,.*\\.c$) {
+        warning(C source \'$$source\' found in SOURCES but should be in SOURCES)
+        OBJECTIVE_SOURCES -= $$source
+        SOURCES += $$source
+    } else {
+      	contains(source,.*\\.cc$) {
+            warning(C++ source \'$$source\' found in SOURCES but should be in SOURCES)
+            OBJECTIVE_SOURCES -= $$source
+            SOURCES += $$source
+        } else {
+    	    contains(source,.*\\.cpp$) {
+	        warning(C++ source \'$$source\' found in SOURCES but should be in SOURCES)
+		OBJECTIVE_SOURCES -= $$source
+		SOURCES += $$source
+            }
+        }
+    }
+}
+
+# split Objective C and C++ sources into their own variables
+
+for(source, OBJECTIVE_SOURCES) {
+    contains(source,.*\\.mm$) {
+        OBJECTIVE_CXX_SOURCES += $$source
+    } else {
+        contains(source,.*\\.m$) {
+            OBJECTIVE_C_SOURCES += $$source
+        } else {
+            warning(Source \'$$source\' was found in OBJECTIVE_SOURCES but its file extension is not a typical objective C (\'.m\') or C++ (\'.mm\') extension; assuming Objective C.)
+            OBJECTIVE_C_SOURCES += $$source
+	}
+    }
+}
