Index: .
===================================================================
diff --git a/trunk/dports/_resources/port1.0/group/qt5-2.0.tcl b/trunk/dports/_resources/port1.0/group/qt5-2.0.tcl
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/_resources/port1.0/group/qt5-2.0.tcl	(working copy)
@@ -0,0 +1,310 @@
+# -*- 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$
+# $Id$
+
+# Copyright (c) 2014 The MacPorts Project
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of Apple Computer, Inc. nor the names of its
+#    contributors may be used to endorse or promote products derived from
+#    this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#
+# This portgroup defines standard settings when using Qt5.
+#
+# Usage:
+# PortGroup     qt5 2.0
+
+# no universal binary support in Qt 5
+#     see http://lists.qt-project.org/pipermail/interest/2012-December/005038.html
+#     see also https://bugreports.qt-project.org/browse/QTBUG-24952
+if { ![exists universal_variant] || [option universal_variant] } {
+    PortGroup muniversal 1.0
+    #universal_archs_supported i386 x86_64
+}
+
+# check for +debug variant of this port, and make sure Qt was
+# installed with +debug as well; if not, error out.
+platform darwin {
+    pre-extract {
+        if {[variant_exists debug] && \
+            [variant_isset debug] && \
+           ![info exists building_qt5]} {
+            if {![file exists ${qt_frameworks_dir}/QtCore.framework/QtCore_debug]} {
+                return -code error "\n\nERROR:\n\
+In order to install this port as +debug,
+Qt5 must also be installed with +debug.\n"
+            }
+        }
+    }
+}
+
+# standard Qt5 name
+global qt_name
+set qt_name             qt5
+
+# standard install directory
+    global qt_dir
+    global qt_dir_rel
+# standard Qt documents directory
+    global qt_docs_dir
+# standard Qt plugins directory
+    global qt_plugins_dir
+# standard Qt mkspecs directory
+    global qt_mkspecs_dir
+# standard Qt imports directory
+    global qt_imports_dir
+# standard Qt qml directory
+    global qt_qml_dir
+# standard Qt includes directory
+    global qt_includes_dir
+# standard Qt libraries directory
+    global qt_libs_dir
+# standard Qt libraries directory
+    global qt_frameworks_dir
+    global qt_frameworks_dir_rel
+# standard Qt non-.app executables directory
+    global qt_bins_dir
+# standard Qt data directory
+    global qt_data_dir
+# standard Qt translations directory
+    global qt_translations_dir
+# standard Qt sysconf directory
+    global qt_sysconf_dir
+# standard Qt examples directory
+    global qt_examples_dir
+# standard Qt tests directory
+    global qt_tests_dir
+# standard Qt demos directory
+    global qt_demos_dir
+# standard CMake module directory for Qt-related files
+    global qt_cmake_module_dir
+# standard qmake command location
+    global qt_qmake_cmd
+# standard moc command location
+    global qt_moc_cmd
+# standard uic command location
+    global qt_uic_cmd
+# standard lrelease command location
+    global qt_lrelease_cmd
+
+global qt5_is_concurrent
+# check if we're building qt5 itself
+if {![info exists building_qt5] || ![info exists name] || ${name} ne "qt5-mac"} {
+    # no, this must be a dependent port: check the qt5 install:
+    if {[file exists ${prefix}/libexec/${qt_name}/bin/qmake]} {
+        # we have a "concurrent" install, which means we must look for the various components
+        # in different locations (esp. qmake)
+        set qt5_is_concurrent   1
+        set auto_concurrent     1
+    }
+} else {
+    # we're building qt5-mac or one of its subports
+    # we're asking for the standard concurrent install. No need to guess anything, give the user what s/he wants
+    set qt5_is_concurrent   1
+    set auto_concurrent     1
+}
+
+if {![info exists qt5_is_concurrent]} {
+    if {![info exists building_qt5]} {
+                return -code error "\n\nERROR:\n\
+Qt5 appears to be installed in the old, exclusive mode,
+and this port, ${name}, ought to use PortGroup qt5 1.0\n"
+    }
+}
+
+set qt_dir              ${prefix}/libexec/${qt_name}
+set qt_dir_rel          libexec/${qt_name}
+set qt_docs_dir         ${prefix}/share/doc/${qt_name}
+set qt_plugins_dir      ${prefix}/share/${qt_name}/plugins
+set qt_mkspecs_dir      ${prefix}/share/${qt_name}/mkspecs
+set qt_imports_dir      ${prefix}/share/${qt_name}/imports
+set qt_qml_dir          ${prefix}/share/${qt_name}/qml
+set qt_includes_dir     ${prefix}/include/${qt_name}
+set qt_libs_dir         ${qt_dir}/lib
+set qt_frameworks_dir   ${qt_dir}/Library/Frameworks
+set qt_bins_dir         ${qt_dir}/bin
+set qt_data_dir         ${prefix}/share/${qt_name}
+set qt_translations_dir ${prefix}/share/${qt_name}/translations
+set qt_sysconf_dir      ${prefix}/etc/${qt_name}
+set qt_examples_dir     ${prefix}/share/${qt_name}/examples
+set qt_tests_dir        ${prefix}/share/${qt_name}/tests
+set qt_demos_dir        ${prefix}/share/${qt_name}/demos
+set qt_cmake_module_dir ${prefix}/lib/cmake
+set qt_qmake_cmd        ${qt_dir}/bin/qmake
+set qt_moc_cmd          ${qt_dir}/bin/moc
+set qt_uic_cmd          ${qt_dir}/bin/uic
+set qt_lrelease_cmd     ${qt_dir}/bin/lrelease
+set qt_frameworks_dir_rel   ${qt_dir_rel}/Library/Frameworks
+
+# standard Qt .app executables directory, if created
+global qt_apps_dir
+set qt_apps_dir         ${applications_dir}/Qt5
+
+# standard qmake spec
+# configure script prefers clang (but "[a]dvertise[s] g++ as an alternative on Lion and below").
+# According to http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations,
+#    however, Snow Leopard is only tested on "GCC as provided by Apple"
+# Create a variant for Snow Leopard that uses "-platform macx-g++-32" or "-platform macx-g++"?
+global qt_qmake_spec
+global qt_qmake_spec_32
+global qt_qmake_spec_64
+compiler.whitelist clang
+
+set qt_qmake_spec_32 macx-clang-32
+set qt_qmake_spec_64 macx-clang
+
+if { ![option universal_variant] || ![variant_isset universal] } {
+    if { ${build_arch} eq "i386" } {
+        set qt_qmake_spec ${qt_qmake_spec_32}
+    } else {
+        set qt_qmake_spec ${qt_qmake_spec_64}
+    }
+} else {
+    set qt_qmake_spec ""
+}
+
+# standard PKGCONFIG path
+global qt_pkg_config_dir
+set qt_pkg_config_dir   ${prefix}/lib/pkgconfig
+
+# data used by qmake
+global qt_host_data_dir
+set qt_host_data_dir   ${prefix}/share/${qt_name} 
+
+# standard cmake info for Qt5
+global qt_cmake_defines
+set qt_cmake_defines    \
+    "-DQT_QT_INCLUDE_DIR=${qt_includes_dir} \
+     -DQT_QMAKESPEC=${qt_qmake_spec} \
+     -DQT_ZLIB_LIBRARY=${prefix}/lib/libz.dylib \
+     -DQT_PNG_LIBRARY=${prefix}/lib/libpng.dylib"
+
+# allow for depending on either qt5-mac and qt5-mac-devel, simultaneously
+
+if {![info exists building_qt5]} {
+    if {${os.platform} eq "darwin"} {
+
+        # see if the framework install exists, and if so depend on it;
+        # if not, depend on the library version
+
+        if {[info exists qt5_is_concurrent]} {
+            if {[file exists ${qt_frameworks_dir}/QtCore.framework/QtCore]} {
+                depends_lib-append path:libexec/${qt_name}/Library/Frameworks/QtCore.framework/QtCore:qt5-mac
+            } else {
+                depends_lib-append path:libexec/${qt_name}/lib/libQtCore.5.dylib:qt5-mac
+            }
+        } else {
+            if {[file exists ${qt_frameworks_dir}/QtCore.framework/QtCore]} {
+                depends_lib-append path:Library/Frameworks/QtCore.framework/QtCore:qt5-mac
+            } else {
+                depends_lib-append path:lib/libQtCore.5.dylib:qt5-mac
+            }
+        }
+    }
+}
+
+# standard configure environment, when not building qt5
+
+if {![info exists building_qt5]} {
+    configure.env-append \
+        QTDIR=${qt_dir} \
+        QMAKE=${qt_qmake_cmd} \
+        MOC=${qt_moc_cmd}
+
+    if { ![option universal_variant] || ![variant_isset universal] } {
+        configure.env-append QMAKESPEC=${qt_qmake_spec}
+    } else {
+        set merger_configure_env(i386)   "QMAKESPEC=${qt_qmake_spec_32}"
+        set merger_configure_env(x86_64) "QMAKESPEC=${qt_qmake_spec_64}"
+    }
+
+    # make sure the Qt binaries' directory is in the path, if it is
+    # not the current prefix
+
+    if {${qt_dir} ne ${prefix}} {
+        configure.env-append PATH=${qt_dir}/bin:$env(PATH)
+    }
+} else {
+    configure.env-append QMAKE_NO_DEFAULTS=""
+}
+
+# standard build environment, when not building qt5
+
+if {![info exists building_qt5]} {
+    build.env-append \
+        QTDIR=${qt_dir} \
+        QMAKE=${qt_qmake_cmd} \
+        MOC=${qt_moc_cmd}
+
+    if { ![option universal_variant] || ![variant_isset universal] } {
+        build.env-append QMAKESPEC=${qt_qmake_spec}
+    } else {
+        set merger_build_env(i386)   "QMAKESPEC=${qt_qmake_spec_32}"
+        set merger_build_env(x86_64) "QMAKESPEC=${qt_qmake_spec_64}"
+    }
+
+    # make sure the Qt binaries' directory is in the path, if it is
+    # not the current prefix
+
+    if {${qt_dir} ne ${prefix}} {
+        build.env-append    PATH=${qt_dir}/bin:$env(PATH)
+    }
+}
+
+# use PKGCONFIG for Qt discovery in configure scripts
+depends_build-append    port:pkgconfig
+
+# standard destroot environment
+if { ![option universal_variant] || ![variant_isset universal] } {
+    destroot.env-append \
+        INSTALL_ROOT=${destroot}
+} else {
+    foreach arch ${configure.universal_archs} {
+        lappend merger_destroot_env($arch) INSTALL_ROOT=${workpath}/destroot-${arch}
+    }
+}
+
+# standard destroot environment, when not building qt5
+
+if {![info exists building_qt5]} {
+    destroot.env-append \
+        QTDIR=${qt_dir} \
+        QMAKE=${qt_qmake_cmd} \
+        MOC=${qt_moc_cmd}
+
+    if { ![option universal_variant] || ![variant_isset universal] } {
+        build.env-append QMAKESPEC=${qt_qmake_spec}
+    } else {
+        set destroot_build_env(i386)   "QMAKESPEC=${qt_qmake_spec_32}"
+        set destroot_build_env(x86_64) "QMAKESPEC=${qt_qmake_spec_64}"
+    }
+
+    # make sure the Qt binaries' directory is in the path, if it is
+    # not the current prefix
+
+    if {${qt_dir} ne ${prefix}} {
+        destroot.env-append PATH=${qt_dir}/bin:$env(PATH)
+    }
+}

Property changes on: trunk/dports/_resources/port1.0/group/qt5-2.0.tcl
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: .
===================================================================
diff --git a/trunk/dports/_resources/port1.0/group/qmake5-2.0.tcl b/trunk/dports/_resources/port1.0/group/qmake5-2.0.tcl
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/_resources/port1.0/group/qmake5-2.0.tcl	(working copy)
@@ -0,0 +1,51 @@
+# -*- coding: utf-8; mode: tcl; c-basic-offset: 4; indent-tabs-mode: nil; tab-width: 4; truncate-lines: t -*- vim:fenc=utf-8:et:sw=4:ts=4:sts=4
+# $Id$
+# $Id$
+
+#
+# Copyright (c) 2013 The MacPorts Project
+# All rights reserved.
+#
+# Redistribution and use in source and binary forms, with or without
+# modification, are permitted provided that the following conditions are
+# met:
+#
+# 1. Redistributions of source code must retain the above copyright
+#    notice, this list of conditions and the following disclaimer.
+# 2. Redistributions in binary form must reproduce the above copyright
+#    notice, this list of conditions and the following disclaimer in the
+#    documentation and/or other materials provided with the distribution.
+# 3. Neither the name of Apple Computer, Inc. nor the names of its
+#    contributors may be used to endorse or promote products derived from
+#    this software without specific prior written permission.
+#
+# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
+# "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
+# LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
+# A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
+# OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
+# SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
+# LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
+# DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
+# THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
+# (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
+# OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
+#
+#
+# This portgroup defines standard settings when using qmake.
+#
+# Usage:
+# PortGroup                     qmake5 2.0
+
+PortGroup                       qt5 2.0
+
+configure.cmd                   ${qt_qmake_cmd} -r
+configure.pre_args-replace      --prefix=${prefix} PREFIX=${prefix}
+configure.universal_args-delete --disable-dependency-tracking
+
+# qmake defaults to -mmacosx-version-min=10.6, which implies stdlib is libstdc++, which caused problems
+#    (see https://trac.macports.org/wiki/FAQ#libcpp)
+configure.pre_args-append       "QMAKE_MACOSX_DEPLOYMENT_TARGET=${macosx_deployment_target}"
+
+# qt5-mac does not currently support debug.
+configure.pre_args-append       "CONFIG+=release"   

Property changes on: trunk/dports/_resources/port1.0/group/qmake5-2.0.tcl
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: Portfile
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/Portfile b/trunk/dports/aqua/qt5-mac-devel/Portfile
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/Portfile	(working copy)
@@ -0,0 +1,14 @@
+# -*- 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$
+# $Id$
+
+PortSystem          1.0
+
+name                qt5-mac-devel
+version             5.4.0
+revision            1
+
+if {[catch {source "${portpath}/Portfile.qt5"} err]} {
+    puts stderr "Error reading Portfile.qt5: $err"
+    return 1;
+}

Property changes on: trunk/dports/aqua/qt5-mac-devel/Portfile
___________________________________________________________________
Added: svn:eol-style
## -0,0 +1 ##
+native
\ No newline at end of property
Added: svn:keywords
## -0,0 +1 ##
+Id
\ No newline at end of property
Index: Portfile.qt5
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/Portfile.qt5 b/trunk/dports/aqua/qt5-mac-devel/Portfile.qt5
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/Portfile.qt5	(working copy)
@@ -0,0 +1,622 @@
+# -*- 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: port=qt5 1 2014-12-08 18:51:13Z rjvbertin@gmail.com, mcalhoun@macports.org $
+
+# set building_qt5 immediately!
+set building_qt5    1
+
+PortGroup           qt5 2.0
+set branch          [join [lrange [split ${version} .] 0 1] .]
+
+categories          aqua
+platforms           macosx
+maintainers         mcalhoun openmaintainer
+license             {LGPL-2.1 GPL-3}
+
+homepage            http://qt-project.org
+description         Qt Tool Kit 5.3
+long_description    Qt Tool Kit: A cross-platform framework \
+                    (headers, data, and libraries) for writing \
+                    cross-platform GUI-based applications. \
+                    Installs to ${qt_dir}
+
+distname            qt-everywhere-opensource-src-${version}
+
+master_sites        http://download.qt-project.org/official_releases/qt/${branch}/${version}/single/
+
+use_xz			yes
+checksums           rmd160  5c6b5a0e3ea6a7d3d9754b87fc502af7a4ff7a85 \
+                    sha256  b2d9df47b9fd2fcfa5ebd162e1373b7eddf4759e6ba148c4589f3d8b6628c39c
+
+if { ${os.platform} ne "darwin" } {
+	pre-fetch {
+		ui_msg "You're on your own on \"${os.platform}\"!!"
+	}
+} elseif { ${os.major} < 10 } {
+    pre-fetch {
+        ui_error "OS X prior to 10.7 (Lion) is not a Reference Configuration for Qt."
+        ui_error "OS X prior to 10.6 (Snow Leopard) is not even tested."
+        ui_error "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
+        return -code error "unsupported OS"
+    }
+} elseif { ${os.major} == 10 } {
+    pre-fetch {
+        ui_warn "OS X prior to 10.7 (Lion) is not a Reference Configuration for Qt."
+        if { [variant_isset universal] } {
+            ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\" but ONLY in 32-bit mode."
+            ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4."
+        } else {
+            if { ${build_arch} eq "i386" } {
+                ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\"."
+                ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4."
+            } else {
+                ui_warn "OS X 10.6 (Snow Leopard) is \"occasionally tested\" but ONLY in 32-bit mode."
+                ui_warn "OS X 10.6 (Snow Leopard) is deprecated and scheduled for removal in Qt 5.4."
+            }
+        }
+        ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
+    }
+} elseif { ${os.major} > 13 } {
+    pre-fetch {
+        ui_warn "OS X subsequent to 10.9 (Mavericks) is not a Reference Configuration for Qt."
+        ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
+    }
+} else {
+    # 11 <= ${os.major} <= 13
+    if { [variant_isset universal] } {
+        pre-fetch {
+            ui_warn "Multiple architectures is not a Reference Configuration for Qt."
+            ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
+        }
+    } else {
+        if { ${build_arch} eq "i386" } {
+            pre-fetch {
+                ui_warn "32-bit mode is not a Reference Configuration for Qt."
+                ui_warn "See http://qt-project.org/doc/qt-5/supported-platforms.html#reference-configurations"
+            }
+        }
+    }
+}
+
+if { ${subport} eq "${name}-docs"  } {
+    universal_variant no
+}
+
+if {[info exists env(QTDIR)]} {
+    ui_msg "unsetting \$QTDIR"
+    unset env(QTDIR)
+}
+
+if { ${subport} eq ${name} || ${subport} eq "${name}-docs" } {
+    # use the qt5 group; set 'building_qt5' so that the portgroup
+    # does not include certain parts
+    PortGroup           conflicts_build 1.0
+    conflicts           qt3 qt3-mac
+    PortGroup           xcodeversion 1.0
+
+
+    minimum_xcodeversions   {10 3.2}
+
+    # From 5.4.0, qt5-mac ought to be able to co-exist with any qt4-mac version.
+
+    # Kuba states in https://trac.macports.org/ticket/44207#comment:7 
+    #  "There's no reason to have parallel building disabled. Really."
+    #use_parallel_build no 
+
+    # header file QtCore/private/qmachparser_p.h is included only if "defined(QT_BUILD_INTERNAL) && defined(Q_OF_MACH_O)"
+    #     code from header is used only "ifdef Q_OF_MACH_O"
+    #     the two must be consistent
+    #     assume the header include code is correct
+    patchfiles-append patch-tst_qpluginloader.diff
+
+    # When testing, ensure that a universal object file is not inadvertently created.
+    patchfiles-append patch-machtest.diff
+
+    # On testing of 32-bit systems,
+    #  Pre-patch: QCOMPARE(unsigned long const&, unsigned int const&
+    # Post-patch: QCOMPARE(unsigned int  const&, unsigned int const&
+    # Function template is only instantiated for same first and second arguments.
+    patchfiles-append patch-tst_qarraydata.diff
+
+    # see http://stackoverflow.com/questions/14506151/invalid-symbol-redefinition-in-inline-asm-on-llvm
+    patchfiles-append patch-tst_benchlibcallgrind.diff
+
+    # During testing, NSStringFromRect requires NSRect.
+    patchfiles-append patch-tst_qaccessibilitymac_helpers.diff
+
+    # see #44934 (and #35067 for the qt4-mac version)
+    patchfiles-append patch-shared.diff
+
+    # avoid leaving zombies when starting an inexisting executable through QProcess
+    patchfiles-append qprocess-nozombies.patch
+
+    # add (prepend) ${prefix}/share to the standard search paths so they become XDG-compliant
+    patchfiles-append fix-qstandardpaths.patch
+
+    # make sure the private headers are always found through the CMake files,
+    # even in an out-of-tree build
+    patchfiles-append always_include_private_headers.diff
+
+    variant KDE description {Include a number of patches tailoring Qt5 for use with KDE, and enable useful backtraces into Qt code for debugging} {
+        patchfiles-append       deactivate-menurole-heuristics.patch \
+                                debug-negative-qtimerint.patch
+        configure.args-append   -force-debug-info -no-strip -no-separate-debug-info
+    }
+
+    # patches from Ubuntu 5.3.2+dfsg-4ubuntu8 (from Vivid Velvet)
+    # TODO : check Report-the-system-error-on-why-chmod-2-failed-in-XDG.patch and Don-t-always-chmod-the-XDG_RUNTIME_DIR.patch
+    # for relevance for qstandard_mac.?
+    patchfiles-append           remove_icon_from_example.patch \
+                                remove_google_adsense.patch \
+                                load_testability_from_env_var.patch \
+                                Add-workaround-for-GL-on-Android-emulator.patch \
+                                disable-generic-plugin-when-others-available.patch \
+                                QtBearer-networkmanager-make-sure-to-set-flag-Active.patch \
+                                Break-after-handling-the-read-write.patch
+
+    # --prefix is not recognised.
+    configure.pre_args-delete       --prefix=${prefix}
+
+    # --disable-dependency-tracking is not recognised.
+    configure.universal_args-delete --disable-dependency-tracking
+
+    if {${configure.sdkroot} ne ""} {
+        configure.args-append \
+            -sdk [string tolower [join [lrange [split [lindex [split ${configure.sdkroot} "/"] end] "."] 0 end-1] "."]]
+    }
+
+    # NB: -prefix->${prefix} !
+    configure.args-append                      \
+        -prefix         ${prefix}              \
+        -archdatadir    ${qt_dir}              \
+        -docdir         ${qt_docs_dir}         \
+        -headerdir      ${qt_includes_dir}     \
+        -plugindir      ${qt_plugins_dir}      \
+        -importdir      ${qt_imports_dir}      \
+        -qmldir         ${qt_qml_dir}          \
+        -datadir        ${qt_data_dir}         \
+        -libdir         ${qt_frameworks_dir}   \
+        -bindir         ${qt_bins_dir}         \
+        -libexecdir     ${qt_dir}/libexec      \
+        -translationdir ${qt_translations_dir} \
+        -sysconfdir     ${qt_sysconf_dir}      \
+        -examplesdir    ${qt_examples_dir}     \
+        -testsdir       ${qt_tests_dir}        \
+        -hostbindir     ${qt_bins_dir}         \
+        -hostlibdir     ${qt_frameworks_dir}   \
+        -hostdatadir    ${qt_host_data_dir}
+
+    # Configure options:
+    configure.args-append \
+        -v                \
+        -release          \
+        -opensource       \
+        -confirm-license  \
+        -shared           \
+        -force-pkg-config
+
+    # Third Party Libraries:
+    configure.args-append \
+        -no-mtdev         \
+        -no-harfbuzz      \
+        -openssl-linked   \
+        -no-xinput2       \
+        -no-xcb-xlib
+
+    # configure options that don't show up in configure --help
+    configure.args-append \
+        -no-libudev       \
+        -no-egl
+
+    # Additional options:
+    configure.args-append    \
+        {-make libs}         \
+        {-make tools}        \
+        {-nomake examples}   \
+        {-nomake tests}      \
+        -verbose             \
+        -nis                 \
+        -cups                \
+        -iconv               \
+        -no-evdev            \
+        -icu                 \
+        -fontconfig          \
+        -no-pch              \
+        -dbus-linked         \
+        -no-xcb              \
+        -glib                \
+        -directfb            \
+        -no-linuxfb          \
+        -no-kms              \
+        -framework
+
+    configure.args-append   -optimized-qmake
+
+    foreach driver { db2 ibase mysql oci odbc psql sqlite sqlite2 tds } {
+        configure.args-append -no-sql-${driver}
+    }
+
+    if { ![variant_isset universal] } {
+        configure.args-append "-platform ${qt_qmake_spec}"
+    } else {
+        set merger_configure_args(i386)   "-platform ${qt_qmake_spec_32}"
+        set merger_configure_args(x86_64) "-platform ${qt_qmake_spec_64}"
+    }
+
+    # configure options that don't show up in configure --help
+    # openvg makes sense only when using X11 ...
+    configure.args-append   -no-openvg
+
+#    # this is where MacPorts hides the dbus and glib headers:
+#    # unnecessary when -force-pkg-config is given.
+#    configure.args-append   -I ${prefix}/include/dbus-1.0 \
+#                            -I ${prefix}/lib/dbus-1.0/include \
+#                            -I ${prefix}/include/glib-2.0 \
+#                            -I ${prefix}/lib/glib-2.0/include
+
+    # Qt builds part of the system using environment provided by MacPorts.
+    # It builds the rest using its own internal environment.
+    # For consistency, clear MacPorts environment.
+    configure.cxx_stdlib
+    configure.sdkroot
+    configure.cc_archflags
+    configure.cxx_archflags
+    configure.objc_archflags
+    configure.objcxx_archflags
+    configure.ld_archflags
+    configure.cppflags
+#    configure.cflags
+#    configure.cxxflags
+#    configure.objcflags
+#    configure.objcxxflags
+#    configure.ldflags
+    configure.objcflags-append  "-g"
+    configure.objcxxflags-append  "-g"
+    configure.pipe  no
+    if { [variant_isset universal] } {
+        set merger_arch_flag no
+    }
+    configure.march
+    configure.mtune
+    configure.universal_ldflags
+    configure.universal_cflags
+    configure.universal_cxxflags
+    configure.universal_cppflags
+}
+
+if { ${subport} eq ${name} } {
+    depends_lib                              \
+        port:zlib                            \
+        port:libpng                          \
+        port:jpeg                            \
+        port:freetype                        \
+        path:bin/dbus-daemon:dbus            \
+        port:openssl                         \
+        port:tiff                            \
+        port:libmng                          \
+        path:lib/pkgconfig/glib-2.0.pc:glib2 \
+        port:icu                             \
+        port:pcre                            \
+        port:libiconv
+
+    post-extract            { file mkdir ${workpath}/build }
+    default configure.cmd	  {../${worksrcdir}/configure}
+    default configure.dir       {${workpath}/build}
+    default build.dir           {${workpath}/build}
+
+    # see https://bugreports.qt-project.org/browse/QTBUG-35514
+    build.target
+
+    post-patch {
+        #reinplace "s|//opt//local//|${prefix}/|g" ${worksrcpath}/qtbase/src/corelib/io/qstandardpaths_mac.cpp
+    }
+    # TODO : check if qtwebengine/src/core always has Release and Debug build directories
+    # even when not configured with -debug-info -no-strip -no-separate-debug-info
+    post-configure {
+        # there's one subproject that mistakingly adds ${qt_includes_dir} to the build header search paths;
+        # correct that!
+        reinplace "s|-I${qt_includes_dir}||g" \
+            ${workpath}/build/qtwebengine/src/core/Release/obj/src/core/QtWebEngineCore.ninja \
+            ${workpath}/build/qtwebengine/src/core/Debug/obj/src/core/QtWebEngineCore.ninja
+    }
+    pre-build {
+        # this is a kludge; should the build system regenerate the ninja files we edited
+        # we reinplace them again restarting the `port build` step after the inevitable failure...
+        reinplace "s|-I${qt_includes_dir}||g" \
+            ${workpath}/build/qtwebengine/src/core/Release/obj/src/core/QtWebEngineCore.ninja \
+            ${workpath}/build/qtwebengine/src/core/Debug/obj/src/core/QtWebEngineCore.ninja
+    }
+
+    if { [variant_isset universal] } {
+        merger-post-destroot {
+            foreach arch ${universal_archs_to_use} {
+                set dir ${destroot}-${arch}
+
+                reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_frameworks_dir}/pkgconfig/Qt5WebKit.pc
+
+                foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.framework/*.prl] {
+                    reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl}
+                }
+
+                foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.prl] {
+                    reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl}
+                }
+
+                foreach prlfl [glob ${dir}${qt_frameworks_dir}/*.framework/*.prl] {
+                    reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${prlfl}
+                }
+
+                reinplace "s|${worksrcpath}-${arch}|${worksrcpath}|g" ${dir}${qt_mkspecs_dir}/modules/qt_lib_bootstrap_private.pri
+
+                reinplace \
+                    "s|^set(_qt5_corelib_extra_includes \"\${_qt5Core_install_prefix}/share/qt5//mkspecs/macx-clang.*\")$|set(_qt5_corelib_extra_includes \"\${_qt5Core_install_prefix}/share/qt5//mkspecs/macx-clang-32\" \"\${_qt5Core_install_prefix}/share/qt5//mkspecs/macx-clang\")|" \
+                    ${dir}${qt_frameworks_dir}/cmake/Qt5Core/Qt5CoreConfigExtrasMkspecDir.cmake
+            }
+        }
+
+        post-destroot {
+            # delete preprocessor comments surrounding QT_CPU_FEATURES.i386 and QT_CPU_FEATURES.x86_64
+            reinplace "/^#ifndef.*$/d" ${destroot}${qt_mkspecs_dir}/qmodule.pri
+            reinplace "/^#else.*$/d"   ${destroot}${qt_mkspecs_dir}/qmodule.pri
+            reinplace "/^#endif.*$/d"  ${destroot}${qt_mkspecs_dir}/qmodule.pri
+        }
+
+        # The file ${prefix}/share/qt5/mkspecs/qconfig.pri is still not properly merged
+        # The solution is ???.
+    }
+
+    post-destroot {
+
+        # see #44204
+        foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/pkgconfig *.pc] {
+            set framework [file rootname [file tail ${f}]]
+            set incname   [string map {Qt5 Qt} ${framework}]
+            reinplace "s|-I\${includedir}/${incname}|-I\${includedir}|g" ${f}
+            reinplace "s|includedir=\${prefix}/include|includedir=\${libdir}/${framework}/Headers|g" ${f}
+        }
+
+        # move items out of the Frameworks directory that are more appropriate to lib directory
+        xinstall -m 775 -d ${destroot}${qt_cmake_module_dir}
+        foreach d [glob -tails -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake *] {
+            xinstall -m 775 -d ${destroot}${qt_cmake_module_dir}/${d}
+            foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake/${d} *.cmake] {
+                # ${qt_frameworks_dir} is  ${qt_dir}/Library/Frameworks while
+                # ${qt_libs_dir}       is  ${qt_dir}/lib
+                # unless modified, cmake files will point to a directory that is too high in the directory hierarchy
+                reinplace "s|/../../../../|/../../../${qt_dir_rel}/|g" ${f}
+                file rename ${f} ${destroot}${qt_cmake_module_dir}/${d}/
+            }
+        }
+
+        # 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 the target directories exist
+        exec mkdir -p ${destroot}${qt_includes_dir} ${destroot}${qt_libs_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
+
+            # remove the QMAKE_PRL_BUILD_DIR line from the .prl file
+            reinplace "/QMAKE_PRL_BUILD_DIR/d" ${dr_qt_libs_dir}/lib${tf}.prl
+
+            # deal with debug files
+
+            # RJVB: I have *not* tested the block below!
+            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
+            }
+        }
+
+        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}
+
+        xinstall -m 775 -d ${destroot}${qt_pkg_config_dir}
+        foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/pkgconfig *.pc] {
+            file rename ${f} ${destroot}${qt_pkg_config_dir}
+        }
+        xinstall -m 775 -d ${destroot}${qt_libs_dir}/
+        foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir} *.{a,prl,la}] {
+            file rename ${f} ${destroot}${qt_libs_dir}/
+        }
+
+        # move items out of the bin directory that are more appropriate to the Applications directory
+        xinstall -m 775 -d ${destroot}${qt_apps_dir}
+        foreach f [glob -nocomplain -directory ${destroot}${qt_bins_dir} *.app] {
+            file rename ${f} ${destroot}${qt_apps_dir}/
+        }
+
+        if {[variant_isset KDE]} {
+            # expose KF5 styles to Qt5 ... once we know where those styles are stored and if it's still required.
+            #ln -s ${prefix}/lib/kf5??/plugins/styles ${destroot}${qt_plugins_dir}/
+        }
+    }
+
+    variant harfbuzz description {(experimental) Use HarfBuzz-NG to do text shaping} {
+        depends_lib-append port:harfbuzz
+        configure.args-replace \
+            -no-harfbuzz       \
+            -system-harfbuzz
+    }
+
+    variant tests description {Enable tests} {
+        configure.args-replace {-nomake tests} {-make tests}
+    }
+
+    variant examples description {Build examples} {
+        configure.args-replace {-nomake examples} {-make examples}
+    }
+
+    variant debug description {Build both release and debug library} {
+        configure.args-replace -release -debug-and-release
+    }
+}
+
+subport ${name}-docs {
+    depends_lib-append \
+        path:${prefix}/bin/qdoc:${name} \
+        path:${qt_plugins_dir}/sqldrivers/libqsqlite.dylib:${name}-sqlite3-plugin
+
+    supported_archs   noarch
+
+    build.target      docs
+    destroot.target   install_docs
+
+    post-extract {
+        # For the most part, generated makefiles use ${prefix}/bin/qdoc.
+        # There are a couple of places that look in ${worksrcpath}/qtbase/src/tools/qdoc/.
+        ln -s ${prefix}/bin/qdoc ${worksrcpath}/qtbase/src/tools/qdoc/
+        ln -s ${prefix}/bin/qdoc ${worksrcpath}/qtbase/bin
+
+        # Similarly, location of qhelpgenerator is expected in ${worksrcpath}
+        xinstall -d -m 755 ${worksrcpath}/qttools/bin/
+        ln -s ${prefix}/bin/qhelpgenerator ${worksrcpath}/qttools/bin/
+
+        # Without this file, the makefile ${worksrcpath}/qtwebkit/Source/WebCore/Makefile.WebCore.Target
+        #    keeps generating itself over and over again.
+        # This file is only created when the library is being built, however.
+        xinstall -d -m 755 ${worksrcpath}/qtwebkit/Source/WebCore/generated
+        touch ${worksrcpath}/qtwebkit/Source/WebCore/generated/InspectorBackendCommands.qrc
+    }
+}
+
+# See http://qt-project.org/doc/qt-5/sql-driver.html for info on building SQL Database Drivers
+
+subport ${name}-sqlite3-plugin {
+    PortGroup           qmake5 2.0
+
+    depends_lib-append port:sqlite3
+
+    # for single architecture, easier to use
+    #    worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/sqlite,
+    #    but doesn't work for universal build
+    configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/sqlite
+    build.dir     ${configure.dir}
+    destroot.dir  ${configure.dir}
+
+    configure.args-append "INCLUDEPATH+=${prefix}/include" "LIBS+=\"-L${prefix}/lib -lsqlite3\""
+    post-destroot {
+        xinstall -m 775 -d ${destroot}${qt_cmake_module_dir}
+        foreach f [glob -nocomplain -directory ${destroot}${qt_frameworks_dir}/cmake/ *] {
+            file rename ${f} ${destroot}${qt_cmake_module_dir}/
+        }
+    }
+}
+
+subport ${name}-psql84-plugin {
+    PortGroup           qmake5 2.0
+
+    depends_lib-append port:postgresql84
+
+    # for single architecture, easier to use
+    #    worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/psql,
+    #    but doesn't work for universal build
+    configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/psql
+    build.dir     ${configure.dir}
+    destroot.dir  ${configure.dir}
+
+    configure.args-append "INCLUDEPATH+=${prefix}/include/postgresql84" "LIBS+=\"-L${prefix}/lib/postgresql84 -lpq\""
+}
+
+subport ${name}-mysql56-plugin {
+    PortGroup           qmake5 2.0
+
+    depends_lib-append port:mysql56
+
+    # for single architecture, easier to use
+    #    worksrcdir ${worksrcdir}/qtbase/src/plugins/sqldrivers/mysql,
+    #    but doesn't work for universal build
+    configure.dir ${worksrcpath}/qtbase/src/plugins/sqldrivers/mysql
+    build.dir     ${configure.dir}
+    destroot.dir  ${configure.dir}
+
+    configure.args-append "INCLUDEPATH+=${prefix}/include/mysql56/mysql" "LIBS+=\"-L${prefix}/lib/mysql56/mysql -lmysqlclient_r\""
+}
+
+livecheck.type      regex
+livecheck.url       http://download.qt.io/archive/qt/5.4/
+livecheck.regex     (\\d+(\\.\\d+)+)
Index: files/Add-workaround-for-GL-on-Android-emulator.patch
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/Add-workaround-for-GL-on-Android-emulator.patch b/trunk/dports/aqua/qt5-mac-devel/files/Add-workaround-for-GL-on-Android-emulator.patch
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/Add-workaround-for-GL-on-Android-emulator.patch	(working copy)
@@ -0,0 +1,35 @@
+From cbf649ff92e7d3416cb9d03609648f96efdf76dd Mon Sep 17 00:00:00 2001
+From: Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
+Date: Mon, 17 Mar 2014 19:43:41 -0300
+Subject: [PATCH] Add workaround for GL on Android emulator
+
+On the Android Emulator, the shaders will be compiled by a desktop
+GL driver, since the GL driver in the emulator is just a thin
+wrapper. The GL driver does not necessarily support the precision
+qualifiers, which can cause applications to break. We detect this
+at runtime in the platform plugin and set a workaround flag to
+
+Upstream (9eeb1bd) just enabled the workaround when the android
+backend is used, which is not true in our case (traditional desktop).
+As a consequence, we also need a similar check in order to have
+a functional Ubuntu Touch emulator.
+
+Signed-off-by: Ricardo Salveti de Araujo <ricardo.salveti@canonical.com>
+---
+ src/gui/kernel/qopenglcontext.cpp | 5 +++++
+ 1 file changed, 5 insertions(+)
+
+--- qtbase/src/gui/kernel/qopenglcontext.cpp
++++ qtbase/src/gui/kernel/qopenglcontext.cpp
+@@ -900,6 +900,11 @@
+ 
+         d->shareGroup->d_func()->deletePendingResources(this);
+ 
++        const char *rendererString = reinterpret_cast<const char *>(glGetString(GL_RENDERER));
++        if (rendererString != 0 && qstrncmp(rendererString, "Android Emulator", 16) == 0) {
++            QOpenGLContextPrivate *ctx_d = QOpenGLContextPrivate::get(this);
++            ctx_d->workaround_missingPrecisionQualifiers = true;
++        }
+ #ifndef QT_NO_DEBUG
+         QOpenGLContextPrivate::toggleMakeCurrentTracker(this, true);
+ #endif
Index: files/Break-after-handling-the-read-write.patch
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/Break-after-handling-the-read-write.patch b/trunk/dports/aqua/qt5-mac-devel/files/Break-after-handling-the-read-write.patch
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/Break-after-handling-the-read-write.patch	(working copy)
@@ -0,0 +1,36 @@
+From 2a733b9bf62df746fb538d37ba1b150ada70c0b0 Mon Sep 17 00:00:00 2001
+From: Albert Astals Cid <albert.astals@canonical.com>
+Date: Thu, 27 Nov 2014 13:27:06 +0100
+Subject: [PATCH] Break after handling the read/write
+
+The loop is there because watchers may have two Watcher for the same
+fd, one for read and one for write, but after we're processed the
+correct one we don't need to keep looping.
+
+This fixes a crash since it's possible that while in processing
+q_dbus_watch_handle we get a watch added/remove this invalidating
+the iterator and crashing
+
+Change-Id: Icb61deae272d2f237a4c616fae598404d419df90
+---
+ src/dbus/qdbusintegrator.cpp | 2 ++
+ 1 file changed, 2 insertions(+)
+
+--- qtbase/src/dbus/qdbusintegrator.cpp
++++ qtbase/src/dbus/qdbusintegrator.cpp
+@@ -1184,6 +1184,7 @@
+         if (it->watch && it->read && it->read->isEnabled()) {
+             if (!q_dbus_watch_handle(it.value().watch, DBUS_WATCH_READABLE))
+                 qDebug("OUT OF MEM");
++            break;
+         }
+         ++it;
+     }
+@@ -1198,6 +1199,7 @@
+         if (it->watch && it->write && it->write->isEnabled()) {
+             if (!q_dbus_watch_handle(it.value().watch, DBUS_WATCH_WRITABLE))
+                 qDebug("OUT OF MEM");
++            break;
+         }
+         ++it;
+     }
Index: files/QtBearer-networkmanager-make-sure-to-set-flag-Active.patch
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/QtBearer-networkmanager-make-sure-to-set-flag-Active.patch b/trunk/dports/aqua/qt5-mac-devel/files/QtBearer-networkmanager-make-sure-to-set-flag-Active.patch
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/QtBearer-networkmanager-make-sure-to-set-flag-Active.patch	(working copy)
@@ -0,0 +1,600 @@
+From dedb8c1c928edbbb4408a0c5889353b142b20d1c Mon Sep 17 00:00:00 2001
+From: Lorn Potter <lorn.potter@gmail.com>
+Date: Thu, 13 Nov 2014 13:06:49 +1000
+Subject: [PATCH] QtBearer networkmanager make sure to set flag Active
+
+Also, no need to create objects to get properties, when the properties
+can be had for free.
+
+Make plugin more robust to network-manager or ofono crashes
+
+Change-Id: Ibadb46bd51aa27f130f8d245e8c50aa7bff5f9c8
+---
+ .../bearer/linux_common/qofonoservice_linux.cpp    |  12 +
+ .../bearer/linux_common/qofonoservice_linux_p.h    |   2 +
+ src/plugins/bearer/networkmanager/main.cpp         |   5 +-
+ .../networkmanager/qnetworkmanagerengine.cpp       | 310 ++++++++++++++-------
+ .../bearer/networkmanager/qnetworkmanagerengine.h  |  13 +
+ .../networkmanager/qnetworkmanagerservice.cpp      |  22 ++
+ .../bearer/networkmanager/qnetworkmanagerservice.h |   2 +
+ 7 files changed, 263 insertions(+), 103 deletions(-)
+
+--- qtbase/src/plugins/bearer/linux_common/qofonoservice_linux.cpp
++++ qtbase/src/plugins/bearer/linux_common/qofonoservice_linux.cpp
+@@ -269,6 +269,18 @@
+     return contextList;
+ }
+ 
++PathPropertiesList QOfonoDataConnectionManagerInterface::contextsWithProperties()
++{
++    if (contextListProperties.isEmpty()) {
++        QDBusPendingReply<PathPropertiesList > reply = call(QLatin1String("GetContexts"));
++        reply.waitForFinished();
++        if (!reply.isError()) {
++            contextListProperties = reply.value();
++        }
++    }
++    return contextListProperties;
++}
++
+ bool QOfonoDataConnectionManagerInterface::roamingAllowed()
+ {
+     QVariant var = getProperty(QStringLiteral("RoamingAllowed"));
+--- qtbase/src/plugins/bearer/linux_common/qofonoservice_linux_p.h
++++ qtbase/src/plugins/bearer/linux_common/qofonoservice_linux_p.h
+@@ -153,6 +153,7 @@
+     ~QOfonoDataConnectionManagerInterface();
+ 
+     QStringList contexts();
++    PathPropertiesList contextsWithProperties();
+     bool roamingAllowed();
+     QVariant getProperty(const QString &);
+     QString bearer();
+@@ -162,6 +163,7 @@
+     QVariantMap getProperties();
+     QVariantMap propertiesMap;
+     QStringList contextList;
++    PathPropertiesList contextListProperties;
+ private slots:
+     void propertyChanged(const QString &, const QDBusVariant &value);
+ };
+--- qtbase/src/plugins/bearer/networkmanager/main.cpp
++++ qtbase/src/plugins/bearer/networkmanager/main.cpp
+@@ -66,10 +66,7 @@
+ {
+     if (key == QLatin1String("networkmanager")) {
+         QNetworkManagerEngine *engine = new QNetworkManagerEngine;
+-        if (engine->networkManagerAvailable())
+-            return engine;
+-        else
+-            delete engine;
++        return engine;
+     }
+ 
+     return 0;
+--- qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
++++ qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerengine.cpp
+@@ -56,29 +56,34 @@
+ 
+ QNetworkManagerEngine::QNetworkManagerEngine(QObject *parent)
+ :   QBearerEngineImpl(parent),
+-    managerInterface(new QNetworkManagerInterface(this)),
+-    systemSettings(new QNetworkManagerSettings(NM_DBUS_SERVICE, this)),
+-    ofonoManager(new QOfonoManagerInterface(this))
++    managerInterface(NULL),
++    systemSettings(NULL),
++    ofonoManager(NULL),
++    nmAvailable(false)
+ {
+-
+-    if (!managerInterface->isValid())
+-        return;
+-
+     qDBusRegisterMetaType<QNmSettingsMap>();
+ 
+-    connect(managerInterface, SIGNAL(deviceAdded(QDBusObjectPath)),
+-            this, SLOT(deviceAdded(QDBusObjectPath)));
+-    connect(managerInterface, SIGNAL(deviceRemoved(QDBusObjectPath)),
+-            this, SLOT(deviceRemoved(QDBusObjectPath)));
+-    connect(managerInterface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)),
+-            this, SLOT(activationFinished(QDBusPendingCallWatcher*)));
+-    connect(managerInterface, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
+-            this, SLOT(interfacePropertiesChanged(QMap<QString,QVariant>)));
+-    managerInterface->setConnections();
++    nmWatcher = new QDBusServiceWatcher(NM_DBUS_SERVICE,QDBusConnection::systemBus(),
++            QDBusServiceWatcher::WatchForRegistration |
++            QDBusServiceWatcher::WatchForUnregistration, this);
++    connect(nmWatcher, SIGNAL(serviceRegistered(QString)),
++            this, SLOT(nmRegistered(QString)));
++    connect(nmWatcher, SIGNAL(serviceUnregistered(QString)),
++            this, SLOT(nmUnRegistered(QString)));
++
++    ofonoWatcher = new QDBusServiceWatcher("org.ofono",QDBusConnection::systemBus(),
++            QDBusServiceWatcher::WatchForRegistration |
++            QDBusServiceWatcher::WatchForUnregistration, this);
++    connect(ofonoWatcher, SIGNAL(serviceRegistered(QString)),
++            this, SLOT(ofonoRegistered(QString)));
++    connect(ofonoWatcher, SIGNAL(serviceUnregistered(QString)),
++            this, SLOT(ofonoUnRegistered(QString)));
+ 
+-    connect(systemSettings, SIGNAL(newConnection(QDBusObjectPath)),
+-            this, SLOT(newConnection(QDBusObjectPath)));
+-    systemSettings->setConnections();
++    if (QDBusConnection::systemBus().interface()->isServiceRegistered("org.ofono"))
++        ofonoRegistered();
++
++    if (QDBusConnection::systemBus().interface()->isServiceRegistered(NM_DBUS_SERVICE))
++        nmRegistered();
+ }
+ 
+ QNetworkManagerEngine::~QNetworkManagerEngine()
+@@ -105,15 +110,13 @@
+ 
+ void QNetworkManagerEngine::initialize()
+ {
+-    QMutexLocker locker(&mutex);
++    if (nmAvailable)
++        setupConfigurations();
++}
+ 
+-    if (ofonoManager->isValid()) {
+-        Q_FOREACH (const QString &modem, ofonoManager->getModems()) {
+-            QOfonoDataConnectionManagerInterface *ofonoContextManager
+-                    = new QOfonoDataConnectionManagerInterface(modem,this);
+-            ofonoContextManagers.insert(modem, ofonoContextManager);
+-        }
+-    }
++void QNetworkManagerEngine::setupConfigurations()
++{
++    QMutexLocker locker(&mutex);
+     // Get active connections.
+     foreach (const QDBusObjectPath &acPath, managerInterface->activeConnections()) {
+ 
+@@ -151,7 +154,7 @@
+ 
+ bool QNetworkManagerEngine::networkManagerAvailable() const
+ {
+-    return managerInterface->isValid();
++    return nmAvailable;
+ }
+ 
+ QString QNetworkManagerEngine::getInterfaceFromId(const QString &settingsPath)
+@@ -180,6 +183,9 @@
+     const QString settingsPath = connection->connectionInterface()->path();
+     QString specificPath = configuredAccessPoints.key(settingsPath);
+ 
++    if (isConnectionActive(settingsPath))
++        return;
++
+     QHashIterator<QString, QNetworkManagerInterfaceDevice*> i(interfaceDevices);
+     while (i.hasNext()) {
+         i.next();
+@@ -229,7 +235,7 @@
+ 
+ void QNetworkManagerEngine::requestUpdate()
+ {
+-    if (managerInterface->wirelessEnabled()) {
++    if (managerInterface && managerInterface->wirelessEnabled()) {
+         QHashIterator<QString, QNetworkManagerInterfaceDeviceWireless *> i(wirelessDevices);
+         while (i.hasNext()) {
+             i.next();
+@@ -282,8 +288,9 @@
+                 if (ptr) {
+                     ptr->mutex.lock();
+                     if (activeConnection->state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED &&
+-                        ptr->state != QNetworkConfiguration::Active) {
+-                        ptr->state = QNetworkConfiguration::Active;
++                            (ptr->state & QNetworkConfiguration::Active) != QNetworkConfiguration::Active) {
++
++                        ptr->state |= QNetworkConfiguration::Active;
+ 
+                         if (activeConnectionsList.value(id) && activeConnectionsList.value(id)->defaultRoute()
+                                 && managerInterface->state() < QNetworkManagerInterface::NM_STATE_CONNECTED_GLOBAL) {
+@@ -339,23 +346,25 @@
+ 
+     QNetworkConfigurationPrivatePointer ptr = accessPointConfigurations.value(id);
+     if (ptr) {
+-        ptr->mutex.lock();
+-        if (properties.value("State").toUInt() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
+-            QStringList devices = activeConnection->devices();
+-            if (!devices.isEmpty()) {
+-                QNetworkManagerInterfaceDevice device(devices.at(0),this);
+-                connectionInterfaces.insert(id,device.networkInterface());
+-            }
+-
+-            ptr->state |= QNetworkConfiguration::Active;
+-            ptr->mutex.unlock();
+-
+-            locker.unlock();
+-            emit configurationChanged(ptr);
+-            locker.relock();
+-        } else {
+-            connectionInterfaces.remove(id);
+-            ptr->mutex.unlock();
++        if (properties.contains(QStringLiteral("State"))) {
++            ptr->mutex.lock();
++            if (properties.value("State").toUInt() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
++                QStringList devices = activeConnection->devices();
++                if (!devices.isEmpty()) {
++                    QNetworkManagerInterfaceDevice device(devices.at(0),this);
++                    connectionInterfaces.insert(id,device.networkInterface());
++                }
++
++                ptr->state |= QNetworkConfiguration::Active;
++                ptr->mutex.unlock();
++
++                locker.unlock();
++                emit configurationChanged(ptr);
++                locker.relock();
++            } else {
++                connectionInterfaces.remove(id);
++                ptr->mutex.unlock();
++            }
+         }
+     }
+ }
+@@ -403,9 +412,6 @@
+         connect(wirelessDevice,SIGNAL(scanDone()),this,SLOT(scanFinished()));
+         wirelessDevice->setConnections();
+ 
+-        foreach (const QDBusObjectPath &apPath, wirelessDevice->getAccessPoints())
+-            newAccessPoint(apPath.path());
+-
+         wirelessDevices.insert(path.path(), wirelessDevice);
+     }
+ 
+@@ -518,14 +524,9 @@
+         parseConnection(settingsPath, connection->getSettings());
+ 
+     // Check if connection is active.
+-    QHashIterator<QString, QNetworkManagerConnectionActive*> i(activeConnectionsList);
+-    while (i.hasNext()) {
+-        i.next();
+-        if (i.value()->connection().path() == settingsPath) {
+-            cpPriv->state |= QNetworkConfiguration::Active;
+-            break;
+-        }
+-    }
++    if (isConnectionActive(settingsPath))
++        cpPriv->state |= QNetworkConfiguration::Active;
++
+     if (deviceType == DEVICE_TYPE_ETHERNET) {
+         QHashIterator<QString, QNetworkManagerInterfaceDevice*> i(interfaceDevices);
+         while (i.hasNext()) {
+@@ -539,12 +540,36 @@
+              }
+          }
+      }
++
+     QNetworkConfigurationPrivatePointer ptr(cpPriv);
+     accessPointConfigurations.insert(ptr->id, ptr);
+     locker.unlock();
+     emit configurationAdded(ptr);
+ }
+ 
++bool QNetworkManagerEngine::isConnectionActive(const QString &settingsPath)
++{
++    QHashIterator<QString, QNetworkManagerConnectionActive*> i(activeConnectionsList);
++    while (i.hasNext()) {
++        i.next();
++        if (i.value()->connection().path() == settingsPath) {
++            if (i.value()->state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATING
++                    || i.value()->state() == NM_ACTIVE_CONNECTION_STATE_ACTIVATED) {
++                return true;
++            } else {
++                break;
++            }
++        }
++    }
++
++    QNetworkManagerSettingsConnection *settingsConnection = connectionFromId(settingsPath);
++    if (settingsConnection->getType() == DEVICE_TYPE_MODEM) {
++        return isActiveContext(settingsConnection->connectionInterface()->path());
++    }
++
++    return false;
++}
++
+ void QNetworkManagerEngine::removeConnection(const QString &path)
+ {
+     QMutexLocker locker(&mutex);
+@@ -652,7 +677,6 @@
+ void QNetworkManagerEngine::newAccessPoint(const QString &path)
+ {
+     QMutexLocker locker(&mutex);
+-
+     QNetworkManagerInterfaceAccessPoint *accessPoint =
+         new QNetworkManagerInterfaceAccessPoint(path,this);
+ 
+@@ -683,6 +707,9 @@
+                 ptr->mutex.lock();
+                 QNetworkConfiguration::StateFlags flag = QNetworkConfiguration::Defined;
+                 ptr->state = (flag | QNetworkConfiguration::Discovered);
++
++                if (isConnectionActive(settingsPath))
++                    ptr->state = (flag | QNetworkConfiguration::Active);
+                 ptr->mutex.unlock();
+ 
+                 locker.unlock();
+@@ -762,7 +789,6 @@
+     QMutexLocker locker(&mutex);
+     QNetworkConfigurationPrivate *cpPriv = new QNetworkConfigurationPrivate;
+     cpPriv->name = map.value("connection").value("id").toString();
+-
+     cpPriv->isValid = true;
+     cpPriv->id = settingsPath;
+     cpPriv->type = QNetworkConfiguration::InternetAccessPoint;
+@@ -811,18 +837,46 @@
+         }
+     } else if (connectionType == QLatin1String("gsm")) {
+ 
+-        const QString contextPath = map.value("connection").value("id").toString();
+-        cpPriv->name = contextName(contextPath);
+-        cpPriv->bearerType = currentBearerType(contextPath);
+-
+-        if (map.value("connection").contains("timestamp")) {
+-            cpPriv->state |= QNetworkConfiguration::Discovered;
++        const QString connectionPath = map.value("connection").value("id").toString();
++        cpPriv->name = contextName(connectionPath);
++        cpPriv->bearerType = currentBearerType(connectionPath);
++
++        if (ofonoManager && ofonoManager->isValid()) {
++            const QString contextPart = connectionPath.section('/', -1);
++            QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
++            while (i.hasNext()) {
++                i.next();
++                const QString path = i.key() +"/"+contextPart;
++                if (isActiveContext(path)) {
++                    cpPriv->state |= QNetworkConfiguration::Active;
++                    break;
++                }
++            }
+         }
+     }
+ 
+     return cpPriv;
+ }
+ 
++bool QNetworkManagerEngine::isActiveContext(const QString &contextPath)
++{
++    if (ofonoManager && ofonoManager->isValid()) {
++        const QString contextPart = contextPath.section('/', -1);
++        QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
++        while (i.hasNext()) {
++            i.next();
++            PathPropertiesList list = i.value()->contextsWithProperties();
++            for (int i = 0; i < list.size(); ++i) {
++                if (list.at(i).path.path().contains(contextPart)) {
++                    return list.at(i).properties.value(QStringLiteral("Active")).toBool();
++
++                }
++            }
++        }
++    }
++    return false;
++}
++
+ QNetworkManagerSettingsConnection *QNetworkManagerEngine::connectionFromId(const QString &id) const
+ {
+     for (int i = 0; i < connections.count(); ++i) {
+@@ -967,53 +1021,111 @@
+ 
+ QNetworkConfiguration::BearerType QNetworkManagerEngine::currentBearerType(const QString &id)
+ {
+-    if (ofonoManager->isValid()) {
+-        QString contextPart = id.section('/', -1);
++    QString contextPart = id.section('/', -1);
++    QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
++    while (i.hasNext()) {
++        i.next();
++        QString contextPath = i.key() +"/"+contextPart;
+ 
+-        QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
+-        while (i.hasNext()) {
+-            i.next();
+-            QString contextPath = i.key() +"/"+contextPart;
+-            if (i.value()->contexts().contains(contextPath)) {
++        if (i.value()->contexts().contains(contextPath)) {
+ 
+-                QString bearer = i.value()->bearer();
+-                if (bearer == QStringLiteral("gsm")) {
+-                    return QNetworkConfiguration::Bearer2G;
+-                } else if (bearer == QStringLiteral("edge")) {
+-                    return QNetworkConfiguration::Bearer2G;
+-                } else if (bearer == QStringLiteral("umts")) {
+-                    return QNetworkConfiguration::BearerWCDMA;
+-                } else if (bearer == QStringLiteral("hspa")
+-                           || bearer == QStringLiteral("hsdpa")
+-                           || bearer == QStringLiteral("hsupa")) {
+-                    return QNetworkConfiguration::BearerHSPA;
+-                } else if (bearer == QStringLiteral("lte")) {
+-                    return QNetworkConfiguration::BearerLTE;
+-                }
++            QString bearer = i.value()->bearer();
++
++            if (bearer == QStringLiteral("gsm")) {
++                return QNetworkConfiguration::Bearer2G;
++            } else if (bearer == QStringLiteral("edge")) {
++                return QNetworkConfiguration::Bearer2G;
++            } else if (bearer == QStringLiteral("umts")) {
++                return QNetworkConfiguration::BearerWCDMA;
++            } else if (bearer == QStringLiteral("hspa")
++                       || bearer == QStringLiteral("hsdpa")
++                       || bearer == QStringLiteral("hsupa")) {
++                return QNetworkConfiguration::BearerHSPA;
++            } else if (bearer == QStringLiteral("lte")) {
++                return QNetworkConfiguration::BearerLTE;
+             }
+         }
+     }
++
+     return QNetworkConfiguration::BearerUnknown;
+ }
+ 
+ QString QNetworkManagerEngine::contextName(const QString &path)
+ {
+-    if (ofonoManager->isValid()) {
+-        QString contextPart = path.section('/', -1);
+-        QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
+-        while (i.hasNext()) {
+-            i.next();
+-            Q_FOREACH (const QString &oContext, i.value()->contexts()) {
+-                if (oContext.contains(contextPart)) {
+-                    QOfonoConnectionContextInterface contextInterface(oContext,this);
+-                    return contextInterface.name();
+-                }
++    QString contextPart = path.section('/', -1);
++    QHashIterator<QString, QOfonoDataConnectionManagerInterface*> i(ofonoContextManagers);
++    while (i.hasNext()) {
++        i.next();
++        PathPropertiesList list = i.value()->contextsWithProperties();
++        for (int i = 0; i < list.size(); ++i) {
++            if (list.at(i).path.path().contains(contextPart)) {
++                return list.at(i).properties.value(QStringLiteral("Name")).toString();
+             }
+         }
+     }
+     return path;
+ }
+ 
++void QNetworkManagerEngine::nmRegistered(const QString &)
++{
++    if (ofonoManager) {
++        delete ofonoManager;
++        ofonoManager = NULL;
++    }
++    managerInterface = new QNetworkManagerInterface(this);
++    systemSettings = new QNetworkManagerSettings(NM_DBUS_SERVICE, this);
++
++    connect(managerInterface, SIGNAL(deviceAdded(QDBusObjectPath)),
++            this, SLOT(deviceAdded(QDBusObjectPath)));
++    connect(managerInterface, SIGNAL(deviceRemoved(QDBusObjectPath)),
++            this, SLOT(deviceRemoved(QDBusObjectPath)));
++    connect(managerInterface, SIGNAL(activationFinished(QDBusPendingCallWatcher*)),
++            this, SLOT(activationFinished(QDBusPendingCallWatcher*)));
++    connect(managerInterface, SIGNAL(propertiesChanged(QMap<QString,QVariant>)),
++            this, SLOT(interfacePropertiesChanged(QMap<QString,QVariant>)));
++    managerInterface->setConnections();
++
++    connect(systemSettings, SIGNAL(newConnection(QDBusObjectPath)),
++            this, SLOT(newConnection(QDBusObjectPath)));
++    systemSettings->setConnections();
++    nmAvailable = true;
++
++    setupConfigurations();
++}
++
++void QNetworkManagerEngine::nmUnRegistered(const QString &)
++{
++    if (systemSettings) {
++        delete systemSettings;
++        systemSettings = NULL;
++    }
++    if (managerInterface) {
++        delete managerInterface;
++        managerInterface = NULL;
++    }
++}
++
++void QNetworkManagerEngine::ofonoRegistered(const QString &)
++{
++    if (ofonoManager) {
++        delete ofonoManager;
++        ofonoManager = NULL;
++    }
++    ofonoManager = new QOfonoManagerInterface(this);
++    if (ofonoManager && ofonoManager->isValid()) {
++        Q_FOREACH (const QString &modem, ofonoManager->getModems()) {
++            QOfonoDataConnectionManagerInterface *ofonoContextManager
++                    = new QOfonoDataConnectionManagerInterface(modem,this);
++            ofonoContextManagers.insert(modem, ofonoContextManager);
++        }
++    }
++}
++
++void QNetworkManagerEngine::ofonoUnRegistered(const QString &)
++{
++    ofonoContextManagers.clear();
++}
++
+ QT_END_NAMESPACE
+ 
+ #endif // QT_NO_DBUS
+--- qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
++++ qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerengine.h
+@@ -109,6 +109,12 @@
+ 
+     void wiredCarrierChanged(bool);
+ 
++    void nmRegistered(const QString &serviceName = QString());
++    void nmUnRegistered(const QString &serviceName = QString());
++
++    void ofonoRegistered(const QString &serviceName = QString());
++    void ofonoUnRegistered(const QString &serviceName = QString());
++
+ private:
+     QNetworkConfigurationPrivate *parseConnection(const QString &settingsPath,
+                                                   const QNmSettingsMap &map);
+@@ -132,6 +138,13 @@
+     QNetworkConfiguration::BearerType currentBearerType(const QString &id);
+     QString contextName(const QString &path);
+ 
++    bool isConnectionActive(const QString &settingsPath);
++    QDBusServiceWatcher *ofonoWatcher;
++    QDBusServiceWatcher *nmWatcher;
++
++    bool isActiveContext(const QString &contextPath);
++    bool nmAvailable;
++    void setupConfigurations();
+ };
+ 
+ QT_END_NAMESPACE
+--- qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
++++ qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerservice.cpp
+@@ -688,6 +688,15 @@
+                                   QLatin1String(NM_DBUS_INTERFACE_DEVICE_WIRELESS),
+                                   QLatin1String("PropertiesChanged"),
+                                   this,SLOT(propertiesSwap(QMap<QString,QVariant>)));
++
++    QDBusPendingReply<QList<QDBusObjectPath> > reply
++            = d->connectionInterface->asyncCall(QLatin1String("GetAccessPoints"));
++
++    QDBusPendingCallWatcher *callWatcher = new QDBusPendingCallWatcher(reply);
++    connect(callWatcher, SIGNAL(finished(QDBusPendingCallWatcher*)),
++                     this, SLOT(accessPointsFinished(QDBusPendingCallWatcher*)));
++
++
+     d->valid = true;
+ }
+ 
+@@ -749,6 +758,19 @@
+     return allOk;
+ }
+ 
++void QNetworkManagerInterfaceDeviceWireless::accessPointsFinished(QDBusPendingCallWatcher *watcher)
++{
++    QDBusPendingReply<QList<QDBusObjectPath> > reply(*watcher);
++    watcher->deleteLater();
++    if (!reply.isError()) {
++        accessPointsList = reply.value();
++    }
++
++    for (int i = 0; i < accessPointsList.size(); i++) {
++        Q_EMIT accessPointAdded(accessPointsList.at(i).path());
++    }
++}
++
+ QDBusInterface *QNetworkManagerInterfaceDeviceWireless::connectionInterface() const
+ {
+     return d->connectionInterface;
+--- qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
++++ qtbase/src/plugins/bearer/networkmanager/qnetworkmanagerservice.h
+@@ -369,6 +369,8 @@
+     void slotAccessPointAdded(QDBusObjectPath);
+     void slotAccessPointRemoved(QDBusObjectPath);
+ 
++    void accessPointsFinished(QDBusPendingCallWatcher *watcher);
++
+ private:
+     QNetworkManagerInterfaceDeviceWirelessPrivate *d;
+     QVariantMap propertyMap;
Index: files/always_include_private_headers.diff
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/always_include_private_headers.diff b/trunk/dports/aqua/qt5-mac-devel/files/always_include_private_headers.diff
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/always_include_private_headers.diff	(working copy)
@@ -0,0 +1,20 @@
+--- qtbase/mkspecs/features/orig.create_cmake.prf	2014-12-05 17:24:38.000000000 +0100
++++ qtbase/mkspecs/features/create_cmake.prf	2015-01-12 18:38:41.000000000 +0100
+@@ -28,7 +28,7 @@
+ 
+ split_incpath {
+     CMAKE_ADD_SOURCE_INCLUDE_DIRS = true
+-    CMAKE_NO_PRIVATE_INCLUDES = true # Don't add private includes in the build dir which don't exist
++    #CMAKE_NO_PRIVATE_INCLUDES = true # Don't add private includes in the build dir which don't exist
+     CMAKE_SOURCE_INCLUDES = \
+         $$cmakeTargetPaths($$QT_MODULE_INCLUDE_BASE $$QT_MODULE_INCLUDE_BASE/Qt$${CMAKE_MODULE_NAME})
+     CMAKE_SOURCE_PRIVATE_INCLUDES = \
+@@ -51,7 +51,7 @@
+     CMAKE_INCLUDE_DIR_IS_ABSOLUTE = True
+ }
+ 
+-!exists($$first(QT.$${MODULE}_private.includes)): CMAKE_NO_PRIVATE_INCLUDES = true
++#!exists($$first(QT.$${MODULE}_private.includes)): CMAKE_NO_PRIVATE_INCLUDES = true
+ 
+ CMAKE_LIB_DIR = $$cmakeRelativePath($$[QT_INSTALL_LIBS], $$[QT_INSTALL_PREFIX])
+ contains(CMAKE_LIB_DIR,"^\\.\\./.*") {
Index: files/deactivate-menurole-heuristics.patch
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/deactivate-menurole-heuristics.patch b/trunk/dports/aqua/qt5-mac-devel/files/deactivate-menurole-heuristics.patch
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/deactivate-menurole-heuristics.patch	(working copy)
@@ -0,0 +1,29 @@
+--- qtbase/src/plugins/platforms/cocoa/messages.cpp
++++ qtbase/src/plugins/platforms/cocoa/messages.cpp
+@@ -70,16 +70,16 @@
+ {
+     QString captionNoAmpersand(caption);
+     captionNoAmpersand.remove(QChar('&'));
+-    const QString aboutString = QCoreApplication::translate("QCocoaMenuItem", "About");
+-    if (captionNoAmpersand.startsWith(aboutString, Qt::CaseInsensitive) || caption.endsWith(aboutString, Qt::CaseInsensitive))
+-        return QPlatformMenuItem::AboutRole;
+-    if (captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Config"), Qt::CaseInsensitive)
+-        || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Preference"), Qt::CaseInsensitive)
+-        || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Options"), Qt::CaseInsensitive)
+-        || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setting"), Qt::CaseInsensitive)
+-        || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setup"), Qt::CaseInsensitive)) {
+-        return QPlatformMenuItem::PreferencesRole;
+-    }
++//     const QString aboutString = QCoreApplication::translate("QCocoaMenuItem", "About");
++//     if (captionNoAmpersand.startsWith(aboutString, Qt::CaseInsensitive) || caption.endsWith(aboutString, Qt::CaseInsensitive))
++//         return QPlatformMenuItem::AboutRole;
++//     if (captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Config"), Qt::CaseInsensitive)
++//         || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Preference"), Qt::CaseInsensitive)
++//         || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Options"), Qt::CaseInsensitive)
++//         || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setting"), Qt::CaseInsensitive)
++//         || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Setup"), Qt::CaseInsensitive)) {
++//         return QPlatformMenuItem::PreferencesRole;
++//     }
+     if (captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Quit"), Qt::CaseInsensitive)
+         || captionNoAmpersand.startsWith(QCoreApplication::translate("QCocoaMenuItem", "Exit"), Qt::CaseInsensitive)) {
+         return QPlatformMenuItem::QuitRole;
Index: files/debug-negative-qtimerint.patch
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/debug-negative-qtimerint.patch b/trunk/dports/aqua/qt5-mac-devel/files/debug-negative-qtimerint.patch
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/debug-negative-qtimerint.patch	(working copy)
@@ -0,0 +1,11 @@
+--- qtbase/src/corelib/kernel/qobject.cpp
++++ qtbase/src/corelib/kernel/qobject.cpp
+@@ -1612,7 +1612,7 @@
+     Q_D(QObject);
+ 
+     if (Q_UNLIKELY(interval < 0)) {
+-        qWarning("QObject::startTimer: Timers cannot have negative intervals");
++        qWarning() << "QObject::startTimer: Timer" << this << "cannot have a negative interval";
+         return 0;
+     }
+     if (Q_UNLIKELY(!d->threadData->eventDispatcher.load())) {
Index: files/disable-generic-plugin-when-others-available.patch
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/disable-generic-plugin-when-others-available.patch b/trunk/dports/aqua/qt5-mac-devel/files/disable-generic-plugin-when-others-available.patch
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/disable-generic-plugin-when-others-available.patch	(working copy)
@@ -0,0 +1,11 @@
+--- qtbase/src/network/bearer/qnetworkconfigmanager_p.cpp
++++ qtbase/src/network/bearer/qnetworkconfigmanager_p.cpp
+@@ -405,7 +405,7 @@
+             }
+         }
+ 
+-        if (generic)
++        if (generic && sessionEngines.count() == 0)
+             sessionEngines.append(generic);
+ #endif // QT_NO_LIBRARY
+     }
Index: files/fix-qstandardpaths.patch
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/fix-qstandardpaths.patch b/trunk/dports/aqua/qt5-mac-devel/files/fix-qstandardpaths.patch
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/fix-qstandardpaths.patch	(working copy)
@@ -0,0 +1,96 @@
+--- qtbase/src/corelib/io/qstandardpaths_mac.cpp
++++ qtbase/src/corelib/io/qstandardpaths_mac.cpp
+@@ -37,6 +37,7 @@
+ 
+ #ifndef QT_BOOTSTRAPPED
+ #include <qcoreapplication.h>
++#include <qlibraryinfo.h>
+ #endif
+ 
+ #include <CoreFoundation/CoreFoundation.h>
+@@ -169,17 +169,85 @@
+     }
+ }
+ 
++static void normaliseDirs(QStringList &dirs)
++{
++    // Normalise paths, skip relative paths
++    QMutableListIterator<QString> it(dirs);
++    while (it.hasNext()) {
++        const QString dir = it.next();
++        if (!dir.startsWith(QLatin1Char('/')))
++            it.remove();
++        else
++            it.setValue(QDir::cleanPath(dir));
++    }
++
++    // Remove duplicates from the list, there's no use for duplicated
++    // paths in XDG_CONFIG_DIRS - if it's not found in the given
++    // directory the first time, it won't be there the second time.
++    // Plus duplicate paths causes problems for example for mimetypes,
++    // where duplicate paths here lead to duplicated mime types returned
++    // for a file, eg "text/plain,text/plain" instead of "text/plain"
++    dirs.removeDuplicates();
++}
++
++static QStringList xdgConfigDirs()
++{
++    QStringList dirs;
++    // http://standards.freedesktop.org/basedir-spec/latest/
++    QString xdgConfigDirsEnv = QFile::decodeName(qgetenv("XDG_CONFIG_DIRS"));
++    if (xdgConfigDirsEnv.isEmpty()) {
++#ifndef QT_BOOTSTRAPPED
++        dirs.append(QLibraryInfo::location(QLibraryInfo::PrefixPath) + QString::fromLatin1("/config"));
++#endif
++    } else {
++        dirs = xdgConfigDirsEnv.split(QLatin1Char(':'), QString::SkipEmptyParts);
++
++        normaliseDirs(dirs);
++    }
++    return dirs;
++}
++
++static QStringList xdgDataDirs()
++{
++    QStringList dirs;
++    // http://standards.freedesktop.org/basedir-spec/latest/
++    QString xdgDataDirsEnv = QFile::decodeName(qgetenv("XDG_DATA_DIRS"));
++    if (xdgDataDirsEnv.isEmpty()) {
++#ifndef QT_BOOTSTRAPPED
++        dirs.append(QLibraryInfo::location(QLibraryInfo::PrefixPath) + QString::fromLatin1("/share"));
++#endif
++    } else {
++        dirs = xdgDataDirsEnv.split(QLatin1Char(':'), QString::SkipEmptyParts);
++
++        normaliseDirs(dirs);
++    }
++    return dirs;
++}
++
+ QStringList QStandardPaths::standardLocations(StandardLocation type)
+ {
+     QStringList dirs;
+ 
++    if (type == GenericDataLocation) {
++        dirs.append(xdgDataDirs());
++    }
++
+     if (type == GenericDataLocation || type == AppDataLocation || type == AppLocalDataLocation || type == GenericCacheLocation || type == CacheLocation) {
+         const QString path = macLocation(type, kOnAppropriateDisk);
+         if (!path.isEmpty())
+             dirs.append(path);
+     }
+ 
++    if (type == GenericConfigLocation || type == ConfigLocation)
++        dirs.append(xdgConfigDirs());
++
+     if (type == AppDataLocation || type == AppLocalDataLocation) {
++        QStringList xdgDirs = xdgDataDirs();
++        for (int i = 0; i < xdgDirs.count(); ++i) {
++            appendOrganizationAndApp(xdgDirs[i]);
++        }
++        dirs.append(xdgDirs);
++
+         CFBundleRef mainBundle = CFBundleGetMainBundle();
+         if (mainBundle) {
+             CFURLRef bundleUrl = CFBundleCopyBundleURL(mainBundle);
Index: files/load_testability_from_env_var.patch
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/load_testability_from_env_var.patch b/trunk/dports/aqua/qt5-mac-devel/files/load_testability_from_env_var.patch
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/load_testability_from_env_var.patch	(working copy)
@@ -0,0 +1,16 @@
+Description: load testability from environment variable
+Author: Thomi Richards <thomi.richards@canonical.com>
+Forwarded: https://bugreports.qt-project.org/browse/QTBUG-32974
+
+--- qtbase/src/gui/kernel/qguiapplication.cpp
++++ qtbase/src/gui/kernel/qguiapplication.cpp
+@@ -1273,6 +1273,9 @@
+         argc = j;
+     }
+ 
++    if (qgetenv("QT_LOAD_TESTABILITY").toInt() > 0)
++        loadTestability = true;
++
+ #if defined(QT_DEBUG) && defined(Q_OS_LINUX)
+     if (!doGrabUnderDebugger && !QGuiApplicationPrivate::noGrab && runningUnderDebugger()) {
+         QGuiApplicationPrivate::noGrab = true;
Index: files/patch-machtest.diff
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/patch-machtest.diff b/trunk/dports/aqua/qt5-mac-devel/files/patch-machtest.diff
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/patch-machtest.diff	(working copy)
@@ -0,0 +1,15 @@
+--- qtbase/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pro
++++ qtbase/tests/auto/corelib/plugin/qpluginloader/machtest/machtest.pro
+@@ -4,10 +4,10 @@
+     generate-bad.pl
+ 
+ i386.target = good.i386.dylib
+-i386.commands = $(CXX) $(CXXFLAGS) -shared -arch i386 -o $@ -I$$[QT_INSTALL_HEADERS/get] $<
++i386.commands = $(CXX) $(filter-out -arch i386 x86_64,$(CXXFLAGS)) -shared -arch i386 -o $@ -I$$[QT_INSTALL_HEADERS/get] $<
+ i386.depends += $$PWD/../fakeplugin.cpp
+ x86_64.target = good.x86_64.dylib
+-x86_64.commands = $(CXX) $(CXXFLAGS) -shared -arch x86_64 -o $@ -I$$[QT_INSTALL_HEADERS/get] $<
++x86_64.commands = $(CXX) $(filter-out -arch i386 x86_64,$(CXXFLAGS)) -shared -arch x86_64 -o $@ -I$$[QT_INSTALL_HEADERS/get] $<
+ x86_64.depends += $$PWD/../fakeplugin.cpp
+ 
+ # Current Mac OS X toolchains have no compiler for PPC anymore
Index: files/patch-qmacstyle_mac.diff
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/patch-qmacstyle_mac.diff b/trunk/dports/aqua/qt5-mac-devel/files/patch-qmacstyle_mac.diff
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/patch-qmacstyle_mac.diff	(working copy)
@@ -0,0 +1,14 @@
+--- .//qtbase/src/widgets/styles/qmacstyle_mac.mm.orig	2014-09-11 03:48:01.000000000 -0700
++++ .//qtbase/src/widgets/styles/qmacstyle_mac.mm	2014-10-28 19:28:34.000000000 -0700
+@@ -3667,9 +3667,9 @@
+ 
+                 NSBezierPath *pushButtonFocusRingPath;
+                 if (bdi.kind == kThemeBevelButton)
+-                    pushButtonFocusRingPath = [NSBezierPath bezierPathWithRect:focusRect];
++                    pushButtonFocusRingPath = [NSBezierPath bezierPathWithRect:NSRectFromCGRect(focusRect)];
+                 else
+-                    pushButtonFocusRingPath = [NSBezierPath bezierPathWithRoundedRect:focusRect xRadius:4 yRadius:4];
++                    pushButtonFocusRingPath = [NSBezierPath bezierPathWithRoundedRect:NSRectFromCGRect(focusRect) xRadius:4 yRadius:4];
+                 qt_drawFocusRingOnPath(cg, pushButtonFocusRingPath);
+             }
+ 
Index: files/patch-shared.diff
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/patch-shared.diff b/trunk/dports/aqua/qt5-mac-devel/files/patch-shared.diff
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/patch-shared.diff	(working copy)
@@ -0,0 +1,11 @@
+--- qttools/src/macdeployqt/shared/shared.cpp
++++ qttools/src/macdeployqt/shared/shared.cpp
+@@ -196,7 +196,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;
Index: files/patch-tst_benchlibcallgrind.diff
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/patch-tst_benchlibcallgrind.diff b/trunk/dports/aqua/qt5-mac-devel/files/patch-tst_benchlibcallgrind.diff
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/patch-tst_benchlibcallgrind.diff	(working copy)
@@ -0,0 +1,14 @@
+--- qtbase/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp
++++ qtbase/tests/auto/testlib/selftests/benchlibcallgrind/tst_benchlibcallgrind.cpp
+@@ -73,9 +73,9 @@
+     QBENCHMARK {
+         __asm__ __volatile__(
+             "mov $100000000,%%eax   \n"
+-            "LOOPTOP:               \n"
++            "1:                     \n"
+             "dec %%eax              \n"
+-            "jnz LOOPTOP            \n"
++            "jnz 1b                 \n"
+             : /* no output */
+             : /* no input */
+             : /* clobber */ "eax"
Index: files/patch-tst_qaccessibilitymac_helpers.diff
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/patch-tst_qaccessibilitymac_helpers.diff b/trunk/dports/aqua/qt5-mac-devel/files/patch-tst_qaccessibilitymac_helpers.diff
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/patch-tst_qaccessibilitymac_helpers.diff	(working copy)
@@ -0,0 +1,11 @@
+--- qtbase/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm
++++ qtbase/tests/auto/other/qaccessibilitymac/tst_qaccessibilitymac_helpers.mm
+@@ -116,7 +116,7 @@
+ 
+ - (AXUIElementRef) ref { return reference; }
+ - (void) print {
+-    NSLog(@"Accessible Object role: '%@', description: '%@', value: '%@', rect: '%@'", self.role, self.description, self.value, NSStringFromRect(self.rect));
++    NSLog(@"Accessible Object role: '%@', description: '%@', value: '%@', rect: '%@'", self.role, self.description, self.value, NSStringFromRect(NSRectFromCGRect(self.rect)));
+     NSLog(@"    Children: %ld", [[self childList] count]);
+ }
+ 
Index: files/patch-tst_qarraydata.diff
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/patch-tst_qarraydata.diff b/trunk/dports/aqua/qt5-mac-devel/files/patch-tst_qarraydata.diff
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/patch-tst_qarraydata.diff	(working copy)
@@ -0,0 +1,11 @@
+--- qtbase/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
++++ qtbase/tests/auto/corelib/tools/qarraydata/tst_qarraydata.cpp
+@@ -789,7 +789,7 @@
+                     + minAlignment - Q_ALIGNOF(QArrayData)));
+ 
+         // Data is aligned
+-        QCOMPARE(quintptr(data->data()) % alignment, quintptr(0u));
++        QCOMPARE(quintptr(quintptr(data->data()) % alignment), quintptr(0));
+ 
+         // Check that the allocated array can be used. Best tested with a
+         // memory checker, such as valgrind, running.
Index: files/patch-tst_qpluginloader.diff
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/patch-tst_qpluginloader.diff b/trunk/dports/aqua/qt5-mac-devel/files/patch-tst_qpluginloader.diff
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/patch-tst_qpluginloader.diff	(working copy)
@@ -0,0 +1,20 @@
+--- qtbase/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp
++++ qtbase/tests/auto/corelib/plugin/qpluginloader/tst_qpluginloader.cpp
+@@ -311,7 +311,7 @@
+ 
+ void tst_QPluginLoader::loadMachO_data()
+ {
+-#ifdef Q_OF_MACH_O
++#if defined(QT_BUILD_INTERNAL) && defined(Q_OF_MACH_O)
+     QTest::addColumn<int>("parseResult");
+ 
+     QTest::newRow("/dev/null") << int(QMachOParser::NotSuitable);
+@@ -347,7 +347,7 @@
+ 
+ void tst_QPluginLoader::loadMachO()
+ {
+-#ifdef Q_OF_MACH_O
++#if defined(QT_BUILD_INTERNAL) && defined(Q_OF_MACH_O)
+     QFile f(QFINDTESTDATA(QTest::currentDataTag()));
+     QVERIFY(f.open(QIODevice::ReadOnly));
+     QByteArray data = f.readAll();
Index: files/qprocess-nozombies.patch
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/qprocess-nozombies.patch b/trunk/dports/aqua/qt5-mac-devel/files/qprocess-nozombies.patch
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/qprocess-nozombies.patch	(working copy)
@@ -0,0 +1,23 @@
+--- qtbase/src/corelib/io/qprocess_unix.cpp
++++ qtbase/src/corelib/io/qprocess_unix.cpp
+@@ -1312,17 +1312,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);
Index: files/remove_google_adsense.patch
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/remove_google_adsense.patch b/trunk/dports/aqua/qt5-mac-devel/files/remove_google_adsense.patch
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/remove_google_adsense.patch	(working copy)
@@ -0,0 +1,69 @@
+Description: remove tracking javascript from examples
+Author: Lisandro Damián Nicanor Pérez Meyer <lisandro@debian.org>
+Last-Update: 2014-02-17
+
+---
+ examples/xml/htmlinfo/trolltech_com.html |   45 -------------------------------
+ 1 file changed, 45 deletions(-)
+
+--- qtbase/examples/xml/htmlinfo/trolltech_com.html
++++ qtbase/examples/xml/htmlinfo/trolltech_com.html
+@@ -23,14 +23,6 @@
+               content="Trolltech creates application development platforms for desktop and mobile device innovation." />
+         <meta name="keywords" content="" />
+     
+-<script src="http://www.google-analytics.com/urchin.js" type="text/javascript"><!-- &nbsp;--></script>
+-<script type="text/javascript">
+-    <!-- Urchin script
+-                _uacct = "UA-4457116-1";
+-                urchinTracker();
+-    -->
+-	</script>
+-      
+         <base href="http://trolltech.com/homepage" />
+       
+     
+@@ -910,43 +902,6 @@
+     </div>
+       
+     </div>
+-<!-- ProspectXtractor tracker script -->
+-<script type="text/javascript"><!--
+-function _pxPar()
+-{
+-var p="";
+-p+="&ref="+escape(top.document.referrer);
+-p+="&dt="+escape(document.title);
+-p+="&sr="+screen.width+"x"+screen.height;
+-p+="&sd="+screen.colorDepth;
+-p+="&fv="+_pxFV();
+-return p;
+-}
+-function _pxFV()
+-{
+-var f=0,n=navigator;
+-if (n.plugins && n.mimeTypes.length) {
+-var x=n.plugins["Shockwave Flash"];
+-if(x && x.description) {
+-var y=x.description;
+-f=y.charAt(y.indexOf('.')-1);
+-}
+-} else {
+-r=false;
+-for(var i=15;i>=3&&r!=true;i-=1){
+-execScript('on error resume next: r=IsObject(CreateObject("ShockwaveFlash.ShockwaveFlash.'+i+'"))','VBScript');
+-f=i;
+-}
+-}
+-return f;
+-}
+-document.write('<img src="http://pxreg.onlineservicesas.com/pxreg/?id=50C9FD2F-61D5-4824-B726-50D6B1F89999'+_pxPar()+'" width="1" heigth="1" />');
+-//-->
+-</script>
+-<noscript>
+-<div><img src="http://pxreg.onlineservicesas.com/pxreg/?id=50C9FD2F-61D5-4824-B726-50D6B1F89999" width="1" height="1" alt="" /></div>
+-</noscript>
+-<!-- END ProspectXtractor tracker script -->
+ </body>
+ </html>
+ 
Index: files/remove_icon_from_example.patch
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/remove_icon_from_example.patch b/trunk/dports/aqua/qt5-mac-devel/files/remove_icon_from_example.patch
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/remove_icon_from_example.patch	(working copy)
@@ -0,0 +1,24 @@
+Description: remove icon link from example html file
+ This patch removes a suposedly privacy breach detected by lintian.
+ As the Trolltech site is down and the example is simply not working I am
+ just removing the link to it.
+Author: Lisandro Damián Nicanor Pérez Meyer <lisandro@debian.org>
+Forwarded: not-needed
+Last-Update: 2014-06-25
+
+---
+ examples/xml/htmlinfo/trolltech_com.html |    3 ---
+ 1 file changed, 3 deletions(-)
+
+--- qtbase/examples/xml/htmlinfo/trolltech_com.html
++++ qtbase/examples/xml/htmlinfo/trolltech_com.html
+@@ -110,9 +110,6 @@
+         <style type="text/css" media="all">@import url(http://trolltech.com/IEFixes.css);</style>
+     <![endif]-->
+ 
+-    <link rel="shortcut icon" type="image/x-icon"
+-          href="http://trolltech.com/favicon.ico" />
+-
+     <link rel="home" href="http://trolltech.com"
+           title="Front page" />
+     <link rel="search"
Index: files/series
===================================================================
diff --git a/trunk/dports/aqua/qt5-mac-devel/files/series b/trunk/dports/aqua/qt5-mac-devel/files/series
new file mode 10644
--- /dev/null	(revision 0)
+++ b/trunk/dports/aqua/qt5-mac-devel/files/series	(working copy)
@@ -0,0 +1,16 @@
+patch-tst_qpluginloader.diff
+patch-machtest.diff
+patch-tst_qarraydata.diff
+patch-tst_benchlibcallgrind.diff
+patch-tst_qaccessibilitymac_helpers.diff
+qprocess-nozombies.patch
+fix-qstandardpaths.patch
+deactivate-menurole-heuristics.patch
+debug-negative-qtimerint.patch
+remove_icon_from_example.patch
+remove_google_adsense.patch
+load_testability_from_env_var.patch
+Add-workaround-for-GL-on-Android-emulator.patch
+disable-generic-plugin-when-others-available.patch
+QtBearer-networkmanager-make-sure-to-set-flag-Active.patch
+Break-after-handling-the-read-write.patch
