Files
haikuports/dev-qt/qt6-base/patches/qt6_base-6.10.3.patchset
2026-04-13 14:34:59 +00:00

1112 lines
35 KiB
Plaintext

From aca918e6c771388bad4473d63da56b2f9264567c Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 20 Oct 2023 10:16:14 +1000
Subject: Make sure libs are searched in the develop/ dir by CMake
diff --git a/mkspecs/features/create_cmake.prf b/mkspecs/features/create_cmake.prf
index 24ed125..52f637e 100644
--- a/mkspecs/features/create_cmake.prf
+++ b/mkspecs/features/create_cmake.prf
@@ -112,6 +112,9 @@ win32:!static:!staticlib {
CMAKE_DLL_DIR = $$[QT_INSTALL_BINS]/
CMAKE_DLL_DIR_IS_ABSOLUTE = True
}
+} else:haiku {
+ CMAKE_DLL_DIR = develop/$$CMAKE_LIB_DIR
+ CMAKE_DLL_DIR_IS_ABSOLUTE = $$CMAKE_LIB_DIR_IS_ABSOLUTE
} else {
CMAKE_DLL_DIR = $$CMAKE_LIB_DIR
CMAKE_DLL_DIR_IS_ABSOLUTE = $$CMAKE_LIB_DIR_IS_ABSOLUTE
--
2.52.0
From ebbe56cc4c9ee2bbec45a79b65f3f72061a89ef6 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 20 Oct 2023 10:16:34 +1000
Subject: Fix QStandartPaths for Haiku
diff --git a/src/corelib/io/qstandardpaths_haiku.cpp b/src/corelib/io/qstandardpaths_haiku.cpp
index f473ebe..2560722 100644
--- a/src/corelib/io/qstandardpaths_haiku.cpp
+++ b/src/corelib/io/qstandardpaths_haiku.cpp
@@ -112,15 +112,16 @@ QString QStandardPaths::writableLocation(StandardLocation type)
return haikuStandardPath(B_USER_NONPACKAGED_BIN_DIRECTORY);
case TempLocation:
return haikuStandardPath(B_SYSTEM_TEMP_DIRECTORY);
- case AppDataLocation: // fall through
+ case AppDataLocation:
+ return haikuAppStandardPath(B_SYSTEM_CACHE_DIRECTORY);
case AppLocalDataLocation:
- return haikuAppStandardPath(B_USER_NONPACKAGED_DATA_DIRECTORY);
+ return haikuAppStandardPath(B_USER_CACHE_DIRECTORY);
case GenericDataLocation:
- return haikuStandardPath(B_USER_NONPACKAGED_DATA_DIRECTORY);
+ return haikuAppStandardPath(B_SYSTEM_CACHE_DIRECTORY);
case CacheLocation:
return haikuAppStandardPath(B_USER_CACHE_DIRECTORY);
case GenericCacheLocation:
- return haikuStandardPath(B_USER_CACHE_DIRECTORY);
+ return haikuStandardPath(B_SYSTEM_CACHE_DIRECTORY);
case ConfigLocation:
case AppConfigLocation:
case StateLocation:
@@ -129,7 +130,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
case GenericConfigLocation:
return haikuStandardPath(B_USER_SETTINGS_DIRECTORY);
default:
- return QString();
+ return haikuAppStandardPath(B_USER_SETTINGS_DIRECTORY);
}
}
@@ -150,7 +151,7 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
case PublicShareLocation:
case TemplatesLocation:
case HomeLocation:
- paths += haikuStandardPath(B_USER_NONPACKAGED_DIRECTORY);
+ paths += haikuStandardPath(B_USER_DIRECTORY);
break;
case FontsLocation:
paths += haikuStandardPaths(B_FIND_PATH_FONTS_DIRECTORY);
@@ -174,7 +175,7 @@ QStringList QStandardPaths::standardLocations(StandardLocation type)
break;
case ConfigLocation: // fall through
case AppConfigLocation:
- paths += haikuAppStandardPath(B_SYSTEM_SETTINGS_DIRECTORY);
+ paths += haikuAppStandardPath(B_USER_SETTINGS_DIRECTORY);
break;
case GenericConfigLocation:
paths += haikuStandardPath(B_SYSTEM_SETTINGS_DIRECTORY);
--
2.52.0
From 10940c9d06e10195e86e349815a0674f0727f35e Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 20 Oct 2023 10:16:55 +1000
Subject: QSslSocketPrivate::unixRootCertDirectories(): add ssl path for Haiku.
diff --git a/src/network/ssl/qsslsocket.cpp b/src/network/ssl/qsslsocket.cpp
index 46859a2..7be4dd0 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -2972,6 +2972,7 @@ QList<QByteArray> QSslSocketPrivate::unixRootCertDirectories()
ba("/usr/local/ssl/certs/"), // Solaris
ba("/etc/openssl/certs/"), // BlackBerry
ba("/opt/openssl/certs/"), // HP-UX
+ ba("/system/data/ssl/"), // Haiku
ba("/etc/ssl/"), // OpenBSD
};
QList<QByteArray> result = QList<QByteArray>::fromReadOnlyData(dirs);
--
2.52.0
From e313ee421d568e9b045c0296d08c945c9b3aa149 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 20 Oct 2023 10:45:27 +1000
Subject: Fix build for Haiku platform
diff --git a/mkspecs/features/toolchain.prf b/mkspecs/features/toolchain.prf
index 13bf7f1..aaa22ee 100644
--- a/mkspecs/features/toolchain.prf
+++ b/mkspecs/features/toolchain.prf
@@ -263,7 +263,7 @@ isEmpty($${target_prefix}.INCDIRS) {
}
}
}
- if(!darwin:clang)|intel_icc {
+ if(!darwin:clang)|haiku|intel_icc {
# Clang on a non-Apple system (that is, a system without ld64 -- say, with GNU ld
# or gold under Linux) will not print any library search path. Need to use another
# invocation with different options (which in turn doesn't print include search
--
2.52.0
From 7b52d12df220ba3e863192d790becc51f421157e Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 20 Oct 2023 10:45:56 +1000
Subject: Fix endian detection
diff --git a/src/3rdparty/sha3/brg_endian.h b/src/3rdparty/sha3/brg_endian.h
index 0baac93..1d48cbc 100644
--- a/src/3rdparty/sha3/brg_endian.h
+++ b/src/3rdparty/sha3/brg_endian.h
@@ -39,10 +39,10 @@ Changes for ARM 9/9/2010 [Downstream relative to Gladman's GitHub, upstream to Q
#elif defined( BSD ) && ( BSD >= 199103 ) || defined( __APPLE__ ) || \
defined( __CYGWIN32__ ) || defined( __DJGPP__ ) || defined( __osf__ )
# include <machine/endian.h>
-#elif defined( __linux__ ) || defined( __GNUC__ ) || defined( __GNU_LIBRARY__ )
+#elif defined( __linux__ ) || defined( __HAIKU__ ) || defined( __GNUC__ ) || defined( __GNU_LIBRARY__ )
# if !defined( __MINGW32__ ) && !defined( _AIX ) && !defined(Q_OS_QNX)
# include <endian.h>
-# if !defined( __BEOS__ ) && !defined(Q_OS_RTEMS) && !defined(Q_OS_VXWORKS)
+# if !defined( __BEOS__ ) && !defined( __HAIKU__ ) && !defined(Q_OS_RTEMS) && !defined(Q_OS_VXWORKS)
# include <byteswap.h>
# endif
# endif
--
2.52.0
From 185de4e1a57428f3cdf00e954351e56b8ea777f3 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 20 Oct 2023 12:11:52 +1000
Subject: Disable LibResolv for Haiku
diff --git a/src/network/kernel/qhostinfo_unix.cpp b/src/network/kernel/qhostinfo_unix.cpp
index 1883f41..1e10854 100644
--- a/src/network/kernel/qhostinfo_unix.cpp
+++ b/src/network/kernel/qhostinfo_unix.cpp
@@ -51,6 +51,8 @@ static void maybeRefreshResolver()
// res_init() is not thread-safe; executing it leads to state corruption.
// Whether it reloads resolv.conf on its own is unknown.
return;
+#elif defined(Q_OS_HAIKU)
+ return;
#endif
#if QT_CONFIG(libresolv)
--
2.52.0
From a369a6a5e3f87cecfec793e02c574296af29e219 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 20 Oct 2023 12:15:38 +1000
Subject: Don't use ifaddrs for Haiku
diff --git a/src/network/kernel/qnetworkinterface_unix.cpp b/src/network/kernel/qnetworkinterface_unix.cpp
index 5313e17..03bb881 100644
--- a/src/network/kernel/qnetworkinterface_unix.cpp
+++ b/src/network/kernel/qnetworkinterface_unix.cpp
@@ -22,7 +22,7 @@
# include <ifaddrs.h>
#endif
-#ifdef QT_LINUXBASE
+#if defined(QT_LINUXBASE) || defined(Q_OS_HAIKU)
# include <arpa/inet.h>
# ifndef SIOCGIFBRDADDR
# define SIOCGIFBRDADDR 0x8919
--
2.52.0
From a37fa9ca1403d1420b2df25c3ecb6b54b5d2eb02 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 20 Oct 2023 12:15:58 +1000
Subject: Disable sharedmemory feature for bootstrap
diff --git a/src/tools/bootstrap/CMakeLists.txt b/src/tools/bootstrap/CMakeLists.txt
index 4ed8169..bbfc3d6 100644
--- a/src/tools/bootstrap/CMakeLists.txt
+++ b/src/tools/bootstrap/CMakeLists.txt
@@ -79,6 +79,7 @@ qt_internal_extend_target(Bootstrap
QT_NO_CAST_FROM_ASCII
QT_NO_CAST_TO_ASCII
QT_NO_FOREACH
+ QT_NO_SHAREDMEMORY
INCLUDE_DIRECTORIES
..
../../3rdparty/tinycbor/src
--
2.52.0
From 292d2c08004325941457efd91d49dc3a4c1eef58 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 20 Oct 2023 12:16:20 +1000
Subject: Fix build for x86_gcc2
diff --git a/src/3rdparty/forkfd/forkfd.c b/src/3rdparty/forkfd/forkfd.c
index 465258e..4cb6b0c 100644
--- a/src/3rdparty/forkfd/forkfd.c
+++ b/src/3rdparty/forkfd/forkfd.c
@@ -680,7 +680,7 @@ static int forkfd_fork_fallback(int flags, pid_t *ppid)
/* parent process */
info->deathPipe = death_pipe[1];
fd = death_pipe[0];
- ffd_atomic_store(&info->pid, pid, FFD_ATOMIC_RELEASE);
+ ffd_atomic_store(&info->pid, (int32_t)pid, FFD_ATOMIC_RELEASE);
/* release the child */
#ifdef HAVE_EVENTFD
--
2.52.0
From 89d11d7cded303e340e062e47977b6fe68cd8287 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 20 Oct 2023 12:17:49 +1000
Subject: Implement QFilesystemWatcher for Haiku
diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt
index d3b6af0..0e101c4 100644
--- a/src/corelib/CMakeLists.txt
+++ b/src/corelib/CMakeLists.txt
@@ -1044,6 +1044,11 @@ qt_internal_extend_target(Core CONDITION MACOS AND QT_FEATURE_filesystemwatcher
io/qfilesystemwatcher_fsevents.mm io/qfilesystemwatcher_fsevents_p.h
)
+qt_internal_extend_target(Core CONDITION QT_FEATURE_filesystemwatcher AND HAIKU
+ SOURCES
+ io/qfilesystemwatcher_haiku.cpp io/qfilesystemwatcher_haiku_p.h
+)
+
qt_internal_extend_target(Core CONDITION QT_FEATURE_filesystemwatcher AND QT_FEATURE_inotify AND UNIX AND NOT MACOS
SOURCES
io/qfilesystemwatcher_inotify.cpp io/qfilesystemwatcher_inotify_p.h
diff --git a/src/corelib/io/qfilesystemwatcher.cpp b/src/corelib/io/qfilesystemwatcher.cpp
index cd72f21..ba27bae 100644
--- a/src/corelib/io/qfilesystemwatcher.cpp
+++ b/src/corelib/io/qfilesystemwatcher.cpp
@@ -18,6 +18,8 @@
#include "qfilesystemwatcher_polling_p.h"
#if defined(Q_OS_WIN)
# include "qfilesystemwatcher_win_p.h"
+#elif defined(Q_OS_HAIKU)
+# include "qfilesystemwatcher_haiku_p.h"
#elif defined(USE_INOTIFY)
# include "qfilesystemwatcher_inotify_p.h"
#elif defined(Q_OS_FREEBSD) || defined(Q_OS_NETBSD) || defined(Q_OS_OPENBSD) || defined(QT_PLATFORM_UIKIT)
@@ -39,6 +41,8 @@ QFileSystemWatcherEngine *QFileSystemWatcherPrivate::createNativeEngine(QObject
{
#if defined(Q_OS_WIN)
return new QWindowsFileSystemWatcherEngine(parent);
+#elif defined(Q_OS_HAIKU)
+ return new QHaikuFileSystemWatcherEngine(parent);
#elif defined(USE_INOTIFY)
// there is a chance that inotify may fail on Linux pre-2.6.13 (August
// 2005), so we can't just new inotify directly.
diff --git a/src/corelib/io/qfilesystemwatcher_haiku.cpp b/src/corelib/io/qfilesystemwatcher_haiku.cpp
new file mode 100644
index 0000000..92a2647
--- /dev/null
+++ b/src/corelib/io/qfilesystemwatcher_haiku.cpp
@@ -0,0 +1,254 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Copyright (C) 2015-2020 Gerasim Troeglazov,
+** Contact: 3dEyes@gmail.com
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#include "qfilesystemwatcher_haiku_p.h"
+#include <QtCore/qscopeguard.h>
+#include <QtCore/qtimer.h>
+#include <QDebug>
+
+QT_BEGIN_NAMESPACE
+
+QHaikuFileWatcher::QHaikuFileWatcher() : QObject(), BLooper() {};
+QHaikuDirWatcher::QHaikuDirWatcher() : QObject(), BLooper() {};
+
+QHaikuFileSystemWatcherEngine::QHaikuFileSystemWatcherEngine(QObject *parent)
+ : QFileSystemWatcherEngine(parent)
+{
+ fileLooper = new QHaikuFileWatcher();
+ connect(fileLooper, SIGNAL(fileChanged(const QString &, bool)), SLOT(bfsFileChanged(const QString &, bool)));
+ fileLooper->Run();
+
+ dirLooper = new QHaikuDirWatcher();
+ connect(dirLooper, SIGNAL(directoryChanged(const QString &, bool)), SLOT(bfsDirectoryChanged(const QString &, bool)));
+ dirLooper->Run();
+}
+
+QHaikuFileSystemWatcherEngine::~QHaikuFileSystemWatcherEngine()
+{
+ stop_watching(fileLooper);
+ if (fileLooper->Lock())
+ fileLooper->Quit();
+
+ stop_watching(dirLooper);
+ if (dirLooper->Lock())
+ dirLooper->Quit();
+}
+
+QStringList QHaikuFileSystemWatcherEngine::addPaths(const QStringList &paths,
+ QStringList *files,
+ QStringList *directories)
+{
+ QStringList unhandled;
+ for (const QString &path : paths) {
+ QFileInfo fi(path);
+ bool isDir = fi.isDir();
+ auto sg = qScopeGuard([&]{ unhandled.push_back(path); });
+ if (isDir) {
+ if (directories->contains(path))
+ continue;
+ } else {
+ if (files->contains(path))
+ continue;
+ }
+
+ BEntry entry(path.toUtf8().constData());
+ if (!entry.Exists())
+ continue;
+
+ node_ref nref;
+ entry.GetNodeRef(&nref);
+ status_t status = isDir ?
+ watch_node(&nref, (B_WATCH_NAME | B_WATCH_ATTR | B_WATCH_STAT | B_WATCH_DIRECTORY), dirLooper):
+ watch_node(&nref, (B_WATCH_NAME | B_WATCH_ATTR | B_WATCH_STAT), fileLooper);
+
+ if (status != B_OK) {
+ qWarning("watch_node(%s) failed:", path.toUtf8().constData());
+ continue;
+ }
+
+ sg.dismiss();
+
+ if (isDir)
+ directories->append(path);
+ else
+ files->append(path);
+ }
+ return unhandled;
+}
+
+QStringList QHaikuFileSystemWatcherEngine::removePaths(const QStringList &paths,
+ QStringList *files,
+ QStringList *directories)
+{
+ QStringList unhandled;
+ for (const QString &path : paths) {
+ auto sg = qScopeGuard([&]{ unhandled.push_back(path); });
+
+ BEntry entry(path.toUtf8().constData());
+ node_ref nref;
+ entry.GetNodeRef(&nref);
+
+ if (directories->contains(path)) {
+ directories->removeAll(path);
+ watch_node(&nref, B_STOP_WATCHING, dirLooper);
+ } else if (files->contains(path)) {
+ files->removeAll(path);
+ watch_node(&nref, B_STOP_WATCHING, fileLooper);
+ } else {
+ continue;
+ }
+
+ sg.dismiss();
+ }
+
+ return unhandled;
+}
+
+void
+QHaikuDirWatcher::MessageReceived(BMessage* message)
+{
+ if (message->what == B_NODE_MONITOR) {
+ int32 opcode;
+
+ if (message->FindInt32("opcode", &opcode) != B_OK)
+ return;
+
+ switch (opcode) {
+ case B_ENTRY_MOVED:
+ {
+ int32 device = 0;
+ int64 srcFolder = 0;
+ int64 dstFolder = 0;
+ const char* name = NULL;
+ if (message->FindInt32("device", &device) != B_OK
+ || message->FindInt64("to directory", &dstFolder) != B_OK
+ || message->FindInt64("from directory", &srcFolder) != B_OK
+ || message->FindString("name", &name) != B_OK)
+ break;
+
+ entry_ref ref(device, srcFolder, name);
+ BEntry entry(&ref);
+
+ BEntry dirEntry;
+ entry.GetParent(&dirEntry);
+
+ BPath path;
+ dirEntry.GetPath(&path);
+
+ QString qpath = QString::fromUtf8(path.Path());
+
+ emit directoryChanged(qpath, false);
+ }
+ break;
+ case B_ENTRY_CREATED:
+ case B_ENTRY_REMOVED:
+ {
+ int64 directory;
+ int32 device;
+ int64 node;
+ const char *name;
+ if (message->FindInt64("directory", &directory) != B_OK
+ || message->FindInt32("device", &device) != B_OK
+ || message->FindInt64("node", &node) != B_OK
+ || message->FindString("name", &name) != B_OK)
+ break;
+
+ entry_ref ref(device, directory, name);
+ BEntry entry(&ref);
+ BEntry dirEntry;
+ entry.GetParent(&dirEntry);
+
+ BPath path;
+ dirEntry.GetPath(&path);
+
+ QString qpath = QString::fromUtf8(path.Path());
+ emit directoryChanged(qpath, opcode == B_ENTRY_REMOVED);
+ }
+ break;
+ }
+ }
+}
+
+void
+QHaikuFileWatcher::MessageReceived(BMessage* message)
+{
+ if (message->what == B_NODE_MONITOR) {
+ int32 opcode;
+ node_ref nref;
+ const char *name;
+
+ if (message->FindInt32("opcode", &opcode) != B_OK)
+ return;
+
+ switch (opcode) {
+ case B_ENTRY_MOVED:
+ {
+ int32 device = 0;
+ int64 srcFolder = 0;
+ int64 dstFolder = 0;
+ const char* name = NULL;
+ if (message->FindInt32("device", &device) != B_OK
+ || message->FindInt64("to directory", &dstFolder) != B_OK
+ || message->FindInt64("from directory", &srcFolder) != B_OK
+ || message->FindString("name", &name) != B_OK)
+ break;
+
+ entry_ref ref(device, srcFolder, name);
+ BEntry entry(&ref);
+
+ BPath path;
+ entry.GetPath(&path);
+
+ QString qpath = QString::fromUtf8(path.Path());
+
+ emit fileChanged(qpath, false);
+ }
+ break;
+ case B_STAT_CHANGED:
+ case B_ATTR_CHANGED:
+ BString path;
+ if (message->FindString("path", &path) == B_OK) {
+ QString qpath = QString::fromUtf8(path.String());
+
+ QFileInfo fi(qpath);
+ if (!fi.exists())
+ emit fileChanged(qpath, true);
+ else
+ emit fileChanged(qpath, false);
+ }
+ break;
+ }
+ }
+}
+
+void
+QHaikuFileSystemWatcherEngine::bfsDirectoryChanged(const QString &path, bool removed)
+{
+ emit directoryChanged(path, removed);
+}
+
+void
+QHaikuFileSystemWatcherEngine::bfsFileChanged(const QString &path, bool removed)
+{
+ emit fileChanged(path, removed);
+}
+
+QT_END_NAMESPACE
+
+#include "moc_qfilesystemwatcher_haiku_p.cpp"
diff --git a/src/corelib/io/qfilesystemwatcher_haiku_p.h b/src/corelib/io/qfilesystemwatcher_haiku_p.h
new file mode 100644
index 0000000..0ae4bdf
--- /dev/null
+++ b/src/corelib/io/qfilesystemwatcher_haiku_p.h
@@ -0,0 +1,84 @@
+/****************************************************************************
+**
+** Copyright (C) 2020 The Qt Company Ltd.
+** Copyright (C) 2015-2020 Gerasim Troeglazov,
+** Contact: 3dEyes@gmail.com
+**
+** GNU General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU
+** General Public License version 2.0 or (at your option) the GNU General
+** Public license version 3 or any later version approved by the KDE Free
+** Qt Foundation. The licenses are as published by the Free Software
+** Foundation and appearing in the file LICENSE.GPL2 and LICENSE.GPL3
+** included in the packaging of this file. Please review the following
+** information to ensure the GNU General Public License requirements will
+** be met: https://www.gnu.org/licenses/gpl-2.0.html and
+** https://www.gnu.org/licenses/gpl-3.0.html.
+**
+****************************************************************************/
+
+#ifndef QFILESYSTEMWATCHER_HAIKU_P_H
+#define QFILESYSTEMWATCHER_HAIKU_P_H
+
+#include <QtCore/qfileinfo.h>
+#include <QtCore/qmutex.h>
+#include <QtCore/qdatetime.h>
+#include <QtCore/qdir.h>
+#include <QtCore/qtimer.h>
+#include <QtCore/qhash.h>
+
+#include <Application.h>
+#include <NodeMonitor.h>
+#include <Looper.h>
+#include <String.h>
+#include <Autolock.h>
+#include <Handler.h>
+#include <Entry.h>
+#include <Path.h>
+
+#include "qfilesystemwatcher_p.h"
+
+QT_REQUIRE_CONFIG(filesystemwatcher);
+QT_BEGIN_NAMESPACE
+
+class QHaikuDirWatcher : public QObject, public BLooper {
+ Q_OBJECT
+public:
+ QHaikuDirWatcher();
+ virtual void MessageReceived(BMessage* msg) override;
+Q_SIGNALS:
+ void directoryChanged(const QString &path, bool removed);
+};
+
+class QHaikuFileWatcher : public QObject, public BLooper {
+ Q_OBJECT
+public:
+ QHaikuFileWatcher();
+ virtual void MessageReceived(BMessage* msg) override;
+Q_SIGNALS:
+ void fileChanged(const QString &path, bool removed);
+};
+
+class QHaikuFileSystemWatcherEngine : public QFileSystemWatcherEngine
+{
+ Q_OBJECT
+
+public:
+ QHaikuFileSystemWatcherEngine(QObject *parent);
+ ~QHaikuFileSystemWatcherEngine();
+
+ QStringList addPaths(const QStringList &paths, QStringList *files, QStringList *directories) override;
+ QStringList removePaths(const QStringList &paths, QStringList *files, QStringList *directories) override;
+
+private:
+ QHaikuDirWatcher *dirLooper;
+ QHaikuFileWatcher *fileLooper;
+
+private Q_SLOTS:
+ void bfsDirectoryChanged(const QString &path, bool removed);
+ void bfsFileChanged(const QString &path, bool removed);
+};
+
+QT_END_NAMESPACE
+#endif // QFILESYSTEMWATCHER_HAIKU_P_H
+
--
2.52.0
From fbebe66dfc4f822927f38e71a08c9193173ecb73 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 20 Oct 2023 12:18:17 +1000
Subject: Don't use AF_INET6 for new sockets
diff --git a/src/network/socket/qnativesocketengine_unix.cpp b/src/network/socket/qnativesocketengine_unix.cpp
index 6d49943..8b12671 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -199,8 +199,12 @@ bool QNativeSocketEnginePrivate::createNewSocket(QAbstractSocket::SocketType soc
}
int protocol = 0;
#endif // QT_NO_SCTP
+#ifdef Q_OS_HAIKU
+ int domain = AF_INET;
+#else
int domain = (socketProtocol == QAbstractSocket::IPv6Protocol
|| socketProtocol == QAbstractSocket::AnyIPProtocol) ? AF_INET6 : AF_INET;
+#endif
int type = (socketType == QAbstractSocket::UdpSocket) ? SOCK_DGRAM : SOCK_STREAM;
int socket = qt_safe_socket(domain, type, protocol, O_NONBLOCK);
--
2.52.0
From 2f134aa158a9d22933da577b881a57b5a7e7006a Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 20 Oct 2023 12:18:41 +1000
Subject: Disable Haswell CPU feature for plugins
diff --git a/src/corelib/plugin/qlibrary_unix.cpp b/src/corelib/plugin/qlibrary_unix.cpp
index f03eba3..0a21b64 100644
--- a/src/corelib/plugin/qlibrary_unix.cpp
+++ b/src/corelib/plugin/qlibrary_unix.cpp
@@ -163,7 +163,7 @@ bool QLibraryPrivate::load_sys()
prefixes.append(QString());
}
-#if defined(Q_PROCESSOR_X86) && !defined(Q_OS_DARWIN)
+#if defined(Q_PROCESSOR_X86) && !defined(Q_OS_DARWIN) && !defined(Q_OS_HAIKU)
if (qCpuHasFeature(ArchHaswell)) {
auto transform = [](QStringList &list, void (*f)(QString *)) {
QStringList tmp;
--
2.52.0
From f5e7f7fbe1a922671f255fcdc8a018c202741e96 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 20 Oct 2023 12:19:25 +1000
Subject: Haiku build setup
diff --git a/cmake/QtBuildHelpers.cmake b/cmake/QtBuildHelpers.cmake
index df43ac1..360b7a8 100644
--- a/cmake/QtBuildHelpers.cmake
+++ b/cmake/QtBuildHelpers.cmake
@@ -43,7 +43,7 @@ endmacro()
macro(qt_internal_setup_position_independent_code)
## Position independent code:
- set(CMAKE_POSITION_INDEPENDENT_CODE ON)
+ set(CMAKE_POSITION_INDEPENDENT_CODE OFF)
# Does the linker support position independent code?
include(CheckPIESupported)
diff --git a/cmake/QtMkspecHelpers.cmake b/cmake/QtMkspecHelpers.cmake
index a7f239f..55d2212 100644
--- a/cmake/QtMkspecHelpers.cmake
+++ b/cmake/QtMkspecHelpers.cmake
@@ -50,6 +50,12 @@ macro(qt_internal_setup_platform_definitions_and_mkspec)
elseif(CLANG)
set(QT_DEFAULT_MKSPEC linux-clang)
endif()
+ elseif(HAIKU)
+ if(GCC)
+ set(QT_DEFAULT_MKSPEC haiku-g++)
+ elseif(CLANG)
+ set(QT_DEFAULT_MKSPEC haiku-clang)
+ endif()
elseif(ANDROID)
if(GCC)
set(QT_DEFAULT_MKSPEC android-g++)
diff --git a/cmake/QtRpathHelpers.cmake b/cmake/QtRpathHelpers.cmake
index da6c871..bd085e2 100644
--- a/cmake/QtRpathHelpers.cmake
+++ b/cmake/QtRpathHelpers.cmake
@@ -8,6 +8,8 @@ function(qt_internal_get_relative_rpath_base_token out_var)
set(rpath_rel_base "@loader_path")
elseif(LINUX OR SOLARIS OR FREEBSD OR HURD OR OPENBSD)
set(rpath_rel_base "$ORIGIN")
+ elseif(HAIKU)
+ set(rpath_rel_base "$ORIGIN")
else()
set(rpath_rel_base "NO_KNOWN_RPATH_REL_BASE")
endif()
--
2.52.0
From 02f9359cd258af84e502997f4ef3ad3759026a15 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 20 Oct 2023 12:21:18 +1000
Subject: Haiku: link against libnetwork
diff --git a/src/network/CMakeLists.txt b/src/network/CMakeLists.txt
index 1112f10..1bc87a5 100644
--- a/src/network/CMakeLists.txt
+++ b/src/network/CMakeLists.txt
@@ -225,6 +225,11 @@ qt_internal_extend_target(Network CONDITION WIN32
NOMINMAX
)
+qt_internal_extend_target(Network CONDITION HAIKU
+ LIBRARIES
+ network
+)
+
qt_internal_extend_target(Network CONDITION APPLE AND NOT UIKIT
LIBRARIES
${FWCoreServices}
--
2.52.0
From 5cb3efe692ccf1558c2e758a3658ae778e6eac4e Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 20 Oct 2023 12:28:46 +1000
Subject: Fix elf parser for Haiku
diff --git a/src/corelib/plugin/qelfparser_p.cpp b/src/corelib/plugin/qelfparser_p.cpp
index 78c9be0..6cc9db8 100644
--- a/src/corelib/plugin/qelfparser_p.cpp
+++ b/src/corelib/plugin/qelfparser_p.cpp
@@ -20,6 +20,12 @@
# error "Need ELF header to parse plugins."
#endif
+#ifdef __HAIKU__
+#define PF_R PF_READ
+#define PF_W PF_WRITE
+#define PF_X PF_EXECUTE
+#endif
+
QT_BEGIN_NAMESPACE
using namespace Qt::StringLiterals;
@@ -206,18 +212,26 @@ struct ElfHeaderCheck : public ElfHeaderCommonCheck
// byte 7
static bool checkOsAbi(const uchar *ident)
{
+#ifndef __HAIKU__
uchar osabi = ident[EI_OSABI];
// we don't check
Q_UNUSED(osabi);
+#else
+ Q_UNUSED(ident);
+#endif
return true;
}
// byte 8
static bool checkAbiVersion(const uchar *ident)
{
+#ifndef __HAIKU__
uchar abiversion = ident[EI_ABIVERSION];
// we don't check (and I don't know anyone who uses this)
Q_UNUSED(abiversion);
+#else
+ Q_UNUSED(ident);
+#endif
return true;
}
@@ -335,6 +349,9 @@ Q_DECL_UNUSED Q_DECL_COLD_FUNCTION static QDebug &operator<<(QDebug &d, ElfHeade
break;
}
+#ifdef __HAIKU__
+ d << " (Haiku v1)";
+#else
switch (e_ident[EI_OSABI]) {
case ELFOSABI_SYSV: d << " (SYSV"; break;
case ELFOSABI_HPUX: d << " (HP-UX"; break;
@@ -351,7 +368,7 @@ Q_DECL_UNUSED Q_DECL_COLD_FUNCTION static QDebug &operator<<(QDebug &d, ElfHeade
if (e_ident[EI_ABIVERSION])
d << " v" << e_ident[EI_ABIVERSION];
d << ')';
-
+#endif
if (e_ident[EI_VERSION] != 1) {
d << ", file version " << e_ident[EI_VERSION];
return d;
@@ -446,11 +463,12 @@ Q_DECL_UNUSED static QDebug &operator<<(QDebug &d, ElfSectionDebug s)
d << 'A';
if (s.shdr->sh_flags & SHF_EXECINSTR)
d << 'X';
+#ifndef __HAIKU__
if (s.shdr->sh_flags & SHF_STRINGS)
d << 'S';
if (s.shdr->sh_flags & SHF_TLS)
d << 'T';
-
+#endif
d.space() << "offset" << s.shdr->sh_offset << "size" << s.shdr->sh_size;
return d;
}
--
2.52.0
From 7cc6468b8415b0cd2b9391c78ef29ba4cb17d695 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 20 Oct 2023 12:29:03 +1000
Subject: Don't use nl_langinfo
diff --git a/src/corelib/kernel/qcoreapplication.cpp b/src/corelib/kernel/qcoreapplication.cpp
index 310b011..9dff974 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -572,7 +572,7 @@ void QCoreApplicationPrivate::initLocale()
// QLocal8Bit hard-codes this, and we need to be consistent.
# if defined(Q_OS_INTEGRITY)
setlocale(LC_CTYPE, "UTF-8");
-# elif defined(Q_OS_QNX)
+# elif defined(Q_OS_QNX) || defined(Q_OS_HAIKU)
// QNX has no nl_langinfo, so we can't check.
// FIXME: Shouldn't we still setlocale("UTF-8")?
# elif defined(Q_OS_ANDROID) && __ANDROID_API__ < __ANDROID_API_O__
--
2.52.0
From d2b76b23c7537c247e513255afc4b2ed751578d2 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 20 Oct 2023 12:30:12 +1000
Subject: Workaround for shm_open
diff --git a/src/corelib/ipc/qsharedmemory_posix.cpp b/src/corelib/ipc/qsharedmemory_posix.cpp
index fa215c3..7a0978c 100644
--- a/src/corelib/ipc/qsharedmemory_posix.cpp
+++ b/src/corelib/ipc/qsharedmemory_posix.cpp
@@ -69,6 +69,10 @@ bool QSharedMemoryPosix::create(QSharedMemoryPrivate *self, qsizetype size)
int fd;
QT_EINTR_LOOP(fd, ::shm_open(shmName.constData(), O_RDWR | O_CREAT | O_EXCL | O_CLOEXEC, 0600));
+#ifdef Q_OS_HAIKU
+ if (fd == -1)
+ QT_EINTR_LOOP(fd, ::shm_open(shmName.constData(), O_RDWR | O_CLOEXEC, 0600));
+#endif
if (fd == -1) {
const int errorNumber = errno;
const auto function = "QSharedMemory::attach (shm_open)"_L1;
--
2.52.0
From fa2f55ce45389c2b3edec09f43489eaedc718112 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 14 Apr 2024 12:20:21 +1000
Subject: Disable DisconnectControllingTerminal
diff --git a/src/corelib/io/qprocess_unix.cpp b/src/corelib/io/qprocess_unix.cpp
index 32c0851..ad1b87f 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -881,6 +881,7 @@ static const char *applyProcessParameters(const QProcess::UnixProcessParameters
return "setsid";
}
+#ifndef Q_OS_HAIKU
// Disconnect from the controlling TTY. This probably won't fail. Must be
// done after the session settings from above.
if (params.flags.testFlag(QProcess::UnixProcessFlag::DisconnectControllingTerminal)) {
@@ -897,6 +898,7 @@ static const char *applyProcessParameters(const QProcess::UnixProcessParameters
}
#endif
}
+#endif
// Disable core dumps near the end. This isn't expected to fail.
if (params.flags.testFlag(QProcess::UnixProcessFlag::DisableCoreDumps)) {
--
2.52.0
From ef3533ea614d9d577e52d785a055bbdc990f28f9 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Fri, 4 Oct 2024 18:22:17 +1000
Subject: Use ICU backend for QTimeZone
diff --git a/src/corelib/time/qtimezone.cpp b/src/corelib/time/qtimezone.cpp
index 7b43aab..0061b1e 100644
--- a/src/corelib/time/qtimezone.cpp
+++ b/src/corelib/time/qtimezone.cpp
@@ -29,6 +29,8 @@ static QTimeZonePrivate *newBackendTimeZone()
return new QMacTimeZonePrivate();
#elif defined(Q_OS_ANDROID)
return new QAndroidTimeZonePrivate();
+#elif defined(Q_OS_HAIKU)
+ return new QUtcTimeZonePrivate();
#elif defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS)
return new QTzTimeZonePrivate();
#elif QT_CONFIG(icu)
--
2.52.0
From d4f024f59e53f3cdcfb5003af5cf5e08caba1cd8 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sat, 5 Oct 2024 19:48:13 +1000
Subject: Use ICU backend for ianaId
diff --git a/src/corelib/time/qtimezone.cpp b/src/corelib/time/qtimezone.cpp
index 0061b1e..542f54c 100644
--- a/src/corelib/time/qtimezone.cpp
+++ b/src/corelib/time/qtimezone.cpp
@@ -52,6 +52,8 @@ static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId)
return new QMacTimeZonePrivate(ianaId);
#elif defined(Q_OS_ANDROID)
return new QAndroidTimeZonePrivate(ianaId);
+#elif defined(Q_OS_HAIKU)
+ return new QUtcTimeZonePrivate(ianaId);
#elif defined(Q_OS_UNIX) && !defined(Q_OS_VXWORKS)
return new QTzTimeZonePrivate(ianaId);
#elif QT_CONFIG(icu)
--
2.52.0
From 9bb3a7e3b0cd7bb7d02daa48c6e657eb359dba84 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sat, 5 Oct 2024 19:48:35 +1000
Subject: Disable tz backend for Haiku
diff --git a/src/corelib/CMakeLists.txt b/src/corelib/CMakeLists.txt
index 0e101c4..c88104b 100644
--- a/src/corelib/CMakeLists.txt
+++ b/src/corelib/CMakeLists.txt
@@ -989,7 +989,7 @@ qt_internal_extend_target(Core
qt_internal_extend_target(Core
CONDITION
QT_FEATURE_timezone AND UNIX AND NOT VXWORKS
- AND NOT ANDROID AND NOT APPLE AND NOT QT_FEATURE_timezone_tzdb
+ AND NOT ANDROID AND NOT APPLE AND NOT HAIKU AND NOT QT_FEATURE_timezone_tzdb
SOURCES
time/qtimezoneprivate_tz.cpp
)
--
2.52.0
From e80158369cd39f200326d89aa5b19f3de6f255d3 Mon Sep 17 00:00:00 2001
From: Luc Schrijvers <begasus@gmail.com>
Date: Sun, 29 Jun 2025 09:30:39 +0200
Subject: Build fix*
diff --git a/src/testlib/qtestcrashhandler_unix.cpp b/src/testlib/qtestcrashhandler_unix.cpp
index d66a542..81ccaaf 100644
--- a/src/testlib/qtestcrashhandler_unix.cpp
+++ b/src/testlib/qtestcrashhandler_unix.cpp
@@ -40,7 +40,9 @@
# elif __has_include(<ucontext.h>)
# include <ucontext.h>
# else
+# if !defined(Q_OS_HAIKU)
using ucontext_t = void;
+#endif
# endif
#if defined(Q_OS_MACOS)
--
2.52.0
From bbc29bd220863bda48eb1178000a936abec3d962 Mon Sep 17 00:00:00 2001
From: Luc Schrijvers <begasus@gmail.com>
Date: Thu, 9 Oct 2025 10:52:56 +0200
Subject: Include Qt warning
diff --git a/src/corelib/io/qfilesystemwatcher_haiku_p.h b/src/corelib/io/qfilesystemwatcher_haiku_p.h
index 0ae4bdf..0339487 100644
--- a/src/corelib/io/qfilesystemwatcher_haiku_p.h
+++ b/src/corelib/io/qfilesystemwatcher_haiku_p.h
@@ -20,6 +20,17 @@
#ifndef QFILESYSTEMWATCHER_HAIKU_P_H
#define QFILESYSTEMWATCHER_HAIKU_P_H
+//
+// W A R N I N G
+// -------------
+//
+// This file is not part of the Qt API. It exists purely as an
+// implementation detail. This header file may change from version to
+// version without notice, or even be removed.
+//
+// We mean it.
+//
+
#include <QtCore/qfileinfo.h>
#include <QtCore/qmutex.h>
#include <QtCore/qdatetime.h>
--
2.52.0
From 6f96d33e4669acbd235c9bbc058e9ce843858855 Mon Sep 17 00:00:00 2001
From: Luc Schrijvers <begasus@gmail.com>
Date: Fri, 13 Feb 2026 16:08:03 +0100
Subject: Fix error for static_assert
diff --git a/src/corelib/global/qtypes.h b/src/corelib/global/qtypes.h
index a7e6505..a40f266 100644
--- a/src/corelib/global/qtypes.h
+++ b/src/corelib/global/qtypes.h
@@ -178,7 +178,7 @@ static_assert(std::is_signed_v<qint128>,
#ifndef __cplusplus
// In C++ mode, we define below using QIntegerForSize template
-static_assert(sizeof(ptrdiff_t) == sizeof(size_t), "Weird ptrdiff_t and size_t definitions");
+_Static_assert(sizeof(ptrdiff_t) == sizeof(size_t), "Weird ptrdiff_t and size_t definitions");
typedef ptrdiff_t qptrdiff;
typedef ptrdiff_t qsizetype;
typedef ptrdiff_t qintptr;
--
2.52.0
From b60b6a91c853a0877c4df08035d3a0c932aed41d Mon Sep 17 00:00:00 2001
From: Luc Schrijvers <begasus@gmail.com>
Date: Mon, 13 Apr 2026 16:21:10 +0200
Subject: Fix* missing function for memrchr
diff --git a/src/corelib/text/qbytearray.cpp b/src/corelib/text/qbytearray.cpp
index 71a7799..72347f5 100644
--- a/src/corelib/text/qbytearray.cpp
+++ b/src/corelib/text/qbytearray.cpp
@@ -72,6 +72,8 @@ static constexpr inline uchar asciiLower(uchar c)
Used in QByteArrayView::lastIndexOf() overload for a single char.
*/
+extern void *memrchr(const void *source, int value, size_t length);
+
const void *qmemrchr(const void *s, int needle, size_t size) noexcept
{
#if QT_CONFIG(memrchr)
--
2.52.0