diff src/qt-1-win32.patch @ 972:e5d55b815b89

improved naming of patch files
author Volker Grabsch <vog@notjusthosting.com>
date Fri, 14 May 2010 19:59:46 +0200
parents
children 37e7bea19863
line wrap: on
line diff
--- /dev/null	Thu Jan 01 00:00:00 1970 +0000
+++ b/src/qt-1-win32.patch	Fri May 14 19:59:46 2010 +0200
@@ -0,0 +1,838 @@
+This file is part of mingw-cross-env.
+See doc/index.html for further information.
+
+diff --git a/config.tests/unix/compile.test b/config.tests/unix/compile.test
+index 67a4636..fa54560 100755
+--- a/config.tests/unix/compile.test
++++ b/config.tests/unix/compile.test
+@@ -66,7 +66,7 @@ cd "$OUTDIR/$TEST"
+ 
+ test -r Makefile && $MAKE distclean >/dev/null 2>&1
+ 
+-"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile"
++"$OUTDIR/bin/qmake" -nocache -spec "$QMKSPEC" "CONFIG+=$QMAKE_CONFIG" "CONFIG-=debug_and_release" "LIBS*=$LFLAGS" "LIBS+=$MAC_ARCH_LFLAGS" "INCLUDEPATH*=$INCLUDEPATH" "QMAKE_CXXFLAGS*=$CXXFLAGS" "QMAKE_CXXFLAGS+=$MAC_ARCH_CXXFLAGS" "$SRCDIR/$TEST/$EXE.pro" -o "$OUTDIR/$TEST/Makefile"
+ 
+ if [ "$VERBOSE" = "yes" ]; then
+     $MAKE
+@@ -74,7 +74,7 @@ else
+     $MAKE >/dev/null 2>&1
+ fi
+ 
+-[ -x "$EXE" ] && SUCCESS=yes
++[ -x "$EXE" ] || [ -x "${EXE}.exe" ] && SUCCESS=yes
+ 
+ # done
+ if [ "$SUCCESS" != "yes" ]; then
+diff --git a/config.tests/unix/getaddrinfo/getaddrinfotest.cpp b/config.tests/unix/getaddrinfo/getaddrinfotest.cpp
+index a00bf15..cb562fe 100644
+--- a/config.tests/unix/getaddrinfo/getaddrinfotest.cpp
++++ b/config.tests/unix/getaddrinfo/getaddrinfotest.cpp
+@@ -42,9 +42,16 @@
+ /* Sample program for configure to test for getaddrinfo on the unix
+      platform. we check for all structures and functions required. */
+ 
++#include <stdio.h>
++#include <stdlib.h>
++#ifdef __MINGW32__
++#include <winsock2.h>
++#include <ws2tcpip.h>
++#else
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netdb.h>
++#endif
+ 
+ int main()
+ {
+diff --git a/config.tests/unix/iconv/iconv.pro b/config.tests/unix/iconv/iconv.pro
+index 8cdc776..898a017 100644
+--- a/config.tests/unix/iconv/iconv.pro
++++ b/config.tests/unix/iconv/iconv.pro
+@@ -1,3 +1,3 @@
+ SOURCES = iconv.cpp
+ CONFIG -= qt dylib app_bundle
+-mac:LIBS += -liconv
++mac|win32-g++:LIBS += -liconv
+diff --git a/config.tests/unix/ipv6/ipv6test.cpp b/config.tests/unix/ipv6/ipv6test.cpp
+index 3dc30c3..5783a85 100644
+--- a/config.tests/unix/ipv6/ipv6test.cpp
++++ b/config.tests/unix/ipv6/ipv6test.cpp
+@@ -46,9 +46,14 @@ platforms. We check for the required IPv6 data structures. */
+ #define _HPUX_SOURCE
+ #endif
+ 
++#ifdef __MINGW32__
++#include <winsock2.h>
++#include <ws2tcpip.h>
++#else
+ #include <sys/types.h>
+ #include <sys/socket.h>
+ #include <netinet/in.h>
++#endif
+ 
+ int main()
+ {
+diff --git a/config.tests/unix/largefile/largefiletest.cpp b/config.tests/unix/largefile/largefiletest.cpp
+index a5d7313..3a8924c 100644
+--- a/config.tests/unix/largefile/largefiletest.cpp
++++ b/config.tests/unix/largefile/largefiletest.cpp
+@@ -51,6 +51,9 @@ platforms.
+ #include <sys/stat.h>
+ #include <assert.h>
+ #include <stdio.h>
++#ifdef __MINGW32__
++#define ftello ftello64
++#endif
+ 
+ int main( int, char **argv )
+ {
+diff --git a/config.tests/unix/odbc/odbc.cpp b/config.tests/unix/odbc/odbc.cpp
+index 7092c58..f28712e 100644
+--- a/config.tests/unix/odbc/odbc.cpp
++++ b/config.tests/unix/odbc/odbc.cpp
+@@ -38,7 +38,9 @@
+ ** $QT_END_LICENSE$
+ **
+ ****************************************************************************/
+-
++#ifdef __MINGW32__
++#include <windows.h>
++#endif
+ #include <sql.h>
+ #include <sqlext.h>
+ 
+diff --git a/config.tests/unix/odbc/odbc.pro b/config.tests/unix/odbc/odbc.pro
+index c588ede..740582a 100644
+--- a/config.tests/unix/odbc/odbc.pro
++++ b/config.tests/unix/odbc/odbc.pro
+@@ -1,4 +1,5 @@
+ SOURCES = odbc.cpp
+ CONFIG -= qt dylib
+ mac:CONFIG -= app_bundle
+-LIBS += -lodbc
++win32-g++:LIBS += -lodbc32
++else:LIBS += -lodbc
+diff --git a/config.tests/unix/rtti/rtti.cpp b/config.tests/unix/rtti/rtti.cpp
+new file mode 100644
+index 0000000..e78103c
+--- /dev/null
++++ b/config.tests/unix/rtti/rtti.cpp
+@@ -0,0 +1,45 @@
++/****************************************************************************
++**
++** Copyright (C) 2010 Nokia Corporation and/or its subsidiary(-ies).
++** All rights reserved.
++** Contact: Nokia Corporation (qt-info@nokia.com)
++**
++** This file is part of the config.tests of the Qt Toolkit.
++**
++** $QT_BEGIN_LICENSE:LGPL$
++** Commercial Usage
++** Licensees holding valid Qt Commercial licenses may use this file in
++** accordance with the Qt Commercial License Agreement provided with the
++** Software or, alternatively, in accordance with the terms contained in
++** a written agreement between you and Nokia.
++**
++** GNU Lesser General Public License Usage
++** Alternatively, this file may be used under the terms of the GNU Lesser
++** General Public License version 2.1 as published by the Free Software
++** Foundation and appearing in the file LICENSE.LGPL included in the
++** packaging of this file.  Please review the following information to
++** ensure the GNU Lesser General Public License version 2.1 requirements
++** will be met: http://www.gnu.org/licenses/old-licenses/lgpl-2.1.html.
++**
++** In addition, as a special exception, Nokia gives you certain additional
++** rights.  These rights are described in the Nokia Qt LGPL Exception
++** version 1.1, included in the file LGPL_EXCEPTION.txt in this package.
++**
++** GNU General Public License Usage
++** Alternatively, this file may be used under the terms of the GNU
++** General Public License version 3.0 as published by the Free Software
++** Foundation and appearing in the file LICENSE.GPL included in the
++** packaging of this file.  Please review the following information to
++** ensure the GNU General Public License version 3.0 requirements will be
++** met: http://www.gnu.org/copyleft/gpl.html.
++**
++** If you have questions regarding the use of this file, please contact
++** Nokia at qt-info@nokia.com.
++** $QT_END_LICENSE$
++**
++****************************************************************************/
++
++int main(int, char**)
++{
++    return 0;
++}
+diff --git a/config.tests/unix/rtti/rtti.pro b/config.tests/unix/rtti/rtti.pro
+new file mode 100644
+index 0000000..d0aae30
+--- /dev/null
++++ b/config.tests/unix/rtti/rtti.pro
+@@ -0,0 +1,3 @@
++SOURCES = rtti.cpp
++CONFIG -= x11 qt
++mac:CONFIG -= app_bundle
+diff --git a/config.tests/x11/opengl/opengl.pro b/config.tests/x11/opengl/opengl.pro
+index 432bd8d..94faf15 100644
+--- a/config.tests/x11/opengl/opengl.pro
++++ b/config.tests/x11/opengl/opengl.pro
+@@ -7,4 +7,5 @@ for(p, QMAKE_LIBDIR_OPENGL) {
+ }
+ 
+ CONFIG -= qt
+-LIBS += -lGL -lGLU
++win32-g++:LIBS += -lopengl32
++else:LIBS += -lGL -lGLU
+diff --git a/configure b/configure
+index ed5891f..a070d78 100755
+--- a/configure
++++ b/configure
+@@ -178,6 +178,7 @@ UNAME_VERSION=`(uname -v) 2>/dev/null` || UNAME_VERSION=unknown
+ # window system detection
+ #-------------------------------------------------------------------------------
+ 
++# XPLATFROM win32-g++ is treated as a subcase of PLATFORM_X11 for convenience
+ PLATFORM_X11=no
+ PLATFORM_MAC=no
+ PLATFORM_QWS=no
+@@ -605,7 +606,7 @@ mkdir -p "$outpath/config.tests"
+ rm -f "$outpath/config.tests/.qmake.cache"
+ cp "$QMAKE_VARS_FILE" "$outpath/config.tests/.qmake.cache"
+ 
+-QMakeVar add styles "cde mac motif plastique cleanlooks windows"
++QMakeVar add styles "cde mac motif plastique cleanlooks windows windowsxp windowsvista"
+ QMakeVar add decorations "default windows styled"
+ QMakeVar add mouse-drivers "pc"
+ if [ "$UNAME_SYSTEM" = "Linux" ] ; then
+@@ -733,6 +734,7 @@ CFG_MMX=auto
+ CFG_3DNOW=auto
+ CFG_SSE=auto
+ CFG_SSE2=auto
++CFG_RTTI=auto
+ CFG_REDUCE_RELOCATIONS=no
+ CFG_IPV6=auto
+ CFG_NAS=no
+@@ -1602,6 +1604,13 @@ while [ "$#" -gt 0 ]; do
+             UNKNOWN_OPT=yes
+         fi
+         ;;
++    rtti)
++        if [ "$VAL" = "no" ]; then
++            CFG_RTTI="$VAL"
++        else
++            UNKNOWN_OPT=yes
++        fi
++        ;;
+     iwmmxt)
+ 	CFG_IWMMXT="yes"
+ 	;;
+@@ -3482,6 +3491,7 @@ cat << EOF
+     -no-3dnow .......... Do not compile with use of 3DNOW instructions.
+     -no-sse ............ Do not compile with use of SSE instructions.
+     -no-sse2 ........... Do not compile with use of SSE2 instructions.
++    -no-rtti ........... Do not compile with RTTI.
+ 
+     -qtnamespace <name>  Wraps all Qt library code in 'namespace <name> {...}'.
+     -qtlibinfix <infix>  Renames all libQt*.so to libQt*<infix>.so.
+@@ -4508,6 +4518,17 @@ if [ "${CFG_SSE2}" = "auto" ]; then
+     fi
+ fi
+ 
++# detect rtti support
++if [ "${CFG_RTTI}" = "auto" ]; then
++    if [ "$XPLATFORM" != "win32-g++" ]; then
++        CFG_RTTI=no
++    elif "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/rtti "rtti" $L_FLAGS $I_FLAGS $l_FLAGS "-frtti"; then
++        CFG_RTTI=yes
++    else
++        CFG_RTTI=no
++    fi
++fi
++
+ # check iWMMXt support
+ if [ "$CFG_IWMMXT" = "yes" ]; then
+     "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/iwmmxt "iwmmxt" $L_FLAGS $I_FLAGS $l_FLAGS "-mcpu=iwmmxt"
+@@ -4683,6 +4704,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do
+                 if "$WHICH" pg_config >/dev/null 2>&1; then
+                     QT_CFLAGS_PSQL=`pg_config --includedir 2>/dev/null`
+                     QT_LFLAGS_PSQL=`pg_config --libdir 2>/dev/null`
++                    QT_LFLAGS_PSQL="$QT_LFLAGS_PSQL $PSQL_LIBS"
+                 fi
+                 [ -z "$QT_CFLAGS_PSQL" ] || QT_CFLAGS_PSQL="-I$QT_CFLAGS_PSQL"
+                 [ -z "$QT_LFLAGS_PSQL" ] || QT_LFLAGS_PSQL="-L$QT_LFLAGS_PSQL"
+@@ -4707,7 +4729,7 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do
+         ;;
+         odbc)
+             if [ "$CFG_SQL_odbc" != "no" ]; then
+-                if [ "$PLATFORM_MAC" != "yes" ] && "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/odbc "ODBC" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
++                if [ "$PLATFORM_MAC" != "yes" ] || [ "$XPLATFORM" = "win32-g++" ] && "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/odbc "ODBC" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then
+                     if [ "$CFG_SQL_odbc" = "auto" ]; then
+                         CFG_SQL_odbc=plugin
+                     fi
+@@ -5002,7 +5024,10 @@ if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then
+     fi
+ 
+     if [ "$CFG_PHONON" != "no" ]; then
+-        if [ "$CFG_PHONON_BACKEND" != "no" ]; then
++        if [ "$XPLATFORM" = "win32-g++" ]; then
++            echo "Will build Phonon for win32-g++"
++            CFG_PHONON=yes
++        elif [ "$CFG_PHONON_BACKEND" != "no" ]; then
+             if [ "$CFG_GLIB" = "yes" -a "$CFG_GSTREAMER" != "no" ]; then
+                 if [ -n "$PKG_CONFIG" ]; then
+                     QT_CFLAGS_GSTREAMER=`$PKG_CONFIG --cflags gstreamer-0.10 gstreamer-plugins-base-0.10 2>/dev/null`
+@@ -5060,8 +5085,9 @@ if [ "$PLATFORM_X11" = "yes" ]; then
+     fi
+ 
+     # Check we actually have X11 :-)
+-    "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xlib "XLib" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS
+-    if [ $? != "0" ]; then
++    if [ "$XPLATFORM" = "win32-g++" ]; then
++        echo "Skipping XLib test for win32-g++"
++    elif ! "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xlib "XLib" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then
+         echo "Basic XLib functionality test failed!"
+         echo " You might need to modify the include and library search paths by editing"
+         echo " QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in ${XQMAKESPEC}."
+@@ -6141,6 +6167,7 @@ fi
+ [ "$CFG_3DNOW" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG 3dnow"
+ [ "$CFG_SSE" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse"
+ [ "$CFG_SSE2" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG sse2"
++[ "$CFG_RTTI" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG rtti"
+ [ "$CFG_IWMMXT" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG iwmmxt"
+ [ "$CFG_NEON" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG neon"
+ [ "$PLATFORM_MAC" = "yes" ] && QMAKE_CONFIG="$QMAKE_CONFIG $CFG_MAC_ARCHS"
+@@ -6222,7 +6249,7 @@ else
+     QT_CONFIG="$QT_CONFIG freetype"
+ fi
+ 
+-if [ "x$PLATFORM_MAC" = "xyes" ]; then
++if [ "x$PLATFORM_MAC" = "xyes" ] && [ "$XPLATFORM" != "win32-g++" ]; then
+     #On Mac we implicitly link against libz, so we
+     #never use the 3rdparty stuff.
+     [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system"
+@@ -7161,7 +7188,7 @@ fi
+ 
+ cat >>"$QTCONFIG.tmp" <<EOF
+ #configuration
+-CONFIG += $QTCONFIG_CONFIG
++CONFIG += $QMAKE_CONFIG $QTCONFIG_CONFIG
+ QT_ARCH = $CFG_ARCH
+ QT_EDITION = $Edition
+ QT_CONFIG += $QT_CONFIG
+@@ -7434,7 +7461,7 @@ fi
+ echo "Declarative module .. $CFG_DECLARATIVE"
+ echo "STL support ......... $CFG_STL"
+ echo "PCH support ......... $CFG_PRECOMPILE"
+-echo "MMX/3DNOW/SSE/SSE2..  ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}"
++echo "MMX/3DNOW/SSE/SSE2/RTTI..  ${CFG_MMX}/${CFG_3DNOW}/${CFG_SSE}/${CFG_SSE2}/${CFG_RTTI}"
+ if [ "$CFG_ARCH" = "arm" ] || [ "$CFG_ARCH" = "armv6" ]; then
+     echo "iWMMXt support ...... ${CFG_IWMMXT}"
+     echo "NEON support ........ ${CFG_NEON}"
+@@ -7752,7 +7779,11 @@ for file in .projects .projects.3; do
+         [ "$IN_ROOT" = "no" ] && continue
+ 
+         case $a in
+-        *winmain/winmain.pro) continue ;;
++        *winmain/winmain.pro)
++            case "$XPLATFORM" in
++            win32*) SPEC=$XQMAKESPEC ;;
++            *) continue ;;
++            esac ;;
+         *s60main/s60main.pro) continue ;;
+         *examples/activeqt/*) continue ;;
+         */qmake/qmake.pro) continue ;;
+diff --git a/mkspecs/win32-g++/qmake.conf b/mkspecs/win32-g++/qmake.conf
+index b282f69..b537bc7 100644
+--- a/mkspecs/win32-g++/qmake.conf
++++ b/mkspecs/win32-g++/qmake.conf
+@@ -3,23 +3,31 @@
+ #
+ # Written for MinGW
+ #
++load(qt_config)
+ 
+ MAKEFILE_GENERATOR	= MINGW
+ TEMPLATE		= app
+ CONFIG			+= qt warn_on release link_prl copy_dir_files debug_and_release debug_and_release_target precompile_header
++CONFIG			+= windows win32
++CONFIG			-= freetype
++QT_CONFIG		-= freetype
+ QT			+= core gui
+ DEFINES			+= UNICODE QT_LARGEFILE_SUPPORT
++DEFINES			-= QT_LARGEFILE_SUPPORT
++DEFINES			+= QT_TABLET QT_SESSIONMANAGER QT_NO_DIRECT3D QT_NO_CODECS
+ QMAKE_COMPILER_DEFINES  += __GNUC__ WIN32
+ 
+ QMAKE_EXT_OBJ           = .o
+ QMAKE_EXT_RES           = _res.o
+ 
+-QMAKE_CC		= gcc
++QMAKE_CC		= HOSTPLATFORMPREFIX-gcc
+ QMAKE_LEX		= flex
+ QMAKE_LEXFLAGS		=
+ QMAKE_YACC		= byacc
+ QMAKE_YACCFLAGS		= -d
+ QMAKE_CFLAGS		=
++QMAKE_CFLAGS		+= -isystem HOSTPLATFORMINCLUDE
++QMAKE_CFLAGS		+= -pipe
+ QMAKE_CFLAGS_DEPS	= -M
+ QMAKE_CFLAGS_WARN_ON	= -Wall
+ QMAKE_CFLAGS_WARN_OFF	= -w
+@@ -27,7 +35,7 @@ QMAKE_CFLAGS_RELEASE	= -O2
+ QMAKE_CFLAGS_DEBUG	= -g
+ QMAKE_CFLAGS_YACC	= -Wno-unused -Wno-parentheses
+ 
+-QMAKE_CXX		= g++
++QMAKE_CXX		= HOSTPLATFORMPREFIX-g++
+ QMAKE_CXXFLAGS		= $$QMAKE_CFLAGS
+ QMAKE_CXXFLAGS_DEPS	= $$QMAKE_CFLAGS_DEPS
+ QMAKE_CXXFLAGS_WARN_ON	= $$QMAKE_CFLAGS_WARN_ON
+@@ -42,6 +50,7 @@ QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions -mthreads
+ QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -fno-exceptions
+ 
+ QMAKE_INCDIR		=
++QMAKE_INCDIR		+= .
+ QMAKE_INCDIR_QT		= $$[QT_INSTALL_HEADERS]
+ QMAKE_LIBDIR_QT		= $$[QT_INSTALL_LIBS]
+ 
+@@ -50,8 +59,8 @@ QMAKE_RUN_CC_IMP	= $(CC) -c $(CFLAGS) $(INCPATH) -o $@ $<
+ QMAKE_RUN_CXX		= $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $obj $src
+ QMAKE_RUN_CXX_IMP	= $(CXX) -c $(CXXFLAGS) $(INCPATH) -o $@ $<
+ 
+-QMAKE_LINK		= g++
+-QMAKE_LINK_C		= gcc
++QMAKE_LINK		= HOSTPLATFORMPREFIX-g++
++QMAKE_LINK_C		= HOSTPLATFORMPREFIX-gcc
+ QMAKE_LFLAGS		= -enable-stdcall-fixup -Wl,-enable-auto-import -Wl,-enable-runtime-pseudo-reloc
+ QMAKE_LFLAGS_EXCEPTIONS_ON = -mthreads -Wl
+ QMAKE_LFLAGS_EXCEPTIONS_OFF =
+@@ -72,15 +81,18 @@ QMAKE_LIBS_OPENGL       = -lopengl32 -lglu32 -lgdi32 -luser32
+ QMAKE_LIBS_COMPAT       = -ladvapi32 -lshell32 -lcomdlg32 -luser32 -lgdi32 -lws2_32
+ QMAKE_LIBS_QT_ENTRY     = -lmingw32 -lqtmain
+ 
++QMAKE_SH				= bash
++
+ !isEmpty(QMAKE_SH) {
+     MINGW_IN_SHELL      = 1
+ 	QMAKE_DIR_SEP		= /
+ 	QMAKE_COPY		= cp
+-	QMAKE_COPY_DIR		= xcopy /s /q /y /i
++	QMAKE_COPY_DIR		= cp -r
+ 	QMAKE_MOVE		= mv
+-	QMAKE_DEL_FILE		= rm
+-	QMAKE_MKDIR		= mkdir
++	QMAKE_DEL_FILE		= rm -f
++	QMAKE_MKDIR		= mkdir -p
+ 	QMAKE_DEL_DIR		= rmdir
++	QMAKE_SYMBOLIC_LINK	= ln -s
+     QMAKE_CHK_DIR_EXISTS = test -d
+ } else {
+ 	QMAKE_COPY		= copy /y
+@@ -92,15 +104,16 @@ QMAKE_LIBS_QT_ENTRY     = -lmingw32 -lqtmain
+     QMAKE_CHK_DIR_EXISTS	= if not exist
+ }
+ 
+-QMAKE_MOC		= $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}moc.exe
+-QMAKE_UIC		= $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}uic.exe
+-QMAKE_IDC		= $$[QT_INSTALL_BINS]$${DIR_SEPARATOR}idc.exe
++#QMAKE_IDC		= HOSTPLATFORMPREFIX-idc
++QMAKE_MOC		= HOSTPLATFORMPREFIX-moc
++QMAKE_RCC		= HOSTPLATFORMPREFIX-rcc
++QMAKE_UIC		= HOSTPLATFORMPREFIX-uic
+ 
+-QMAKE_IDL		= midl
+-QMAKE_LIB		= ar -ru
+-QMAKE_RC		= windres
++#QMAKE_IDL		= midl
++QMAKE_LIB		= HOSTPLATFORMPREFIX-ar -ru
++QMAKE_RC		= HOSTPLATFORMPREFIX-windres
+ QMAKE_ZIP		= zip -r -9
+ 
+-QMAKE_STRIP		= strip
++QMAKE_STRIP		= HOSTPLATFORMPREFIX-strip
+ QMAKE_STRIPFLAGS_LIB 	+= --strip-unneeded
+-load(qt_config)
++PKG_CONFIG		= HOSTPLATFORMPREFIX-pkg-config
+diff --git a/src/3rdparty/phonon/ds9/videorenderer_soft.cpp b/src/3rdparty/phonon/ds9/videorenderer_soft.cpp
+index f7d42cf..9c7993c 100644
+--- a/src/3rdparty/phonon/ds9/videorenderer_soft.cpp
++++ b/src/3rdparty/phonon/ds9/videorenderer_soft.cpp
+@@ -45,7 +45,7 @@ along with this library.  If not, see <http://www.gnu.org/licenses/>.
+ #endif
+ 
+ #ifndef QT_NO_OPENGL
+-#include <gl/gl.h>
++#include <GL/gl.h>
+ #ifndef GL_FRAGMENT_PROGRAM_ARB
+ #define GL_FRAGMENT_PROGRAM_ARB           0x8804
+ #define GL_PROGRAM_FORMAT_ASCII_ARB       0x8875
+diff --git a/src/corelib/tools/tools.pri b/src/corelib/tools/tools.pri
+index 3406e41..e171584 100644
+--- a/src/corelib/tools/tools.pri
++++ b/src/corelib/tools/tools.pri
+@@ -96,8 +96,8 @@ contains(QT_CONFIG, zlib) {
+         ../3rdparty/zlib/uncompr.c \
+         ../3rdparty/zlib/zutil.c
+ } else:!contains(QT_CONFIG, no-zlib) {
+-   unix:LIBS_PRIVATE += -lz
+-#  win32:LIBS += libz.lib
++    unix|win32-g++:LIBS_PRIVATE += -lz
++    win32:!win32-g++:LIBS += zdll.lib
+ }
+ 
+ DEFINES += HB_EXPORT=Q_CORE_EXPORT
+diff --git a/src/gui/image/image.pri b/src/gui/image/image.pri
+index b67be55..6642ae3 100644
+--- a/src/gui/image/image.pri
++++ b/src/gui/image/image.pri
+@@ -93,11 +93,11 @@ SOURCES += \
+     SOURCES += image/qpnghandler.cpp
+ 
+     contains(QT_CONFIG, system-png) {
+-        unix:LIBS_PRIVATE  += -lpng
+-        win32:LIBS += libpng.lib
++        unix|win32-g++:LIBS_PRIVATE += -lpng
++        win32:!win32-g++:LIBS += libpng.lib
+     } else {
+         !isEqual(QT_ARCH, i386):!isEqual(QT_ARCH, x86_64):DEFINES += PNG_NO_ASSEMBLER_CODE
+-        INCLUDEPATH  += ../3rdparty/libpng ../3rdparty/zlib
++        INCLUDEPATH += ../3rdparty/libpng
+         SOURCES += ../3rdparty/libpng/png.c \
+           ../3rdparty/libpng/pngerror.c \
+           ../3rdparty/libpng/pngget.c \
+@@ -115,6 +115,10 @@ SOURCES += \
+           ../3rdparty/libpng/pngwutil.c \
+           ../3rdparty/libpng/pnggccrd.c
+     }
++    contains(QT_CONFIG, system-zlib) {
++        unix|win32-g++:LIBS_PRIVATE += -lz
++        win32:!win32-g++:LIBS += zdll.lib
++    }
+ } else {
+     DEFINES *= QT_NO_IMAGEFORMAT_PNG
+ }
+diff --git a/src/gui/painting/painting.pri b/src/gui/painting/painting.pri
+index a6cc9c7..95779a1 100644
+--- a/src/gui/painting/painting.pri
++++ b/src/gui/painting/painting.pri
+@@ -387,9 +387,9 @@ neon {
+ }
+ 
+ contains(QT_CONFIG, zlib) {
+-   INCLUDEPATH += ../3rdparty/zlib
++    INCLUDEPATH += ../3rdparty/zlib
+ } else:!contains(QT_CONFIG, no-zlib) {
+-   unix:LIBS_PRIVATE += -lz
+-#  win32:LIBS += libz.lib
++    unix|win32-g++:LIBS_PRIVATE += -lz
++    win32:!win32-g++:LIBS += zdll.lib
+ }
+ 
+diff --git a/src/network/access/access.pri b/src/network/access/access.pri
+index aa36890..f009761 100644
+--- a/src/network/access/access.pri
++++ b/src/network/access/access.pri
+@@ -59,8 +59,8 @@ SOURCES += access/qftp.cpp \
+ 
+ #zlib support
+ contains(QT_CONFIG, zlib) {
+-   INCLUDEPATH += ../3rdparty/zlib
++    INCLUDEPATH += ../3rdparty/zlib
+ } else:!contains(QT_CONFIG, no-zlib) {
+-   unix:LIBS_PRIVATE += -lz
+-#  win32:LIBS += libz.lib
++    unix|win32-g++:LIBS_PRIVATE += -lz
++    win32:!win32-g++:LIBS += zdll.lib
+ }
+diff --git a/src/network/ssl/ssl.pri b/src/network/ssl/ssl.pri
+index 72ea80f..cf31a5b 100644
+--- a/src/network/ssl/ssl.pri
++++ b/src/network/ssl/ssl.pri
+@@ -34,6 +34,7 @@ symbian {
+     # Include Qt's default CA bundle
+     RESOURCES += network.qrc
+ 
+-    # Add optional SSL libs
++    # Add optional SSL libs, but not accidently system zlib
++    !contains(QT_CONFIG, system-zlib):OPENSSL_LIBS -= -lz
+     LIBS_PRIVATE += $$OPENSSL_LIBS
+ }
+diff --git a/src/plugins/imageformats/jpeg/jpeg.pro b/src/plugins/imageformats/jpeg/jpeg.pro
+index ebc79cc..30a19c6 100644
+--- a/src/plugins/imageformats/jpeg/jpeg.pro
++++ b/src/plugins/imageformats/jpeg/jpeg.pro
+@@ -20,8 +20,8 @@ symbian: {
+ }
+ 
+ contains(QT_CONFIG, system-jpeg) {
+-        unix:LIBS += -ljpeg
+-        win32:LIBS += libjpeg.lib
++        unix|win32-g++:LIBS += -ljpeg
++        win32:!win32-g++:LIBS += libjpeg.lib
+ }
+ !contains(QT_CONFIG, system-jpeg) {
+ 	INCLUDEPATH += ../../../3rdparty/libjpeg
+diff --git a/src/plugins/imageformats/mng/mng.pro b/src/plugins/imageformats/mng/mng.pro
+index de7dfa7..46c84c4 100644
+--- a/src/plugins/imageformats/mng/mng.pro
++++ b/src/plugins/imageformats/mng/mng.pro
+@@ -14,8 +14,8 @@ symbian: {
+ }
+ 
+ contains(QT_CONFIG, system-mng) {
+-        unix:LIBS += -lmng
+-        win32:LIBS += libmng.lib
++        unix|win32-g++:LIBS += -lmng
++        win32:!win32-g++:LIBS += libmng.lib
+ }
+ !contains(QT_CONFIG, system-mng) {
+         DEFINES += MNG_BUILD_SO
+@@ -44,10 +44,11 @@ contains(QT_CONFIG, system-mng) {
+ }
+ 
+ contains(QT_CONFIG, system-zlib) {
+-        LIBS += -lz
++    unix|win32-g++:LIBS_PRIVATE += -lz
++    win32:!win32-g++:LIBS += zdll.lib
+ }
+ !contains(QT_CONFIG, system-zlib) {
+-        INCLUDEPATH +=  ../../../3rdparty/zlib
++    INCLUDEPATH +=  ../../../3rdparty/zlib
+ }
+ 
+ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/imageformats
+diff --git a/src/plugins/imageformats/tiff/tiff.pro b/src/plugins/imageformats/tiff/tiff.pro
+index 312f99c..29d36f4 100644
+--- a/src/plugins/imageformats/tiff/tiff.pro
++++ b/src/plugins/imageformats/tiff/tiff.pro
+@@ -8,8 +8,13 @@ SOURCES += main.cpp \
+            qtiffhandler.cpp
+ 
+ contains(QT_CONFIG, system-tiff) {
+-        unix:LIBS += -ltiff
+-        win32:LIBS += libtiff.lib
++        unix|win32-g++:LIBS += -ltiff
++        win32:!win32-g++:LIBS += libtiff.lib
++
++        contains(QT_CONFIG, system-jpeg) {
++                unix|win32-g++:LIBS += -ljpeg
++                win32:!win32-g++:LIBS += libjpeg.lib
++        }
+ }
+ !contains(QT_CONFIG, system-tiff) {
+ 	INCLUDEPATH += ../../../3rdparty/libtiff/libtiff
+@@ -62,10 +67,11 @@ contains(QT_CONFIG, system-tiff) {
+ }
+ 
+ contains(QT_CONFIG, system-zlib) {
+-        LIBS += -lz
++    unix|win32-g++:LIBS_PRIVATE += -lz
++    win32:!win32-g++:LIBS += zdll.lib
+ }
+ !contains(QT_CONFIG, system-zlib) {
+-        INCLUDEPATH +=  ../../../3rdparty/zlib
++    INCLUDEPATH +=  ../../../3rdparty/zlib
+ }
+ 
+ QTDIR_build:DESTDIR = $$QT_BUILD_TREE/plugins/imageformats
+diff --git a/src/plugins/sqldrivers/psql/psql.pro b/src/plugins/sqldrivers/psql/psql.pro
+index 29fbada..0a38ee4 100644
+--- a/src/plugins/sqldrivers/psql/psql.pro
++++ b/src/plugins/sqldrivers/psql/psql.pro
+@@ -4,18 +4,15 @@ HEADERS		= ../../../sql/drivers/psql/qsql_psql.h
+ SOURCES		= main.cpp \
+ 		  ../../../sql/drivers/psql/qsql_psql.cpp
+ 
+-unix: {
++unix|win32-g++: {
+     !isEmpty(QT_LFLAGS_PSQL) {
+-        LIBS *= $$QT_LFLAGS_PSQL
++        !contains(QT_CONFIG, system-zlib): QT_LFLAGS_PSQL -= -lz
++        !static:LIBS *= $$QT_LFLAGS_PSQL
+         QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL
+     }
+     !contains(LIBS, .*pq.*):LIBS *= -lpq
+ }
+ 
+-win32:!contains(LIBS, .*pq.* ) {
+-    !win32-g++:LIBS    *= -llibpq       
+-    win32-g++:LIBS *= -lpq	
+-    LIBS    *= -lws2_32 -ladvapi32
+-}
++win32:!win32-g++:!contains(LIBS, .*pq.* ) LIBS *= -llibpq -lws2_32 -ladvapi32
+ 
+ include(../qsqldriverbase.pri)
+diff --git a/src/plugins/sqldrivers/tds/main.cpp b/src/plugins/sqldrivers/tds/main.cpp
+index eb654ef..0a17f17 100644
+--- a/src/plugins/sqldrivers/tds/main.cpp
++++ b/src/plugins/sqldrivers/tds/main.cpp
+@@ -47,6 +47,7 @@
+ #define _WINSCARD_H_
+ #include <windows.h>
+ #endif
++#define Q_USE_SYBASE
+ #include "../../../sql/drivers/tds/qsql_tds.h"
+ 
+ QT_BEGIN_NAMESPACE
+diff --git a/src/plugins/sqldrivers/tds/tds.pro b/src/plugins/sqldrivers/tds/tds.pro
+index 08a166b..f66d5b7 100644
+--- a/src/plugins/sqldrivers/tds/tds.pro
++++ b/src/plugins/sqldrivers/tds/tds.pro
+@@ -6,8 +6,9 @@ SOURCES		= main.cpp \
+ 		  ../../../sql/drivers/tds/qsql_tds.cpp
+ 
+ unix:!contains( LIBS, .*sybdb.* ):LIBS 	*= -lsybdb
++win32-g++:LIBS *=  -lsybdb -liconv -lws2_32
+ 
+-win32 {
++win32:!win32-g++ {
+     !win32-borland:LIBS *= -lNTWDBLIB
+     win32-borland:LIBS 	*= $(BCB)/lib/PSDK/NTWDBLIB.LIB
+ }
+diff --git a/src/qbase.pri b/src/qbase.pri
+index 710a2b6..2c3e91c 100644
+--- a/src/qbase.pri
++++ b/src/qbase.pri
+@@ -85,7 +85,6 @@ win32-borland {
+ }
+ 
+ win32 {
+-    CONFIG += zlib
+     INCLUDEPATH += tmp
+     !static: DEFINES+=QT_MAKEDLL
+ }
+diff --git a/src/sql/drivers/drivers.pri b/src/sql/drivers/drivers.pri
+index 184eca9..aac0267 100644
+--- a/src/sql/drivers/drivers.pri
++++ b/src/sql/drivers/drivers.pri
+@@ -6,19 +6,16 @@ contains(sql-drivers, psql) {
+     HEADERS +=      drivers/psql/qsql_psql.h
+     SOURCES +=      drivers/psql/qsql_psql.cpp
+ 
+-    unix {
+-        !isEmpty(QT_LFLAGS_PSQL) {
+-            LIBS *= $$QT_LFLAGS_PSQL
++    unix|win32-g++ {
++        !static:!isEmpty(QT_LFLAGS_PSQL) {
++            !contains(QT_CONFIG, system-zlib): QT_LFLAGS_PSQL -= -lz
++            !static:LIBS *= $$QT_LFLAGS_PSQL
+             QMAKE_CXXFLAGS *= $$QT_CFLAGS_PSQL
+         }
+         !contains(LIBS, .*pq.*):LIBS *= -lpq
+     }
+ 
+-    win32 {
+-	!win32-g++:!contains( LIBS, .*pq.* ):LIBS *= -llibpq
+-    	win32-g++:!contains( LIBS, .*pq.* ):LIBS *= -lpq
+-        LIBS *= -lws2_32 -ladvapi32
+-    }
++    win32:!win32-g++:!contains(LIBS, .*pq.* ) LIBS *= -llibpq -lws2_32 -ladvapi32
+ }
+ 
+ contains(sql-drivers, mysql) {
+diff --git a/src/sql/drivers/tds/qsql_tds.cpp b/src/sql/drivers/tds/qsql_tds.cpp
+index 422f866..16785ed 100644
+--- a/src/sql/drivers/tds/qsql_tds.cpp
++++ b/src/sql/drivers/tds/qsql_tds.cpp
+@@ -47,7 +47,8 @@
+ #else
+ #define Q_USE_SYBASE
+ #endif
+-
++//Force SYBASE because we use FreeTDS
++#define Q_USE_SYBASE
+ #include "qsql_tds.h"
+ 
+ #include <qvariant.h>
+diff --git a/src/sql/drivers/tds/qsql_tds.h b/src/sql/drivers/tds/qsql_tds.h
+index cb318f3..a6354ce 100644
+--- a/src/sql/drivers/tds/qsql_tds.h
++++ b/src/sql/drivers/tds/qsql_tds.h
+@@ -48,7 +48,8 @@
+ 
+ #ifdef Q_OS_WIN32
+ #define WIN32_LEAN_AND_MEAN
+-#define DBNTWIN32 // indicates 32bit windows dblib
++//#define DBNTWIN32 // indicates 32bit windows dblib
++#include <winsock2.h>
+ #include <QtCore/qt_windows.h>
+ #include <sqlfront.h>
+ #include <sqldb.h>
+diff --git a/src/svg/svg.pro b/src/svg/svg.pro
+index d2a4227..0d3ef83 100644
+--- a/src/svg/svg.pro
++++ b/src/svg/svg.pro
+@@ -44,7 +44,8 @@ symbian:TARGET.UID3=0x2001B2E2
+ 
+ #zlib support
+ contains(QT_CONFIG, zlib) {
+-   INCLUDEPATH += ../3rdparty/zlib
++    INCLUDEPATH += ../3rdparty/zlib
+ } else:!contains(QT_CONFIG, no-zlib) {
+-   unix:LIBS_PRIVATE += -lz
++    unix|win32-g++:LIBS_PRIVATE += -lz
++    win32:!win32-g++:LIBS += zdll.lib
+ }
+diff --git a/src/tools/bootstrap/bootstrap.pri b/src/tools/bootstrap/bootstrap.pri
+index b3ee948..18efe9d 100644
+--- a/src/tools/bootstrap/bootstrap.pri
++++ b/src/tools/bootstrap/bootstrap.pri
+@@ -52,8 +52,8 @@ hpux-acc*|hpuxi-acc* {
+     LIBS += -lbootstrap
+ }
+ !contains(QT_CONFIG, zlib):!contains(QT_CONFIG, no-zlib) {
+-   unix:LIBS += -lz
+-#  win32:LIBS += libz.lib
++    unix|win32-g++:LIBS_PRIVATE += -lz
++    win32:!win32-g++:LIBS += zdll.lib
+ }
+ win32:LIBS += -luser32
+ 
+diff --git a/src/tools/bootstrap/bootstrap.pro b/src/tools/bootstrap/bootstrap.pro
+index 0dbb90f..e6b43a6 100644
+--- a/src/tools/bootstrap/bootstrap.pro
++++ b/src/tools/bootstrap/bootstrap.pro
+@@ -109,6 +109,9 @@ contains(QT_CONFIG, zlib) {
+         ../3rdparty/zlib/trees.c \
+         ../3rdparty/zlib/uncompr.c \
+         ../3rdparty/zlib/zutil.c
++} else:!contains(QT_CONFIG, no-zlib) {
++    unix|win32-g++:LIBS_PRIVATE += -lz
++    win32:!win32-g++:LIBS += zdll.lib
+ }
+ 
+ lib.CONFIG = dummy_install
+diff --git a/src/winmain/winmain.pro b/src/winmain/winmain.pro
+index bc322b9..f1fec05 100644
+--- a/src/winmain/winmain.pro
++++ b/src/winmain/winmain.pro
+@@ -11,7 +11,7 @@ win32 {
+ 	win32-g++:DEFINES += QT_NEEDS_QMAIN
+ 	win32-borland:DEFINES += QT_NEEDS_QMAIN
+ 	SOURCES		= qtmain_win.cpp
+-	CONFIG		+= png zlib
++	CONFIG		+= png
+ 	CONFIG		-= jpeg
+ 	INCLUDEPATH	+= tmp $$QMAKE_INCDIR_QT/QtCore
+ }
+diff --git a/tools/qvfb/qvfb.pro b/tools/qvfb/qvfb.pro
+index dde7e8d..556dbcb 100644
+--- a/tools/qvfb/qvfb.pro
++++ b/tools/qvfb/qvfb.pro
+@@ -42,12 +42,14 @@ contains(QT_CONFIG, opengl) {
+ }
+ 
+ contains(QT_CONFIG, system-png) {
+-	LIBS += -lpng
++    unix|win32-g++:LIBS_PRIVATE += -lpng
++    win32:!win32-g++:LIBS += libpng.lib
+ } else {
+ 	INCLUDEPATH     += $$QT_SOURCE_TREE/src/3rdparty/libpng
+ }
+ contains(QT_CONFIG, system-zlib) {
+-	LIBS += -lz
++    unix|win32-g++:LIBS_PRIVATE += -lz
++    win32:!win32-g++:LIBS += zdll.lib
+ } else {
+ 	INCLUDEPATH     += $$QT_SOURCE_TREE/src/3rdparty/zlib
+ }