Files
RedBear-OS/local/recipes/kde/sddm/wayland-patch.sh
T
vasilito 7aeb3bb475 build: capture build script auto-stash changes from 0.2.5 kernel/relibc/base build
The build-redbear.sh script auto-stashes working tree changes
in nested relibc and base source trees before running the
build. These changes were captured by the failed kernel
build attempt that hit the json-target-spec / kernel rust
toolchain mismatch (fixed in 0.2.5 by creating the local
0.2.5 branch).

Captured changes:
- local/recipes/kde/* : KDE Frameworks 6 source CMakeLists
  whitespace changes from the autostash (preserved)
- local/recipes/qt/qtbase/* : qtypes.h whitespace from the
  autostash (preserved)
- local/sources/kernel/Cargo.lock : dependency lock from
  the kernel relibc rebuild attempt
- local/sources/kernel/src/lib.rs : touched (mtime) by the
  build script's touch + make prefix command

This is a bookkeeping commit — the actual code changes
for the threading plan are on the 4 submodule branches
(kernel, relibc, base, libredox) and will be pushed
separately.

0.2.5 branch was created from 0.2.4 (HEAD cd3950072e) to
continue Phase 0 of the multi-threading plan work in a
clean branch.
2026-07-02 13:41:03 +03:00

206 lines
7.4 KiB
Bash
Executable File

#!/bin/bash
set -e
SRC="$1"
if [ -z "$SRC" ]; then
echo "Usage: $0 <source-directory>"
exit 1
fi
CMAKE="$SRC/CMakeLists.txt"
if [ ! -f "$CMAKE" ]; then
echo "ERROR: $CMAKE not found"
exit 1
fi
sed -i 's/find_package(XCB REQUIRED)/# Wayland-only: XCB not needed/' "$CMAKE"
sed -i 's/find_package(XCB)/# Wayland-only: XCB not needed/' "$CMAKE"
for cmakelists in "$SRC/src/daemon/CMakeLists.txt" "$SRC/src/helper/CMakeLists.txt" "$SRC/src/greeter/CMakeLists.txt"; do
if [ -f "$cmakelists" ]; then
sed -i 's/"\${LIBXCB_INCLUDE_DIR}"//' "$cmakelists"
sed -i 's/\${LIBXCB_LIBRARIES}//' "$cmakelists"
fi
done
if [ -f "$SRC/src/greeter/CMakeLists.txt" ]; then
sed -i 's/XcbKeyboardBackend.cpp/# Wayland-only: XCB not needed/' "$SRC/src/greeter/CMakeLists.txt"
fi
if [ -f "$SRC/src/daemon/CMakeLists.txt" ]; then
sed -i 's/XorgDisplayServer.cpp/XorgDisplayServer.cpp/' "$SRC/src/daemon/CMakeLists.txt"
sed -i 's/XorgUserDisplayServer.cpp/XorgUserDisplayServer.cpp/' "$SRC/src/daemon/CMakeLists.txt"
sed -i 's/XorgUserDisplayServer.h/XorgUserDisplayServer.h/' "$SRC/src/daemon/CMakeLists.txt"
fi
if [ -f "$SRC/cmake/FindXKB.cmake" ]; then
sed -i 's/PKG_CHECK_MODULES(PKG_XKB xcb-xkb)/PKG_CHECK_MODULES(PKG_XKB xkbcommon)/' "$SRC/cmake/FindXKB.cmake"
sed -i 's/FIND_PATH(LIBXKB_INCLUDE_DIR xcb\/xkb.h/FIND_PATH(LIBXKB_INCLUDE_DIR xkbcommon\/xkb.h/' "$SRC/cmake/FindXKB.cmake"
sed -i 's/FIND_LIBRARY(LIBXKB_LIBRARIES NAMES xcb-xkb libxcb-xkb/FIND_LIBRARY(LIBXKB_LIBRARIES NAMES xkbcommon/' "$SRC/cmake/FindXKB.cmake"
fi
if [ -f "$SRC/CMakeLists.txt" ]; then
sed -i 's/find_package(Qt\${QT_MAJOR_VERSION} 5.15.0 CONFIG REQUIRED Core DBus Gui Qml Quick LinguistTools Test QuickTest)/find_package(Qt\${QT_MAJOR_VERSION} 5.15.0 CONFIG REQUIRED Core DBus Gui Network Qml Quick)/' "$SRC/CMakeLists.txt"
sed -i '/find_package(Qt\${QT_MAJOR_VERSION} 5.15.0 CONFIG REQUIRED Core DBus Gui Network Qml Quick)/a find_package(Qt\${QT_MAJOR_VERSION} 5.15.0 CONFIG OPTIONAL_COMPONENTS LinguistTools Test QuickTest)' "$SRC/CMakeLists.txt"
fi
if [ -f "$SRC/data/themes/CMakeLists.txt" ]; then
sed -i 's/qt_add_translation(QM_FILES "\${TRANSLATION_SOURCES}")/if(Qt6LinguistTools_FOUND)\n qt_add_translation(QM_FILES "\${TRANSLATION_SOURCES}")\nendif()/' "$SRC/data/themes/CMakeLists.txt"
fi
if [ -f "$SRC/data/translations/CMakeLists.txt" ]; then
sed -i 's/qt_add_translation(QM_FILES \${TRANSLATION_FILES})/if(Qt6LinguistTools_FOUND)\n qt_add_translation(QM_FILES \${TRANSLATION_FILES})\nendif()/' "$SRC/data/translations/CMakeLists.txt"
fi
if [ -f "$SRC/test/CMakeLists.txt" ]; then
sed -i '1s/^/if(Qt6Test_FOUND AND Qt6QuickTest_FOUND)\n/' "$SRC/test/CMakeLists.txt"
echo 'endif()' >> "$SRC/test/CMakeLists.txt"
fi
if [ -f "$SRC/src/greeter/KeyboardModel.cpp" ]; then
sed -i '/#include "XcbKeyboardBackend.h"/d' "$SRC/src/greeter/KeyboardModel.cpp"
sed -i 's/if (QGuiApplication::platformName() == QLatin1String("xcb")) {/\/\/ Wayland-only: XCB not needed\n\/\/ if (QGuiApplication::platformName() == QLatin1String("xcb")) {/' "$SRC/src/greeter/KeyboardModel.cpp"
sed -i 's/m_backend = new XcbKeyboardBackend(d);/\/\/ m_backend = new XcbKeyboardBackend(d);/' "$SRC/src/greeter/KeyboardModel.cpp"
sed -i 's/m_backend->init();/\/\/ m_backend->init();/' "$SRC/src/greeter/KeyboardModel.cpp"
sed -i 's/m_backend->connectEventsDispatcher(this);/\/\/ m_backend->connectEventsDispatcher(this);/' "$SRC/src/greeter/KeyboardModel.cpp"
sed -i 's/} else if (QGuiApplication::platformName().contains(QLatin1String("wayland"))) {/if (QGuiApplication::platformName().contains(QLatin1String("wayland"))) {/' "$SRC/src/greeter/KeyboardModel.cpp"
fi
if [ -f "$SRC/src/common/XAuth.cpp" ]; then
cat > "$SRC/src/common/XAuth.cpp" << 'EOF'
#include "XAuth.h"
#include <QDebug>
namespace SDDM {
XAuth::XAuth() {}
QString XAuth::authDirectory() const { return m_authDir; }
void XAuth::setAuthDirectory(const QString &path) {
if (m_setup) {
qWarning("Unable to set xauth directory after setup");
return;
}
m_authDir = path;
}
QString XAuth::authPath() const { return m_authFile.fileName(); }
QByteArray XAuth::cookie() const { return m_cookie; }
void XAuth::setup() {
if (m_setup)
return;
m_setup = true;
qDebug() << "XAuth setup (Wayland-only stub)";
}
bool XAuth::addCookie(const QString &display) {
Q_UNUSED(display)
if (!m_setup) {
qWarning("Please setup xauth before adding a cookie");
return false;
}
return true;
}
bool XAuth::writeCookieToFile(const QString &display, const QString &fileName, QByteArray cookie) {
Q_UNUSED(display)
Q_UNUSED(fileName)
Q_UNUSED(cookie)
qDebug() << "XAuth writeCookieToFile (Wayland-only stub)";
return true;
}
}
EOF
fi
if [ -f "$SRC/src/daemon/XorgDisplayServer.cpp" ]; then
cat > "$SRC/src/daemon/XorgDisplayServer.cpp" << 'EOF'
#include "XorgDisplayServer.h"
#include <QDebug>
namespace SDDM {
XorgDisplayServer::XorgDisplayServer(Display *parent) : DisplayServer(parent) {
qDebug() << "XorgDisplayServer stub (Wayland-only build)";
}
XorgDisplayServer::~XorgDisplayServer() {}
const QString &XorgDisplayServer::display() const {
static QString dummy;
return dummy;
}
QString XorgDisplayServer::authPath() const {
return QString();
}
QString XorgDisplayServer::sessionType() const {
return QStringLiteral("x11");
}
const QByteArray XorgDisplayServer::cookie() const {
return QByteArray();
}
bool XorgDisplayServer::start() { return false; }
void XorgDisplayServer::stop() {}
void XorgDisplayServer::finished() {}
void XorgDisplayServer::setupDisplay() {}
void XorgDisplayServer::changeOwner(const QString &fileName) { Q_UNUSED(fileName) }
}
EOF
fi
if [ -f "$SRC/src/daemon/XorgUserDisplayServer.cpp" ]; then
cat > "$SRC/src/daemon/XorgUserDisplayServer.cpp" << 'EOF'
#include "XorgUserDisplayServer.h"
#include <QDebug>
namespace SDDM {
XorgUserDisplayServer::XorgUserDisplayServer(Display *parent) : DisplayServer(parent) {
qDebug() << "XorgUserDisplayServer stub (Wayland-only build)";
}
XorgUserDisplayServer::~XorgUserDisplayServer() {}
QString XorgUserDisplayServer::sessionType() const {
return QStringLiteral("x11");
}
void XorgUserDisplayServer::setDisplayName(const QString &displayName) {
Q_UNUSED(displayName)
}
QString XorgUserDisplayServer::command(Display *display) {
Q_UNUSED(display)
return QString();
}
bool XorgUserDisplayServer::start() { return false; }
void XorgUserDisplayServer::stop() {}
void XorgUserDisplayServer::finished() {}
void XorgUserDisplayServer::setupDisplay() {}
}
EOF
fi
if [ -f "$SRC/src/helper/UserSession.cpp" ]; then
sed -i 's/ioctl(STDIN_FILENO, TIOCSCTTY)/ioctl(STDIN_FILENO, TIOCSCTTY, 0)/' "$SRC/src/helper/UserSession.cpp"
fi
# Wayland-only port: SocketWriter.h uses QLocalSocket, so the greeter target
# must link Qt6::Network even though upstream SDDM greeter does not.
if [ -f "$SRC/src/greeter/CMakeLists.txt" ]; then
sed -i 's|target_link_libraries(${GREETER_TARGET}|target_link_libraries(${GREETER_TARGET} Qt${QT_MAJOR_VERSION}::Network|' "$SRC/src/greeter/CMakeLists.txt"
sed -i 's|target_link_libraries(${GREETER_TARGET} Qt${QT_MAJOR_VERSION}::Network *Qt${QT_MAJOR_VERSION}::Network|target_link_libraries(${GREETER_TARGET} Qt${QT_MAJOR_VERSION}::Network|g' "$SRC/src/greeter/CMakeLists.txt"
fi
echo "CMakeLists.txt patched for Wayland-only build."