qt5{14,15}.qtbase: fix on darwin

This commit is contained in:
Dmitry Kalinkin 2020-11-11 21:07:09 -05:00
parent f3dc13bd09
commit 0c74da1342
No known key found for this signature in database
GPG key ID: 5157B3EC8B2CA333
10 changed files with 196 additions and 242 deletions

View file

@ -54,7 +54,10 @@ let
qtbase =
optionals stdenv.isDarwin [
./qtbase.patch.d/0001-qtbase-mkspecs-mac.patch
./qtbase.patch.d/0002-qtbase-mac.patch
# Downgrade minimal required SDK to 10.12
./qtbase.patch.d/0013-define-kiosurfacesuccess.patch
./qtbase.patch.d/qtbase-sdk-10.12-mac.patch
# Patch framework detection to support X.framework/X.tbd,
# extending the current support for X.framework/X.

View file

@ -309,10 +309,8 @@ index e3534561a5..3b01424e67 100644
-xcode_copy_phase_strip_setting.value = NO
-QMAKE_MAC_XCODE_SETTINGS += xcode_copy_phase_strip_setting
diff --git a/mkspecs/features/mac/sdk.mk b/mkspecs/features/mac/sdk.mk
deleted file mode 100644
index c40f58c987..0000000000
--- a/mkspecs/features/mac/sdk.mk
+++ /dev/null
+++ b/mkspecs/features/mac/sdk.mk
@@ -1,25 +0,0 @@
-
-ifeq ($(QT_MAC_SDK_NO_VERSION_CHECK),)

View file

@ -1,116 +0,0 @@
From ccaa916eab33093704293bc911eedd85fbe5f160 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Milan=20P=C3=A4ssler?= <me@pbb.lc>
Date: Fri, 3 Apr 2020 21:15:27 +0200
Subject: [PATCH 02/10] qtbase-mac
---
src/corelib/kernel/qcore_mac_p.h | 16 ++++++++++++++--
src/testlib/qappletestlogger.cpp | 2 +-
src/testlib/qappletestlogger_p.h | 2 +-
src/testlib/qtestcase.cpp | 2 +-
src/testlib/qtestlog.cpp | 2 +-
src/testlib/qtestlog_p.h | 2 +-
6 files changed, 19 insertions(+), 7 deletions(-)
diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
index 535d3579b2..3d70bf39c1 100644
--- a/src/corelib/kernel/qcore_mac_p.h
+++ b/src/corelib/kernel/qcore_mac_p.h
@@ -225,7 +225,7 @@ private:
// --------------------------------------------------------------------------
-#if !defined(QT_BOOTSTRAPPED)
+#if 0
QT_END_NAMESPACE
#include <os/activity.h>
@@ -303,7 +303,19 @@ QT_MAC_WEAK_IMPORT(_os_activity_current);
#define QT_APPLE_SCOPED_LOG_ACTIVITY(...) QAppleLogActivity scopedLogActivity = QT_APPLE_LOG_ACTIVITY(__VA_ARGS__).enter();
-#endif // !defined(QT_BOOTSTRAPPED)
+#else // !defined(QT_BOOTSTRAPPED)
+
+#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT3(...)
+#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT2(...)
+#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT(...)
+
+#define QT_APPLE_LOG_ACTIVITY2(...)
+#define QT_APPLE_LOG_ACTIVITY1(...)
+#define QT_APPLE_LOG_ACTIVITY(...)
+
+#define QT_APPLE_SCOPED_LOG_ACTIVITY(...)
+
+#endif
// -------------------------------------------------------------------------
diff --git a/src/testlib/qappletestlogger.cpp b/src/testlib/qappletestlogger.cpp
index dfeadebdef..2a74330c1d 100644
--- a/src/testlib/qappletestlogger.cpp
+++ b/src/testlib/qappletestlogger.cpp
@@ -43,7 +43,7 @@
QT_BEGIN_NAMESPACE
-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
+#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
using namespace QTestPrivate;
diff --git a/src/testlib/qappletestlogger_p.h b/src/testlib/qappletestlogger_p.h
index 62c6d95c5a..f8e0a3b767 100644
--- a/src/testlib/qappletestlogger_p.h
+++ b/src/testlib/qappletestlogger_p.h
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
+#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
class QAppleTestLogger : public QAbstractTestLogger
{
public:
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index 70733a692a..8bcda17858 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -852,7 +852,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, const char *const argv[], bool
bool addFallbackLogger = !explicitLoggerRequested;
-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
+#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
// Any explicitly requested loggers will be added by now, so we can check if they use stdout
const bool safeToAddAppleLogger = !AppleUnifiedLogger::willMirrorToStderr() || !QTestLog::loggerUsingStdout();
if (safeToAddAppleLogger && QAppleTestLogger::debugLoggingEnabled()) {
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index f3ebf343c5..9b4f526b2e 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -465,7 +465,7 @@ void QTestLog::addLogger(LogMode mode, const char *filename)
case QTestLog::TAP:
logger = new QTapTestLogger(filename);
break;
-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
+#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
case QTestLog::Apple:
logger = new QAppleTestLogger;
break;
diff --git a/src/testlib/qtestlog_p.h b/src/testlib/qtestlog_p.h
index fff36f290d..f737ccf064 100644
--- a/src/testlib/qtestlog_p.h
+++ b/src/testlib/qtestlog_p.h
@@ -72,7 +72,7 @@ public:
enum LogMode {
Plain = 0, XML, LightXML, XunitXML, CSV, TeamCity, TAP
-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
+#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
, Apple
#endif
#if defined(HAVE_XCTEST)
--
2.25.1

View file

@ -0,0 +1,16 @@
diff --git a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm
index a367487e..c3aeca1d 100644
--- a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm
+++ b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm
@@ -49,6 +49,11 @@
// but was only added in the 10.14 SDK, so declare it just in case.
extern "C" CFPropertyListRef CGColorSpaceCopyPropertyList(CGColorSpaceRef space);
+// Introduced in 10.13: http://codeworkshop.net/objc-diff/sdkdiffs/macos/10.13/IOSurface.html
+#if !defined(kIOSurfaceSuccess)
+#define kIOSurfaceSuccess KERN_SUCCESS
+#endif
+
QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcQpaIOSurface, "qt.qpa.backingstore.iosurface");

View file

@ -0,0 +1,77 @@
diff --git a/mkspecs/common/macx.conf b/mkspecs/common/macx.conf
--- a/mkspecs/common/macx.conf
+++ b/mkspecs/common/macx.conf
@@ -10,7 +10,7 @@ QMAKE_APPLE_DEVICE_ARCHS = x86_64
# Should be 10.15, but as long as the CI builds with
# older SDKs we have to keep this.
-QT_MAC_SDK_VERSION_MIN = 10.14
+QT_MAC_SDK_VERSION_MIN = 10.12
QT_MAC_SDK_VERSION_MAX = 10.15
diff --git a/src/corelib/kernel/qcore_mac_objc.mm b/src/corelib/kernel/qcore_mac_objc.mm
--- a/src/corelib/kernel/qcore_mac_objc.mm
+++ b/src/corelib/kernel/qcore_mac_objc.mm
@@ -142,16 +142,10 @@ QMacAutoReleasePool::QMacAutoReleasePool()
#ifdef QT_DEBUG
void *poolFrame = nullptr;
- if (__builtin_available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 5.0, *)) {
- void *frame;
- if (backtrace_from_fp(__builtin_frame_address(0), &frame, 1))
- poolFrame = frame;
- } else {
static const int maxFrames = 3;
void *callstack[maxFrames];
if (backtrace(callstack, maxFrames) == maxFrames)
poolFrame = callstack[maxFrames - 1];
- }
if (poolFrame) {
Dl_info info;
diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp
--- a/src/gui/rhi/qrhi.cpp
+++ b/src/gui/rhi/qrhi.cpp
@@ -4050,7 +4050,7 @@ QRhi *QRhi::create(Implementation impl, QRhiInitParams *params, Flags flags, QRh
#endif
case Metal:
//#ifdef Q_OS_DARWIN
-#ifdef Q_OS_MACOS
+#if 0
r->d = new QRhiMetal(static_cast<QRhiMetalInitParams *>(params),
static_cast<QRhiMetalNativeHandles *>(importDevice));
break;
diff --git a/src/gui/rhi/rhi.pri b/src/gui/rhi/rhi.pri
--- a/src/gui/rhi/rhi.pri
+++ b/src/gui/rhi/rhi.pri
@@ -44,7 +44,7 @@ win32 {
}
# darwin {
-macos {
+false {
HEADERS += \
rhi/qrhimetal_p.h \
rhi/qrhimetal_p_p.h
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm
--- a/src/plugins/platforms/cocoa/qcocoadrag.mm
+++ b/src/plugins/platforms/cocoa/qcocoadrag.mm
@@ -134,7 +134,7 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
NSImage *nsimage = qt_mac_create_nsimage(pm);
[nsimage setSize:NSSizeFromCGSize(pmDeviceIndependentSize.toCGSize())];
- QMacPasteboard dragBoard(CFStringRef(NSPasteboardNameDrag), QMacInternalPasteboardMime::MIME_DND);
+ QMacPasteboard dragBoard((CFStringRef) NSDragPboard, QMacInternalPasteboardMime::MIME_DND);
m_drag->mimeData()->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy"));
dragBoard.setMimeData(m_drag->mimeData(), QMacPasteboard::LazyRequest);
@@ -145,7 +145,7 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
CGFloat flippedY = pmDeviceIndependentSize.height() - hotSpot.y();
event_location.y -= flippedY;
NSSize mouseOffset_unused = NSMakeSize(0.0, 0.0);
- NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSPasteboardNameDrag];
+ NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
[theWindow dragImage:nsimage
at:event_location

View file

@ -54,7 +54,10 @@ let
qtbase =
optionals stdenv.isDarwin [
./qtbase.patch.d/0001-qtbase-mkspecs-mac.patch
./qtbase.patch.d/0002-qtbase-mac.patch
# Downgrade minimal required SDK to 10.12
./qtbase.patch.d/0013-define-kiosurfacesuccess.patch
./qtbase.patch.d/qtbase-sdk-10.12-mac.patch
# Patch framework detection to support X.framework/X.tbd,
# extending the current support for X.framework/X.

View file

@ -309,10 +309,8 @@ index e3534561a5..3b01424e67 100644
-xcode_copy_phase_strip_setting.value = NO
-QMAKE_MAC_XCODE_SETTINGS += xcode_copy_phase_strip_setting
diff --git a/mkspecs/features/mac/sdk.mk b/mkspecs/features/mac/sdk.mk
deleted file mode 100644
index c40f58c987..0000000000
--- a/mkspecs/features/mac/sdk.mk
+++ /dev/null
+++ b/mkspecs/features/mac/sdk.mk
@@ -1,25 +0,0 @@
-
-ifeq ($(QT_MAC_SDK_NO_VERSION_CHECK),)

View file

@ -1,118 +0,0 @@
From a9ba67d3db7390d9ddc46751346e70b0a522711a Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Milan=20P=C3=A4ssler?= <me@pbb.lc>
Date: Fri, 3 Apr 2020 21:15:27 +0200
Subject: [PATCH 02/11] qtbase-mac
---
src/corelib/kernel/qcore_mac_p.h | 16 ++++++++++++++--
src/testlib/qappletestlogger.cpp | 2 +-
src/testlib/qappletestlogger_p.h | 2 +-
src/testlib/qtestcase.cpp | 2 +-
src/testlib/qtestlog.cpp | 2 +-
src/testlib/qtestlog_p.h | 4 ++--
6 files changed, 20 insertions(+), 8 deletions(-)
diff --git a/src/corelib/kernel/qcore_mac_p.h b/src/corelib/kernel/qcore_mac_p.h
index 535d3579b2..3d70bf39c1 100644
--- a/src/corelib/kernel/qcore_mac_p.h
+++ b/src/corelib/kernel/qcore_mac_p.h
@@ -225,7 +225,7 @@ private:
// --------------------------------------------------------------------------
-#if !defined(QT_BOOTSTRAPPED)
+#if 0
QT_END_NAMESPACE
#include <os/activity.h>
@@ -303,7 +303,19 @@ QT_MAC_WEAK_IMPORT(_os_activity_current);
#define QT_APPLE_SCOPED_LOG_ACTIVITY(...) QAppleLogActivity scopedLogActivity = QT_APPLE_LOG_ACTIVITY(__VA_ARGS__).enter();
-#endif // !defined(QT_BOOTSTRAPPED)
+#else // !defined(QT_BOOTSTRAPPED)
+
+#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT3(...)
+#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT2(...)
+#define QT_APPLE_LOG_ACTIVITY_WITH_PARENT(...)
+
+#define QT_APPLE_LOG_ACTIVITY2(...)
+#define QT_APPLE_LOG_ACTIVITY1(...)
+#define QT_APPLE_LOG_ACTIVITY(...)
+
+#define QT_APPLE_SCOPED_LOG_ACTIVITY(...)
+
+#endif
// -------------------------------------------------------------------------
diff --git a/src/testlib/qappletestlogger.cpp b/src/testlib/qappletestlogger.cpp
index dfeadebdef..2a74330c1d 100644
--- a/src/testlib/qappletestlogger.cpp
+++ b/src/testlib/qappletestlogger.cpp
@@ -43,7 +43,7 @@
QT_BEGIN_NAMESPACE
-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
+#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
using namespace QTestPrivate;
diff --git a/src/testlib/qappletestlogger_p.h b/src/testlib/qappletestlogger_p.h
index 62c6d95c5a..f8e0a3b767 100644
--- a/src/testlib/qappletestlogger_p.h
+++ b/src/testlib/qappletestlogger_p.h
@@ -57,7 +57,7 @@
QT_BEGIN_NAMESPACE
-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
+#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
class QAppleTestLogger : public QAbstractTestLogger
{
public:
diff --git a/src/testlib/qtestcase.cpp b/src/testlib/qtestcase.cpp
index f45999c7fa..d5b525dc12 100644
--- a/src/testlib/qtestcase.cpp
+++ b/src/testlib/qtestcase.cpp
@@ -849,7 +849,7 @@ Q_TESTLIB_EXPORT void qtest_qParseArgs(int argc, const char *const argv[], bool
bool addFallbackLogger = !explicitLoggerRequested;
-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
+#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
// Any explicitly requested loggers will be added by now, so we can check if they use stdout
const bool safeToAddAppleLogger = !AppleUnifiedLogger::willMirrorToStderr() || !QTestLog::loggerUsingStdout();
if (safeToAddAppleLogger && QAppleTestLogger::debugLoggingEnabled()) {
diff --git a/src/testlib/qtestlog.cpp b/src/testlib/qtestlog.cpp
index a388780532..63ab965101 100644
--- a/src/testlib/qtestlog.cpp
+++ b/src/testlib/qtestlog.cpp
@@ -465,7 +465,7 @@ void QTestLog::addLogger(LogMode mode, const char *filename)
case QTestLog::TAP:
logger = new QTapTestLogger(filename);
break;
-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
+#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
case QTestLog::Apple:
logger = new QAppleTestLogger;
break;
diff --git a/src/testlib/qtestlog_p.h b/src/testlib/qtestlog_p.h
index ddaf14ed9b..0c49c93a88 100644
--- a/src/testlib/qtestlog_p.h
+++ b/src/testlib/qtestlog_p.h
@@ -74,8 +74,8 @@ public:
Q_DISABLE_COPY_MOVE(QTestLog)
enum LogMode {
- Plain = 0, XML, LightXML, JUnitXML, CSV, TeamCity, TAP
-#if defined(QT_USE_APPLE_UNIFIED_LOGGING)
+ Plain = 0, XML, LightXML, XunitXML, CSV, TeamCity, TAP
+#if defined(QT_USE_APPLE_UNIFIED_LOGGING) && 0
, Apple
#endif
#if defined(HAVE_XCTEST)
--
2.25.4

View file

@ -0,0 +1,16 @@
diff --git a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm
index a367487e..c3aeca1d 100644
--- a/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm
+++ b/src/plugins/platforms/cocoa/qiosurfacegraphicsbuffer.mm
@@ -49,6 +49,11 @@
// but was only added in the 10.14 SDK, so declare it just in case.
extern "C" CFPropertyListRef CGColorSpaceCopyPropertyList(CGColorSpaceRef space);
+// Introduced in 10.13: http://codeworkshop.net/objc-diff/sdkdiffs/macos/10.13/IOSurface.html
+#if !defined(kIOSurfaceSuccess)
+#define kIOSurfaceSuccess KERN_SUCCESS
+#endif
+
QT_BEGIN_NAMESPACE
Q_LOGGING_CATEGORY(lcQpaIOSurface, "qt.qpa.backingstore.iosurface");

View file

@ -0,0 +1,77 @@
diff --git a/mkspecs/common/macx.conf b/mkspecs/common/macx.conf
--- a/mkspecs/common/macx.conf
+++ b/mkspecs/common/macx.conf
@@ -10,7 +10,7 @@ QMAKE_APPLE_DEVICE_ARCHS = x86_64
# Should be 10.15, but as long as the CI builds with
# older SDKs we have to keep this.
-QT_MAC_SDK_VERSION_MIN = 10.14
+QT_MAC_SDK_VERSION_MIN = 10.12
QT_MAC_SDK_VERSION_MAX = 10.15
diff --git a/src/corelib/kernel/qcore_mac.mm b/src/corelib/kernel/qcore_mac.mm
--- a/src/corelib/kernel/qcore_mac.mm
+++ b/src/corelib/kernel/qcore_mac.mm
@@ -261,16 +261,10 @@ QMacAutoReleasePool::QMacAutoReleasePool()
#ifdef QT_DEBUG
void *poolFrame = nullptr;
- if (__builtin_available(macOS 10.14, iOS 12.0, tvOS 12.0, watchOS 5.0, *)) {
- void *frame;
- if (backtrace_from_fp(__builtin_frame_address(0), &frame, 1))
- poolFrame = frame;
- } else {
static const int maxFrames = 3;
void *callstack[maxFrames];
if (backtrace(callstack, maxFrames) == maxFrames)
poolFrame = callstack[maxFrames - 1];
- }
if (poolFrame) {
Dl_info info;
diff --git a/src/gui/rhi/qrhi.cpp b/src/gui/rhi/qrhi.cpp
--- a/src/gui/rhi/qrhi.cpp
+++ b/src/gui/rhi/qrhi.cpp
@@ -4251,7 +4251,7 @@ QRhi *QRhi::create(Implementation impl, QRhiInitParams *params, Flags flags, QRh
break;
#endif
case Metal:
-#if defined(Q_OS_MACOS) || defined(Q_OS_IOS)
+#if 0
r->d = new QRhiMetal(static_cast<QRhiMetalInitParams *>(params),
static_cast<QRhiMetalNativeHandles *>(importDevice));
break;
diff --git a/src/gui/rhi/rhi.pri b/src/gui/rhi/rhi.pri
--- a/src/gui/rhi/rhi.pri
+++ b/src/gui/rhi/rhi.pri
@@ -43,7 +43,7 @@ win32 {
LIBS += -ld3d11 -ldxgi -ldxguid
}
-macos|ios {
+false {
HEADERS += \
rhi/qrhimetal_p.h \
rhi/qrhimetal_p_p.h
diff --git a/src/plugins/platforms/cocoa/qcocoadrag.mm b/src/plugins/platforms/cocoa/qcocoadrag.mm
--- a/src/plugins/platforms/cocoa/qcocoadrag.mm
+++ b/src/plugins/platforms/cocoa/qcocoadrag.mm
@@ -133,7 +133,7 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
NSImage *dragImage = [NSImage imageFromQImage:pm.toImage()];
Q_ASSERT(dragImage);
- QMacPasteboard dragBoard(CFStringRef(NSPasteboardNameDrag), QMacInternalPasteboardMime::MIME_DND);
+ QMacPasteboard dragBoard((CFStringRef) NSDragPboard, QMacInternalPasteboardMime::MIME_DND);
m_drag->mimeData()->setData(QLatin1String("application/x-qt-mime-type-name"), QByteArray("dummy"));
dragBoard.setMimeData(m_drag->mimeData(), QMacPasteboard::LazyRequest);
@@ -144,7 +144,7 @@ Qt::DropAction QCocoaDrag::drag(QDrag *o)
CGFloat flippedY = dragImage.size.height - hotSpot.y();
event_location.y -= flippedY;
NSSize mouseOffset_unused = NSMakeSize(0.0, 0.0);
- NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSPasteboardNameDrag];
+ NSPasteboard *pboard = [NSPasteboard pasteboardWithName:NSDragPboard];
[theWindow dragImage:dragImage
at:event_location