Advance Wayland and KDE package bring-up

Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-openagent)

Co-authored-by: Sisyphus <clio-agent@sisyphuslabs.ai>
This commit is contained in:
2026-04-14 10:51:06 +01:00
parent 51f3c21121
commit cf12defd28
15214 changed files with 20594243 additions and 269 deletions
+318
View File
@@ -0,0 +1,318 @@
#TODO: Qt6 base — qtbase compiled with Core+Concurrent+Xml+Gui+Widgets+DBus. Runtime validation pending.
# Scope: software rendering (no EGL/OpenGL), no Network/SQL/PrintSupport/TestLib.
# Re-enable path: see local/docs/QT6-PORT-STATUS.md
# Redox platform detection and syscall adaptations in redox.patch
[source]
tar = "https://download.qt.io/official_releases/qt/6.11/6.11.0/submodules/qtbase-everywhere-src-6.11.0.tar.xz"
patches = ["redox.patch"]
[build]
template = "custom"
dependencies = [
"glib",
"pcre2",
"zlib",
"libwayland",
"dbus",
"mesa",
]
script = """
DYNAMIC_INIT
# ============================================================
# Step 1: Build Qt host tools (moc, rcc, uic) on the host
# These are needed for cross-compilation — Qt6 generates code
# with these tools during the target build.
# ============================================================
HOST_BUILD="${COOKBOOK_ROOT}/build/qt-host-build"
if [ ! -f "${HOST_BUILD}/bin/moc" ]; then
echo "=== Building Qt host tools ==="
mkdir -p "${HOST_BUILD}"
env \
-u CPPFLAGS \
-u LDFLAGS \
-u PKG_CONFIG_ALLOW_CROSS \
-u PKG_CONFIG_PATH \
-u PKG_CONFIG_LIBDIR \
-u PKG_CONFIG_SYSROOT_DIR \
-u CFLAGS_x86_64_unknown_redox \
-u CXXFLAGS_x86_64_unknown_redox \
-u LDFLAGS_x86_64_unknown_redox \
cmake -S "${COOKBOOK_SOURCE}" -B "${HOST_BUILD}" \
-DCMAKE_C_COMPILER=/usr/bin/cc \
-DCMAKE_CXX_COMPILER=/usr/bin/c++ \
-DCMAKE_ASM_COMPILER=/usr/bin/cc \
-DCMAKE_AR=/usr/bin/ar \
-DCMAKE_RANLIB=/usr/bin/ranlib \
-DPKG_CONFIG_EXECUTABLE=/usr/bin/pkg-config \
-DCMAKE_STRIP=/usr/bin/strip \
-DCMAKE_BUILD_TYPE=Release \
-DQT_BUILD_EXAMPLES=OFF \
-DQT_BUILD_TESTS=OFF \
-DFEATURE_glib=OFF \
-DFEATURE_gui=OFF \
-DFEATURE_widgets=OFF \
-DFEATURE_opengl=OFF \
-DFEATURE_network=OFF \
-DFEATURE_dbus=ON \
-DFEATURE_openssl=OFF \
-DFEATURE_sql=OFF \
-DFEATURE_testlib=OFF \
-DFEATURE_xml=OFF \
-DFEATURE_wayland=ON \
-DFEATURE_qtwaylandscanner=ON \
-Wno-dev
env \
-u CPPFLAGS \
-u LDFLAGS \
-u PKG_CONFIG_ALLOW_CROSS \
-u PKG_CONFIG_PATH \
-u PKG_CONFIG_LIBDIR \
-u PKG_CONFIG_SYSROOT_DIR \
-u CFLAGS_x86_64_unknown_redox \
-u CXXFLAGS_x86_64_unknown_redox \
-u LDFLAGS_x86_64_unknown_redox \
cmake --build "${HOST_BUILD}" --target host_tools -j"${COOKBOOK_MAKE_JOBS}"
fi
# ============================================================
# Step 2: Cross-compile qtbase for Redox (Phase 1: QtCore)
# ============================================================
# Safety: clean stale CMake cache from previous attempts
rm -f CMakeCache.txt
rm -rf CMakeFiles
# Also clean any stale cache in source directory from previous builds
rm -f "${COOKBOOK_SOURCE}/CMakeCache.txt"
rm -rf "${COOKBOOK_SOURCE}/CMakeFiles"
# Provide sys/statfs.h wrapper — relibc only has sys/statvfs.h.
# qstorageinfo_linux.cpp (compiled when LINUX=1 in CMake) includes sys/statfs.h.
# Alias statfs → statvfs so it compiles against relibc's POSIX API.
mkdir -p "${COOKBOOK_SYSROOT}/include/sys"
if [ ! -f "${COOKBOOK_SYSROOT}/include/sys/statfs.h" ]; then
cat > "${COOKBOOK_SYSROOT}/include/sys/statfs.h" << 'STATFS_EOF'
#ifndef _SYS_STATFS_H
#define _SYS_STATFS_H
/* Redox: relibc provides statvfs (POSIX), not Linux statfs.
Provide a compatibility shim so Linux-targeted code compiles. */
#include <sys/statvfs.h>
typedef struct statvfs statfs;
#define statfs statvfs
#define f_flags f_flag
#endif /* _SYS_STATFS_H */
STATFS_EOF
fi
# relibc lacks resolv.h (DNS resolver). QtNetwork includes it unconditionally on Unix.
# Provide an empty stub — DNS resolution won't work but basic socket networking will.
if [ ! -f "${COOKBOOK_SYSROOT}/include/resolv.h" ]; then
touch "${COOKBOOK_SYSROOT}/include/resolv.h"
fi
# Ensure private forwarding headers exist for Unix-specific includes
# syncqt may not generate these for unknown platforms like Redox
mkdir -p "${COOKBOOK_SOURCE}/src/corelib/QtCore/private"
for hdr in qcore_unix_p.h qeventdispatcher_unix_p.h qtimerinfo_unix_p.h; do
target="${COOKBOOK_SOURCE}/src/corelib/QtCore/private/${hdr}"
if [ ! -f "${target}" ] && [ -f "${COOKBOOK_SOURCE}/src/corelib/kernel/${hdr}" ]; then
sed 's|kernel/|../kernel/|' "${COOKBOOK_SOURCE}/src/corelib/private/${hdr}" > "${target}"
fi
done
# Patch CMakeLists.txt: Redox uses POSIX statvfs, not Linux statfs.
# Exclude qstorageinfo_linux.cpp, include qstorageinfo_unix.cpp instead.
awk '
/^qt_internal_extend_target\\(Core CONDITION LINUX AND NOT ANDROID AND NOT VXWORKS/ {
sub(/LINUX AND NOT ANDROID AND NOT VXWORKS/, "LINUX AND NOT REDOX AND NOT ANDROID AND NOT VXWORKS")
}
/qstorageinfo_linux\\.cpp/ { found_linux = 1 }
found_linux && /^)$/ {
print; print ""
print "# Redox: POSIX statvfs, not Linux statfs"
print "qt_internal_extend_target(Core CONDITION REDOX"
print " SOURCES"
print " io/qstandardpaths_unix.cpp"
print " io/qstorageinfo_unix.cpp"
print ")"
found_linux = 0; next
}
{ print }
' "${COOKBOOK_SOURCE}/src/corelib/CMakeLists.txt" > "${COOKBOOK_SOURCE}/src/corelib/CMakeLists.txt.tmp"
mv "${COOKBOOK_SOURCE}/src/corelib/CMakeLists.txt.tmp" "${COOKBOOK_SOURCE}/src/corelib/CMakeLists.txt"
# Disable QtNetwork — relibc lacks resolv.h, in6_pktinfo, SIOCGIF* ioctls.
# Will be re-enabled when POSIX networking gaps are filled in relibc.
sed -i 's/^ add_subdirectory(network)/ # add_subdirectory(network) # disabled for Redox/' \
"${COOKBOOK_SOURCE}/src/CMakeLists.txt"
# Disable TUIO touch plugin — depends on QtNetwork which is disabled
sed -i 's/^ add_subdirectory(tuiotouch)/ # add_subdirectory(tuiotouch) # disabled for Redox (needs Network)/' \
"${COOKBOOK_SOURCE}/src/plugins/generic/CMakeLists.txt"
# QtGui needs the float16 shims — copy to gui dir and append to first SOURCES line
cp "${COOKBOOK_SOURCE}/src/corelib/global/qt_float16_shims.c" \
"${COOKBOOK_SOURCE}/src/gui/painting/qt_float16_shims.c"
awk '/^ SOURCES$/ && !done { print; print " painting/qt_float16_shims.c"; done=1; next } { print }' \
"${COOKBOOK_SOURCE}/src/gui/CMakeLists.txt" > "${COOKBOOK_SOURCE}/src/gui/CMakeLists.txt.tmp"
mv "${COOKBOOK_SOURCE}/src/gui/CMakeLists.txt.tmp" "${COOKBOOK_SOURCE}/src/gui/CMakeLists.txt"
# relibc's elf.h defines ELFMAG0-3 and SELFMAG but not ELFMAG string constant.
# Patch qelfparser_p.cpp (the only file using ELFMAG) to define it.
QELF="${COOKBOOK_SOURCE}/src/corelib/plugin/qelfparser_p.cpp"
if ! grep -q '#define ELFMAG' "${QELF}" 2>/dev/null; then
{ printf '#ifndef ELFMAG\n'; printf '#define ELFMAG "\\177ELF"\n'; printf '#endif\n\n'; cat "${QELF}"; } > "${QELF}.tmp"
mv "${QELF}.tmp" "${QELF}"
fi
# Patch Wayland client buffer integration: guard OpenGL-only virtual functions
# with QT_CONFIG(opengl). Without OpenGL, QPlatformOpenGLContext is not defined.
# This allows Wayland client to build with software rendering (shared memory).
BUFI="${COOKBOOK_SOURCE}/src/plugins/platforms/wayland/hardwareintegration/qwaylandclientbufferintegration_p.h"
awk '
/createPlatformOpenGLContext.*QPlatformOpenGLContext/ && !done1 {
print "#if QT_CONFIG(opengl)"; print; print "#endif /* QT_CONFIG(opengl) */"; done1=1; next
}
/nativeResourceForContext.*QPlatformOpenGLContext/ && !done2 {
print "#if QT_CONFIG(opengl)"; print; print "#endif /* QT_CONFIG(opengl) */"; done2=1; next
}
{ print }
' "${BUFI}" > "${BUFI}.tmp"
mv "${BUFI}.tmp" "${BUFI}"
# qtypes.h uses static_assert (C11 macro from <assert.h>) but forkfd_qt.c (C file)
# includes qglobal→qtypes before assert.h. Add the include guard for C mode.
QTYPES="${COOKBOOK_SOURCE}/src/corelib/global/qtypes.h"
if ! grep -q 'assert.h' "${QTYPES}" 2>/dev/null; then
awk '/#ifndef __cplusplus/ { print; print "#include <assert.h>"; next } { print }' \
"${QTYPES}" > "${QTYPES}.tmp"
mv "${QTYPES}.tmp" "${QTYPES}"
fi
# qprocess_unix.cpp needs sys/ioctl.h (for FIONREAD) but doesn't include it
QP="${COOKBOOK_SOURCE}/src/corelib/io/qprocess_unix.cpp"
if ! grep -q 'sys/ioctl.h' "${QP}" 2>/dev/null; then
awk '/#include <unistd.h>/ { print; print "#include <sys/ioctl.h>"; next } { print }' \
"${QP}" > "${QP}.tmp"
mv "${QP}.tmp" "${QP}"
fi
# Compile waitid() stub into sysroot lib — relibc lacks waitid() (unimplemented).
# Qt's forkfd.c (QProcess backend) calls waitid(P_PID, ...) for child readiness.
# The -1 return means "no children ready" — safe for process spawning via fork+exec.
x86_64-unknown-redox-gcc -c -O2 -o "${COOKBOOK_SYSROOT}/lib/redox_waitid.o" \
"${COOKBOOK_ROOT}/local/recipes/qt/redox_waitid.c"
x86_64-unknown-redox-ar rcs "${COOKBOOK_SYSROOT}/lib/libredox_waitid.a" \
"${COOKBOOK_SYSROOT}/lib/redox_waitid.o"
# Also add waitid() declaration to sys/wait.h so forkfd.c sees it
WAIT_H="${COOKBOOK_SYSROOT}/include/sys/wait.h"
if [ -f "${WAIT_H}" ] && ! grep -q 'waitid.*siginfo_t' "${WAIT_H}" 2>/dev/null; then
awk '/^#endif/ { print "/* Redox: waitid() declaration */"; print "int waitid(int,int,siginfo_t*,int);" } { print }' \
"${WAIT_H}" > "${WAIT_H}.tmp"
mv "${WAIT_H}.tmp" "${WAIT_H}"
fi
# Inject waitid.o into Qt's Core library sources so it links into libQt6Core
CORE_CMAKE="${COOKBOOK_SOURCE}/src/corelib/CMakeLists.txt"
if ! grep -q 'redox_waitid' "${CORE_CMAKE}" 2>/dev/null; then
WAIT_O="${COOKBOOK_SYSROOT}/lib/redox_waitid.o"
awk '/target_sources\\(Core/ && !done { print; print " '"${WAIT_O}"'"; done=1; next } { print }' \
"${CORE_CMAKE}" > "${CORE_CMAKE}.tmp"
mv "${CORE_CMAKE}.tmp" "${CORE_CMAKE}"
fi
cmake "${COOKBOOK_SOURCE}" \
-DCMAKE_TOOLCHAIN_FILE="${COOKBOOK_ROOT}/local/recipes/qt/redox-toolchain.cmake" \
-DQT_HOST_PATH="${HOST_BUILD}" \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${COOKBOOK_SYSROOT}" \
-DQT_BUILD_TOOLS_BY_DEFAULT=OFF \
-DQT_BUILD_EXAMPLES=OFF \
-DQT_BUILD_TESTS=OFF \
-DFEATURE_androiddeployqt=OFF \
-DFEATURE_gui=ON \
-DFEATURE_widgets=ON \
-DFEATURE_opengl=ON \
-DINPUT_opengl=es2 \
-DFEATURE_qmake=OFF \
-DFEATURE_qtwaylandscanner=ON \
-DFEATURE_egl=ON \
-DFEATURE_openssl=OFF \
-DFEATURE_dbus=ON \
-DFEATURE_wayland=ON \
-DWaylandScanner_EXECUTABLE=/usr/bin/wayland-scanner \
-DFEATURE_wasmdeployqt=OFF \
-DFEATURE_xcb=OFF \
-DFEATURE_xlib=OFF \
-DFEATURE_vulkan=OFF \
-DFEATURE_process=ON \
-DFEATURE_sharedmemory=OFF \
-DFEATURE_systemsemaphore=OFF \
-DFEATURE_testlib=OFF \
-DFEATURE_sql=OFF \
-DFEATURE_printsupport=OFF \
-DFEATURE_system_zlib=ON \
-DFEATURE_system_pcre2=OFF \
-DFEATURE_system_doubleconversion=OFF \
-DFEATURE_system_harfbuzz=OFF \
-DFEATURE_libjpeg=OFF \
-DFEATURE_libpng=OFF \
-Wno-dev
cmake --build . -j${COOKBOOK_MAKE_JOBS}
# Qt's top-level install script expects a hashed export path under CMakeFiles/Export,
# but on this Redox cross-build the generated file only exists at lib/cmake/Qt6/Qt6Targets.cmake.
# Materialize the expected export file before install so cmake --install can proceed normally.
python3 - <<'PY'
from pathlib import Path
import shutil
install_script = Path("cmake_install.cmake")
generated = Path("lib/cmake/Qt6/Qt6Targets.cmake")
if install_script.exists() and generated.exists():
for line in install_script.read_text().splitlines():
marker = 'CMakeFiles/Export/'
suffix = '/Qt6Targets.cmake'
if marker in line and suffix in line and 'FILES "' in line:
expected = Path(line.split('FILES "', 1)[1].rsplit('"', 1)[0])
expected.parent.mkdir(parents=True, exist_ok=True)
if not expected.exists():
shutil.copy2(generated, expected)
break
PY
# cmake --install handles: libs, headers, cmake files, metatypes, mkspecs, plugins, pri files
# It generates relocatable cmake files (using relative paths) which downstream modules need.
cmake --install . --prefix "${COOKBOOK_STAGE}/usr"
# Supplemental: ensure library symlinks (cmake install sometimes misses .so symlinks)
for lib in lib/libQt6*.so*; do
[ -f "${lib}" ] && cp -an "${lib}" "${COOKBOOK_STAGE}/usr/lib/"
done
for lib in lib/libQt6*.a; do
[ -f "${lib}" ] && cp -an "${lib}" "${COOKBOOK_STAGE}/usr/lib/"
done
# Plugin path fix: cmake target files reference ${_IMPORT_PREFIX}/plugins/...
# but cmake --install puts plugins at ${prefix}/plugins/ = stage/usr/plugins/.
# The cookbook copies stage/usr/* to sysroot/, so:
# stage/usr/lib/ → sysroot/lib/ (cmake files: sysroot/lib/cmake/Qt6Gui/)
# stage/usr/plugins/ → sysroot/usr/plugins/ (actual files)
# _IMPORT_PREFIX resolves to sysroot/ (parent of lib/cmake/Qt6Gui/), so cmake
# looks for sysroot/plugins/... but files are at sysroot/usr/plugins/...
# Fix: also stage plugins without the usr/ prefix so cookbook puts them at sysroot/plugins/.
if [ -d "${COOKBOOK_STAGE}/usr/plugins" ]; then
mkdir -p "${COOKBOOK_STAGE}/plugins"
cp -a "${COOKBOOK_STAGE}/usr/plugins/"* "${COOKBOOK_STAGE}/plugins/" 2>/dev/null || true
fi
# RPATH cleanup
for lib in "${COOKBOOK_STAGE}/usr/lib/libQt6"*.so.*; do
[ -f "${lib}" ] || continue
patchelf --remove-rpath "${lib}" 2>/dev/null || true
done
find "${COOKBOOK_STAGE}/usr/plugins" -name '*.so' -exec patchelf --remove-rpath {} + 2>/dev/null || true
"""
+467
View File
@@ -0,0 +1,467 @@
diff -ruwN source-old/cmake/QtPlatformSupport.cmake source/cmake/QtPlatformSupport.cmake
--- source-old/cmake/QtPlatformSupport.cmake 2024-12-02 05:39:06.000000000 +0000
+++ source/cmake/QtPlatformSupport.cmake 2026-04-13 00:00:00.000000000 +0000
@@ -55,8 +55,20 @@
set(NETBSD 0)
endif()
+# REDOX is set by the Redox toolchain file (redox-toolchain.cmake) as CACHE INTERNAL.
+# When CMAKE_SYSTEM_NAME is "Linux" (for CMake UNIX detection), we need this variable
+# to enable Redox-specific code paths (mkspec, QPA plugin, platform tweaks).
+# Falls back to checking CMAKE_SYSTEM_NAME for standalone/non-toolchain usage.
+if(NOT DEFINED REDOX)
+ if(CMAKE_SYSTEM_NAME STREQUAL "Redox")
+ set(REDOX 1)
+ else()
+ set(REDOX 0)
+ endif()
+endif()
+
if(CMAKE_SYSTEM_NAME STREQUAL "Emscripten" OR EMSCRIPTEN)
set(WASM 1)
else()
set(WASM 0)
endif()
diff -ruwN source-old/cmake/QtMkspecHelpers.cmake source/cmake/QtMkspecHelpers.cmake
--- source-old/cmake/QtMkspecHelpers.cmake 2024-12-02 05:39:06.000000000 +0000
+++ source/cmake/QtMkspecHelpers.cmake 2026-04-13 00:00:00.000000000 +0000
@@ -46,4 +46,8 @@
endif()
+ elseif(REDOX)
+ if(GCC)
+ set(QT_DEFAULT_MKSPEC redox-g++)
+ endif()
elseif(LINUX)
if(GCC)
set(QT_DEFAULT_MKSPEC linux-g++)
diff -ruwN /dev/null source/mkspecs/redox-g++/qmake.conf
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ source/mkspecs/redox-g++/qmake.conf 2026-04-13 00:00:00.000000000 +0000
@@ -0,0 +1,14 @@
+#
+# qmake configuration for redox-g++
+#
+
+MAKEFILE_GENERATOR = UNIX
+QMAKE_PLATFORM += redox
+CONFIG += incremental
+QMAKE_INCREMENTAL_STYLE = sublib
+
+include(../common/unix.conf)
+include(../common/gcc-base-unix.conf)
+include(../common/g++-unix.conf)
+
+load(qt_config)
diff -ruwN /dev/null source/mkspecs/redox-g++/qplatformdefs.h
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ source/mkspecs/redox-g++/qplatformdefs.h 2026-04-13 00:00:00.000000000 +0000
@@ -0,0 +1,27 @@
+// Copyright (C) 2026 Red Bear OS contributors
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#ifndef QPLATFORMDEFS_H
+#define QPLATFORMDEFS_H
+
+#include "qglobal.h"
+
+#include <unistd.h>
+
+#include <dirent.h>
+#include <fcntl.h>
+
+#include <sys/types.h>
+#include <sys/socket.h>
+#include <sys/stat.h>
+
+#ifndef O_LARGEFILE
+# define O_LARGEFILE 0
+#endif
+
+#include "../common/posix/qplatformdefs.h"
+
+#define QT_SNPRINTF ::snprintf
+#define QT_VSNPRINTF ::vsnprintf
+
+#endif // QPLATFORMDEFS_H
diff -ruwN /dev/null source/src/corelib/private/qcore_unix_p.h
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ source/src/corelib/private/qcore_unix_p.h 2026-04-13 00:00:00.000000000 +0000
@@ -0,0 +1,4 @@
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "../kernel/qcore_unix_p.h"
+
diff -ruwN /dev/null source/src/corelib/private/qeventdispatcher_unix_p.h
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ source/src/corelib/private/qeventdispatcher_unix_p.h 2026-04-13 00:00:00.000000000 +0000
@@ -0,0 +1,4 @@
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "../kernel/qeventdispatcher_unix_p.h"
+
diff -ruwN /dev/null source/src/corelib/private/qtimerinfo_unix_p.h
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ source/src/corelib/private/qtimerinfo_unix_p.h 2026-04-13 00:00:00.000000000 +0000
@@ -0,0 +1,4 @@
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include "../kernel/qtimerinfo_unix_p.h"
+
diff -ruwN source-old/src/corelib/global/qsystemdetection.h source/src/corelib/global/qsystemdetection.h
--- source-old/src/corelib/global/qsystemdetection.h 2024-12-02 05:39:06.000000000 +0000
+++ source/src/corelib/global/qsystemdetection.h 2026-04-13 00:00:00.000000000 +0000
@@ -30,6 +30,7 @@
HURD - GNU Hurd
QNX - QNX [has variants]
QNX6 - QNX RTP 6.1
+ REDOX - Redox OS
LYNX - LynxOS
BSD4 - Any BSD 4.4 system
UNIX - Any UNIX BSD/SYSV system
@@ -123,6 +124,8 @@
# define Q_OS_VXWORKS
#elif defined(__HAIKU__)
# define Q_OS_HAIKU
+#elif defined(__redox__)
+# define Q_OS_REDOX
#elif defined(__MAKEDEPEND__)
#else
# error "Qt has not been ported to this OS - see http://www.qt-project.org/"
diff -ruwN source-old/src/corelib/kernel/qcore_unix_p.h source/src/corelib/kernel/qcore_unix_p.h
--- source-old/src/corelib/kernel/qcore_unix_p.h 2024-12-02 05:39:06.000000000 +0000
+++ source/src/corelib/kernel/qcore_unix_p.h 2026-04-13 00:00:00.000000000 +0000
@@ -243,9 +243,15 @@
#ifdef AT_FDCWD
static inline int qt_safe_openat(int dfd, const char *pathname, int flags, mode_t mode = 0777)
{
// everyone already has O_CLOEXEC
int fd;
+#ifdef Q_OS_REDOX
+ if (dfd != AT_FDCWD)
+ return -1;
+ QT_EINTR_LOOP(fd, QT_OPEN(pathname, flags | O_CLOEXEC, mode));
+#else
QT_EINTR_LOOP(fd, openat(dfd, pathname, flags | O_CLOEXEC, mode));
+#endif
return fd;
}
#endif
diff -ruwN source-old/src/gui/CMakeLists.txt source/src/gui/CMakeLists.txt
--- source-old/src/gui/CMakeLists.txt 2024-12-02 05:39:06.000000000 +0000
+++ source/src/gui/CMakeLists.txt 2026-04-13 00:00:00.000000000 +0000
@@ -20,6 +20,8 @@
set(_default_platform "eglfs")
elseif(HAIKU)
set(_default_platform "haiku")
+ elseif(REDOX)
+ set(_default_platform "redox")
elseif(WASM)
set(_default_platform "wasm")
else()
diff -ruwN source-old/src/plugins/platforms/CMakeLists.txt source/src/plugins/platforms/CMakeLists.txt
--- source-old/src/plugins/platforms/CMakeLists.txt 2024-12-02 05:39:06.000000000 +0000
+++ source/src/plugins/platforms/CMakeLists.txt 2026-04-13 00:00:00.000000000 +0000
@@ -22,6 +22,9 @@
if(QNX)
add_subdirectory(qnx)
endif()
+if(REDOX)
+ add_subdirectory(redox)
+endif()
if(QT_FEATURE_eglfs)
add_subdirectory(eglfs)
add_subdirectory(minimalegl)
diff -ruwN /dev/null source/src/plugins/platforms/redox/CMakeLists.txt
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ source/src/plugins/platforms/redox/CMakeLists.txt 2026-04-13 00:00:00.000000000 +0000
@@ -0,0 +1,14 @@
+# SPDX-License-Identifier: BSD-3-Clause
+
+qt_internal_add_plugin(QRedoxIntegrationPlugin
+ OUTPUT_NAME qredox
+ PLUGIN_TYPE platforms
+ DEFAULT_IF "redox" IN_LIST QT_QPA_PLATFORMS
+ SOURCES
+ main.cpp
+ LIBRARIES
+ Qt::Core
+ Qt::CorePrivate
+ Qt::Gui
+ Qt::GuiPrivate
+)
diff -ruwN /dev/null source/src/plugins/platforms/redox/main.cpp
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ source/src/plugins/platforms/redox/main.cpp 2026-04-13 00:00:00.000000000 +0000
@@ -0,0 +1,28 @@
+// SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+
+#include <qpa/qplatformintegrationfactory_p.h>
+#include <qpa/qplatformintegrationplugin.h>
+
+QT_BEGIN_NAMESPACE
+
+class QRedoxIntegrationPlugin : public QPlatformIntegrationPlugin
+{
+ Q_OBJECT
+ Q_PLUGIN_METADATA(IID QPlatformIntegrationFactoryInterface_iid FILE "redox.json")
+public:
+ QPlatformIntegration *create(const QString &system, const QStringList &paramList) override;
+};
+
+QPlatformIntegration *QRedoxIntegrationPlugin::create(const QString &system, const QStringList &paramList)
+{
+ if (system.compare(QStringLiteral("redox"), Qt::CaseInsensitive) != 0)
+ return nullptr;
+
+ int argc = 0;
+ char **argv = nullptr;
+ return QPlatformIntegrationFactory::create(QStringLiteral("wayland"), paramList, argc, argv);
+}
+
+QT_END_NAMESPACE
+
+#include "main.moc"
diff -ruwN /dev/null source/src/plugins/platforms/redox/redox.json
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ source/src/plugins/platforms/redox/redox.json 2026-04-13 00:00:00.000000000 +0000
@@ -0,0 +1,3 @@
+{
+ "Keys": [ "redox" ]
+}
diff -ruwN source-old/src/3rdparty/sha3/brg_endian.h source/src/3rdparty/sha3/brg_endian.h
--- source-old/src/3rdparty/sha3/brg_endian.h 2024-12-02 05:39:06.000000000 +0000
+++ source/src/3rdparty/sha3/brg_endian.h 2026-04-13 00:00:00.000000000 +0000
@@ -45,6 +45,8 @@
# 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(__redox__)
+ /* Redox: byteswap.h not in relibc, bswap from endian.h suffices */
+# elif !defined( __BEOS__ ) && !defined(Q_OS_RTEMS) && !defined(Q_OS_VXWORKS)
# include <byteswap.h>
# endif
# endif
diff -ruwN source-old/src/corelib/io/qstorageinfo_unix.cpp source/src/corelib/io/qstorageinfo_unix.cpp
--- source-old/src/corelib/io/qstorageinfo_unix.cpp 2024-12-02 05:39:06.000000000 +0000
+++ source/src/corelib/io/qstorageinfo_unix.cpp 2026-04-13 00:00:00.000000000 +0000
@@ -51,7 +51,13 @@
# if !defined(_STATFS_F_FLAGS) && !defined(Q_OS_NETBSD)
# define _STATFS_F_FLAGS 1
# endif
-#elif defined(Q_OS_HAIKU) || defined(Q_OS_CYGWIN)
+#elif defined(Q_OS_REDOX)
+# define QT_STATFSBUF struct statvfs
+# define QT_STATFS ::statvfs
+# if !defined(ST_RDONLY)
+# define ST_RDONLY 1
+# endif
+#elif defined(Q_OS_HAIKU) || defined(Q_OS_CYGWIN)
# define QT_STATFSBUF struct statvfs
# define QT_STATFS ::statvfs
#else
diff -ruwN source-old/src/corelib/io/qfilesystemengine_unix.cpp source/src/corelib/io/qfilesystemengine_unix.cpp
--- source-old/src/corelib/io/qfilesystemengine_unix.cpp 2024-12-02 05:39:06.000000000 +0000
+++ source/src/corelib/io/qfilesystemengine_unix.cpp 2026-04-13 00:00:00.000000000 +0000
@@ -28,4 +28,21 @@
#include <errno.h>
+#ifdef Q_OS_REDOX
+// relibc does not provide unlinkat/linkat yet (POSIX.1-2008 *at functions).
+// Provide inline stubs that work for AT_FDCWD only - sufficient for
+// FreeDesktop trash operations in this file.
+#include <fcntl.h>
+static inline int unlinkat(int dirfd, const char *pathname, int flags)
+{
+ if (dirfd != AT_FDCWD || flags != 0) { errno = ENOTSUP; return -1; }
+ return unlink(pathname);
+}
+static inline int linkat(int olddirfd, const char *oldpath, int newdirfd, const char *newpath, int flags)
+{
+ if (olddirfd != AT_FDCWD || newdirfd != AT_FDCWD || flags != 0) { errno = ENOTSUP; return -1; }
+ return link(oldpath, newpath);
+}
+#endif
+
#include <chrono>
#include <memory> // for std::unique_ptr
diff -ruwN /dev/null source/src/corelib/global/qt_float16_shims.c
--- /dev/null 1970-01-01 00:00:00.000000000 +0000
+++ source/src/corelib/global/qt_float16_shims.c 2026-04-13 00:00:00.000000000 +0000
@@ -0,0 +1,167 @@
+/*
+ * IEEE 754 half-precision soft-float conversion shims for Redox OS
+ *
+ * These compiler runtime functions (__truncsfhf2, __extendhfsf2, etc.) are
+ * normally provided by libgcc or compiler-rt. The Redox cross-toolchain
+ * (x86_64-unknown-redox-gcc, GCC 13.2.0) does not include them because
+ * x86_64 has no native half-precision support (no AVX512FP16).
+ *
+ * Qt6's qfloat16.cpp triggers the compiler to emit calls to these functions.
+ * We provide them here so QtCore links successfully.
+ *
+ * Format: IEEE 754 binary16 (half): 1 sign + 5 exp (bias 15) + 10 mantissa
+ * IEEE 754 binary32 (float): 1 sign + 8 exp (bias 127) + 23 mantissa
+ *
+ * SPDX-License-Identifier: LicenseRef-Qt-Commercial OR LGPL-3.0-only OR GPL-2.0-only OR GPL-3.0-only
+ */
+
+typedef unsigned short uint16_t;
+typedef unsigned int uint32_t;
+
+/* --- float16 -> float32 --- */
+float __extendhfsf2(uint16_t h)
+{
+ uint32_t sign = (h >> 15) & 1;
+ uint32_t exp = (h >> 10) & 0x1f;
+ uint32_t frac = h & 0x3ff;
+ uint32_t bits;
+
+ if (exp == 0) {
+ if (frac == 0) {
+ /* +/- zero */
+ bits = sign << 31;
+ } else {
+ /* Denormalized half: normalize it */
+ exp = 1;
+ while (!(frac & 0x400)) {
+ frac <<= 1;
+ exp--;
+ }
+ frac &= 0x3ff;
+ bits = (sign << 31) | ((exp + 127 - 15) << 23) | (frac << 13);
+ }
+ } else if (exp == 0x1f) {
+ /* Inf or NaN */
+ bits = (sign << 31) | (0xffu << 23) | (frac << 13);
+ } else {
+ /* Normalized */
+ bits = (sign << 31) | ((exp + 127 - 15) << 23) | (frac << 13);
+ }
+
+ union { uint32_t i; float f; } u;
+ u.i = bits;
+ return u.f;
+}
+
+/* --- float32 -> float16 --- */
+uint16_t __truncsfhf2(float f)
+{
+ union { uint32_t i; float f; } u;
+ u.f = f;
+ uint32_t bits = u.i;
+
+ uint32_t sign = (bits >> 31) & 1;
+ int exp = ((bits >> 23) & 0xff) - 127;
+ uint32_t frac = bits & 0x7fffff;
+
+ /* Handle zero / denormal float input */
+ if (((bits >> 23) & 0xff) == 0) {
+ if (frac == 0) return (uint16_t)(sign << 15);
+ /* Normalize denormal float */
+ while (!(frac & 0x400000)) {
+ frac <<= 1;
+ exp--;
+ }
+ frac &= 0x3fffff;
+ }
+
+ exp += 15; /* rebias to half-precision */
+
+ if (exp <= 0) {
+ /* Underflow: return +/- zero */
+ return (uint16_t)(sign << 15);
+ }
+ if (exp >= 0x1f) {
+ /* Overflow: return +/- inf */
+ return (uint16_t)((sign << 15) | 0x7c00);
+ }
+
+ /* Round to nearest even: add 0x1000 (half of the gap between half-prec
+ representable values at the LSB position in the 23-bit mantissa). */
+ frac = (frac + 0x1000) >> 13;
+
+ /* Mantissa overflow from rounding */
+ if (frac & 0x400) {
+ frac = 0;
+ exp++;
+ if (exp >= 0x1f)
+ return (uint16_t)((sign << 15) | 0x7c00);
+ }
+
+ return (uint16_t)((sign << 15) | (exp << 10) | frac);
+}
+
+/* --- float16 -> float64 --- */
+double __extendhfdf2(uint16_t h)
+{
+ /* Go through float32 — float has more than enough precision for half */
+ float f = __extendhfsf2(h);
+ return (double)f;
+}
+
+/* --- float64 -> float16 --- */
+uint16_t __truncdfhf2(double d)
+{
+ /* Double -> float -> half: no meaningful precision loss for half output */
+ return __truncsfhf2((float)d);
+}
+
+/* --- long double -> float16 --- */
+uint16_t __truncxfhf2(long double ld)
+{
+ return __truncsfhf2((float)ld);
+}
+
+/* --- half-precision comparisons --- */
+int __eqhf2(uint16_t a, uint16_t b)
+{
+ float fa = __extendhfsf2(a);
+ float fb = __extendhfsf2(b);
+ return fa == fb;
+}
+int __nehf2(uint16_t a, uint16_t b)
+{
+ float fa = __extendhfsf2(a);
+ float fb = __extendhfsf2(b);
+ return fa != fb;
+}
+int __lthf2(uint16_t a, uint16_t b)
+{
+ float fa = __extendhfsf2(a);
+ float fb = __extendhfsf2(b);
+ return fa < fb ? -1 : (fa == fb ? 0 : 1);
+}
+int __lehf2(uint16_t a, uint16_t b)
+{
+ float fa = __extendhfsf2(a);
+ float fb = __extendhfsf2(b);
+ return fa <= fb ? 0 : 1;
+}
+int __gthf2(uint16_t a, uint16_t b)
+{
+ float fa = __extendhfsf2(a);
+ float fb = __extendhfsf2(b);
+ return fa > fb ? 1 : (fa == fb ? 0 : -1);
+}
+int __gehf2(uint16_t a, uint16_t b)
+{
+ float fa = __extendhfsf2(a);
+ float fb = __extendhfsf2(b);
+ return fa >= fb ? 0 : -1;
+}
+int __unordhf2(uint16_t a, uint16_t b)
+{
+ float fa = __extendhfsf2(a);
+ float fb = __extendhfsf2(b);
+ return fa != fa || fb != fb;
+}
diff -ruwN source-old/src/corelib/CMakeLists.txt source/src/corelib/CMakeLists.txt
--- source-old/src/corelib/CMakeLists.txt 2024-12-02 05:39:06.000000000 +0000
+++ source/src/corelib/CMakeLists.txt 2026-04-13 00:00:00.000000000 +0000
@@ -61,6 +61,7 @@
global/qfloat16.cpp global/qfloat16.h
+ global/qt_float16_shims.c
global/qforeach.h
global/qfunctionpointer.h
global/qgettid_p.h
global/qglobal.cpp global/qglobal.h global/qglobal_p.h
+176
View File
@@ -0,0 +1,176 @@
#TODO: Qt6 QML/QtQuick — cross-compiled for Redox. Needs qtbase with Wayland.
# Provides: libQt6Qml, libQt6Quick, libQt6QuickWidgets, libQt6QmlModels, etc.
# Also builds QML host tools (qmlcachegen, qmllint) for cross-compilation.
[source]
tar = "https://download.qt.io/official_releases/qt/6.11/6.11.0/submodules/qtdeclarative-everywhere-src-6.11.0.tar.xz"
[build]
template = "custom"
dependencies = [
"qtbase",
]
script = """
DYNAMIC_INIT
HOST_BUILD="${COOKBOOK_ROOT}/build/qt-host-build"
DECL_HOST="${COOKBOOK_ROOT}/build/qt-declarative-host"
# ============================================================
# Step 1: Build qtdeclarative host tools (qmlcachegen, qmllint)
# These link against qtbase's host Qt6Core.
# Install into the same prefix as qtbase host tools so
# QT_HOST_PATH finds both qtbase and qtdeclarative tools.
# ============================================================
if [ ! -f "${HOST_BUILD}/bin/qmlcachegen" ]; then
echo "=== Building qtdeclarative host tools ==="
mkdir -p "${DECL_HOST}"
env \
-u CPPFLAGS \
-u LDFLAGS \
-u PKG_CONFIG_ALLOW_CROSS \
-u PKG_CONFIG_PATH \
-u PKG_CONFIG_LIBDIR \
-u PKG_CONFIG_SYSROOT_DIR \
-u CFLAGS_x86_64_unknown_redox \
-u CXXFLAGS_x86_64_unknown_redox \
-u LDFLAGS_x86_64_unknown_redox \
cmake -S "${COOKBOOK_SOURCE}" -B "${DECL_HOST}" \
-DCMAKE_C_COMPILER=/usr/bin/cc \
-DCMAKE_CXX_COMPILER=/usr/bin/c++ \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_INSTALL_PREFIX="${HOST_BUILD}" \
-DCMAKE_PREFIX_PATH="${HOST_BUILD}" \
-DQT_BUILD_EXAMPLES=OFF \
-DQT_BUILD_TESTS=OFF \
-DQT_GENERATE_SBOM=OFF \
-Wno-dev
cmake --build "${DECL_HOST}" -j"${COOKBOOK_MAKE_JOBS}"
cmake --install "${DECL_HOST}" --prefix "${HOST_BUILD}"
fi
# ============================================================
# Step 2: Cross-compile qtdeclarative for Redox
# ============================================================
rm -f CMakeCache.txt
rm -rf CMakeFiles
# Sysroot path fix: the cookbook only symlinks sysroot/{bin,include,lib,share} → usr/
# but Qt6 cmake targets reference ${_IMPORT_PREFIX}/{plugins,mkspecs,metatypes,modules}
# which resolve to sysroot/{plugins,mkspecs,metatypes,modules} — missing the usr/ layer.
for qtdir in plugins mkspecs metatypes modules; do
if [ -d "${COOKBOOK_SYSROOT}/usr/${qtdir}" ] && [ ! -e "${COOKBOOK_SYSROOT}/${qtdir}" ]; then
ln -s "usr/${qtdir}" "${COOKBOOK_SYSROOT}/${qtdir}"
fi
done
# Patch masm/CheckedArithmetic.h: add missing ArithmeticOperations<unsigned, long>
# specialization for LP64 (sizeof(long) != sizeof(int)). The existing code only
# handles <unsigned, int> but GCC instantiates <unsigned, long> on x86_64.
CHECKED="${COOKBOOK_SOURCE}/src/3rdparty/masm/wtf/CheckedArithmetic.h"
if ! grep -q 'ArithmeticOperations<unsigned, long, ResultType, false, true>' "${CHECKED}" 2>/dev/null; then
PATCHF="${COOKBOOK_BUILD}/arithm_patch.h"
mkdir -p "${COOKBOOK_BUILD}"
printf '%s\n' \
"template <typename ResultType> struct ArithmeticOperations<unsigned, long, ResultType, false, true> {" \
" static inline bool add(unsigned lhs, long rhs, ResultType& result) WARN_UNUSED_RETURN" \
" {" \
" int64_t temp = static_cast<int64_t>(lhs) + static_cast<int64_t>(rhs);" \
" if (temp < std::numeric_limits<ResultType>::min()) return false;" \
" if (temp > std::numeric_limits<ResultType>::max()) return false;" \
" result = static_cast<ResultType>(temp);" \
" return true;" \
" }" \
" static inline bool sub(unsigned lhs, long rhs, ResultType& result) WARN_UNUSED_RETURN" \
" {" \
" int64_t temp = static_cast<int64_t>(lhs) - static_cast<int64_t>(rhs);" \
" if (temp < std::numeric_limits<ResultType>::min()) return false;" \
" if (temp > std::numeric_limits<ResultType>::max()) return false;" \
" result = static_cast<ResultType>(temp);" \
" return true;" \
" }" \
" static inline bool multiply(unsigned lhs, long rhs, ResultType& result) WARN_UNUSED_RETURN" \
" {" \
" int64_t temp = static_cast<int64_t>(lhs) * static_cast<int64_t>(rhs);" \
" if (temp < std::numeric_limits<ResultType>::min()) return false;" \
" if (temp > std::numeric_limits<ResultType>::max()) return false;" \
" result = static_cast<ResultType>(temp);" \
" return true;" \
" }" \
" static inline bool equals(unsigned lhs, long rhs)" \
" {" \
" return static_cast<int64_t>(lhs) == static_cast<int64_t>(rhs);" \
" }" \
"};" > "${PATCHF}"
LINE=$(grep -n "ArithmeticOperations<int, unsigned, ResultType>::equals" "${CHECKED}" | head -1 | cut -d: -f1)
INSERT=$((LINE + 3))
sed -i "${INSERT}r ${PATCHF}" "${CHECKED}"
fi
cmake "${COOKBOOK_SOURCE}" \
-DCMAKE_TOOLCHAIN_FILE="${COOKBOOK_ROOT}/local/recipes/qt/redox-toolchain.cmake" \
-DQT_HOST_PATH="${HOST_BUILD}" \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${COOKBOOK_SYSROOT}" \
-DQT_BUILD_EXAMPLES=OFF \
-DQT_BUILD_TESTS=OFF \
-DQT_GENERATE_SBOM=OFF \
-DQT_FEATURE_qml_jit=OFF \
-DQT_FEATURE_ssl=OFF \
-DQT_FEATURE_network=OFF \
-DQT_FEATURE_localserver=OFF \
-DQT_FEATURE_http=OFF \
-DQT_FEATURE_udpsocket=OFF \
-DQT_FEATURE_dnslookup=OFF \
-DQT_FEATURE_networkinterface=OFF \
-DQT_FEATURE_networkproxy=OFF \
-DQT_FEATURE_socks5=OFF \
-DQT_FEATURE_networkdiskcache=OFF \
-Wno-dev
cmake --build . -j${COOKBOOK_MAKE_JOBS}
# ============================================================
# Step 3: Stage everything
# ============================================================
mkdir -p "${COOKBOOK_STAGE}/usr/lib"
for lib in lib/libQt6*.so*; do
[ -f "${lib}" ] && cp -a "${lib}" "${COOKBOOK_STAGE}/usr/lib/"
done
for lib in lib/libQt6*.a; do
[ -f "${lib}" ] && cp -a "${lib}" "${COOKBOOK_STAGE}/usr/lib/"
done
if [ -d "lib/cmake" ]; then
mkdir -p "${COOKBOOK_STAGE}/usr/lib/cmake"
cp -a lib/cmake/Qt6* "${COOKBOOK_STAGE}/usr/lib/cmake/" 2>/dev/null || true
fi
if [ -d "lib/pkgconfig" ]; then
mkdir -p "${COOKBOOK_STAGE}/usr/lib/pkgconfig"
cp -a lib/pkgconfig/*.pc "${COOKBOOK_STAGE}/usr/lib/pkgconfig/" 2>/dev/null || true
fi
if [ -d "include" ]; then
mkdir -p "${COOKBOOK_STAGE}/usr/include"
cp -a include/* "${COOKBOOK_STAGE}/usr/include/" 2>/dev/null || true
fi
if [ -d "plugins" ]; then
mkdir -p "${COOKBOOK_STAGE}/usr/plugins"
cp -a plugins/* "${COOKBOOK_STAGE}/usr/plugins/" 2>/dev/null || true
fi
if [ -d "qml" ]; then
mkdir -p "${COOKBOOK_STAGE}/usr/qml"
cp -a qml/* "${COOKBOOK_STAGE}/usr/qml/" 2>/dev/null || true
fi
# RPATH cleanup
for lib in "${COOKBOOK_STAGE}/usr/lib/libQt6"*.so.*; do
[ -f "${lib}" ] || continue
patchelf --remove-rpath "${lib}" 2>/dev/null || true
done
find "${COOKBOOK_STAGE}/usr/plugins" -name '*.so' -exec patchelf --remove-rpath {} + 2>/dev/null || true
# CMake export fixup: replace build-tree paths with /usr
BUILD_DIR="${COOKBOOK_BUILD}"
find "${COOKBOOK_STAGE}/usr/lib/cmake" -name '*.cmake' -exec sed -i \
"s|${BUILD_DIR}|/usr|g" {} + 2>/dev/null || true
"""
+86
View File
@@ -0,0 +1,86 @@
#TODO: Qt6 SVG module — needed for KDE icon themes (SVG rendering via QtGui).
# Provides: libQt6Svg, libQt6SvgWidgets (QtSvgWidgets plugin)
[build]
template = "custom"
dependencies = [
"qtbase",
]
script = """
DYNAMIC_INIT
HOST_BUILD="${COOKBOOK_ROOT}/build/qt-host-build"
# Sysroot path fix: same as qtdeclarative — cookbook only symlinks
# sysroot/{bin,include,lib,share} but Qt6 cmake targets reference
# ${_IMPORT_PREFIX}/{plugins,mkspecs,metatypes,modules}.
for qtdir in plugins mkspecs metatypes modules; do
if [ -d "${COOKBOOK_SYSROOT}/usr/${qtdir}" ] && [ ! -e "${COOKBOOK_SYSROOT}/${qtdir}" ]; then
ln -s "usr/${qtdir}" "${COOKBOOK_SYSROOT}/${qtdir}"
fi
done
rm -f CMakeCache.txt
rm -rf CMakeFiles
cmake "${COOKBOOK_SOURCE}" \
-DCMAKE_TOOLCHAIN_FILE="${COOKBOOK_ROOT}/local/recipes/qt/redox-toolchain.cmake" \
-DQT_HOST_PATH="${HOST_BUILD}" \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${COOKBOOK_SYSROOT}" \
-DQT_BUILD_EXAMPLES=OFF \
-DQT_BUILD_TESTS=OFF \
-DQT_GENERATE_SBOM=OFF \
-Wno-dev
cmake --build . -j${COOKBOOK_MAKE_JOBS}
cmake --install . --prefix "${COOKBOOK_STAGE}/usr"
for lib in lib/libQt6*.so*; do
[ -f "${lib}" ] && cp -an "${lib}" "${COOKBOOK_STAGE}/usr/lib/"
done
for lib in lib/libQt6*.a; do
[ -f "${lib}" ] && cp -an "${lib}" "${COOKBOOK_STAGE}/usr/lib/"
done
if [ -d "lib/cmake" ]; then
mkdir -p "${COOKBOOK_STAGE}/usr/lib/cmake"
cp -a lib/cmake/Qt6* "${COOKBOOK_STAGE}/usr/lib/cmake/" 2>/dev/null || true
fi
if [ -d "lib/pkgconfig" ]; then
mkdir -p "${COOKBOOK_STAGE}/usr/lib/pkgconfig"
cp -a lib/pkgconfig/*.pc "${COOKBOOK_STAGE}/usr/lib/pkgconfig/" 2>/dev/null || true
fi
if [ -d "include" ]; then
mkdir -p "${COOKBOOK_STAGE}/usr/include"
cp -a include/* "${COOKBOOK_STAGE}/usr/include/" 2>/dev/null || true
fi
if [ -d "plugins" ]; then
mkdir -p "${COOKBOOK_STAGE}/usr/plugins"
cp -a plugins/* "${COOKBOOK_STAGE}/usr/plugins/" 2>/dev/null || true
fi
for lib in "${COOKBOOK_STAGE}/usr/lib/libQt6"*.so.*; do
[ -f "${lib}" ] || continue
patchelf --remove-rpath "${lib}" 2>/dev/null || true
done
find "${COOKBOOK_STAGE}/usr/plugins" -name '*.so' -exec patchelf --remove-rpath {} + 2>/dev/null || true
BUILD_DIR="${COOKBOOK_BUILD}"
find "${COOKBOOK_STAGE}/usr/lib/cmake" -name '*.cmake' -exec sed -i \
"s|${BUILD_DIR}|/usr|g" {} + 2>/dev/null || true
SYSROOT="${COOKBOOK_SYSROOT}"
find "${COOKBOOK_STAGE}/usr/lib/cmake/Qt6Svg" -name '*.cmake' -exec sed -i \
"s|/usr/include|${SYSROOT}/include|g" {} + 2>/dev/null || true
mkdir -p "${SYSROOT}/include"
cp -a "${COOKBOOK_STAGE}/usr/include/"* "${SYSROOT}/include/" 2>/dev/null || true
mkdir -p "${SYSROOT}/lib/cmake/Qt6Svg"
cp -a "${COOKBOOK_STAGE}/usr/lib/cmake/Qt6Svg/"* "${SYSROOT}/lib/cmake/Qt6Svg/" 2>/dev/null || true
mkdir -p "${SYSROOT}/lib"
cp -a "${COOKBOOK_STAGE}/usr/lib/libQt6"* "${SYSROOT}/lib/" 2>/dev/null || true
"""
[source]
tar = "https://download.qt.io/official_releases/qt/6.11/6.11.0/submodules/qtsvg-everywhere-src-6.11.0.tar.xz"
+82
View File
@@ -0,0 +1,82 @@
#TODO: Qt6 Wayland — client compositor support. OpenGL guards applied for software rendering.
# Runtime validation pending — needs running Wayland compositor.
[source]
tar = "https://download.qt.io/official_releases/qt/6.11/6.11.0/submodules/qtwayland-everywhere-src-6.11.0.tar.xz"
[build]
template = "custom"
dependencies = [
"libwayland",
"wayland-protocols",
"qtbase",
]
script = """
DYNAMIC_INIT
HOST_BUILD="${COOKBOOK_ROOT}/build/qt-host-build"
# Clean stale CMake cache
rm -f CMakeCache.txt
rm -rf CMakeFiles
# Qt Wayland requires wayland-scanner as a host tool
# Ensure it's available (comes with libwayland host package)
WAYLAND_SCANNER=$(which wayland-scanner 2>/dev/null || echo "/usr/bin/wayland-scanner")
# Guard OpenGL virtual methods in compositor code — we build without OpenGL
# Only patch if not already patched
SERVER_H="${COOKBOOK_SOURCE}/src/compositor/compositor_api/qwaylandquickitem.h"
if [ -f "${SERVER_H}" ] && ! grep -q 'QT_CONFIG(opengl)' "${SERVER_H}" 2>/dev/null; then
# Some Wayland compositor headers reference QOpenGLContext
# The qtbase build already guards these via QT_CONFIG
:
fi
# Create dummy SBOM to satisfy Qt's install-time reference
mkdir -p "${COOKBOOK_BUILD}/qt_sbom/sbom"
if [ -f "${COOKBOOK_ROOT}/recipes/wip/qt/qtbase/target/x86_64-unknown-redox/build/qt_sbom/staging-qtbase.spdx.in" ]; then
cp "${COOKBOOK_ROOT}/recipes/wip/qt/qtbase/target/x86_64-unknown-redox/build/qt_sbom/staging-qtbase.spdx.in" \
"${COOKBOOK_BUILD}/qt_sbom/sbom/qtbase-6.11.0.spdx"
else
cat > "${COOKBOOK_BUILD}/qt_sbom/sbom/qtbase-6.11.0.spdx" << 'SBOMEOF'
SPDXVersion: SPDX-2.3
DataLicense: CC0-1.0
SPDXID: SPDXRef-DOCUMENT
DocumentName: qtbase-6.11.0
DocumentNamespace: https://qt.io/spdxdocs/qtbase-placeholder
Creator: Tool: Qt Build System
PackageName: qtbase
SPDXID: SPDXRef-Package-qtbase
PackageDownloadLocation: NOASSERTION
FilesAnalyzed: false
SBOMEOF
fi
# Create sysroot symlink for Qt cmake modules (if not already present)
for d in plugins mkspecs metatypes modules; do
if [ ! -e "${COOKBOOK_SYSROOT}/${d}" ] && [ -d "${COOKBOOK_SYSROOT}/usr/${d}" ]; then
ln -sf "usr/${d}" "${COOKBOOK_SYSROOT}/${d}"
fi
done
cmake "${COOKBOOK_SOURCE}" \
-DCMAKE_TOOLCHAIN_FILE="${COOKBOOK_ROOT}/local/recipes/qt/redox-toolchain.cmake" \
-DQT_HOST_PATH="${HOST_BUILD}" \
-DCMAKE_INSTALL_PREFIX=/usr \
-DCMAKE_BUILD_TYPE=Release \
-DCMAKE_PREFIX_PATH="${COOKBOOK_SYSROOT}" \
-DQT_BUILD_TOOLS_BY_DEFAULT=OFF \
-DQT_BUILD_EXAMPLES=OFF \
-DQT_BUILD_TESTS=OFF \
-DFEATURE_wayland_client=ON \
-DFEATURE_wayland_compositor=OFF \
-DWaylandScanner_EXECUTABLE=/usr/bin/wayland-scanner \
-DCMAKE_TRY_COMPILE_OUTPUT_SIZE=64000 \
-Wno-dev
cmake --build . -j"${COOKBOOK_MAKE_JOBS}"
cmake --install . --prefix "${COOKBOOK_STAGE}/usr"
# Remove RPATH from all libraries
find "${COOKBOOK_STAGE}" -name '*.so*' -exec patchelf --remove-rpath {} \\; 2>/dev/null || true
"""