Files
haikuports/dev-qt/qt6-base/patches/qt6_base-6.9.0.patchset
2025-05-15 05:40:39 +00:00

1010 lines
32 KiB
Plaintext

From 66b9a0b4d6b61c4059baf32debbec09bea29fee6 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.48.1
From f4ed9213f570c269bb5a08e1af420465829f9adc 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 93eba13..2862472 100644
--- a/src/corelib/io/qstandardpaths_haiku.cpp
+++ b/src/corelib/io/qstandardpaths_haiku.cpp
@@ -111,15 +111,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:
@@ -128,7 +129,7 @@ QString QStandardPaths::writableLocation(StandardLocation type)
case GenericConfigLocation:
return haikuStandardPath(B_USER_SETTINGS_DIRECTORY);
default:
- return QString();
+ return haikuAppStandardPath(B_USER_SETTINGS_DIRECTORY);
}
}
@@ -149,7 +150,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);
@@ -173,7 +174,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.48.1
From 7356bedf2ee4c9dc7e4794c35e00a26f60f43912 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 395394d..91483c2 100644
--- a/src/network/ssl/qsslsocket.cpp
+++ b/src/network/ssl/qsslsocket.cpp
@@ -2968,6 +2968,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.48.1
From 54d6f6828a9e058d174d166c4e2744f3d973b3b3 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.48.1
From c364cc1ebbd882eefa83a4093c2b8a4f172ef23a 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.48.1
From 8903e42c098d0c75ffb0a5cc658bafd3bc89a683 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 3b0e2d3..b824440 100644
--- a/src/network/kernel/qhostinfo_unix.cpp
+++ b/src/network/kernel/qhostinfo_unix.cpp
@@ -50,6 +50,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.48.1
From f30a4dd62fe9d052363484ad0a4361fb9f3a4286 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 39ff8db..3a9a992 100644
--- a/src/network/kernel/qnetworkinterface_unix.cpp
+++ b/src/network/kernel/qnetworkinterface_unix.cpp
@@ -21,7 +21,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.48.1
From c46fe83b709542a86098f9d46eca52646c76b42a 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 6a68425..2a6b2c5 100644
--- a/src/tools/bootstrap/CMakeLists.txt
+++ b/src/tools/bootstrap/CMakeLists.txt
@@ -86,6 +86,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.48.1
From 5ca98cc13d6f160cef292d7dacfd7e9ee1dc626a 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 edef3c5..c9df584 100644
--- a/src/3rdparty/forkfd/forkfd.c
+++ b/src/3rdparty/forkfd/forkfd.c
@@ -675,7 +675,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.48.1
From 395488f1655a98934a4d892bafa1c829ca32d159 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 8e72caa..5411bb5 100644
--- a/src/corelib/CMakeLists.txt
+++ b/src/corelib/CMakeLists.txt
@@ -1019,6 +1019,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 064be4c..d4c03c3 100644
--- a/src/corelib/io/qfilesystemwatcher.cpp
+++ b/src/corelib/io/qfilesystemwatcher.cpp
@@ -17,6 +17,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)
@@ -38,6 +40,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.48.1
From 62d3a237004e87bebc6e8a3a8ec03d6712e016ce 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 b6df412..e7e2f17 100644
--- a/src/network/socket/qnativesocketengine_unix.cpp
+++ b/src/network/socket/qnativesocketengine_unix.cpp
@@ -194,8 +194,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.48.1
From 104fc849a93301a74907b4de51dad9ca3e093496 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 d05a5fa..d582d13 100644
--- a/src/corelib/plugin/qlibrary_unix.cpp
+++ b/src/corelib/plugin/qlibrary_unix.cpp
@@ -152,7 +152,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.48.1
From 280d9a068232cb7bd8ecb0f728dd13e5604aef43 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 3f9f4c9..4fe36fa 100644
--- a/cmake/QtBuildHelpers.cmake
+++ b/cmake/QtBuildHelpers.cmake
@@ -42,7 +42,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 a961296..7444a72 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.48.1
From 70379a7eb7dc6c6055d8c0ddabd00efc650cdc51 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 80892ed..f77f703 100644
--- a/src/network/CMakeLists.txt
+++ b/src/network/CMakeLists.txt
@@ -223,6 +223,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.48.1
From f364c1690698a4a37d616ef25f24457ed5a385c9 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.48.1
From 7fbc2292de7efb65ec5168c81671fb720088ec11 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 24d3134..d58bde5 100644
--- a/src/corelib/kernel/qcoreapplication.cpp
+++ b/src/corelib/kernel/qcoreapplication.cpp
@@ -575,7 +575,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.48.1
From d5dffda79119bcac68c1078fcdf40da9b7998696 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 582c662..0854906 100644
--- a/src/corelib/ipc/qsharedmemory_posix.cpp
+++ b/src/corelib/ipc/qsharedmemory_posix.cpp
@@ -68,6 +68,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.48.1
From dae8e1455ccb328a536add810efe343fd1833e47 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 6109e9d..879aac1 100644
--- a/src/corelib/io/qprocess_unix.cpp
+++ b/src/corelib/io/qprocess_unix.cpp
@@ -869,6 +869,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)) {
@@ -883,6 +884,7 @@ static const char *applyProcessParameters(const QProcess::UnixProcessParameters
}
}
}
+#endif
// Disable core dumps near the end. This isn't expected to fail.
if (params.flags.testFlag(QProcess::UnixProcessFlag::DisableCoreDumps)) {
--
2.48.1
From 547b99e7842d9f1913ab0d4e786be30d2918841d 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 906a42f..d4fdc49 100644
--- a/src/corelib/time/qtimezone.cpp
+++ b/src/corelib/time/qtimezone.cpp
@@ -26,6 +26,8 @@ static QTimeZonePrivate *newBackendTimeZone()
return new QChronoTimeZonePrivate();
#elif defined(Q_OS_DARWIN)
return new QMacTimeZonePrivate();
+#elif defined(Q_OS_HAIKU)
+ return new QUtcTimeZonePrivate();
#elif defined(Q_OS_ANDROID)
return new QAndroidTimeZonePrivate();
#elif defined(Q_OS_UNIX)
--
2.48.1
From 66100dafa96f8bf920eecd4a42cc8d17809f03ed 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 d4fdc49..c059f47 100644
--- a/src/corelib/time/qtimezone.cpp
+++ b/src/corelib/time/qtimezone.cpp
@@ -49,6 +49,8 @@ static QTimeZonePrivate *newBackendTimeZone(const QByteArray &ianaId)
return new QChronoTimeZonePrivate(ianaId);
#elif defined(Q_OS_DARWIN)
return new QMacTimeZonePrivate(ianaId);
+#elif defined(Q_OS_HAIKU)
+ return new QUtcTimeZonePrivate(ianaId);
#elif defined(Q_OS_ANDROID)
return new QAndroidTimeZonePrivate(ianaId);
#elif defined(Q_OS_UNIX)
--
2.48.1
From 221e0f18dd59c97a3b4dcb1d3f51b5763349a477 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 5411bb5..51936d2 100644
--- a/src/corelib/CMakeLists.txt
+++ b/src/corelib/CMakeLists.txt
@@ -964,7 +964,7 @@ qt_internal_extend_target(Core
qt_internal_extend_target(Core
CONDITION
QT_FEATURE_timezone AND UNIX
- 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.48.1