From b4e9cb4c29ef797fe535a84717bebf81fbdc61e4 Mon Sep 17 00:00:00 2001 From: Orgad Shaneh Date: Sun, 24 Sep 2017 08:26:30 +0300 Subject: [PATCH 1/6] Qmake: Introduce and use QMAKE_NULL_DEVICE variable Task-number: QTBUG-62985 Change-Id: If1a4cabd54df7d69be1a580dc120f75d6c6b2092 Reviewed-by: Oswald Buddenhagen --- mkspecs/features/ctest_testcase_common.prf | 14 ++------------ mkspecs/features/qt_functions.prf | 5 +---- mkspecs/features/spec_post.prf | 2 ++ mkspecs/features/toolchain.prf | 18 ++++++------------ qmake/generators/win32/mingw_make.cpp | 8 +------- 5 files changed, 12 insertions(+), 35 deletions(-) diff --git a/mkspecs/features/ctest_testcase_common.prf b/mkspecs/features/ctest_testcase_common.prf index cdc5cca1d7..15701b6a41 100644 --- a/mkspecs/features/ctest_testcase_common.prf +++ b/mkspecs/features/ctest_testcase_common.prf @@ -1,10 +1,5 @@ -win32 { - CMAKE_VERSION = $$system(cmake --version 2>NUL, lines) -} else { - CMAKE_VERSION = $$system(cmake --version 2>/dev/null, lines) -} - +CMAKE_VERSION = $$system(cmake --version 2>$$QMAKE_NULL_DEVICE, lines) CMAKE_VERSION = $$member(CMAKE_VERSION, 0, 0) check.commands = @@ -15,12 +10,7 @@ isEmpty(CMAKE_VERSION) { return() } -win32 { - CTEST_VERSION = $$system(ctest --version 2>NUL) -} else { - CTEST_VERSION = $$system(ctest --version 2>/dev/null) -} - +CTEST_VERSION = $$system(ctest --version 2>$$QMAKE_NULL_DEVICE) isEmpty(CTEST_VERSION) { message("ctest executable not found. Not running CMake unit tests") return() diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index c00fdb73f8..1f44650227 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -291,10 +291,7 @@ defineReplace(pkgConfigExecutable) { } } - equals(QMAKE_HOST.os, Windows): \ - PKG_CONFIG += 2> NUL - else: \ - PKG_CONFIG += 2> /dev/null + PKG_CONFIG += 2> $$QMAKE_NULL_DEVICE return($$PKG_CONFIG) } diff --git a/mkspecs/features/spec_post.prf b/mkspecs/features/spec_post.prf index f87bf3c037..62be69ffda 100644 --- a/mkspecs/features/spec_post.prf +++ b/mkspecs/features/spec_post.prf @@ -82,6 +82,7 @@ equals(MAKEFILE_GENERATOR, MSBUILD) \ QMAKE_MKDIR = mkdir # legacy QMAKE_MKDIR_CMD = if not exist %1 mkdir %1 & if not exist %1 exit 1 QMAKE_STREAM_EDITOR = $(QMAKE) -install sed + QMAKE_NULL_DEVICE = NUL QMAKE_INSTALL_FILE = copy /y QMAKE_INSTALL_PROGRAM = copy /y } else { @@ -101,6 +102,7 @@ equals(MAKEFILE_GENERATOR, MSBUILD) \ QMAKE_MKDIR = mkdir -p # legacy QMAKE_MKDIR_CMD = test -d %1 || mkdir -p %1 QMAKE_STREAM_EDITOR = sed + QMAKE_NULL_DEVICE = /dev/null equals(QMAKE_HOST.os, Windows) { MINGW_IN_SHELL = 1 # legacy diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf index 35175f1744..e7ada377d7 100644 --- a/mkspecs/features/toolchain.prf +++ b/mkspecs/features/toolchain.prf @@ -32,15 +32,11 @@ isEmpty($${target_prefix}.INCDIRS) { # Get default include and library paths from compiler # gcc { - !equals(QMAKE_HOST.os, Windows) { - cmd_prefix = "LC_ALL=C" - cmd_suffix = "/dev/null" - null_file = /dev/null - } else { + cmd_suffix = "<$$QMAKE_NULL_DEVICE >$$QMAKE_NULL_DEVICE" + equals(QMAKE_HOST.os, Windows): \ cmd_prefix = "set LC_ALL=C&" - cmd_suffix = "NUL" - null_file = NUL - } + else: \ + cmd_prefix = "LC_ALL=C" cxx_flags = $$QMAKE_CXXFLAGS @@ -59,7 +55,7 @@ isEmpty($${target_prefix}.INCDIRS) { rim_qcc: \ # Need the cc1plus and ld command lines to pick up the paths - cxx_flags += $$QMAKE_LFLAGS_SHLIB -o $$null_file -v + cxx_flags += $$QMAKE_LFLAGS_SHLIB -o $$QMAKE_NULL_DEVICE -v else: darwin:clang: \ # Need to link to pick up library paths cxx_flags += $$QMAKE_LFLAGS_SHLIB -o /dev/null -v -Wl,-v @@ -175,9 +171,7 @@ defineReplace(qtVariablesFromMSVC) { } defineReplace(qtVariablesFromGCC) { - null_device = /dev/null - equals(QMAKE_HOST.os, Windows): null_device = NUL - ret = $$system("$$1 -E $$system_quote($$PWD/data/macros.cpp) <$$null_device 2>$$null_device", lines, ec) + ret = $$system("$$1 -E $$system_quote($$PWD/data/macros.cpp) <$$QMAKE_NULL_DEVICE 2>$$QMAKE_NULL_DEVICE", lines, ec) !equals(ec, 0): qtCompilerErrror($$1) return($$ret) } diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index bad53dc5b7..2d69f708fb 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -36,12 +36,6 @@ #include #include -#ifdef Q_OS_WIN -#define NULL_DEVICE "NUL" -#else -#define NULL_DEVICE "/dev/null" -#endif - QT_BEGIN_NAMESPACE MingwMakefileGenerator::MingwMakefileGenerator() : Win32MakefileGenerator() @@ -329,7 +323,7 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t) if(!project->isEmpty("QMAKE_PRE_LINK")) t << "\n\t" <isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { - t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET) 2>" NULL_DEVICE; + t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET) 2>$$QMAKE_NULL_DEVICE"; if (project->values("OBJECTS").count() < var("QMAKE_LINK_OBJECT_MAX").toInt()) { t << "\n\t$(LIB) $(DESTDIR_TARGET) " << objectsLinkLine << " " ; } else { From 2b51ad471270c01858369f10c7645d863d89160c Mon Sep 17 00:00:00 2001 From: Andy Shaw Date: Mon, 25 Sep 2017 11:28:20 +0200 Subject: [PATCH 2/6] Cups: Check the created QPrintDevice is valid before using it Task-number: QTBUG-63293 Change-Id: Ibde0e8db955f6f3647b31cef8561d0744754cec1 Reviewed-by: Friedemann Kleint --- src/plugins/printsupport/cups/qcupsprintengine.cpp | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/plugins/printsupport/cups/qcupsprintengine.cpp b/src/plugins/printsupport/cups/qcupsprintengine.cpp index e7949d3a0b..6a4eecb06d 100644 --- a/src/plugins/printsupport/cups/qcupsprintengine.cpp +++ b/src/plugins/printsupport/cups/qcupsprintengine.cpp @@ -293,7 +293,7 @@ void QCupsPrintEnginePrivate::changePrinter(const QString &newPrinter) // Try create the printer, only use it if it returns valid QPrintDevice printDevice = ps->createPrintDevice(newPrinter); - if (!m_printDevice.isValid()) + if (!printDevice.isValid()) return; m_printDevice.swap(printDevice); printerName = m_printDevice.id(); From 807fa90b32466fd936704459884c12214d8a254f Mon Sep 17 00:00:00 2001 From: Allan Sandfeld Jensen Date: Tue, 26 Sep 2017 10:57:04 +0200 Subject: [PATCH 3/6] Fix crash with clips entirely outside glyph map When the range to work on is empty just continue to next span. Task-number: QTBUG-63412 Change-Id: Ic5cb77ed438eb9c218f482095aa0cd4e3c2fc6e6 Reviewed-by: Oliver Wolff --- src/gui/painting/qdrawhelper.cpp | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/gui/painting/qdrawhelper.cpp b/src/gui/painting/qdrawhelper.cpp index c78fdfe62e..6c25710271 100644 --- a/src/gui/painting/qdrawhelper.cpp +++ b/src/gui/painting/qdrawhelper.cpp @@ -5627,6 +5627,8 @@ static void qt_alphamapblit_generic(QRasterBuffer *rasterBuffer, int start = qMax(x, clip.x); int end = qMin(x + mapWidth, clip.x + clip.len); + if (end <= start) + continue; Q_ASSERT(end - start <= buffer_size); QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, end - start); @@ -5900,6 +5902,8 @@ static void qt_alphargbblit_generic(QRasterBuffer *rasterBuffer, int start = qMax(x, clip.x); int end = qMin(x + mapWidth, clip.x + clip.len); + if (end <= start) + continue; Q_ASSERT(end - start <= buffer_size); QRgba64 *dest = destFetch64((QRgba64*)buffer, rasterBuffer, start, clip.y, end - start); From 267b1a140aed9ba3c2c4cda0bb6f838cebfbd0d1 Mon Sep 17 00:00:00 2001 From: Friedemann Kleint Date: Tue, 26 Sep 2017 14:45:52 +0200 Subject: [PATCH 4/6] regularexpression example: Fix compilation with clipboard disabled Use the new configure system consistently. Task-number: QTBUG-63429 Change-Id: I6668ba9fde09492f3e60e614103e18e88783d0c4 Reviewed-by: Giuseppe D'Angelo --- .../regularexpression/regularexpressiondialog.cpp | 12 ++++++++++-- 1 file changed, 10 insertions(+), 2 deletions(-) diff --git a/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp b/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp index 7fdce3b674..67d0db4bed 100644 --- a/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp +++ b/examples/widgets/tools/regularexpression/regularexpressiondialog.cpp @@ -129,6 +129,10 @@ PatternLineEdit::PatternLineEdit(QWidget *parent) : connect(escapeSelectionAction, &QAction::triggered, this, &PatternLineEdit::escapeSelection); connect(copyToCodeAction, &QAction::triggered, this, &PatternLineEdit::copyToCode); connect(pasteFromCodeAction, &QAction::triggered, this, &PatternLineEdit::pasteFromCode); +#if !QT_CONFIG(clipboard) + copyToCodeAction->setEnabled(false); + pasteFromCodeAction->setEnabled(false); +#endif } void PatternLineEdit::escapeSelection() @@ -144,12 +148,16 @@ void PatternLineEdit::escapeSelection() void PatternLineEdit::copyToCode() { +#if QT_CONFIG(clipboard) QGuiApplication::clipboard()->setText(patternToCode(text())); +#endif } void PatternLineEdit::pasteFromCode() { +#if QT_CONFIG(clipboard) setText(codeToPattern(QGuiApplication::clipboard()->text())); +#endif } void PatternLineEdit::contextMenuEvent(QContextMenuEvent *event) @@ -316,7 +324,7 @@ void RegularExpressionDialog::refresh() void RegularExpressionDialog::copyEscapedPatternToClipboard() { -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) QClipboard *clipboard = QGuiApplication::clipboard(); if (clipboard) clipboard->setText(escapedPatternLineEdit->text()); @@ -361,7 +369,7 @@ QWidget *RegularExpressionDialog::setupLeftUi() palette.setBrush(QPalette::Base, palette.brush(QPalette::Disabled, QPalette::Base)); escapedPatternLineEdit->setPalette(palette); -#ifndef QT_NO_CLIPBOARD +#if QT_CONFIG(clipboard) QAction *copyEscapedPatternAction = new QAction(this); copyEscapedPatternAction->setText(tr("Copy to clipboard")); copyEscapedPatternAction->setIcon(QIcon(QStringLiteral(":/images/copy.png"))); From 8883e44eca057dce04e94bce50d41c472e4e8f00 Mon Sep 17 00:00:00 2001 From: Jani Heikkinen Date: Fri, 22 Sep 2017 09:02:39 +0300 Subject: [PATCH 5/6] Add changes file for Qt 5.9.2 Task-number: QTBUG-62760 Done-with: Oswald Buddenhagen Change-Id: Ic3f724dd4f85f7a0494e1cf7612277e4bf02d1c3 Reviewed-by: Oliver Wolff Reviewed-by: Thiago Macieira Reviewed-by: Timur Pocheptsov Reviewed-by: Kai Koehne --- dist/changes-5.9.2 | 259 +++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 259 insertions(+) create mode 100644 dist/changes-5.9.2 diff --git a/dist/changes-5.9.2 b/dist/changes-5.9.2 new file mode 100644 index 0000000000..0ed88849ed --- /dev/null +++ b/dist/changes-5.9.2 @@ -0,0 +1,259 @@ +Qt 5.9.2 is a bug-fix release. It maintains both forward and backward +compatibility (source and binary) with Qt 5.9.0. + +For more details, refer to the online documentation included in this +distribution. The documentation is also available online: + +http://doc.qt.io/qt-5/index.html + +The Qt version 5.9 series is binary compatible with the 5.8.x series. +Applications compiled for 5.8 will continue to run with 5.9. + +Some of the changes listed in this file include issue tracking numbers +corresponding to tasks in the Qt Bug Tracker: + +https://bugreports.qt.io/ + +Each of these identifiers can be entered in the bug tracker to obtain more +information about a particular change. + +**************************************************************************** +* Important Behavior Changes * +**************************************************************************** + + - Building examples inside the Qt source tree while not building Qt itself + is rejected now, because this can cause hard to debug configuration + issues. If building isolated examples is needed, you may still use shadow + builds. + + - This version of Qt restores compatibility with pre-5.9.0 calculation of + QCryptographicHash algorithms that were labelled "Sha3_nnn": that is, + applications compiled with old versions of Qt will continue using the + Keccak algorithm. Applications recompiled with this version will use + SHA-3, unless QT_SHA3_KECCAK_COMPAT is #define'd prior to #include + . + +**************************************************************************** +* General Notes * +**************************************************************************** + +Binary Compatibility Note +------------------------- + + - The variable QOperatingSystemVersion::AndroidOreo was added in this + release. Code that uses this variable will not run under Qt 5.9.1. If + backwards compatibility is desired, use instead + QOperatingSystemVersion(QOperatingSystemVersion::Android, 8) + [This is similar to QOperatingSystemVersion::MacOSHighSierra added in + 5.9.1] + + - This version of Qt changes the values assigned to enumerations + QCryptographicHash::Sha3_nnn. Applications compiled with this version and + using those enumerations will not work with Qt 5.9.0 and 5.9.1, unless + QT_SHA3_KECCAK_COMPAT is defined. + +Deprecation Notice +------------------ + + - Starting with Qt 5.10, IPv6 support will be mandatory for all platforms. + Systems without proper IPv6 support, such as the getaddrinfo() function + or the proper socket address structures, will not be able to build + QtNetwork anymore. + +Third-Party Code +---------------- + + - [QTBUG-31020] zlib was updated to version 1.2.11. + - libpng was updated to version 1.6.32 + +**************************************************************************** +* Library * +**************************************************************************** + +QtCore +------ + + - [QTBUG-61350] Fixed the conversion from string to double of the strings + "0E+1" and "0E-1" (with capital E), which QString::toDouble(), + QByteArray::toDouble() and similar functions reported as invalid. + + - QFile: + * [QTBUG-57023] Reverted an incorrect change from Qt 5.9.0 that forbade + the creation and access to Alternate Data Streams on NTFS on Windows. + This means that file names containing a colon (':') are allowed again, + but note that they are not regular files. + + - QFileInfo: + * [QTBUG-62802] Relative symbolic links on Windows are now resolved to + their absolute path by symLinkTarget(). + + - QFileSystemWatcher: + * [QTBUG-62242] Fixed a crash on Windows if this class was instantiated + before QCoreApplication was created. + * [QTBUG-61792] Fixed an issue on Windows that would cause this class not + to monitor files properly if the directory containing the monitored + files was added to the list of watched paths after the files. + + - QLocale: + * [QTBUG-53565] Fixed the conversion of QTime to string form and parsing + from string form to always treat the value as the decimal fraction of + the seconds component. That is, the string format ".z" produces/parses + ".2" for 200 milliseconds and ".002" for 2 milliseconds. Use of "z" or + "zzz" is discouraged outside decimal fractions to avoid surprises. + * [QTBUG-61949] Fixed bcp57Name() to return "en" for the QLocale::c() + locale. Previously, it returned "C", which is not a valid BCP47 + language tag. + + - QProcess: + * [QTBUG-61634] Added a workaround for a rare race-condition bug in + some C libraries that caused the child process started by QProcess to + hang after trying to launch a non-existent executable or change to a + non-existent directory. + * [QTBUG-62584] Fixed a race-condition bug that could cause + waitForXxx() functions to hang forever if a slot triggered by that + function futher started a nested event loop. + + - QTimeZone: + * [QTBUG-63205] Fixed a bug that would cause QTimeZone to mis-parse + timezone files on Unix systems if they contained leap second + information. + + - QVariant: + * [QTBUG-61471] Fixed QVariant to actually perform the conversions + between QVariantHash and QVariantMap in the respective .toHash() and + .toMap() functions. QVariant already reported true in .canConvert() + between those two types. + +QtDBus +------ + + - [QTBUG-62284] Fixed a race condition in QDBusAbstractInterface that + could cause the class to never see the notification that the remote + service became available and cause isValid() to change to true. + +QtGui +----- + + - Text: + * [QTBUG-61520] Fixed matching of non-regular font weights for + application fonts on macOS. + +QtNetwork +--------- + + - [QTBUG-61692] Fixed the handling of application-wide proxy settings (set + with QNetworkProxy): previously, QTcpSocket would directly fall back to + the system settings if the object-specific setting was + QNetworkProxy::DefaultProxy. + + - QLocalSocket: + * [QTBUG-61643] Fixed an issue with Qt pipe-handling code that could + cause deadlocks on Windows, most often if the QLocalSocket object tried + to wait for more data during application shutdown. + +QtTest +------ + + - Added flowId to messages when logging in TeamCity format. FlowId is used + to distinguish logging from multiple processes running in parallel. + +QtWidgets +--------- + + - Android: + * [QTBUG-48639] Fixed label duplication for buttons when using style + sheets with the Android style. + + - QLineEdit: + * [QTBUG-60319] Fixed behavior of the ImSurroundingText query. + Previously, it returned a masked text whose length may be less than + the cursor position. Now it returns unmasked text, so the text length + is always greater than or equal to the cursor position. + + - QMenu: + * [QTBUG-59794] Fixed menu size issue when using high DPI on + multi-screen system. + +**************************************************************************** +* Compiler-specific Changes * +**************************************************************************** + +clang +----- + + - [QTBUG-61840][QTBUG-62085] Fixed an issue that caused recent Clang + versions to print a warning about [[nodiscard]. + +Visual Studio +------------- + + - [QTBUG-61902] Changed Qt uses of certain C++ Standard Library functions + that Visual Studio warns about. Now Qt public headers call + Microsoft-specific versions that do not produce warnings. + +**************************************************************************** +* Platform-specific Changes * +**************************************************************************** + +macOS +----- + + - [QTBUG-59222] Switching focus objects inside a top level window while + composing text using dead keys or input method events would leave the + application in an inconsistent state. The composition now automatically + cancels when the focus object changes. + +Windows +------- + + - [QTBUG-57916] Fixed build with ANGLE and newer MinGW versions. + - [QTBUG-62083] Fixed Qt trying to steal certain events from user windows if + the event ID was WM_USER. + +**************************************************************************** +* Tools * +**************************************************************************** + +configure & build system +------------------------ + + - [QTBUG-35928][QTBUG-41908][Apple] Qt can now be built using just the + Xcode Command Line Tools, without needing to install the full Xcode IDE. + - [QTBUG-55755][Windows] All Qt .exe files now include meta information, + like .dll files already did. + - [QTBUG-58012] (Re-)added a way to specify alternative ICU libraries. + - [QTBUG-62150] Fixed detection of ICU in static builds. + - [QTBUG-53537][X11] Added missing detection of Xinerama. + - [QTBUG-61731][X11] Fixed detection of AT-SPI, allowing accessibility + support to be built again. + - [X11] Fixed detection of x11-xcb with pkg-config. + - [CMake] All Qt module defines are now propagated to the config files. + +qmake +----- + + - [QTBUG-31034] Added qmake feature and configure option to use ccache. + - [QTBUG-48342] Fixed generation of extraneous slashes in -project mode. + - [QTBUG-55633] Fixed misparsing of some string literal concatenations + as C++11 raw strings. This affects dependency scanning. + - [QTBUG-59301][Xcode] Fixed duplicate references in project files. + - [QTBUG-59827][nmake] The 'clean' target now deletes backup files of + MSVC manifests. + - [QTBUG-60455][Android] libc++ is now used instead of libstdc++ when + building with the android-clang mkspec. + - [QTBUG-60430][iOS] Fixed handling of the deprecated variable + QMAKE_IOS_TARGETED_DEVICE_FAMILY. + - [QTBUG-60899][WinRT] Fixed capability handling for Win10 targets. + - [WinRT] Added support for new Win10 capabilities. + - [QTBUG-61335][MinGW] Worked around LTO+MRI linker issue when cross- + building from Linux. + - [QTBUG-61411][Windows] _UNICODE is now defined, consistently with VS. + - [QTBUG-61688][MSVC] Fixed compilation of precompiled headers with + CONFIG+=silent. Done by removing redundant progress messages. + - [QTBUG-61690][QTBUG-61735] Fixed detection of compiler default search + paths for various compilers and platforms. + - [QTBUG-63197][Windows] Fixed moc'ing in a build directory with spaces + when INCLUDEPATH contains 40+ entries. + - [Android] Fixed building with ndkr16+ by using unified headers. + - [Windows] Fixed repeated installation of read-only files. + - [VS] Fixed deployment rules in created solution files. From ec16ba393baf504d4b192cc349775c62d3c96aa0 Mon Sep 17 00:00:00 2001 From: Jani Heikkinen Date: Mon, 2 Oct 2017 09:23:31 +0300 Subject: [PATCH 6/6] Revert "Qmake: Introduce and use QMAKE_NULL_DEVICE variable" With that change QNX7 builds in windows will fail. This reverts commit b4e9cb4c29ef797fe535a84717bebf81fbdc61e4. Task-number: QTBUG-63535 Change-Id: Ia91d173803af62d41d1a7e5832bab911920f590d Reviewed-by: Frederik Gladhorn --- mkspecs/features/ctest_testcase_common.prf | 14 ++++++++++++-- mkspecs/features/qt_functions.prf | 5 ++++- mkspecs/features/spec_post.prf | 2 -- mkspecs/features/toolchain.prf | 18 ++++++++++++------ qmake/generators/win32/mingw_make.cpp | 8 +++++++- 5 files changed, 35 insertions(+), 12 deletions(-) diff --git a/mkspecs/features/ctest_testcase_common.prf b/mkspecs/features/ctest_testcase_common.prf index 15701b6a41..cdc5cca1d7 100644 --- a/mkspecs/features/ctest_testcase_common.prf +++ b/mkspecs/features/ctest_testcase_common.prf @@ -1,5 +1,10 @@ -CMAKE_VERSION = $$system(cmake --version 2>$$QMAKE_NULL_DEVICE, lines) +win32 { + CMAKE_VERSION = $$system(cmake --version 2>NUL, lines) +} else { + CMAKE_VERSION = $$system(cmake --version 2>/dev/null, lines) +} + CMAKE_VERSION = $$member(CMAKE_VERSION, 0, 0) check.commands = @@ -10,7 +15,12 @@ isEmpty(CMAKE_VERSION) { return() } -CTEST_VERSION = $$system(ctest --version 2>$$QMAKE_NULL_DEVICE) +win32 { + CTEST_VERSION = $$system(ctest --version 2>NUL) +} else { + CTEST_VERSION = $$system(ctest --version 2>/dev/null) +} + isEmpty(CTEST_VERSION) { message("ctest executable not found. Not running CMake unit tests") return() diff --git a/mkspecs/features/qt_functions.prf b/mkspecs/features/qt_functions.prf index 1f44650227..c00fdb73f8 100644 --- a/mkspecs/features/qt_functions.prf +++ b/mkspecs/features/qt_functions.prf @@ -291,7 +291,10 @@ defineReplace(pkgConfigExecutable) { } } - PKG_CONFIG += 2> $$QMAKE_NULL_DEVICE + equals(QMAKE_HOST.os, Windows): \ + PKG_CONFIG += 2> NUL + else: \ + PKG_CONFIG += 2> /dev/null return($$PKG_CONFIG) } diff --git a/mkspecs/features/spec_post.prf b/mkspecs/features/spec_post.prf index 62be69ffda..f87bf3c037 100644 --- a/mkspecs/features/spec_post.prf +++ b/mkspecs/features/spec_post.prf @@ -82,7 +82,6 @@ equals(MAKEFILE_GENERATOR, MSBUILD) \ QMAKE_MKDIR = mkdir # legacy QMAKE_MKDIR_CMD = if not exist %1 mkdir %1 & if not exist %1 exit 1 QMAKE_STREAM_EDITOR = $(QMAKE) -install sed - QMAKE_NULL_DEVICE = NUL QMAKE_INSTALL_FILE = copy /y QMAKE_INSTALL_PROGRAM = copy /y } else { @@ -102,7 +101,6 @@ equals(MAKEFILE_GENERATOR, MSBUILD) \ QMAKE_MKDIR = mkdir -p # legacy QMAKE_MKDIR_CMD = test -d %1 || mkdir -p %1 QMAKE_STREAM_EDITOR = sed - QMAKE_NULL_DEVICE = /dev/null equals(QMAKE_HOST.os, Windows) { MINGW_IN_SHELL = 1 # legacy diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf index e7ada377d7..35175f1744 100644 --- a/mkspecs/features/toolchain.prf +++ b/mkspecs/features/toolchain.prf @@ -32,11 +32,15 @@ isEmpty($${target_prefix}.INCDIRS) { # Get default include and library paths from compiler # gcc { - cmd_suffix = "<$$QMAKE_NULL_DEVICE >$$QMAKE_NULL_DEVICE" - equals(QMAKE_HOST.os, Windows): \ - cmd_prefix = "set LC_ALL=C&" - else: \ + !equals(QMAKE_HOST.os, Windows) { cmd_prefix = "LC_ALL=C" + cmd_suffix = "/dev/null" + null_file = /dev/null + } else { + cmd_prefix = "set LC_ALL=C&" + cmd_suffix = "NUL" + null_file = NUL + } cxx_flags = $$QMAKE_CXXFLAGS @@ -55,7 +59,7 @@ isEmpty($${target_prefix}.INCDIRS) { rim_qcc: \ # Need the cc1plus and ld command lines to pick up the paths - cxx_flags += $$QMAKE_LFLAGS_SHLIB -o $$QMAKE_NULL_DEVICE -v + cxx_flags += $$QMAKE_LFLAGS_SHLIB -o $$null_file -v else: darwin:clang: \ # Need to link to pick up library paths cxx_flags += $$QMAKE_LFLAGS_SHLIB -o /dev/null -v -Wl,-v @@ -171,7 +175,9 @@ defineReplace(qtVariablesFromMSVC) { } defineReplace(qtVariablesFromGCC) { - ret = $$system("$$1 -E $$system_quote($$PWD/data/macros.cpp) <$$QMAKE_NULL_DEVICE 2>$$QMAKE_NULL_DEVICE", lines, ec) + null_device = /dev/null + equals(QMAKE_HOST.os, Windows): null_device = NUL + ret = $$system("$$1 -E $$system_quote($$PWD/data/macros.cpp) <$$null_device 2>$$null_device", lines, ec) !equals(ec, 0): qtCompilerErrror($$1) return($$ret) } diff --git a/qmake/generators/win32/mingw_make.cpp b/qmake/generators/win32/mingw_make.cpp index 2d69f708fb..bad53dc5b7 100644 --- a/qmake/generators/win32/mingw_make.cpp +++ b/qmake/generators/win32/mingw_make.cpp @@ -36,6 +36,12 @@ #include #include +#ifdef Q_OS_WIN +#define NULL_DEVICE "NUL" +#else +#define NULL_DEVICE "/dev/null" +#endif + QT_BEGIN_NAMESPACE MingwMakefileGenerator::MingwMakefileGenerator() : Win32MakefileGenerator() @@ -323,7 +329,7 @@ void MingwMakefileGenerator::writeBuildRulesPart(QTextStream &t) if(!project->isEmpty("QMAKE_PRE_LINK")) t << "\n\t" <isActiveConfig("staticlib") && project->first("TEMPLATE") == "lib") { - t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET) 2>$$QMAKE_NULL_DEVICE"; + t << "\n\t-$(DEL_FILE) $(DESTDIR_TARGET) 2>" NULL_DEVICE; if (project->values("OBJECTS").count() < var("QMAKE_LINK_OBJECT_MAX").toInt()) { t << "\n\t$(LIB) $(DESTDIR_TARGET) " << objectsLinkLine << " " ; } else {