summaryrefslogtreecommitdiff
path: root/Ports/qt6-qtbase/patches/0001-Add-a-SerenityOS-platform-definition.patch
blob: 10da2fa82f1f4bce811b7a0a9bc2feb1b6529456 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
From 0000000000000000000000000000000000000000 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Martin=20B=C5=99=C3=ADza?= <m@rtinbriza.cz>
Date: Wed, 15 Dec 2021 20:01:43 +0100
Subject: [PATCH] Add a SerenityOS platform definition

---
 cmake/QtBuild.cmake                   |  2 +
 mkspecs/serenity-g++/qmake.conf       | 25 ++++++++
 mkspecs/serenity-g++/qplatformdefs.h  | 87 +++++++++++++++++++++++++++
 src/corelib/global/qsystemdetection.h |  3 +
 src/gui/CMakeLists.txt                |  2 +
 util/cmake/helper.py                  |  1 +
 6 files changed, 120 insertions(+)
 create mode 100644 mkspecs/serenity-g++/qmake.conf
 create mode 100644 mkspecs/serenity-g++/qplatformdefs.h

diff --git a/cmake/QtBuild.cmake b/cmake/QtBuild.cmake
index bb7049e76a65cd8fea0ad4aca2f29bdbefbdc86d..df4c9d07f2984ea8ab02d54004335a2d4377f78b 100644
--- a/cmake/QtBuild.cmake
+++ b/cmake/QtBuild.cmake
@@ -326,6 +326,8 @@ elseif(APPLE)
     set(QT_DEFAULT_MKSPEC macx-clang)
 elseif(WASM)
     set(QT_DEFAULT_MKSPEC wasm-emscripten)
+elseif(SERENITYOS)
+    set(QT_DEFAULT_MKSPEC serenity-g++)
 elseif(QNX)
     # Certain POSIX defines are not set if we don't compile with -std=gnuXX
     set(QT_ENABLE_CXX_EXTENSIONS ON)
diff --git a/mkspecs/serenity-g++/qmake.conf b/mkspecs/serenity-g++/qmake.conf
new file mode 100644
index 0000000000000000000000000000000000000000..3808b5a269788a32d4aa74aa629b519df80d1000
--- /dev/null
+++ b/mkspecs/serenity-g++/qmake.conf
@@ -0,0 +1,25 @@
+#
+# qmake configuration for serenity-g++
+#
+
+MAKEFILE_GENERATOR      = ninja
+QMAKE_PLATFORM          = serenity
+
+include(../common/unix.conf)
+
+QMAKE_LIBS              = -lpthread
+QMAKE_INCDIR            =
+QMAKE_LIBDIR            =
+
+QMAKE_LIBS_THREAD       = -lpthread
+
+QMAKE_LIBS_NETWORK      = -lnetwork
+QMAKE_LIBS_OPENGL       = -lGL
+QMAKE_LIBS_OPENGL_QT    = -lGL
+
+QMAKE_AR                = ar cqs
+QMAKE_OBJCOPY           = objcopy
+QMAKE_NM                = nm -P
+QMAKE_RANLIB            =
+
+load(qt_config)
diff --git a/mkspecs/serenity-g++/qplatformdefs.h b/mkspecs/serenity-g++/qplatformdefs.h
new file mode 100644
index 0000000000000000000000000000000000000000..ff6bd088c99a77689733af03858950fab1cf6284
--- /dev/null
+++ b/mkspecs/serenity-g++/qplatformdefs.h
@@ -0,0 +1,87 @@
+/****************************************************************************
+**
+** Copyright (c) 2021, the SerenityOS developers.
+**
+** This file is part of the qmake spec of the Qt Toolkit.
+**
+** $QT_BEGIN_LICENSE:LGPL$
+** Commercial License Usage
+** Licensees holding valid commercial Qt licenses may use this file in
+** accordance with the commercial license agreement provided with the
+** Software or, alternatively, in accordance with the terms contained in
+** a written agreement between you and The Qt Company. For licensing terms
+** and conditions see https://www.qt.io/terms-conditions. For further
+** information use the contact form at https://www.qt.io/contact-us.
+**
+** GNU Lesser General Public License Usage
+** Alternatively, this file may be used under the terms of the GNU Lesser
+** General Public License version 3 as published by the Free Software
+** Foundation and appearing in the file LICENSE.LGPL3 included in the
+** packaging of this file. Please review the following information to
+** ensure the GNU Lesser General Public License version 3 requirements
+** will be met: https://www.gnu.org/licenses/lgpl-3.0.html.
+**
+** 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.
+**
+** $QT_END_LICENSE$
+**
+****************************************************************************/
+
+#ifndef QPLATFORMDEFS_H
+#define QPLATFORMDEFS_H
+
+// Get Qt defines/settings
+
+#define _GLIBCXX_HAVE_MBSTATE_T 1
+
+#include "qglobal.h"
+
+// Set any POSIX/XOPEN defines at the top of this file to turn on specific APIs
+
+#include <unistd.h>
+
+#include <pthread.h>
+#include <dirent.h>
+#include <fcntl.h>
+#include <grp.h>
+#include <pwd.h>
+#include <signal.h>
+#include <dlfcn.h>
+
+#include <sys/types.h>
+#include <sys/ioctl.h>
+#include <sys/time.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+#include <sys/wait.h>
+#include <netinet/in.h>
+
+#include "../common/posix/qplatformdefs.h"
+
+#ifdef QT_POSIX_IPC
+#define QT_POSIX_IPC 1
+//#undef QT_POSIX_IPC
+#endif
+
+#ifdef QT_OPEN_LARGEFILE
+#undef QT_OPEN_LARGEFILE
+#endif
+#define QT_OPEN_LARGEFILE   0
+
+#ifdef QT_LARGEFILE_SUPPORT
+#undef QT_LARGEFILE_SUPPORT
+#endif
+
+#include <langinfo.h>
+#include <sys/ioctl.h>
+
+#endif // QPLATFORMDEFS_H
diff --git a/src/corelib/global/qsystemdetection.h b/src/corelib/global/qsystemdetection.h
index cbbe613e40cd20110b9aa31177d95e0a18bdf9fa..82b3f84800f8c5bf3a7a4567ea55f6a8a4681b13 100644
--- a/src/corelib/global/qsystemdetection.h
+++ b/src/corelib/global/qsystemdetection.h
@@ -36,6 +36,7 @@
      ANDROID  - Android platform
      HAIKU    - Haiku
      WEBOS    - LG WebOS
+     SERENITY - SerenityOS
 
    The following operating systems have variants:
      LINUX    - both Q_OS_LINUX and Q_OS_ANDROID are defined when building for Android
@@ -129,6 +130,8 @@
 #  define Q_OS_VXWORKS
 #elif defined(__HAIKU__)
 #  define Q_OS_HAIKU
+#elif defined(__serenity__)
+#  define Q_OS_SERENITY
 #elif defined(__MAKEDEPEND__)
 #else
 #  error "Qt has not been ported to this OS - see http://www.qt-project.org/"
diff --git a/src/gui/CMakeLists.txt b/src/gui/CMakeLists.txt
index 36dae764d75bf2c3a641ce0776f307755b4ead44..0ab63742665dd7da1259fdfbbb2cc8dab5450578 100644
--- a/src/gui/CMakeLists.txt
+++ b/src/gui/CMakeLists.txt
@@ -29,6 +29,8 @@ if (QT_FEATURE_gui)
         set(_default_platform "haiku")
     elseif(WASM)
         set(_default_platform "wasm")
+    elseif(SERENITYOS)
+        set(_default_platform "serenity")
     else()
         set(_default_platform "xcb")
     endif()
diff --git a/util/cmake/helper.py b/util/cmake/helper.py
index f40ea4d61f0d1d658b6715c55cb70c1eadb59a25..d8940f09595c887771f12c0e584936907174c540 100644
--- a/util/cmake/helper.py
+++ b/util/cmake/helper.py
@@ -696,6 +696,7 @@ platform_mapping = {
     "macx": "MACOS",
     "macos": "MACOS",
     "macx-icc": "(MACOS AND ICC)",
+    "serenity": "SERENITY",
 }