view src/qt-1-cherrypicks.patch @ 1811:162f2ce3e82e

update package qt
author Mark Brand <mabrand@mabrand.nl>
date Tue, 10 May 2011 11:15:28 +0200
parents 1a22655f516b
children 5d6de750041c
line wrap: on
line source

This file is part of mingw-cross-env.
See doc/index.html for further information.

Commits backported (cherry-picked) from Qt 4.7 branch.
http://qt.gitorious.org/qt

From bb75d02785da59c967dee09006700488af9f482e Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Fri, 15 Oct 2010 14:56:03 +0200
Subject: [PATCH 01/16] removed obsolete -qt-gif configure option

Since "-system-gif" is not offered, offering "-qt-gif" is unnecessary
and perhaps misleading. By default the GIF handler is built from code
included with Qt, unless suppressed by "-no-gif".

Merge-request: 859
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from commit dfe9084344d73d59f4569c8be6104ce83ae0df95)
---
 configure                        |    7 ++-----
 tools/configure/configureapp.cpp |    5 +----
 2 files changed, 3 insertions(+), 9 deletions(-)

diff --git a/configure b/configure
index 7abe0eb..c159cd4 100755
--- a/configure
+++ b/configure
@@ -1570,8 +1570,7 @@ while [ "$#" -gt 0 ]; do
         fi
         ;;
     gif)
-        [ "$VAL" = "qt" ] && VAL=auto
-        if [ "$VAL" = "auto" ] || [ "$VAL" = "no" ]; then
+        if [ "$VAL" = "no" ]; then
             CFG_GIF="$VAL"
         else
             UNKNOWN_OPT=yes
@@ -3544,7 +3543,7 @@ Usage:  $relconf [-h] [-prefix <dir>] [-prefix-install] [-bindir <dir>] [-libdir
         [-accessibility] [-no-stl] [-stl] [-no-sql-<driver>] [-sql-<driver>]
         [-plugin-sql-<driver>] [-system-sqlite] [-no-qt3support] [-qt3support]
         [-platform] [-D <string>] [-I <string>] [-L <string>] [-help]
-        [-qt-zlib] [-system-zlib] [-no-gif] [-qt-gif] [-no-libtiff] [-qt-libtiff] [-system-libtiff]
+        [-qt-zlib] [-system-zlib] [-no-gif] [-no-libtiff] [-qt-libtiff] [-system-libtiff]
         [-no-libpng] [-qt-libpng] [-system-libpng] [-no-libmng] [-qt-libmng]
         [-system-libmng] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg] [-make <part>]
         [-nomake <part>] [-R <string>]  [-l <string>] [-no-rpath]  [-rpath] [-continue]
@@ -3773,8 +3772,6 @@ Third Party Libraries:
                          See http://www.gzip.org/zlib
 
     -no-gif ............ Do not compile GIF reading support.
- *  -qt-gif ............ Compile GIF reading support.
-                         See also src/gui/image/qgifhandler_p.h
 
     -no-libtiff ........ Do not compile TIFF support.
     -qt-libtiff ........ Use the libtiff bundled with Qt.
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index 15c0ddb..dd5647b 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -590,8 +590,6 @@ void Configure::parseCmdLine()
         // Image formats --------------------------------------------
         else if (configCmdLine.at(i) == "-no-gif")
             dictionary[ "GIF" ] = "no";
-        else if (configCmdLine.at(i) == "-qt-gif")
-            dictionary[ "GIF" ] = "plugin";
 
         else if (configCmdLine.at(i) == "-no-libtiff") {
             dictionary[ "TIFF"] = "no";
@@ -1661,7 +1659,7 @@ bool Configure::displayHelp()
                     "[-no-qmake] [-qmake] [-dont-process] [-process]\n"
                     "[-no-style-<style>] [-qt-style-<style>] [-redo]\n"
                     "[-saveconfig <config>] [-loadconfig <config>]\n"
-                    "[-qt-zlib] [-system-zlib] [-no-gif] [-qt-gif] [-no-libpng]\n"
+                    "[-qt-zlib] [-system-zlib] [-no-gif] [-no-libpng]\n"
                     "[-qt-libpng] [-system-libpng] [-no-libtiff] [-qt-libtiff]\n"
                     "[-system-libtiff] [-no-libjpeg] [-qt-libjpeg] [-system-libjpeg]\n"
                     "[-no-libmng] [-qt-libmng] [-system-libmng] [-no-qt3support] [-mmx]\n"
@@ -1794,7 +1792,6 @@ bool Configure::displayHelp()
         desc("ZLIB", "system",  "-system-zlib",         "Use zlib from the operating system.\nSee http://www.gzip.org/zlib\n");
 
         desc("GIF", "no",       "-no-gif",              "Do not compile GIF reading support.");
-        desc("GIF", "auto",     "-qt-gif",              "Compile GIF reading support.\nSee also src/gui/image/qgifhandler_p.h\n");
 
         desc("LIBPNG", "no",    "-no-libpng",           "Do not compile PNG support.");
         desc("LIBPNG", "qt",    "-qt-libpng",           "Use the libpng bundled with Qt.");
-- 
1.7.4.2


From b5e382d8335628edf5d5c5a1671682de7c50c6d2 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Mon, 10 Jan 2011 16:41:54 +0100
Subject: [PATCH 02/16] qmake: fix double directory separator

Merge-request: 2543
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from commit 89886a34d7c4fdacc472f6e1498bc0769f2302ad)
---
 qmake/generators/unix/unixmake2.cpp |    9 +++++++--
 1 files changed, 7 insertions(+), 2 deletions(-)

diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index df580fd..81a379f 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -1345,8 +1345,13 @@ UnixMakefileGenerator::pkgConfigFileName(bool fixify)
     if(dot != -1)
         ret = ret.left(dot);
     ret += Option::pkgcfg_ext;
-    if(!project->isEmpty("QMAKE_PKGCONFIG_DESTDIR"))
-        ret.prepend(project->first("QMAKE_PKGCONFIG_DESTDIR") + Option::dir_sep);
+    QString subdir = project->first("QMAKE_PKGCONFIG_DESTDIR");
+    if(!subdir.isEmpty()) {
+        // initOutPaths() appends dir_sep, but just to be safe..
+        if (!subdir.endsWith(Option::dir_sep))
+            ret.prepend(Option::dir_sep);
+        ret.prepend(subdir);
+    }
     if(fixify) {
         if(QDir::isRelativePath(ret) && !project->isEmpty("DESTDIR"))
             ret.prepend(project->first("DESTDIR"));
-- 
1.7.4.2


From f35c452aaf665489060d317ce180d192433abd24 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Mon, 10 Jan 2011 16:41:55 +0100
Subject: [PATCH 03/16] qmake: don't limit pkg-config writing to unix generator

Move pkg-config related methods from unix generator to base class
so they can be used by other generators too.

Merge-request: 2543
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from commit 95646b07968604aa69f7e367dab7c9966dc44772)
---
 qmake/generators/makefile.cpp       |  178 +++++++++++++++++++++++++++++++++++
 qmake/generators/makefile.h         |    5 +
 qmake/generators/unix/unixmake.h    |    4 -
 qmake/generators/unix/unixmake2.cpp |  178 -----------------------------------
 4 files changed, 183 insertions(+), 182 deletions(-)

diff --git a/qmake/generators/makefile.cpp b/qmake/generators/makefile.cpp
index 77b9979..d77f002 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -3123,4 +3123,182 @@ MakefileGenerator::openOutput(QFile &file, const QString &build) const
     return false;
 }
 
+QString
+MakefileGenerator::pkgConfigFileName(bool fixify)
+{
+    QString ret = var("TARGET");
+    int slsh = ret.lastIndexOf(Option::dir_sep);
+    if(slsh != -1)
+        ret = ret.right(ret.length() - slsh - 1);
+    if(ret.startsWith("lib"))
+        ret = ret.mid(3);
+    int dot = ret.indexOf('.');
+    if(dot != -1)
+        ret = ret.left(dot);
+    ret += Option::pkgcfg_ext;
+    QString subdir = project->first("QMAKE_PKGCONFIG_DESTDIR");
+    if(!subdir.isEmpty()) {
+        // initOutPaths() appends dir_sep, but just to be safe..
+        if (!subdir.endsWith(Option::dir_sep))
+            ret.prepend(Option::dir_sep);
+        ret.prepend(subdir);
+    }
+    if(fixify) {
+        if(QDir::isRelativePath(ret) && !project->isEmpty("DESTDIR"))
+            ret.prepend(project->first("DESTDIR"));
+        ret = Option::fixPathToLocalOS(fileFixify(ret, qmake_getpwd(), Option::output_dir));
+    }
+    return ret;
+}
+
+QString
+MakefileGenerator::pkgConfigPrefix() const
+{
+    if(!project->isEmpty("QMAKE_PKGCONFIG_PREFIX"))
+        return project->first("QMAKE_PKGCONFIG_PREFIX");
+    return QLibraryInfo::location(QLibraryInfo::PrefixPath);
+}
+
+QString
+MakefileGenerator::pkgConfigFixPath(QString path) const
+{
+    QString prefix = pkgConfigPrefix();
+    if(path.startsWith(prefix))
+        path = path.replace(prefix, "${prefix}");
+    return path;
+}
+
+void
+MakefileGenerator::writePkgConfigFile()
+{
+    QString fname = pkgConfigFileName(), lname = fname;
+    mkdir(fileInfo(fname).path());
+    int slsh = lname.lastIndexOf(Option::dir_sep);
+    if(slsh != -1)
+        lname = lname.right(lname.length() - slsh - 1);
+    QFile ft(fname);
+    if(!ft.open(QIODevice::WriteOnly))
+        return;
+    project->values("ALL_DEPS").append(fileFixify(fname));
+    QTextStream t(&ft);
+
+    QString prefix = pkgConfigPrefix();
+    QString libDir = project->first("QMAKE_PKGCONFIG_LIBDIR");
+    if(libDir.isEmpty())
+        libDir = prefix + Option::dir_sep + "lib" + Option::dir_sep;
+    QString includeDir = project->first("QMAKE_PKGCONFIG_INCDIR");
+    if(includeDir.isEmpty())
+        includeDir = prefix + "/include";
+
+    t << "prefix=" << prefix << endl;
+    t << "exec_prefix=${prefix}\n"
+      << "libdir=" << pkgConfigFixPath(libDir) << "\n"
+      << "includedir=" << pkgConfigFixPath(includeDir) << endl;
+    // non-standard entry. Provides useful info normally only
+    // contained in the internal .qmake.cache file
+    t << varGlue("CONFIG", "qt_config=", " ", "") << endl;
+
+    //extra PKGCONFIG variables
+    const QStringList &pkgconfig_vars = project->values("QMAKE_PKGCONFIG_VARIABLES");
+    for(int i = 0; i < pkgconfig_vars.size(); ++i) {
+        QString var = project->first(pkgconfig_vars.at(i) + ".name"),
+                val = project->values(pkgconfig_vars.at(i) + ".value").join(" ");
+        if(var.isEmpty())
+            continue;
+        if(val.isEmpty()) {
+            const QStringList &var_vars = project->values(pkgconfig_vars.at(i) + ".variable");
+            for(int v = 0; v < var_vars.size(); ++v) {
+                const QStringList &vars = project->values(var_vars.at(v));
+                for(int var = 0; var < vars.size(); ++var) {
+                    if(!val.isEmpty())
+                        val += " ";
+                    val += pkgConfigFixPath(vars.at(var));
+                }
+            }
+        }
+        t << var << "=" << val << endl;
+    }
+
+    t << endl;
+
+    QString name = project->first("QMAKE_PKGCONFIG_NAME");
+    if(name.isEmpty()) {
+        name = project->first("QMAKE_ORIG_TARGET").toLower();
+        name.replace(0, 1, name[0].toUpper());
+    }
+    t << "Name: " << name << endl;
+    QString desc = project->values("QMAKE_PKGCONFIG_DESCRIPTION").join(" ");
+    if(desc.isEmpty()) {
+        if(name.isEmpty()) {
+            desc = project->first("QMAKE_ORIG_TARGET").toLower();
+            desc.replace(0, 1, desc[0].toUpper());
+        } else {
+            desc = name;
+        }
+        if(project->first("TEMPLATE") == "lib") {
+            if(project->isActiveConfig("plugin"))
+               desc += " Plugin";
+            else
+               desc += " Library";
+        } else if(project->first("TEMPLATE") == "app") {
+            desc += " Application";
+        }
+    }
+    t << "Description: " << desc << endl;
+    t << "Version: " << project->first("VERSION") << endl;
+
+    // libs
+    t << "Libs: ";
+    QString pkgConfiglibDir;
+    QString pkgConfiglibName;
+    if (Option::target_mode == Option::TARG_MACX_MODE && project->isActiveConfig("lib_bundle")) {
+        pkgConfiglibDir = "-F${libdir}";
+        QString bundle;
+        if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME"))
+            bundle = unescapeFilePath(project->first("QMAKE_FRAMEWORK_BUNDLE_NAME"));
+        else
+            bundle = unescapeFilePath(project->first("TARGET"));
+        int suffix = bundle.lastIndexOf(".framework");
+        if (suffix != -1)
+            bundle = bundle.left(suffix);
+        pkgConfiglibName = "-framework " + bundle + " ";
+    } else {
+        pkgConfiglibDir = "-L${libdir}";
+        pkgConfiglibName = "-l" + lname.left(lname.length()-Option::libtool_ext.length());
+    }
+    t << pkgConfiglibDir << " " << pkgConfiglibName << " " << endl;
+
+    QStringList libs;
+    if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) {
+        libs = project->values("QMAKE_INTERNAL_PRL_LIBS");
+    } else {
+        libs << "QMAKE_LIBS"; //obvious one
+    }
+    libs << "QMAKE_LIBS_PRIVATE";
+    libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread?
+    t << "Libs.private: ";
+    for(QStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) {
+        t << project->values((*it)).join(" ") << " ";
+    }
+    t << endl;
+
+    // flags
+    // ### too many
+    t << "Cflags: "
+        // << var("QMAKE_CXXFLAGS") << " "
+      << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
+      << project->values("PRL_EXPORT_CXXFLAGS").join(" ")
+      << project->values("QMAKE_PKGCONFIG_CFLAGS").join(" ")
+        //      << varGlue("DEFINES","-D"," -D"," ")
+      << " -I${includedir}" << endl;
+
+    // requires
+    const QString requires = project->values("QMAKE_PKGCONFIG_REQUIRES").join(" ");
+    if (!requires.isEmpty()) {
+        t << "Requires: " << requires << endl;
+    }
+
+    t << endl;
+}
+
 QT_END_NAMESPACE
diff --git a/qmake/generators/makefile.h b/qmake/generators/makefile.h
index b674a44..9b5b4a3 100644
--- a/qmake/generators/makefile.h
+++ b/qmake/generators/makefile.h
@@ -105,6 +105,11 @@ protected:
     virtual bool writeStubMakefile(QTextStream &t);
     virtual bool writeMakefile(QTextStream &t);
 
+    QString pkgConfigPrefix() const;
+    QString pkgConfigFileName(bool fixify=true);
+    QString pkgConfigFixPath(QString) const;
+    void writePkgConfigFile();   // for pkg-config
+
     //generating subtarget makefiles
     struct SubTarget
     {
diff --git a/qmake/generators/unix/unixmake.h b/qmake/generators/unix/unixmake.h
index ad54833..b28da82 100644
--- a/qmake/generators/unix/unixmake.h
+++ b/qmake/generators/unix/unixmake.h
@@ -51,10 +51,6 @@ class UnixMakefileGenerator : public MakefileGenerator
     bool init_flag, include_deps;
     QString libtoolFileName(bool fixify=true);
     void writeLibtoolFile();     // for libtool
-    QString pkgConfigPrefix() const;
-    QString pkgConfigFileName(bool fixify=true);
-    QString pkgConfigFixPath(QString) const;
-    void writePkgConfigFile();   // for pkg-config
     void writePrlFile(QTextStream &);
 
 public:
diff --git a/qmake/generators/unix/unixmake2.cpp b/qmake/generators/unix/unixmake2.cpp
index 81a379f..1846d56 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -1332,182 +1332,4 @@ UnixMakefileGenerator::writeLibtoolFile()
         "libdir='" << Option::fixPathToTargetOS(install_dir, false) << "'\n";
 }
 
-QString
-UnixMakefileGenerator::pkgConfigFileName(bool fixify)
-{
-    QString ret = var("TARGET");
-    int slsh = ret.lastIndexOf(Option::dir_sep);
-    if(slsh != -1)
-        ret = ret.right(ret.length() - slsh - 1);
-    if(ret.startsWith("lib"))
-        ret = ret.mid(3);
-    int dot = ret.indexOf('.');
-    if(dot != -1)
-        ret = ret.left(dot);
-    ret += Option::pkgcfg_ext;
-    QString subdir = project->first("QMAKE_PKGCONFIG_DESTDIR");
-    if(!subdir.isEmpty()) {
-        // initOutPaths() appends dir_sep, but just to be safe..
-        if (!subdir.endsWith(Option::dir_sep))
-            ret.prepend(Option::dir_sep);
-        ret.prepend(subdir);
-    }
-    if(fixify) {
-        if(QDir::isRelativePath(ret) && !project->isEmpty("DESTDIR"))
-            ret.prepend(project->first("DESTDIR"));
-        ret = Option::fixPathToLocalOS(fileFixify(ret, qmake_getpwd(), Option::output_dir));
-    }
-    return ret;
-}
-
-QString
-UnixMakefileGenerator::pkgConfigPrefix() const
-{
-    if(!project->isEmpty("QMAKE_PKGCONFIG_PREFIX"))
-        return project->first("QMAKE_PKGCONFIG_PREFIX");
-    return QLibraryInfo::location(QLibraryInfo::PrefixPath);
-}
-
-QString
-UnixMakefileGenerator::pkgConfigFixPath(QString path) const
-{
-    QString prefix = pkgConfigPrefix();
-    if(path.startsWith(prefix))
-        path = path.replace(prefix, "${prefix}");
-    return path;
-}
-
-void
-UnixMakefileGenerator::writePkgConfigFile()
-{
-    QString fname = pkgConfigFileName(), lname = fname;
-    mkdir(fileInfo(fname).path());
-    int slsh = lname.lastIndexOf(Option::dir_sep);
-    if(slsh != -1)
-        lname = lname.right(lname.length() - slsh - 1);
-    QFile ft(fname);
-    if(!ft.open(QIODevice::WriteOnly))
-        return;
-    project->values("ALL_DEPS").append(fileFixify(fname));
-    QTextStream t(&ft);
-
-    QString prefix = pkgConfigPrefix();
-    QString libDir = project->first("QMAKE_PKGCONFIG_LIBDIR");
-    if(libDir.isEmpty())
-        libDir = prefix + Option::dir_sep + "lib" + Option::dir_sep;
-    QString includeDir = project->first("QMAKE_PKGCONFIG_INCDIR");
-    if(includeDir.isEmpty())
-        includeDir = prefix + "/include";
-
-    t << "prefix=" << prefix << endl;
-    t << "exec_prefix=${prefix}\n"
-      << "libdir=" << pkgConfigFixPath(libDir) << "\n"
-      << "includedir=" << pkgConfigFixPath(includeDir) << endl;
-    // non-standard entry. Provides useful info normally only
-    // contained in the internal .qmake.cache file
-    t << varGlue("CONFIG", "qt_config=", " ", "") << endl;
-
-    //extra PKGCONFIG variables
-    const QStringList &pkgconfig_vars = project->values("QMAKE_PKGCONFIG_VARIABLES");
-    for(int i = 0; i < pkgconfig_vars.size(); ++i) {
-        QString var = project->first(pkgconfig_vars.at(i) + ".name"),
-                val = project->values(pkgconfig_vars.at(i) + ".value").join(" ");
-        if(var.isEmpty())
-            continue;
-        if(val.isEmpty()) {
-            const QStringList &var_vars = project->values(pkgconfig_vars.at(i) + ".variable");
-            for(int v = 0; v < var_vars.size(); ++v) {
-                const QStringList &vars = project->values(var_vars.at(v));
-                for(int var = 0; var < vars.size(); ++var) {
-                    if(!val.isEmpty())
-                        val += " ";
-                    val += pkgConfigFixPath(vars.at(var));
-                }
-            }
-        }
-        t << var << "=" << val << endl;
-    }
-
-    t << endl;
-
-    QString name = project->first("QMAKE_PKGCONFIG_NAME");
-    if(name.isEmpty()) {
-        name = project->first("QMAKE_ORIG_TARGET").toLower();
-        name.replace(0, 1, name[0].toUpper());
-    }
-    t << "Name: " << name << endl;
-    QString desc = project->values("QMAKE_PKGCONFIG_DESCRIPTION").join(" ");
-    if(desc.isEmpty()) {
-        if(name.isEmpty()) {
-            desc = project->first("QMAKE_ORIG_TARGET").toLower();
-            desc.replace(0, 1, desc[0].toUpper());
-        } else {
-            desc = name;
-        }
-        if(project->first("TEMPLATE") == "lib") {
-            if(project->isActiveConfig("plugin"))
-               desc += " Plugin";
-            else
-               desc += " Library";
-        } else if(project->first("TEMPLATE") == "app") {
-            desc += " Application";
-        }
-    }
-    t << "Description: " << desc << endl;
-    t << "Version: " << project->first("VERSION") << endl;
-
-    // libs
-    t << "Libs: ";
-    QString pkgConfiglibDir;
-    QString pkgConfiglibName;
-    if (Option::target_mode == Option::TARG_MACX_MODE && project->isActiveConfig("lib_bundle")) {
-        pkgConfiglibDir = "-F${libdir}";
-        QString bundle;
-        if (!project->isEmpty("QMAKE_FRAMEWORK_BUNDLE_NAME"))
-            bundle = unescapeFilePath(project->first("QMAKE_FRAMEWORK_BUNDLE_NAME"));
-        else
-            bundle = unescapeFilePath(project->first("TARGET"));
-        int suffix = bundle.lastIndexOf(".framework");
-        if (suffix != -1)
-            bundle = bundle.left(suffix);
-        pkgConfiglibName = "-framework " + bundle + " ";
-    } else {
-        pkgConfiglibDir = "-L${libdir}";
-        pkgConfiglibName = "-l" + lname.left(lname.length()-Option::libtool_ext.length());
-    }
-    t << pkgConfiglibDir << " " << pkgConfiglibName << " " << endl;
-
-    QStringList libs;
-    if(!project->isEmpty("QMAKE_INTERNAL_PRL_LIBS")) {
-        libs = project->values("QMAKE_INTERNAL_PRL_LIBS");
-    } else {
-        libs << "QMAKE_LIBS"; //obvious one
-    }
-    libs << "QMAKE_LIBS_PRIVATE";
-    libs << "QMAKE_LFLAGS_THREAD"; //not sure about this one, but what about things like -pthread?
-    t << "Libs.private: ";
-    for(QStringList::ConstIterator it = libs.begin(); it != libs.end(); ++it) {
-        t << project->values((*it)).join(" ") << " ";
-    }
-    t << endl;
-
-    // flags
-    // ### too many
-    t << "Cflags: "
-        // << var("QMAKE_CXXFLAGS") << " "
-      << varGlue("PRL_EXPORT_DEFINES","-D"," -D"," ")
-      << project->values("PRL_EXPORT_CXXFLAGS").join(" ")
-      << project->values("QMAKE_PKGCONFIG_CFLAGS").join(" ")
-        //      << varGlue("DEFINES","-D"," -D"," ")
-      << " -I${includedir}" << endl;
-
-    // requires
-    const QString requires = project->values("QMAKE_PKGCONFIG_REQUIRES").join(" ");
-    if (!requires.isEmpty()) {
-        t << "Requires: " << requires << endl;
-    }
-
-    t << endl;
-}
-
 QT_END_NAMESPACE
-- 
1.7.4.2


From e8afbb5a998931c154aa83ed87be6521cb8d50d3 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Mon, 10 Jan 2011 16:41:56 +0100
Subject: [PATCH 04/16] qmake: write and install pkg-config files for mingw

Merge-request: 2543
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from commit f18aca79a233c71f7a4bc72c9e31de948ba43c31)
---
 qmake/generators/win32/mingw_make.cpp  |    3 +++
 qmake/generators/win32/winmakefile.cpp |   12 ++++++++++++
 2 files changed, 15 insertions(+), 0 deletions(-)

diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp
index 3202cb8..492b584 100644
--- a/qmake/generators/win32/mingw_make.cpp
+++ b/qmake/generators/win32/mingw_make.cpp
@@ -142,6 +142,9 @@ bool MingwMakefileGenerator::writeMakefile(QTextStream &t)
 
     if(project->first("TEMPLATE") == "app" ||
        project->first("TEMPLATE") == "lib") {
+        if(project->isActiveConfig("create_pc") && project->first("TEMPLATE") == "lib")
+            writePkgConfigFile();
+
         if(Option::mkfile::do_stub_makefile) {
             t << "QMAKE    = " << var("QMAKE_QMAKE") << endl;
             QStringList &qut = project->values("QMAKE_EXTRA_TARGETS");
diff --git a/qmake/generators/win32/winmakefile.cpp b/qmake/generators/win32/winmakefile.cpp
index 8af7ddd..6d0a5c4 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -803,6 +803,18 @@ QString Win32MakefileGenerator::defaultInstall(const QString &t)
                 uninst.append("\n\t");
             uninst.append("-$(DEL_FILE) \"" + dst_prl + "\"");
         }
+        if(project->isActiveConfig("create_pc")) {
+            QString dst_pc = pkgConfigFileName(false);
+            if (!dst_pc.isEmpty()) {
+                dst_pc = filePrefixRoot(root, targetdir + dst_pc);
+                if(!ret.isEmpty())
+                    ret += "\n\t";
+                ret += "-$(INSTALL_FILE) \"" + pkgConfigFileName(true) + "\" \"" + dst_pc + "\"";
+                if(!uninst.isEmpty())
+                    uninst.append("\n\t");
+                uninst.append("-$(DEL_FILE) \"" + dst_pc + "\"");
+            }
+        }
         if(project->isActiveConfig("shared") && !project->isActiveConfig("plugin")) {
             QString lib_target = getLibTarget();
             lib_target.remove('"');
-- 
1.7.4.2


From 175b395655d3f24aea0e4232069853dca1c33efd Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Mon, 10 Jan 2011 16:41:57 +0100
Subject: [PATCH 05/16] qt project files: create pkg-config files for mingw

This is mostly the same as for unix.

Merge-request: 2543
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from commit 45fe2dddc3a0677b9ec9fce09f07cd4129e37afa)
---
 src/3rdparty/webkit/WebCore/WebCore.pro            |    4 +---
 src/dbus/dbus.pro                                  |    2 +-
 src/declarative/declarative.pro                    |    2 +-
 src/gui/gui.pro                                    |    2 +-
 src/multimedia/multimedia.pro                      |    2 +-
 src/network/network.pro                            |    2 +-
 src/opengl/opengl.pro                              |    2 +-
 src/openvg/openvg.pro                              |    2 +-
 src/phonon/phonon.pro                              |    2 +-
 src/qbase.pri                                      |    8 ++++++++
 src/qt3support/qt3support.pro                      |    2 +-
 src/script/script.pro                              |    2 +-
 src/scripttools/scripttools.pro                    |    2 +-
 src/sql/sql.pro                                    |    2 +-
 src/svg/svg.pro                                    |    2 +-
 src/xml/xml.pro                                    |    2 +-
 src/xmlpatterns/xmlpatterns.pro                    |    2 +-
 .../lib/fulltextsearch/fulltextsearch.pro          |    2 +-
 tools/assistant/lib/lib.pro                        |    2 +-
 tools/designer/src/components/lib/lib.pro          |    2 +-
 tools/designer/src/lib/lib.pro                     |    2 +-
 tools/designer/src/uitools/uitools.pro             |    2 +-
 22 files changed, 29 insertions(+), 23 deletions(-)

diff --git a/src/3rdparty/webkit/WebCore/WebCore.pro b/src/3rdparty/webkit/WebCore/WebCore.pro
index 37d216d..008bef7 100644
--- a/src/3rdparty/webkit/WebCore/WebCore.pro
+++ b/src/3rdparty/webkit/WebCore/WebCore.pro
@@ -85,9 +85,7 @@ moduleFile=$$PWD/../WebKit/qt/qt_webkit_version.pri
 isEmpty(QT_BUILD_TREE):include($$moduleFile)
 VERSION = $${QT_WEBKIT_MAJOR_VERSION}.$${QT_WEBKIT_MINOR_VERSION}.$${QT_WEBKIT_PATCH_VERSION}
 
-unix {
-    QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork
-}
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork
 
 unix:!mac:*-g++*:QMAKE_CXXFLAGS += -ffunction-sections -fdata-sections 
 unix:!mac:*-g++*:QMAKE_LFLAGS += -Wl,--gc-sections
diff --git a/src/dbus/dbus.pro b/src/dbus/dbus.pro
index 46a723a..52ed217 100644
--- a/src/dbus/dbus.pro
+++ b/src/dbus/dbus.pro
@@ -12,7 +12,7 @@ contains(QT_CONFIG, dbus-linked) {
 }
 
 # INCLUDEPATH += .
-unix { 
+unix|win32-g++* {
     QMAKE_PKGCONFIG_DESCRIPTION = Qt \
         DBus \
         module
diff --git a/src/declarative/declarative.pro b/src/declarative/declarative.pro
index 1ad888b..4ed4f9f 100644
--- a/src/declarative/declarative.pro
+++ b/src/declarative/declarative.pro
@@ -6,7 +6,7 @@ DEFINES   += QT_BUILD_DECLARATIVE_LIB QT_NO_URL_CAST_FROM_STRING
 win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000
 solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
 
 exists("qdeclarative_enable_gcov") {
     QMAKE_CXXFLAGS = -fprofile-arcs -ftest-coverage -fno-elide-constructors
diff --git a/src/gui/gui.pro b/src/gui/gui.pro
index 4d51fa8..05d961c 100644
--- a/src/gui/gui.pro
+++ b/src/gui/gui.pro
@@ -7,7 +7,7 @@ irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
 
 !win32:!embedded:!mac:!symbian:CONFIG      += x11
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
 
 include(../qbase.pri)
 
diff --git a/src/multimedia/multimedia.pro b/src/multimedia/multimedia.pro
index 852322d..e827cdd 100644
--- a/src/multimedia/multimedia.pro
+++ b/src/multimedia/multimedia.pro
@@ -4,7 +4,7 @@ QT = core gui
 
 DEFINES += QT_BUILD_MULTIMEDIA_LIB QT_NO_USING_NAMESPACE
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
 
 include(../qbase.pri)
 
diff --git a/src/network/network.pro b/src/network/network.pro
index 7ed7d3a..948922b 100644
--- a/src/network/network.pro
+++ b/src/network/network.pro
@@ -13,7 +13,7 @@ DEFINES += QT_BUILD_NETWORK_LIB QT_NO_USING_NAMESPACE
 QT = core
 win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x64000000
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
 
 include(../qbase.pri)
 include(access/access.pri)
diff --git a/src/opengl/opengl.pro b/src/opengl/opengl.pro
index 0e82467..d467148 100644
--- a/src/opengl/opengl.pro
+++ b/src/opengl/opengl.pro
@@ -7,7 +7,7 @@ win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x63000000
 solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
 irix-cc*:QMAKE_CXXFLAGS += -no_prelink -ptused
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
 
 include(../qbase.pri)
 
diff --git a/src/openvg/openvg.pro b/src/openvg/openvg.pro
index c05af90..e7ed890 100644
--- a/src/openvg/openvg.pro
+++ b/src/openvg/openvg.pro
@@ -42,7 +42,7 @@ symbian {
 
 include(../qbase.pri)
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
 symbian:TARGET.UID3 = 0x2001E62F
 
 !isEmpty(QMAKE_INCDIR_OPENVG): INCLUDEPATH += $$QMAKE_INCDIR_OPENVG
diff --git a/src/phonon/phonon.pro b/src/phonon/phonon.pro
index 7f79d0b..b16c5a1 100644
--- a/src/phonon/phonon.pro
+++ b/src/phonon/phonon.pro
@@ -11,7 +11,7 @@ DEFINES += MAKE_PHONON_LIB
 
 PHONON_DIR = $$QT_SOURCE_TREE/src/3rdparty/phonon/phonon
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork
 
 # Input
 HEADERS += $$PHONON_DIR/abstractaudiooutput.h \
diff --git a/src/qbase.pri b/src/qbase.pri
index babea56..a72bc76 100644
--- a/src/qbase.pri
+++ b/src/qbase.pri
@@ -152,6 +152,14 @@ unix:!symbian {
    QMAKE_PKGCONFIG_INSTALL_REPLACE += include_replace lib_replace prefix_replace
 }
 
+win32-g++* {
+   CONFIG += create_pc
+   QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS]
+   QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET
+   QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS]
+   QMAKE_PKGCONFIG_DESTDIR = pkgconfig
+}
+
 contains(QT_PRODUCT, OpenSource.*):DEFINES *= QT_OPENSOURCE
 DEFINES *= QT_NO_CAST_TO_ASCII QT_ASCII_CAST_WARNINGS
 contains(QT_CONFIG, qt3support):DEFINES *= QT3_SUPPORT
diff --git a/src/qt3support/qt3support.pro b/src/qt3support/qt3support.pro
index a30117c..1e0717d 100644
--- a/src/qt3support/qt3support.pro
+++ b/src/qt3support/qt3support.pro
@@ -21,7 +21,7 @@ include(canvas/canvas.pri)
 include(network/network.pri)
 include(painting/painting.pri)
 
-unix {
+unix|win32-g++* {
    QMAKE_PKGCONFIG_CFLAGS += -DQT3_SUPPORT
    QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtNetwork QtSql
 }
diff --git a/src/script/script.pro b/src/script/script.pro
index 63917b1..b5a2e70 100644
--- a/src/script/script.pro
+++ b/src/script/script.pro
@@ -7,7 +7,7 @@ DEFINES   += QT_NO_USING_NAMESPACE
 DEFINES   += QLALR_NO_QSCRIPTGRAMMAR_DEBUG_INFO
 #win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000       ### FIXME
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
 
 include(../qbase.pri)
 
diff --git a/src/scripttools/scripttools.pro b/src/scripttools/scripttools.pro
index b1df7aa..061dea5 100644
--- a/src/scripttools/scripttools.pro
+++ b/src/scripttools/scripttools.pro
@@ -5,7 +5,7 @@ DEFINES   += QT_BUILD_SCRIPTTOOLS_LIB
 DEFINES   += QT_NO_USING_NAMESPACE
 #win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtScript
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui QtScript
 
 include(../qbase.pri)
 
diff --git a/src/sql/sql.pro b/src/sql/sql.pro
index a02b0f4..81aa3c0 100644
--- a/src/sql/sql.pro
+++ b/src/sql/sql.pro
@@ -5,7 +5,7 @@ DEFINES += QT_BUILD_SQL_LIB
 DEFINES += QT_NO_USING_NAMESPACE
 win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x62000000
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
 
 include(../qbase.pri)
 
diff --git a/src/svg/svg.pro b/src/svg/svg.pro
index 7b5251a..79f284a 100644
--- a/src/svg/svg.pro
+++ b/src/svg/svg.pro
@@ -6,7 +6,7 @@ DEFINES   += QT_NO_USING_NAMESPACE
 win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x66000000
 solaris-cc*:QMAKE_CXXFLAGS_RELEASE -= -O2
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore QtGui
 
 include(../qbase.pri)
 
diff --git a/src/xml/xml.pro b/src/xml/xml.pro
index 8d1bf68..019153c 100644
--- a/src/xml/xml.pro
+++ b/src/xml/xml.pro
@@ -4,7 +4,7 @@ QT         = core
 DEFINES   += QT_BUILD_XML_LIB QT_NO_USING_NAMESPACE
 win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x61000000
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
 
 include(../qbase.pri)
 
diff --git a/src/xmlpatterns/xmlpatterns.pro b/src/xmlpatterns/xmlpatterns.pro
index e50d184..d22f417 100644
--- a/src/xmlpatterns/xmlpatterns.pro
+++ b/src/xmlpatterns/xmlpatterns.pro
@@ -5,7 +5,7 @@ QT = core \
 DEFINES += QT_BUILD_XMLPATTERNS_LIB \
     QT_NO_USING_NAMESPACE
 win32-msvc*|win32-icc:QMAKE_LFLAGS += /BASE:0x61000000
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore \
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore \
     QtNetwork
 include(../qbase.pri)
 PRECOMPILED_HEADER = ../corelib/global/qt_pch.h
diff --git a/tools/assistant/lib/fulltextsearch/fulltextsearch.pro b/tools/assistant/lib/fulltextsearch/fulltextsearch.pro
index 4d2fddb..d0e7a87 100644
--- a/tools/assistant/lib/fulltextsearch/fulltextsearch.pro
+++ b/tools/assistant/lib/fulltextsearch/fulltextsearch.pro
@@ -23,7 +23,7 @@ contains(QT_CONFIG, reduce_exports) {
     linux*-g++*:DEFINES += _GLIBCXX_EXTERN_TEMPLATE=0
 }
 
-unix:QMAKE_PKGCONFIG_REQUIRES = QtCore
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES = QtCore
 
 # impossible to disable exceptions in clucene atm
 CONFIG(exceptions_off) {
diff --git a/tools/assistant/lib/lib.pro b/tools/assistant/lib/lib.pro
index 26d3456..03821b2 100644
--- a/tools/assistant/lib/lib.pro
+++ b/tools/assistant/lib/lib.pro
@@ -19,7 +19,7 @@ if(!debug_and_release|build_pass):CONFIG(debug, debug|release) {
     win32:qclucene = $${qclucene}d
 }
 linux-lsb-g++:LIBS_PRIVATE += --lsb-shared-libs=$$qclucene
-unix:QMAKE_PKGCONFIG_REQUIRES += QtNetwork \
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES += QtNetwork \
     QtSql \
     QtXml
 LIBS_PRIVATE += -l$$qclucene
diff --git a/tools/designer/src/components/lib/lib.pro b/tools/designer/src/components/lib/lib.pro
index 0ada845..50a8b00 100644
--- a/tools/designer/src/components/lib/lib.pro
+++ b/tools/designer/src/components/lib/lib.pro
@@ -64,7 +64,7 @@ PRECOMPILED_HEADER= lib_pch.h
 include(../../sharedcomponents.pri)
 include(../component.pri)
 
-unix {
+unix|win32-g++* {
     QMAKE_PKGCONFIG_REQUIRES = QtCore QtDesigner QtGui QtXml
     contains(QT_CONFIG, script): QMAKE_PKGCONFIG_REQUIRES += QtScript
 }
diff --git a/tools/designer/src/lib/lib.pro b/tools/designer/src/lib/lib.pro
index 495976d..3ba6f52 100644
--- a/tools/designer/src/lib/lib.pro
+++ b/tools/designer/src/lib/lib.pro
@@ -13,7 +13,7 @@ isEmpty(QT_MAJOR_VERSION) {
    VERSION=$${QT_MAJOR_VERSION}.$${QT_MINOR_VERSION}.$${QT_PATCH_VERSION}
 }
 
-unix:QMAKE_PKGCONFIG_REQUIRES += QtXml
+unix|win32-g++*:QMAKE_PKGCONFIG_REQUIRES += QtXml
 
 include(../../../../src/qt_targets.pri)
 QMAKE_TARGET_PRODUCT = Designer
diff --git a/tools/designer/src/uitools/uitools.pro b/tools/designer/src/uitools/uitools.pro
index 7b94587..6e0a247 100644
--- a/tools/designer/src/uitools/uitools.pro
+++ b/tools/designer/src/uitools/uitools.pro
@@ -35,7 +35,7 @@ INSTALLS        += quitools_headers
 target.path=$$[QT_INSTALL_LIBS]
 INSTALLS        += target
 
-unix {
+unix|win32-g++* {
    CONFIG     += create_pc
    QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS]
    QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET
-- 
1.7.4.2


From 5ef7985e6015c09735094545a07ed93832075507 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Mon, 10 Jan 2011 20:21:05 +0100
Subject: [PATCH 06/16] Fix static build on Windows with MinGW.

Q_DECL_IMPORT is still __declspec(dllimport), which is unsuitable for
static code.

Commit edbc656b changed Q_DECL_IMPORT_IMPORT to Q_CORE_EXPORT when
declaring QtCore functions in svg.

Now we change Q_DECL_IMPORT to Q_GUI_EXPORT when declaring QtGui
functions into opengl and openvg.

Also removed the redundant keyword "extern" from the function declarations.

Merge-request: 2540
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Reviewed-by: mariusSO
(cherry picked from commit 7ec1c27e662dfd4393491f90bfcb9c868cc0a23f)
---
 .../gl2paintengineex/qpaintengineex_opengl2.cpp    |    4 ++--
 src/opengl/qglframebufferobject.cpp                |    4 ++--
 src/opengl/qglpixelbuffer.cpp                      |    4 ++--
 src/opengl/qglpixmapfilter.cpp                     |    6 +++---
 src/opengl/qpaintengine_opengl.cpp                 |    2 +-
 src/opengl/qpixmapdata_gl.cpp                      |    4 ++--
 src/openvg/qpaintengine_vg.cpp                     |    8 ++++----
 src/openvg/qpixmapdata_vg.cpp                      |    4 ++--
 8 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
index 251fcb9..34f4e75 100644
--- a/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
+++ b/src/opengl/gl2paintengineex/qpaintengineex_opengl2.cpp
@@ -102,7 +102,7 @@ extern Q_GUI_EXPORT bool qt_cleartype_enabled;
 extern bool qt_applefontsmoothing_enabled;
 #endif
 
-Q_DECL_IMPORT extern QImage qt_imageForBrush(int brushStyle, bool invert);
+Q_GUI_EXPORT QImage qt_imageForBrush(int brushStyle, bool invert);
 
 ////////////////////////////////// Private Methods //////////////////////////////////////////
 
@@ -1154,7 +1154,7 @@ void QGL2PaintEngineEx::fill(const QVectorPath &path, const QBrush &brush)
     d->fill(path);
 }
 
-extern Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp
+Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale); // qtransform.cpp
 
 
 void QGL2PaintEngineEx::stroke(const QVectorPath &path, const QPen &pen)
diff --git a/src/opengl/qglframebufferobject.cpp b/src/opengl/qglframebufferobject.cpp
index 6faa645..d57ffc5 100644
--- a/src/opengl/qglframebufferobject.cpp
+++ b/src/opengl/qglframebufferobject.cpp
@@ -1171,8 +1171,8 @@ void QGLFramebufferObject::drawTexture(const QPointF &point, QMacCompatGLuint te
 }
 #endif
 
-Q_DECL_IMPORT extern int qt_defaultDpiX();
-Q_DECL_IMPORT extern int qt_defaultDpiY();
+Q_GUI_EXPORT int qt_defaultDpiX();
+Q_GUI_EXPORT int qt_defaultDpiY();
 
 /*! \reimp */
 int QGLFramebufferObject::metric(PaintDeviceMetric metric) const
diff --git a/src/opengl/qglpixelbuffer.cpp b/src/opengl/qglpixelbuffer.cpp
index 931f701..815afee 100644
--- a/src/opengl/qglpixelbuffer.cpp
+++ b/src/opengl/qglpixelbuffer.cpp
@@ -416,8 +416,8 @@ QPaintEngine *QGLPixelBuffer::paintEngine() const
 #endif
 }
 
-Q_DECL_IMPORT extern int qt_defaultDpiX();
-Q_DECL_IMPORT extern int qt_defaultDpiY();
+Q_GUI_EXPORT int qt_defaultDpiX();
+Q_GUI_EXPORT int qt_defaultDpiY();
 
 /*! \reimp */
 int QGLPixelBuffer::metric(PaintDeviceMetric metric) const
diff --git a/src/opengl/qglpixmapfilter.cpp b/src/opengl/qglpixmapfilter.cpp
index 5305e10..eeb791f 100644
--- a/src/opengl/qglpixmapfilter.cpp
+++ b/src/opengl/qglpixmapfilter.cpp
@@ -63,8 +63,8 @@
 QT_BEGIN_NAMESPACE
 
 // qpixmapfilter.cpp
-Q_DECL_IMPORT void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0);
-Q_DECL_IMPORT QImage qt_halfScaled(const QImage &source);
+Q_GUI_EXPORT void qt_blurImage(QImage &blurImage, qreal radius, bool quality, int transposed = 0);
+Q_GUI_EXPORT QImage qt_halfScaled(const QImage &source);
 
 void QGLPixmapFilterBase::bindTexture(const QPixmap &src) const
 {
@@ -436,7 +436,7 @@ static inline uint nextMultiple(uint x, uint multiplier)
     return x + multiplier - mod;
 }
 
-Q_DECL_IMPORT void qt_memrotate90_gl(const quint32 *src, int srcWidth, int srcHeight, int srcStride,
+Q_GUI_EXPORT void qt_memrotate90_gl(const quint32 *src, int srcWidth, int srcHeight, int srcStride,
                        quint32 *dest, int dstStride);
 
 bool QGLPixmapBlurFilter::processGL(QPainter *painter, const QPointF &pos, const QPixmap &src, const QRectF &) const
diff --git a/src/opengl/qpaintengine_opengl.cpp b/src/opengl/qpaintengine_opengl.cpp
index 0b0f910..c04311d 100644
--- a/src/opengl/qpaintengine_opengl.cpp
+++ b/src/opengl/qpaintengine_opengl.cpp
@@ -79,7 +79,7 @@
 
 QT_BEGIN_NAMESPACE
 
-Q_DECL_IMPORT extern QImage qt_imageForBrush(int brushStyle, bool invert); //in qbrush.cpp
+Q_GUI_EXPORT QImage qt_imageForBrush(int brushStyle, bool invert); //in qbrush.cpp
 #ifdef QT_MAC_USE_COCOA
 extern void *qt_current_nsopengl_context(); // qgl_mac.mm
 #endif
diff --git a/src/opengl/qpixmapdata_gl.cpp b/src/opengl/qpixmapdata_gl.cpp
index 0ac647c..d901ab8 100644
--- a/src/opengl/qpixmapdata_gl.cpp
+++ b/src/opengl/qpixmapdata_gl.cpp
@@ -739,8 +739,8 @@ QGLTexture* QGLPixmapData::texture() const
     return &m_texture;
 }
 
-Q_DECL_IMPORT extern int qt_defaultDpiX();
-Q_DECL_IMPORT extern int qt_defaultDpiY();
+Q_GUI_EXPORT int qt_defaultDpiX();
+Q_GUI_EXPORT int qt_defaultDpiY();
 
 int QGLPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
 {
diff --git a/src/openvg/qpaintengine_vg.cpp b/src/openvg/qpaintengine_vg.cpp
index ec2936e..af077e4 100644
--- a/src/openvg/qpaintengine_vg.cpp
+++ b/src/openvg/qpaintengine_vg.cpp
@@ -77,8 +77,8 @@ static const qreal aliasedCoordinateDelta = 0.5 - 0.015625;
 
 #if !defined(QVG_NO_DRAW_GLYPHS)
 
-Q_DECL_IMPORT extern int qt_defaultDpiX();
-Q_DECL_IMPORT extern int qt_defaultDpiY();
+Q_GUI_EXPORT int qt_defaultDpiX();
+Q_GUI_EXPORT int qt_defaultDpiY();
 
 class QVGPaintEnginePrivate;
 
@@ -526,7 +526,7 @@ void QVGPaintEnginePrivate::setTransform
     vgLoadMatrix(mat);
 }
 
-Q_DECL_IMPORT extern bool qt_scaleForTransform(const QTransform &transform, qreal *scale);
+Q_GUI_EXPORT bool qt_scaleForTransform(const QTransform &transform, qreal *scale);
 
 void QVGPaintEnginePrivate::updateTransform(QPaintDevice *pdev)
 {
@@ -994,7 +994,7 @@ VGPath QVGPaintEnginePrivate::roundedRectPath(const QRectF &rect, qreal xRadius,
     return vgpath;
 }
 
-Q_DECL_IMPORT extern QImage qt_imageForBrush(int style, bool invert);
+Q_GUI_EXPORT QImage qt_imageForBrush(int style, bool invert);
 
 static QImage colorizeBitmap(const QImage &image, const QColor &color)
 {
diff --git a/src/openvg/qpixmapdata_vg.cpp b/src/openvg/qpixmapdata_vg.cpp
index ee5c7d9..cdff46c 100644
--- a/src/openvg/qpixmapdata_vg.cpp
+++ b/src/openvg/qpixmapdata_vg.cpp
@@ -412,8 +412,8 @@ void QVGPixmapData::reclaimImages()
     destroyImages();
 }
 
-Q_DECL_IMPORT extern int qt_defaultDpiX();
-Q_DECL_IMPORT extern int qt_defaultDpiY();
+Q_GUI_EXPORT int qt_defaultDpiX();
+Q_GUI_EXPORT int qt_defaultDpiY();
 
 int QVGPixmapData::metric(QPaintDevice::PaintDeviceMetric metric) const
 {
-- 
1.7.4.2


From 3411ae8c3d83b3eb9407c8c338336e95fe74edf3 Mon Sep 17 00:00:00 2001
From: Bernhard Rosenkraenzer <br@blankpage.ch>
Date: Thu, 27 Jan 2011 13:48:13 +0100
Subject: [PATCH 07/16] Allow the user to select imageformats to be built as plugin vs internal

This adds what is already there for different plugin types to
imageformats plugins -- allowing the user to configure which
image formats will be built into Qt and which will be built as
plugins.

Merge-request: 1028
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from commit a6167267d302b97b94fd350df4b27dc7c9a20ef4)
---
 configure                        |   24 +++++++++++++++++++++++-
 tools/configure/configureapp.cpp |   12 ++++++++++++
 2 files changed, 35 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index c159cd4..207dcc1 100755
--- a/configure
+++ b/configure
@@ -908,6 +908,16 @@ if [ -d "$relpath/src/plugins/gfxdrivers" ]; then
   CFG_GFX_OFF="$CFG_GFX_AVAILABLE" # assume all off
 fi
 
+CFG_IMAGEFORMAT_PLUGIN_AVAILABLE=
+if [ -d "$relpath/src/plugins/imageformats" ]; then
+    for a in "$relpath/src/plugins/imageformats/"*; do
+        if [ -d "$a" ]; then
+            base_a=`basename "$a"`
+            CFG_IMAGEFORMAT_PLUGIN_AVAILABLE="${CFG_IMAGEFORMAT_PLUGIN_AVAILABLE} ${base_a}"
+        fi
+    done
+fi
+
 #-------------------------------------------------------------------------------
 # parse command line arguments
 #-------------------------------------------------------------------------------
@@ -2060,7 +2070,7 @@ while [ "$#" -gt 0 ]; do
             UNKNOWN_OPT=yes
         fi
         ;;
-    sql-*|gfx-*|decoration-*|kbd-*|mouse-*)
+    sql-*|gfx-*|decoration-*|kbd-*|mouse-*|imageformat-*)
         # if Qt style options were used, $VAL can be "no", "qt", or "plugin"
         # if autoconf style options were used, $VAL can be "yes" or "no"
         [ "$VAL" = "yes" ] && VAL=qt
@@ -2102,6 +2112,13 @@ while [ "$#" -gt 0 ]; do
 		avail="$CFG_MOUSE_PLUGIN_AVAILABLE"
 	    fi
             ;;
+        imageformat)
+            avail="$CFG_IMAGEFORMAT_PLUGIN_AVAILABLE"
+            if [ "$OPT" != "plugin" ]; then
+                # png is always built in
+                avail="$avail png"
+            fi
+            ;;
         *)
             avail=""
             echo "BUG: Unhandled type $VAR used in $CURRENT_OPT"
@@ -2122,6 +2139,11 @@ while [ "$#" -gt 0 ]; do
             # set the CFG_SQL_driver
             eval "CFG_SQL_$VAL=\$OPT"
             continue
+        elif [ "$VAR" = "imageformat" ]; then
+            [ "$OPT" = "qt" ] && OPT=yes
+            VAL="`echo $VAL |tr a-z A-Z`"
+            eval "CFG_$VAL=$OPT"
+            continue
         fi
 
         if [ "$OPT" = "plugin" ] || [ "$OPT" = "qt" ]; then
diff --git a/tools/configure/configureapp.cpp b/tools/configure/configureapp.cpp
index dd5647b..b6e80ea 100644
--- a/tools/configure/configureapp.cpp
+++ b/tools/configure/configureapp.cpp
@@ -437,6 +437,7 @@ void Configure::parseCmdLine()
 {
     int argCount = configCmdLine.size();
     int i = 0;
+    const QStringList imageFormats = QStringList() << "gif" << "png" << "mng" << "jpeg" << "tiff";
 
 #if !defined(EVAL)
     if (argCount < 1) // skip rest if no arguments
@@ -829,6 +830,17 @@ void Configure::parseCmdLine()
             dictionary[ "SQL_IBASE" ] = "plugin";
         else if (configCmdLine.at(i) == "-no-sql-ibase")
             dictionary[ "SQL_IBASE" ] = "no";
+
+        // Image formats --------------------------------------------
+        else if (configCmdLine.at(i).startsWith("-qt-imageformat-") &&
+                 imageFormats.contains(configCmdLine.at(i).section('-', 3)))
+            dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "yes";
+        else if (configCmdLine.at(i).startsWith("-plugin-imageformat-") &&
+                 imageFormats.contains(configCmdLine.at(i).section('-', 3)))
+            dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "plugin";
+        else if (configCmdLine.at(i).startsWith("-no-imageformat-") &&
+                 imageFormats.contains(configCmdLine.at(i).section('-', 3)))
+            dictionary[ configCmdLine.at(i).section('-', 3).toUpper() ] = "no";
 #endif
         // IDE project generation -----------------------------------
         else if (configCmdLine.at(i) == "-no-dsp")
-- 
1.7.4.2


From 8d719e67c51987fb6439ea1d05a2b10684b974e1 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Tue, 16 Nov 2010 20:06:28 +0100
Subject: [PATCH 08/16] explicitly include -llcms for -lmng (mingw-cross-env specific)

---
 src/gui/image/qmnghandler.pri |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/src/gui/image/qmnghandler.pri b/src/gui/image/qmnghandler.pri
index ffb98de..c213e09 100644
--- a/src/gui/image/qmnghandler.pri
+++ b/src/gui/image/qmnghandler.pri
@@ -3,7 +3,7 @@ INCLUDEPATH *= $$PWD
 HEADERS += $$PWD/qmnghandler_p.h
 SOURCES += $$PWD/qmnghandler.cpp
 contains(QT_CONFIG, system-mng) {
-        if(unix|win32-g++*):LIBS += -lmng
+        if(unix|win32-g++*):LIBS += -lmng -llcms
         else:win32:         LIBS += libmng.lib
 } else {
     include($$PWD/../../3rdparty/libmng.pri)
-- 
1.7.4.2


From c34bd635af9263d1a719cd270db123b1a787640c Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Sat, 5 Jun 2010 23:41:04 +0200
Subject: [PATCH 09/16] added missing INSTALLS to JavaScriptCore.pro for static libjscore (mingw-cross-env specific)

For static build of Qt on win32-g++*, applications using webkit
link to libjscore.a.
---
 .../webkit/JavaScriptCore/JavaScriptCore.pro       |    6 ++++++
 1 files changed, 6 insertions(+), 0 deletions(-)

diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro
index a805170..027eb0f 100644
--- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro
+++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro
@@ -14,6 +14,12 @@ QT -= gui
 
 CONFIG += depend_includepath
 
+static:win32-g++* {
+    # applications must link to static libjscore
+    target.path = $$[QT_INSTALL_LIBS]
+    INSTALLS += target
+}
+
 contains(QT_CONFIG, embedded):CONFIG += embedded
 
 CONFIG(QTDIR_build) {
-- 
1.7.4.2


From c56ec08a3e3af1a9beae552872b443c6a7cf401c Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Tue, 9 Nov 2010 20:09:45 +0100
Subject: [PATCH 10/16] Partially restored support for static linking of QtWebKit (mingw-cross-env specific)

Support was removed by 4221d629e2cf37ee8c5ba7cb595b05ab8c82f113.
Static QtWebkit might be supported by mingw-cross-env.
---
 configure |    6 ------
 1 files changed, 0 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index 207dcc1..b10b0a2 100755
--- a/configure
+++ b/configure
@@ -7179,12 +7179,6 @@ if [ "$CFG_GUI" = "no" ]; then
     canBuildWebKit="no"
 fi
 
-if [ "$CFG_SHARED" = "no" ]; then
-    echo
-    echo "WARNING: Using static linking will disable the WebKit module."
-    echo
-    canBuildWebKit="no"
-fi
 
 CFG_CONCURRENT="yes"
 if [ "$canBuildQtConcurrent" = "no" ]; then
-- 
1.7.4.2


From 074e13614d6071247600eea3c3d6a1f4c4f4a0d5 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Thu, 6 Jan 2011 14:21:32 +0100
Subject: [PATCH 11/16] pkg-config file for jscore (mingw-cross-env specific)

---
 .../webkit/JavaScriptCore/JavaScriptCore.pro       |    8 ++++++++
 1 files changed, 8 insertions(+), 0 deletions(-)

diff --git a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro
index 027eb0f..44bbc3f 100644
--- a/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro
+++ b/src/3rdparty/webkit/JavaScriptCore/JavaScriptCore.pro
@@ -236,3 +236,11 @@ SOURCES += \
 
 # Disable C++0x mode in JSC for those who enabled it in their Qt's mkspec
 *-g++*:QMAKE_CXXFLAGS -= -std=c++0x -std=gnu++0x
+
+win32-g++-* {
+   CONFIG += create_pc
+   QMAKE_PKGCONFIG_LIBDIR = $$[QT_INSTALL_LIBS]
+   QMAKE_PKGCONFIG_INCDIR = $$[QT_INSTALL_HEADERS]/$$TARGET
+   QMAKE_PKGCONFIG_CFLAGS = -I$$[QT_INSTALL_HEADERS]
+   QMAKE_PKGCONFIG_DESTDIR = pkgconfig
+}
-- 
1.7.4.2


From c907c7c1f0922416fd5f19cb477b71c6f97fee45 Mon Sep 17 00:00:00 2001
From: Tony Theodore <tonyt@logyst.com>
Date: Mon, 21 Feb 2011 22:22:04 +0100
Subject: [PATCH 12/16] workaround for native build on OSX (mingw-cross-env specific)

The native build complains about:
"You are building a 64-bit application, but using a 32-bit version of
Qt. Check your build configuration."
---
 mkspecs/macx-g++/qmake.conf |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mkspecs/macx-g++/qmake.conf b/mkspecs/macx-g++/qmake.conf
index 4464686..ba0c45b 100644
--- a/mkspecs/macx-g++/qmake.conf
+++ b/mkspecs/macx-g++/qmake.conf
@@ -13,8 +13,8 @@ CONFIG			+= qt warn_on release app_bundle incremental global_init_link_order lib
 QT			+= core gui
 QMAKE_INCREMENTAL_STYLE = sublib
 
-QMAKE_CC		 = gcc
-QMAKE_CXX		 = g++
+QMAKE_CC		 = gcc -arch i386
+QMAKE_CXX		 = g++ -arch i386
 
 include(../common/mac-g++.conf)
 
-- 
1.7.4.2


From ac552171a0729e1fae026741e4ec89a415298667 Mon Sep 17 00:00:00 2001
From: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
Date: Mon, 10 Jan 2011 20:09:24 +0100
Subject: [PATCH 13/16] fix -enable-stdcall-fixup usage

the leading "-Wl," was apparently accidentally split off to the wrong
line.

Task-number: QTBUG-15391
Reviewed-by: mariusSO
(cherry picked from commit 0953ee31dba532603fb7dfbde78c99aafb048bef)
---
 mkspecs/win32-g++/qmake.conf |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf
index ec216aa..2d9833b 100644
--- a/mkspecs/win32-g++/qmake.conf
+++ b/mkspecs/win32-g++/qmake.conf
@@ -52,8 +52,8 @@ QMAKE_RUN_CXX_IMP	= $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
 
 QMAKE_LINK		= g++
 QMAKE_LINK_C		= gcc
-QMAKE_LFLAGS		= -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
-QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads -Wl
+QMAKE_LFLAGS		= -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
+QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads
 QMAKE_LFLAGS_EXCEPTIONS_OFF =
 QMAKE_LFLAGS_RELEASE	= -Wl,-s
 QMAKE_LFLAGS_DEBUG	=
-- 
1.7.4.2


From 0e32298cb08ef1168dc6c06dd48bab8ee62c6e5d Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Mon, 28 Mar 2011 13:33:58 +0200
Subject: [PATCH 14/16] fix -enable-stdcall-fixup usage

the leading "-Wl," was apparently accidentally split off to the wrong
line.

Originally done in 0953ee3 for mkspecs/win32-g++.

Merge-request: 1154
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from commit 1dac22d30849f0dfb38f281c59afc886b1046bb3)
---
 mkspecs/unsupported/win32-g++-cross/qmake.conf |    4 ++--
 1 files changed, 2 insertions(+), 2 deletions(-)

diff --git a/mkspecs/unsupported/win32-g++-cross/qmake.conf b/mkspecs/unsupported/win32-g++-cross/qmake.conf
index 7e077a1..efc3de2 100644
--- a/mkspecs/unsupported/win32-g++-cross/qmake.conf
+++ b/mkspecs/unsupported/win32-g++-cross/qmake.conf
@@ -52,8 +52,8 @@ QMAKE_RUN_CXX_IMP	= $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
 
 QMAKE_LINK		= i686-pc-mingw32-g++
 QMAKE_LINK_C		= i686-pc-mingw32-gcc
-QMAKE_LFLAGS		= -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
-QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads -Wl
+QMAKE_LFLAGS		= -Wl,-enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
+QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads
 QMAKE_LFLAGS_EXCEPTIONS_OFF =
 QMAKE_LFLAGS_RELEASE	= -Wl,-s
 QMAKE_LFLAGS_DEBUG	=
-- 
1.7.4.2


From 0a9731cad65337c7084791b54db8bfeb0939dc7d Mon Sep 17 00:00:00 2001
From: Jonathan Liu <net147@gmail.com>
Date: Mon, 4 Apr 2011 13:01:48 +0200
Subject: [PATCH 15/16] win32-g++: Correct the order of linked Windows libraries

On Windows 7, kernel32.dll exports many of the same functions as
advapi32.dll. If executables link to these functions in kernel32.dll
instead of advapi32.dll, running these executables on older versions
of Windows will cause an entry point error. This would occur due to
kernel32 being specified before advapi32.

To resolve this issue, advapi32 is specified before kernel32 when
linking.

Task-number: QTBUG-18537
Merge-request: 1169
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from commit a6d48ca57403539ab8e00d16f80bd4cd334e1b5c)
---
 mkspecs/win32-g++/qmake.conf |    2 +-
 qmake/Makefile.win32-g++     |    2 +-
 qmake/Makefile.win32-g++-sh  |    2 +-
 qmake/qmake.pri              |    2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf
index 2d9833b..bf69999 100644
--- a/mkspecs/win32-g++/qmake.conf
+++ b/mkspecs/win32-g++/qmake.conf
@@ -65,7 +65,7 @@ QMAKE_LINK_OBJECT_SCRIPT= object_script
 
 
 QMAKE_LIBS		=
-QMAKE_LIBS_CORE         = -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lws2_32
+QMAKE_LIBS_CORE         = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32
 QMAKE_LIBS_GUI          = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lws2_32 -lole32 -luuid -luser32 -ladvapi32
 QMAKE_LIBS_NETWORK      = -lws2_32
 QMAKE_LIBS_OPENGL       = -lglu32 -lopengl32 -lgdi32 -luser32
diff --git a/qmake/Makefile.win32-g++ b/qmake/Makefile.win32-g++
index 29fbd0a..5a46e41 100644
--- a/qmake/Makefile.win32-g++
+++ b/qmake/Makefile.win32-g++
@@ -28,7 +28,7 @@ CFLAGS	    =	-c -o$@ -O \
 		-DQT_BOOTSTRAPPED -DQLIBRARYINFO_EPOCROOT
 CXXFLAGS    =   $(CFLAGS)
 LFLAGS	    = -static-libgcc -static-libstdc++ -s
-LIBS	    = -lole32 -luuid
+LIBS	    = -lole32 -luuid -ladvapi32 -lkernel32
 LINKQMAKE   =	g++ $(LFLAGS) -o qmake.exe $(OBJS) $(QTOBJS) $(LIBS)
 ADDCLEAN    =
 
diff --git a/qmake/Makefile.win32-g++-sh b/qmake/Makefile.win32-g++-sh
index 9c7942c..6ca7514 100644
--- a/qmake/Makefile.win32-g++-sh
+++ b/qmake/Makefile.win32-g++-sh
@@ -28,7 +28,7 @@ CFLAGS	    =	-c -o$@ -O \
 		-DQT_BOOTSTRAPPED -DQLIBRARYINFO_EPOCROOT
 CXXFLAGS    =   $(CFLAGS)
 LFLAGS	    = -static-libgcc -static-libstdc++ -s
-LIBS	    = -lole32 -luuid
+LIBS	    = -lole32 -luuid -ladvapi32 -lkernel32
 LINKQMAKE   =	g++ $(LFLAGS) -o qmake.exe $(OBJS) $(QTOBJS) $(LIBS)
 ADDCLEAN    =
 
diff --git a/qmake/qmake.pri b/qmake/qmake.pri
index 8f46a2e..3a0ab12 100644
--- a/qmake/qmake.pri
+++ b/qmake/qmake.pri
@@ -135,7 +135,7 @@ bootstrap { #Qt code
 	SOURCES += qfsfileengine_win.cpp qfsfileengine_iterator_win.cpp qsettings_win.cpp \
             qsystemlibrary.cpp
         win32-msvc*:LIBS += ole32.lib advapi32.lib
-        win32-g++*:LIBS += -lole32 -luuid
+        win32-g++*:LIBS += -lole32 -luuid -ladvapi32 -lkernel32
     }
 
     qnx {
-- 
1.7.4.2


From c4a1848f4178fe99daa2c12ad1f14e8de14cc389 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Tue, 5 Apr 2011 10:35:58 +0200
Subject: [PATCH 16/16] win32-g++: Correct the order of linked Windows libraries

Commit a6d48ca corrected the problem for win32-g++. Here we do the same
for win32-g++-cross.

Merge-request: 1173
Reviewed-by: Oswald Buddenhagen <oswald.buddenhagen@nokia.com>
(cherry picked from commit 63ea4ba0ceb8f625da48ddbe31f96b2148f62146)
---
 mkspecs/unsupported/win32-g++-cross/qmake.conf |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/mkspecs/unsupported/win32-g++-cross/qmake.conf b/mkspecs/unsupported/win32-g++-cross/qmake.conf
index efc3de2..6eed244 100644
--- a/mkspecs/unsupported/win32-g++-cross/qmake.conf
+++ b/mkspecs/unsupported/win32-g++-cross/qmake.conf
@@ -65,7 +65,7 @@ QMAKE_LINK_OBJECT_SCRIPT= object_script
 
 
 QMAKE_LIBS		=
-QMAKE_LIBS_CORE         = -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lws2_32
+QMAKE_LIBS_CORE         = -lole32 -luuid -lws2_32 -ladvapi32 -lshell32 -luser32 -lkernel32
 QMAKE_LIBS_GUI          = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lws2_32 -lole32 -luuid -luser32 -ladvapi32
 QMAKE_LIBS_NETWORK      = -lws2_32
 QMAKE_LIBS_OPENGL       = -lglu32 -lopengl32 -lgdi32 -luser32
-- 
1.7.4.2