diff options
-rwxr-xr-x | config.tests/unix/compile.test | 6 | ||||
-rw-r--r-- | config.tests/unix/getaddrinfo/getaddrinfotest.cpp | 7 | ||||
-rw-r--r-- | config.tests/unix/iconv/iconv.pro | 2 | ||||
-rw-r--r-- | config.tests/unix/ipv6/ipv6test.cpp | 5 | ||||
-rw-r--r-- | config.tests/unix/odbc/odbc.cpp | 3 | ||||
-rw-r--r-- | config.tests/unix/odbc/odbc.pro | 3 | ||||
-rw-r--r-- | config.tests/x11/opengl/opengl.pro | 3 | ||||
-rwxr-xr-x | configure | 70 | ||||
-rw-r--r-- | mkspecs/unsupported/win32-g++-cross/qmake.conf | 101 | ||||
-rw-r--r-- | mkspecs/unsupported/win32-g++-cross/qplatformdefs.h | 42 | ||||
-rw-r--r-- | qmake/generators/metamakefile.cpp | 11 | ||||
-rw-r--r-- | qmake/generators/win32/mingw_make.cpp | 7 |
12 files changed, 241 insertions, 19 deletions
diff --git a/config.tests/unix/compile.test b/config.tests/unix/compile.test index 67a4636..99ebfd2 100755 --- a/config.tests/unix/compile.test +++ b/config.tests/unix/compile.test @@ -65,8 +65,10 @@ test -d "$OUTDIR/$TEST" || mkdir -p "$OUTDIR/$TEST" cd "$OUTDIR/$TEST" test -r Makefile && $MAKE distclean >/dev/null 2>&1 +# Make sure output from possible previous tests is gone +rm -f "$EXE" "${EXE}.exe" -"$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 +76,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 0c482cc..df6ae10 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..d642da2 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 4fb27f2..4243f2d 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/odbc/odbc.cpp b/config.tests/unix/odbc/odbc.cpp index 32602c0..98f3571 100644 --- a/config.tests/unix/odbc/odbc.cpp +++ b/config.tests/unix/odbc/odbc.cpp @@ -39,6 +39,9 @@ ** ****************************************************************************/ +#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..06a548f 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/x11/opengl/opengl.pro b/config.tests/x11/opengl/opengl.pro index 432bd8d..5fd41d3 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 @@ -779,6 +779,7 @@ RPATH_FLAGS= l_FLAGS= QCONFIG_FLAGS= XPLATFORM= # This seems to be the QMAKESPEC, like "linux-g++" or "symbian/linux-gcce" +XPLATFORM_MINGW=no # Whether target platform is MinGW (win32-g++*) PLATFORM=$QMAKESPEC QT_CROSS_COMPILE=no OPT_CONFIRM_LICENSE=no @@ -1326,7 +1327,9 @@ while [ "$#" -gt 0 ]; do fi ;; arch) - if [ "$PLATFORM_MAC" = "yes" ]; then + # if this is a Mac then "windows" probably means + # we are cross-compiling for MinGW + if [ "$PLATFORM_MAC" = "yes" ] && [ "$VAL" != "windows" ]; then CFG_MAC_ARCHS="$CFG_MAC_ARCHS $VAL" else CFG_ARCH=$VAL @@ -1444,6 +1447,7 @@ while [ "$#" -gt 0 ]; do ;; xplatform) XPLATFORM="$VAL" + case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac ;; debug-and-release) if [ "$VAL" = "yes" ] || [ "$VAL" = "no" ]; then @@ -2578,9 +2582,13 @@ if [ -z "$PLATFORM" ]; then " ;; SunOS:5*) - #PLATFORM=solaris-g++ - PLATFORM=solaris-cc - #PLATFORM=solaris-cc64 + if [ "$XPLATFORM_MINGW" = "yes" ]; then + PLATFORM="solaris-g++" + else + #PLATFORM=solaris-g++ + PLATFORM=solaris-cc + #PLATFORM=solaris-cc64 + fi PLATFORM_NOTES=" - Also available for Solaris: solaris-g++ solaris-cc-64 " @@ -2650,6 +2658,9 @@ else fi [ -z "$XPLATFORM" ] && XPLATFORM="$PLATFORM" + +case `basename "$XPLATFORM"` in win32-g++*) XPLATFORM_MINGW=yes;; esac + if [ -d "$PLATFORM" ]; then QMAKESPEC="$PLATFORM" else @@ -2922,6 +2933,8 @@ if [ "$PLATFORM" != "$XPLATFORM" -a "$CFG_EMBEDDED" != "no" ]; then CFG_ARCH="$CFG_EMBEDDED" ;; esac +elif [ "$XPLATFORM_MINGW" = "yes" ]; then + [ -z "$CFG_ARCH" ] && CFG_ARCH="windows" elif [ "$PLATFORM_MAC" = "yes" ] || [ -z "$CFG_ARCH" ]; then CFG_ARCH=$CFG_HOST_ARCH fi @@ -4087,6 +4100,8 @@ elif [ "$PLATFORM_MAC" = "yes" ]; then Platform="Qt for Mac OS X" elif echo "$XPLATFORM" | grep "symbian" > /dev/null ; then Platform="Qt for Symbian" +elif [ "$XPLATFORM_MINGW" = "yes" ]; then + Platform="Qt for Windows" elif [ '!' -z "`getQMakeConf \"$XQMAKESPEC\" | grep QMAKE_LIBS_X11 | awk '{print $3;}'`" ]; then PLATFORM_X11=yes Platform="Qt for Linux/X11" @@ -4698,6 +4713,8 @@ if [ "$CFG_ZLIB" = "auto" ]; then fi fi +[ "$XPLATFORM_MINGW" = "yes" ] && QMakeVar add styles "windowsxp windowsvista" + case "$XPLATFORM" in *symbian*) QMakeVar set styles "windows s60" #overwrite previous default CFG_LIBFREETYPE=no @@ -4897,7 +4914,8 @@ for _SQLDR in $CFG_SQL_AVAILABLE; do ;; psql) if [ "$CFG_SQL_psql" != "no" ]; then - if "$WHICH" pg_config >/dev/null 2>&1; then + # Be careful not to use native pg_config when cross building. + if [ "$XPLATFORM_MINGW" != "yes" ] && "$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` fi @@ -4924,7 +4942,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_MINGW" = "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 [ "$CFG_SQL_odbc" = "auto" ]; then CFG_SQL_odbc=plugin fi @@ -5190,6 +5208,7 @@ if [ "$PLATFORM_MAC" = "yes" -a ! -z "$QT_NAMESPACE" ]; then QT_NAMESPACE_MAC_CRC=`"$mactests/crc.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/mac/crc $QT_NAMESPACE $L_FLAGS $I_FLAGS $l_FLAGS` fi +# X11/QWS if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then # auto-detect Glib support @@ -5375,7 +5394,10 @@ if [ "$PLATFORM_X11" = "yes" ]; then echo " QMAKE_INCDIR_X11 and QMAKE_LIBDIR_X11 in ${XQMAKESPEC}." exit 1 fi +fi +# X11/MINGW OpenGL +if [ "$PLATFORM_X11" = "yes" -o "$XPLATFORM_MINGW" = "yes" ]; then # auto-detect OpenGL support (es1 = OpenGL ES 1.x Common, es2 = OpenGL ES 2.x) if [ "$CFG_GUI" = "no" ]; then if [ "$CFG_OPENGL" = "auto" ]; then @@ -5471,7 +5493,10 @@ if [ "$PLATFORM_X11" = "yes" ]; then echo "OpenGL Graphics System is disabled due to missing OpenGL support..." CFG_GRAPHICS_SYSTEM=default fi +fi # X11/MINGW OpenGL +# X11 +if [ "$PLATFORM_X11" = "yes" ]; then # auto-detect Xcursor support if [ "$CFG_XCURSOR" != "no" ]; then if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/x11/xcursor "Xcursor" $L_FLAGS $I_FLAGS $l_FLAGS $X11TESTS_FLAGS; then @@ -5917,9 +5942,12 @@ if [ "$PLATFORM_X11" = "yes" -o "$PLATFORM_QWS" = "yes" ]; then fi fi +[ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_PHONON" != "no" ] && CFG_PHONON="yes" + # freetype support [ "x$CFG_EMBEDDED" != "xno" ] && CFG_LIBFREETYPE="$CFG_QWS_FREETYPE" [ "x$PLATFORM_MAC" = "xyes" ] && CFG_LIBFREETYPE=no +[ "$XPLATFORM_MINGW" = "yes" ] && [ "$CFG_LIBFREETYPE" = "auto" ] && CFG_LIBFREETYPE=no if [ "$CFG_LIBFREETYPE" = "auto" ]; then if "$unixtests/compile.test" "$XQMAKESPEC" "$QMAKE_CONFIG" $OPT_VERBOSE "$relpath" "$outpath" config.tests/unix/freetype "FreeType" $L_FLAGS $I_FLAGS $l_FLAGS $MAC_CONFIG_TEST_COMMANDLINE; then CFG_LIBFREETYPE=system @@ -5929,7 +5957,9 @@ if [ "$CFG_LIBFREETYPE" = "auto" ]; then fi if [ "$CFG_ENDIAN" = "auto" ]; then - if [ "$PLATFORM_MAC" = "yes" ]; then + if [ "$XPLATFORM_MINGW" = "yes" ]; then + CFG_ENDIAN="Q_LITTLE_ENDIAN" + elif [ "$PLATFORM_MAC" = "yes" ]; then true #leave as auto elif [ "$XPLATFORM" = "symbian-sbsv2" ]; then CFG_ENDIAN="Q_LITTLE_ENDIAN" @@ -6255,6 +6285,11 @@ if [ "$CFG_AUDIO_BACKEND" = "auto" ]; then fi fi +if [ "$CFG_LARGEFILE" != "yes" ] && [ "$XPLATFORM_MINGW" = "yes" ]; then + echo "Warning: largefile support cannot be disabled for win32." + CFG_LARGEFILE="yes" +fi + #------------------------------------------------------------------------------- # ask for all that hasn't been auto-detected or specified in the arguments #------------------------------------------------------------------------------- @@ -6357,6 +6392,9 @@ if [ "$PLATFORM_MAC" = "yes" ]; then fi fi +# but disable Cocoa if cross-building for mingw +[ "$XPLATFORM_MINGW" = "yes" ] && CFG_MAC_COCOA="no" + # set the global Mac deployment target. This is overridden on an arch-by-arch basis # in some cases, see code further down case "$PLATFORM,$CFG_MAC_COCOA" in @@ -6495,7 +6533,7 @@ QMakeVar set OBJECTS_DIR ".obj/$QMAKE_OUTDIR" QMakeVar set MOC_DIR ".moc/$QMAKE_OUTDIR" QMakeVar set RCC_DIR ".rcc/$QMAKE_OUTDIR" QMakeVar set UI_DIR ".uic/$QMAKE_OUTDIR" -if [ "$CFG_LARGEFILE" = "yes" ]; then +if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then QMAKE_CONFIG="$QMAKE_CONFIG largefile" fi if [ "$CFG_STL" = "no" ]; then @@ -6611,7 +6649,7 @@ else fi -if [ "x$PLATFORM_MAC" = "xyes" ] && [ "$XPLATFORM" != "win32-g++" ]; then +if [ "x$PLATFORM_MAC" = "xyes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then #On Mac we implicitly link against libz, so we #never use the 3rdparty stuff. [ "$CFG_ZLIB" = "yes" ] && CFG_ZLIB="system" @@ -6750,6 +6788,12 @@ if [ "$CFG_EXCEPTIONS" != "no" ]; then QTCONFIG_CONFIG="$QTCONFIG_CONFIG exceptions" fi +if [ "$XPLATFORM_MINGW" = "yes" ]; then + # mkspecs/features/win32/default_pre.prf sets "no-rtti". + # Follow default behavior of configure.exe by overriding with "rtti". + QTCONFIG_CONFIG="$QTCONFIG_CONFIG rtti" +fi + if [ "$CFG_ALSA" = "yes" ]; then QT_CONFIG="$QT_CONFIG alsa" fi @@ -7343,7 +7387,7 @@ EOF echo '/* Compile time features */' >>"$outpath/src/corelib/global/qconfig.h.new" [ '!' -z "$LicenseKeyExt" ] && echo "#define QT_PRODUCT_LICENSEKEY \"$LicenseKeyExt\"" >>"$outpath/src/corelib/global/qconfig.h.new" -if [ "$CFG_LARGEFILE" = "yes" ]; then +if [ "$CFG_LARGEFILE" = "yes" ] && [ "$XPLATFORM_MINGW" != "yes" ]; then echo "#define QT_LARGEFILE_SUPPORT 64" >>"$outpath/src/corelib/global/qconfig.h.new" fi @@ -7688,7 +7732,7 @@ QMAKE_LIBDIR_QT = \$\$QT_BUILD_TREE/lib EOF # Ensure we can link to uninistalled libraries -if linkerSupportsFlag -rpath-link "$outpath/lib"; then +if [ "$XPLATFORM_MINGW" != "yes" ] && linkerSupportsFlag -rpath-link "$outpath/lib"; then echo "QMAKE_LFLAGS += -Wl,-rpath-link,\$\$QT_BUILD_TREE/lib" >> "$CACHEFILE.tmp" fi @@ -8226,7 +8270,9 @@ for file in .projects .projects.3; do [ "$IN_ROOT" = "no" ] && continue case $a in - *winmain/winmain.pro) continue ;; + *winmain/winmain.pro) + [ "$XPLATFORM_MINGW" = "yes" ] || continue + SPEC=$XQMAKESPEC ;; *s60main/s60main.pro) continue ;; *examples/activeqt/*) continue ;; */qmake/qmake.pro) continue ;; diff --git a/mkspecs/unsupported/win32-g++-cross/qmake.conf b/mkspecs/unsupported/win32-g++-cross/qmake.conf new file mode 100644 index 0000000..e338a22 --- /dev/null +++ b/mkspecs/unsupported/win32-g++-cross/qmake.conf @@ -0,0 +1,101 @@ +# +# qmake configuration for win32-g++-cross +# +# Written for MinGW cross building on Unix +# + +MAKEFILE_GENERATOR = MINGW +TEMPLATE = app +CONFIG += qt warn_on release link_prl copy_dir_files debug_and_release debug_and_release_target precompile_header +QT += core gui +DEFINES += UNICODE QT_LARGEFILE_SUPPORT +QMAKE_COMPILER_DEFINES += __GNUC__ WIN32 + +QMAKE_EXT_OBJ = .o +QMAKE_EXT_RES = _res.o + +QMAKE_CC = i686-pc-mingw32-gcc +QMAKE_LEX = flex +QMAKE_LEXFLAGS = +QMAKE_YACC = byacc +QMAKE_YACCFLAGS = -d +QMAKE_CFLAGS = -pipe +QMAKE_CFLAGS_DEPS = -M +QMAKE_CFLAGS_WARN_ON = -Wall +QMAKE_CFLAGS_WARN_OFF = -w +QMAKE_CFLAGS_RELEASE = -O2 +QMAKE_CFLAGS_DEBUG = -g +QMAKE_CFLAGS_YACC = -Wno-unused -Wno-parentheses + +QMAKE_CXX = i686-pc-mingw32-g++ +QMAKE_CXXFLAGS = $$QMAKE_CFLAGS +QMAKE_CXXFLAGS_DEPS = $$QMAKE_CFLAGS_DEPS +QMAKE_CXXFLAGS_WARN_ON = $$QMAKE_CFLAGS_WARN_ON +QMAKE_CXXFLAGS_WARN_OFF = $$QMAKE_CFLAGS_WARN_OFF +QMAKE_CXXFLAGS_RELEASE = $$QMAKE_CFLAGS_RELEASE +QMAKE_CXXFLAGS_DEBUG = $$QMAKE_CFLAGS_DEBUG +QMAKE_CXXFLAGS_YACC = $$QMAKE_CFLAGS_YACC +QMAKE_CXXFLAGS_THREAD = $$QMAKE_CFLAGS_THREAD +QMAKE_CXXFLAGS_RTTI_ON = -frtti +QMAKE_CXXFLAGS_RTTI_OFF = -fno-rtti +QMAKE_CXXFLAGS_EXCEPTIONS_ON = -fexceptions -mthreads +QMAKE_CXXFLAGS_EXCEPTIONS_OFF = -fno-exceptions + +QMAKE_INCDIR = +QMAKE_INCDIR_QT = $$[QT_INSTALL_HEADERS] +QMAKE_LIBDIR_QT = $$[QT_INSTALL_LIBS] + +QMAKE_RUN_CC = $(CC) -c $(CFLAGS) $(INCPATH) -o $obj $src +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 = 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_EXCEPTIONS_OFF = +QMAKE_LFLAGS_RELEASE = -Wl,-s +QMAKE_LFLAGS_DEBUG = +QMAKE_LFLAGS_CONSOLE = -Wl,-subsystem,console +QMAKE_LFLAGS_WINDOWS = -Wl,-subsystem,windows +QMAKE_LFLAGS_DLL = -shared +QMAKE_LINK_OBJECT_MAX = 10 +QMAKE_LINK_OBJECT_SCRIPT= object_script + + +QMAKE_LIBS = +QMAKE_LIBS_CORE = -lkernel32 -luser32 -lshell32 -luuid -lole32 -ladvapi32 -lws2_32 +QMAKE_LIBS_GUI = -lgdi32 -lcomdlg32 -loleaut32 -limm32 -lwinmm -lwinspool -lws2_32 -lole32 -luuid -luser32 -ladvapi32 +QMAKE_LIBS_NETWORK = -lws2_32 +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 + +MINGW_IN_SHELL = 1 +QMAKE_DIR_SEP = / +QMAKE_COPY = cp +QMAKE_COPY_DIR = cp -r +QMAKE_MOVE = mv +QMAKE_DEL_FILE = rm -f +QMAKE_MKDIR = mkdir -p +QMAKE_DEL_DIR = rmdir +QMAKE_SYMBOLIC_LINK = ln -s +QMAKE_CHK_DIR_EXISTS = test -d + +#QMAKE_IDC = i686-pc-mingw32-idc +QMAKE_MOC = i686-pc-mingw32-moc +QMAKE_RCC = i686-pc-mingw32-rcc +QMAKE_UIC = i686-pc-mingw32-uic + +#QMAKE_IDL = midl +QMAKE_LIB = i686-pc-mingw32-ar -ru +QMAKE_RC = i686-pc-mingw32-windres +QMAKE_ZIP = zip -r -9 + +QMAKE_STRIP = i686-pc-mingw32-strip +QMAKE_STRIPFLAGS_LIB += --strip-unneeded +PKG_CONFIG = i686-pc-mingw32-pkg-config +load(qt_config) diff --git a/mkspecs/unsupported/win32-g++-cross/qplatformdefs.h b/mkspecs/unsupported/win32-g++-cross/qplatformdefs.h new file mode 100644 index 0000000..309e24a --- /dev/null +++ b/mkspecs/unsupported/win32-g++-cross/qplatformdefs.h @@ -0,0 +1,42 @@ +/**************************************************************************** +** +** 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 qmake spec of the Qt Toolkit. +** +** $QT_BEGIN_LICENSE:LGPL$ +** No Commercial Usage +** This file contains pre-release code and may not be distributed. +** You may use this file in accordance with the terms and conditions +** contained in the Technology Preview License Agreement accompanying +** this package. +** +** 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. +** +** If you have questions regarding the use of this file, please contact +** Nokia at qt-info@nokia.com. +** +** +** +** +** +** +** +** +** $QT_END_LICENSE$ +** +****************************************************************************/ + +#include "../../win32-g++/qplatformdefs.h" diff --git a/qmake/generators/metamakefile.cpp b/qmake/generators/metamakefile.cpp index ad8750b..e98831d 100644 --- a/qmake/generators/metamakefile.cpp +++ b/qmake/generators/metamakefile.cpp @@ -529,9 +529,18 @@ MetaMakefileGenerator::modesForGenerator(const QString &gen, *host_mode = Option::HOST_UNIX_MODE; *target_mode = Option::TARG_UNIX_MODE; #endif - } else if (gen == "MSVC.NET" || gen == "MINGW" || gen == "BMAKE" || gen == "MSBUILD") { + } else if (gen == "MSVC.NET" || gen == "BMAKE" || gen == "MSBUILD") { *host_mode = Option::HOST_WIN_MODE; *target_mode = Option::TARG_WIN_MODE; + } else if (gen == "MINGW") { +#if defined(Q_OS_MAC) + *host_mode = Option::HOST_MACX_MODE; +#elif defined(Q_OS_UNIX) + *host_mode = Option::HOST_UNIX_MODE; +#else + *host_mode = Option::HOST_WIN_MODE; +#endif + *target_mode = Option::TARG_WIN_MODE; } else if (gen == "PROJECTBUILDER" || gen == "XCODE") { *host_mode = Option::HOST_MACX_MODE; *target_mode = Option::TARG_MACX_MODE; diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 0936d15..5685d6b 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -371,7 +371,12 @@ void MingwMakefileGenerator::writeObjectsPart(QTextStream &t) ar_script_file += "." + var("BUILD_NAME"); } createArObjectScriptFile(ar_script_file, var("DEST_TARGET"), project->values("OBJECTS")); - objectsLinkLine = "ar -M < " + ar_script_file; + // QMAKE_LIB is used for win32, including mingw, whereas QMAKE_AR is used on Unix. + // Strip off any options since the ar commands will be read from file. + QString ar_cmd = var("QMAKE_LIB").section(" ", 0, 0);; + if (ar_cmd.isEmpty()) + ar_cmd = "ar"; + objectsLinkLine = ar_cmd + " -M < " + ar_script_file; } else { QString ld_script_file = var("QMAKE_LINK_OBJECT_SCRIPT") + "." + var("TARGET"); if (!var("BUILD_NAME").isEmpty()) { |