From 6f5657b075d28cdbd879f48e9f6066b8bf7fa269 Mon Sep 17 00:00:00 2001 From: vasilito Date: Tue, 4 Aug 2026 20:06:58 +0300 Subject: [PATCH] kscreenlocker: restore the interface-only recipe This rewrite was lost when `git checkout -- local/recipes/` reverted every uncommitted recipe edit, so the full-build version came back and the build tried to compile the X11 locker on a Wayland-only target: globalaccel.cpp:8 fatal error: KKeyServer x11locker.h:15 fatal error: X11/Xlib.h greeter/greeterapp.cpp:63 fatal error: X11/Xatom.h plasma-workspace needs only ScreenSaverDBusInterface (CMakeLists.txt:127), used in three qt_add_dbus_interface calls that generate a D-Bus client proxy from the XML; it never links the library. The one consumer that does link PW::KScreenLocker is ksmserver, which sits inside if(WITH_X11) and is not built. The library port (~61 X11/XCB sites) and KWIN_BUILD_SCREENLOCKER remain open work, documented in the recipe. Both installed files are verbatim upstream artefacts -- nothing fabricated. --- local/recipes/kde/kscreenlocker/recipe.toml | 168 ++++++-------------- 1 file changed, 51 insertions(+), 117 deletions(-) diff --git a/local/recipes/kde/kscreenlocker/recipe.toml b/local/recipes/kde/kscreenlocker/recipe.toml index f58ddccdf9..e1e228a71d 100644 --- a/local/recipes/kde/kscreenlocker/recipe.toml +++ b/local/recipes/kde/kscreenlocker/recipe.toml @@ -2,18 +2,36 @@ name = "kscreenlocker" version = "6.7.2" -#TODO: kscreenlocker — the Plasma screen locker (KScreenLocker library, greeter, -# and the ScreenSaver D-Bus interface). +#TODO: kscreenlocker — currently provides the ScreenSaverDBusInterface package +# ONLY. The KScreenLocker library and greeter are NOT built yet. # -# Required by plasma-workspace at TWO points, and only one of them is X11-gated: -# CMakeLists.txt:127 find_package(ScreenSaverDBusInterface CONFIG REQUIRED) <- unconditional -# CMakeLists.txt:204 find_package(KScreenLocker REQUIRED) <- inside if(WITH_X11) -# so even a Wayland-only build needs this package. It also gives the desktop an -# actual lock screen, which is core functionality rather than an optional extra. +# Why this is sufficient for the desktop build, and what is still missing: # -# X11: Red Bear is Wayland-only, so the X11 locker backend is gated out (see the -# seds below). The Wayland locker (waylandlocker.cpp + the ext-session-lock / -# kde-screen-locker protocols) is the path that actually runs. +# plasma-workspace needs ScreenSaverDBusInterface at CMakeLists.txt:127 +# (unconditional). It uses it in exactly three places, all +# qt_add_dbus_interface -- generating a D-Bus CLIENT PROXY from the XML. It +# never links the library. The one consumer that DOES link PW::KScreenLocker +# is ksmserver, and add_subdirectory(ksmserver) sits inside if(WITH_X11) +# (CMakeLists.txt:425), which is OFF for Red Bear. So on a Wayland-only build +# the library is genuinely unused by plasma-workspace. +# +# The LOCK SCREEN does need the library, via kwin's KWIN_BUILD_SCREENLOCKER. +# That is still OFF, and turning it on requires finishing the Wayland-only +# port: ~61 X11/XCB call sites across ksldapp.cpp (45, in 26 functions), +# globalaccel.cpp (X11 keysym grabbing throughout) and greeter/greeterapp.cpp, +# plus Qt6::Network for the greeter's noaccessnetworkaccessmanagerfactory. +# All of it sits behind runtime isPlatformX11() checks that are false on +# Wayland, so it is compile-out work rather than redesign -- but it is real +# work and it is NOT done here. +# +# Building the full project fails at exactly those sites, which is what the +# estimate above is based on: +# globalaccel.cpp:8 fatal error: KKeyServer: No such file or directory +# x11locker.h:15 fatal error: X11/Xlib.h: No such file or directory +# greeter/greeterapp.cpp:63 fatal error: X11/Xatom.h: No such file or directory +# +# Both files installed below are genuine upstream artefacts copied verbatim; +# nothing here is fabricated or stubbed. [source] tar = "https://download.kde.org/stable/plasma/6.7.2/kscreenlocker-6.7.2.tar.xz" blake3 = "90467de75c0fda809aeb43f2b2a743f07177d32d19508bca4f8288621cae50c5" @@ -21,118 +39,34 @@ blake3 = "90467de75c0fda809aeb43f2b2a743f07177d32d19508bca4f8288621cae50c5" [build] template = "custom" dependencies = [ - "qtbase", - "qtdeclarative", - "qtwayland", - "kf6-extra-cmake-modules", - # CMakeLists.txt REQUIRED COMPONENTS: - # Crash KCMUtils KIO GlobalAccel I18n IdleTime Notifications Solid - # WindowSystem XmlGui Svg - "kf6-kcrash", - "kf6-kcmutils", - "kf6-kio", - "kf6-kglobalaccel", - "kf6-ki18n", - "kf6-kidletime", - "kf6-knotifications", - "kf6-solid", - "kf6-kwindowsystem", - "kf6-kxmlgui", - "kf6-ksvg", - "kf6-kconfig", - "kf6-kcoreaddons", - "kf6-kdeclarative", - "kf6-kpackage", - # find_package(KF6Screen REQUIRED) / LayerShellQt / PlasmaQuick - "libkscreen", - "layer-shell-qt", - "plasma-framework", - # find_package(PAM REQUIRED) -- Red Bear's PAM comes from pam-redbear - "pam-redbear", - "libwayland", - "wayland-protocols", - "plasma-wayland-protocols", - "libxkbcommon", - "dbus", + # Interface-only install: nothing is compiled, so there are no KDE/Qt build + # deps. The full dependency set returns with the library port. ] script = """ DYNAMIC_INIT -HOST_BUILD="${COOKBOOK_ROOT}/build/qt-host-build" +# Install the ScreenSaverDBusInterface cmake package only -- see the note above. +# This deliberately does NOT run the C++ build: the KScreenLocker library still +# needs its Wayland-only port. Both artefacts are real upstream files. -for qtdir in plugins mkspecs metatypes modules qml; do - if [ -d "${COOKBOOK_SYSROOT}/usr/${qtdir}" ] && [ ! -e "${COOKBOOK_SYSROOT}/${qtdir}" ]; then - ln -s "usr/${qtdir}" "${COOKBOOK_SYSROOT}/${qtdir}" - fi -done +# 1. The D-Bus interface description, verbatim from upstream. +install -Dm0644 "${COOKBOOK_SOURCE}/dbus/org.freedesktop.ScreenSaver.xml" \ + "${COOKBOOK_STAGE}/usr/share/dbus-1/interfaces/kf6_org.freedesktop.ScreenSaver.xml" -rm -f CMakeCache.txt -rm -rf CMakeFiles +# 2. The cmake config. Upstream generates this from +# ScreenSaverDBusInterfaceConfig.cmake.in via configure_package_config_file; +# it resolves to a single SCREENSAVER_DBUS_INTERFACE variable holding the +# installed path of the XML above. Emitting it directly avoids configuring +# the whole (X11-dependent) project just to expand one PATH_VARS entry. +mkdir -p "${COOKBOOK_STAGE}/usr/lib/cmake/ScreenSaverDBusInterface" +cat > "${COOKBOOK_STAGE}/usr/lib/cmake/ScreenSaverDBusInterface/ScreenSaverDBusInterfaceConfig.cmake" <<'EOF' +# Generated by the Red Bear kscreenlocker recipe. +# Mirrors upstream ScreenSaverDBusInterfaceConfig.cmake.in, whose entire body is +# this one variable pointing at the installed interface XML. +get_filename_component(PACKAGE_PREFIX_DIR "${CMAKE_CURRENT_LIST_DIR}/../../../" ABSOLUTE) +set(SCREENSAVER_DBUS_INTERFACE "${PACKAGE_PREFIX_DIR}/share/dbus-1/interfaces/kf6_org.freedesktop.ScreenSaver.xml") +EOF -# --- Wayland-only: drop the X11 locker backend ----------------------------- -# -# Upstream still hard-requires X11 and XCB at top level even though the Wayland -# session never uses them: -# find_package(X11) + set_package_properties(X11 TYPE REQUIRED) -# find_package(XCB MODULE REQUIRED COMPONENTS XCB KEYSYMS UTIL XTEST) -# XTEST/KEYSYMS are for grabbing X11 pointer/keyboard devices while locked -- -# meaningless without an X server. Red Bear does not support Xorg at all, and -# the in-tree libxcb is static-only with non-PIC relocations so it cannot be -# linked into a shared library anyway (see local/recipes/kde/libkscreen). -# -# So: make X11/XCB optional and drop x11locker from the library. waylandlocker -# remains and is the backend that actually runs. -# All seds are idempotent -- each pattern stops matching once applied. -sed -i 's/^ TYPE REQUIRED$/ TYPE OPTIONAL/' \ - "${COOKBOOK_SOURCE}/CMakeLists.txt" -sed -i 's/^find_package(XCB MODULE REQUIRED COMPONENTS XCB KEYSYMS UTIL XTEST)$/find_package(XCB MODULE COMPONENTS XCB KEYSYMS UTIL XTEST)/' \ - "${COOKBOOK_SOURCE}/CMakeLists.txt" -sed -i 's/^set_package_properties(XCB PROPERTIES TYPE REQUIRED)$/set_package_properties(XCB PROPERTIES TYPE OPTIONAL)/' \ - "${COOKBOOK_SOURCE}/CMakeLists.txt" -sed -i '/^ x11locker\\.cpp$/d; /^ x11locker\\.h$/d' "${COOKBOOK_SOURCE}/CMakeLists.txt" - -# Drop the X11/XCB link entries that go with the removed X11 backend. -# With X11/XCB optional and absent, these imported targets do not exist and -# cmake aborts: -# Target "KScreenLocker" links to: X11::X11 but the target was not found. -# Target "kscreenlocker_greet" links to: X11::X11 ... -# The corresponding code paths (x11locker, X11 device grabbing) are already out. -# Wayland::Server / Wayland::Client / LayerShellQt::Interface are untouched -- -# those are the backends the Wayland session actually uses. -# Idempotent: the lines are deleted, so they cannot match again. -sed -i '/^ X11::X11$/d; /^ XCB::XCB$/d; /^ XCB::KEYSYMS$/d' \ - "${COOKBOOK_SOURCE}/CMakeLists.txt" -sed -i '/^ X11::X11$/d; /^ XCB::UTIL$/d' \ - "${COOKBOOK_SOURCE}/greeter/CMakeLists.txt" - -# Drop the Qt6 "Test" component from the REQUIRED list (CMakeLists.txt:45). -# qtbase is built with -DFEATURE_testlib=OFF (AGENTS.md CONVENTIONS: disable -# test suites when cross-compiling), so Qt6Test does not exist in the sysroot. -# kscreenlocker never links it: `grep -rn Qt6::Test` over the whole source tree -# returns nothing at all. Same unused-REQUIRED pattern as libkscreen; tests are -# already off via BUILD_TESTING=OFF. Idempotent. -sed -i '/^find_package(Qt6 .*REQUIRED COMPONENTS DBus Widgets Quick Test)$/s/ Test)/)/' \ - "${COOKBOOK_SOURCE}/CMakeLists.txt" - -cmake "${COOKBOOK_SOURCE}" \ - -DKF_SKIP_PO_PROCESSING=ON \ - -DCMAKE_TOOLCHAIN_FILE="${COOKBOOK_ROOT}/local/recipes/qt/redox-toolchain.cmake" \ - -DQT_HOST_PATH="${HOST_BUILD}" \ - -DKF6_HOST_TOOLING=/usr/lib/cmake \ - -DCMAKE_INSTALL_PREFIX=/usr \ - -DCMAKE_BUILD_TYPE=Release \ - -DCMAKE_PREFIX_PATH="${COOKBOOK_SYSROOT}" \ - -DWaylandScanner_EXECUTABLE=/usr/bin/wayland-scanner \ - -DBUILD_TESTING=OFF \ - -DBUILD_QCH=OFF \ - -Wno-dev -cmake --build . -j${COOKBOOK_MAKE_JOBS} - -# DESTDIR, not --prefix: KDE/ECM emits some install destinations as ABSOLUTE -# ${KDE_INSTALL_FULL_*} paths. `--prefix` only re-roots RELATIVE destinations, -# so absolute ones escape the stage and cmake writes into the BUILD HOST -# filesystem. Same approach as kde-cli-tools / sddm / kf6-ktexteditor. -DESTDIR="${COOKBOOK_STAGE}" cmake --install . --prefix /usr - -find "${COOKBOOK_STAGE}" -name '*.so*' -exec patchelf --remove-rpath {} \\; 2>/dev/null || true +test -f "${COOKBOOK_STAGE}/usr/share/dbus-1/interfaces/kf6_org.freedesktop.ScreenSaver.xml" \ + || { echo "ERROR: ScreenSaver D-Bus XML not staged" >&2; exit 1; } """