view src/qt-1-cherrypicks.patch @ 1973:171bdb86a6ac

update package qt
author Mark Brand <mabrand@mabrand.nl>
date Thu, 01 Sep 2011 14:36:58 +0200
parents 4ec76e2b5915
children 378b4cabcda2
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 f536051241fe2be447ce57b5ad2410d786a16eaa 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/15] 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 3b7a1f3..4257e68 100755
--- a/configure
+++ b/configure
@@ -1540,8 +1540,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
@@ -3518,7 +3517,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]
@@ -3747,8 +3746,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 69cd70b..307b845 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";
@@ -1663,7 +1661,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"
@@ -1796,7 +1794,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.6.1


From 67f88bc3dd4bb2488a83e5f34f80c1338d994288 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/15] 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 911b617..607c889 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -1346,8 +1346,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.6.1


From 52730b299439cb39afc6ecd6ce382c52cf02ea75 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/15] 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 80c31e3..0b29a78 100644
--- a/qmake/generators/makefile.cpp
+++ b/qmake/generators/makefile.cpp
@@ -3126,4 +3126,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 4167ecb..2bfc0c9 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 d6d6b34..0b8d269 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 607c889..de490b8 100644
--- a/qmake/generators/unix/unixmake2.cpp
+++ b/qmake/generators/unix/unixmake2.cpp
@@ -1333,182 +1333,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.6.1


From bb39cfa681e38eb6a9a16d99aed901603020cdc4 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/15] 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 8ba1d2a..661c5d6 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 e3fc467..3013807 100644
--- a/qmake/generators/win32/winmakefile.cpp
+++ b/qmake/generators/win32/winmakefile.cpp
@@ -831,6 +831,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.6.1


From a4dd9f14820aa2fcd2c35f675622fccc9c8888d5 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/15] 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 c70a168..6f50c7a 100644
--- a/src/3rdparty/webkit/WebCore/WebCore.pro
+++ b/src/3rdparty/webkit/WebCore/WebCore.pro
@@ -84,9 +84,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 27ceaf0..ed6b8cb 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 cf492d6..a3783d2 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 4375358..ff3bd6b 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 5d78336..9d78690 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.6.1


From d3de771560a60cad3d3fc560efc25d09c61e1db7 Mon Sep 17 00:00:00 2001
From: Bernhard Rosenkraenzer <br@blankpage.ch>
Date: Thu, 27 Jan 2011 13:48:13 +0100
Subject: [PATCH 06/15] 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 4257e68..946c74b 100755
--- a/configure
+++ b/configure
@@ -887,6 +887,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
 #-------------------------------------------------------------------------------
@@ -2030,7 +2040,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
@@ -2072,6 +2082,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"
@@ -2092,6 +2109,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 307b845..1d654fe 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.6.1


From e586c2c3df5877dabdf4a6197054b2d24cb10b29 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Tue, 16 Nov 2010 20:06:28 +0100
Subject: [PATCH 07/15] 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.6.1


From aecb4e7acbb0d2386dcb2e7ad0ed39868d4d63fa Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Sat, 5 Jun 2010 23:41:04 +0200
Subject: [PATCH 08/15] 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.6.1


From 6c13eb0e3ab8f0e4bbf6ed79d31ff5255b2446ae Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Tue, 9 Nov 2010 20:09:45 +0100
Subject: [PATCH 09/15] 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 946c74b..53c433c 100755
--- a/configure
+++ b/configure
@@ -7151,12 +7151,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.6.1


From 6f62b8fc99daaac463bb8d3d781eb432006577e5 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Thu, 6 Jan 2011 14:21:32 +0100
Subject: [PATCH 10/15] 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.6.1


From 0db184b757308a8135032069a13722a4b713dc2b Mon Sep 17 00:00:00 2001
From: Tony Theodore <tonyt@logyst.com>
Date: Mon, 21 Feb 2011 22:22:04 +0100
Subject: [PATCH 11/15] 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.6.1


From b24117a7f8a1b1f32d09f8f563a058e8445fc124 Mon Sep 17 00:00:00 2001
From: Mark Brand <mabrand@mabrand.nl>
Date: Tue, 28 Jun 2011 23:02:29 +0200
Subject: [PATCH 12/15] link static text codec plugins (mingw-cross-env
 specific)

Static QtCore for Windows introduces dependencies on the text codec plugins.
Without this patch, users would have to handle these dependencies explicitly
when building any Qt application.
---
 src/corelib/corelib.pro                   |    1 +
 src/plugins/codecs/staticcodecplugins.cpp |    5 +++++
 src/plugins/codecs/staticcodecplugins.pri |    2 ++
 3 files changed, 8 insertions(+), 0 deletions(-)
 create mode 100644 src/plugins/codecs/staticcodecplugins.cpp
 create mode 100644 src/plugins/codecs/staticcodecplugins.pri

diff --git a/src/corelib/corelib.pro b/src/corelib/corelib.pro
index 06aa191..21a8316 100644
--- a/src/corelib/corelib.pro
+++ b/src/corelib/corelib.pro
@@ -40,3 +40,4 @@ symbian: {
                   "$${LITERAL_HASH}endif"
     MMP_RULES += pagingBlock
 }
+win32:static:include(../plugins/codecs/staticcodecplugins.pri)
diff --git a/src/plugins/codecs/staticcodecplugins.cpp b/src/plugins/codecs/staticcodecplugins.cpp
new file mode 100644
index 0000000..47f5bf3
--- /dev/null
+++ b/src/plugins/codecs/staticcodecplugins.cpp
@@ -0,0 +1,5 @@
+#include <QtPlugin>
+Q_IMPORT_PLUGIN(qcncodecs)
+Q_IMPORT_PLUGIN(qjpcodecs)
+Q_IMPORT_PLUGIN(qtwcodecs)
+Q_IMPORT_PLUGIN(qkrcodecs)
diff --git a/src/plugins/codecs/staticcodecplugins.pri b/src/plugins/codecs/staticcodecplugins.pri
new file mode 100644
index 0000000..a579487
--- /dev/null
+++ b/src/plugins/codecs/staticcodecplugins.pri
@@ -0,0 +1,2 @@
+QTPLUGIN += qcncodecs qjpcodecs qtwcodecs qkrcodecs
+SOURCES += $$PWD/staticcodecplugins.cpp
-- 
1.7.6.1


From 8623b9265243f31b6895c31346e2956fcd78436d Mon Sep 17 00:00:00 2001
From: Tony Theodore <tonyt@logyst.com>
Date: Thu, 1 Sep 2011 13:47:10 +0200
Subject: [PATCH 13/15] fix building on GNU/kFreeBSD (mingw-cross-specific)

This patch has been taken from:

http://anonscm.debian.org/gitweb/?p=pkg-kde/qt/qt4-x11.git;a=blob;f=debian/patches/50_kfreebsd_Q_OS.diff;h=4a8db71ff07a91efdf822baa120a3542ccf1d7f2;hb=HEAD

Author: Pino Toscano <pino@kde.org>
Description: Fixes FTBFS on GNU/kFreeBSD by creating new Q_OS_FREEBSD_KERNEL.
Last-Update: 2010-10-06
---
 src/corelib/global/qglobal.h |    2 ++
 1 files changed, 2 insertions(+), 0 deletions(-)

diff --git a/src/corelib/global/qglobal.h b/src/corelib/global/qglobal.h
index b8f3bb0..61588f1 100644
--- a/src/corelib/global/qglobal.h
+++ b/src/corelib/global/qglobal.h
@@ -221,6 +221,8 @@ namespace QT_NAMESPACE {}
 #elif defined(__FreeBSD__) || defined(__DragonFly__)
 #  define Q_OS_FREEBSD
 #  define Q_OS_BSD4
+#elif defined(__FreeBSD_kernel__)
+#  define Q_OS_FREEBSD_KERNEL
 #elif defined(__NetBSD__)
 #  define Q_OS_NETBSD
 #  define Q_OS_BSD4
-- 
1.7.6.1


From 698c9932336929598c5896b45930ede7c7a0bed5 Mon Sep 17 00:00:00 2001
From: Tony Theodore <tonyt@logyst.com>
Date: Thu, 1 Sep 2011 13:49:47 +0200
Subject: [PATCH 14/15] fix missing platform when building on GNU/kFreeBSD
 (mingw-cross-env specific)

This patch is inspired by:
http://anonscm.debian.org/gitweb/?p=pkg-kde/qt/qt4-x11.git;a=blob;f=debian/rules;h=47e5efbf09f77e6da51a3d719d2f6be47f69d096;hb=HEAD

For the time being, glibc-g++ is simply a copy of linux-g++.
---
 configure |    3 +++
 1 files changed, 3 insertions(+), 0 deletions(-)

diff --git a/configure b/configure
index 53c433c..ad23674 100755
--- a/configure
+++ b/configure
@@ -2608,6 +2608,9 @@ if [ -z "$PLATFORM" ]; then
      GNU:*)
         PLATFORM=hurd-g++
         ;;
+     GNU/kFreeBSD:*)
+        PLATFORM=linux-g++
+        ;;
      dgux:*)
         PLATFORM=dgux-g++
         ;;
-- 
1.7.6.1


From 4679cb1b70f4e399ab9010a23998aa335f256437 Mon Sep 17 00:00:00 2001
From: Tony Theodore <tonyt@logyst.com>
Date: Thu, 1 Sep 2011 13:51:50 +0200
Subject: [PATCH 15/15] fix building on dragonfly (mingw-cross-env specific)

This patch is inspired by:                                                                                                                                       http://cvsweb.NetBSD.org/bsdweb.cgi/pkgsrc/x11/qt4-libs/Makefile.common?rev=1.27&content-type=text/x-cvsweb-markup
---
 configure |    2 +-
 1 files changed, 1 insertions(+), 1 deletions(-)

diff --git a/configure b/configure
index ad23674..de5df9f 100755
--- a/configure
+++ b/configure
@@ -2620,7 +2620,7 @@ if [ -z "$PLATFORM" ]; then
      ULTRIX:*)
         PLATFORM=ultrix-g++
         ;;
-     FreeBSD:*)
+     FreeBSD:*|DragonFly:*)
         PLATFORM=freebsd-g++
         PLATFORM_NOTES="
             - Also available for FreeBSD: freebsd-icc
-- 
1.7.6.1