plasma-desktop: install KSMServerDBusInterface, gate X11-only KWindowSystem APIs

Both found by pre-checking plasma-desktop against the failure classes already
catalogued, before it was ever attempted -- rather than discovering them one
~15-minute build at a time.

1. KSMServerDBusInterface. plasma-desktop hard-requires it (CMakeLists.txt:191,
   CONFIG REQUIRED), but upstream generates it in ksmserver/CMakeLists.txt and
   add_subdirectory(ksmserver) sits inside if(WITH_X11) -- OFF here -- so a
   Wayland-only build never installs it. Only the D-Bus INTERFACE is needed:
   the XML is a platform-independent description and upstream's
   KSMServerDBusInterfaceConfig.cmake.in is a single variable pointing at it.
   ksmserver itself is X11-only (links X11::X11/SM/ICE and PW::KScreenLocker)
   and stays unbuilt. XML copied verbatim from the upstream tree. Same shape and
   same remedy as kscreenlocker.

   KRunnerAppDBusInterface, also REQUIRED by plasma-desktop, needs nothing:
   add_subdirectory(krunner) is outside the X11 gate.

2. X11-only KWindowSystem headers, reusing gate-kx11extras.py unchanged:
   KX11Extras (4 files), KUserTimestamp (1), KWindowInfo (2).

Dry-run on the plasma-desktop tree: 3 files gated, 5 includes, 6 blocks;
preprocessor balance OK across all 5 files carrying guards; no malformed
'#endif <code>'; no unguarded references left. Source restored afterwards --
the recipe applies this at build time.
This commit is contained in:
2026-08-04 21:03:01 +03:00
parent f25ccf07c6
commit 908987494d
2 changed files with 41 additions and 0 deletions
@@ -70,6 +70,18 @@ done
#DISABLED: find "${COOKBOOK_SOURCE}" -name CMakeLists.txt -exec sed -i 's/^ecm_install_po_files_as_qm/#ecm_install_po_files_as_qm/' {} \\;
#DISABLED: find "${COOKBOOK_SOURCE}" -name CMakeLists.txt -exec sed -i 's/^ki18n_install(po)/#ki18n_install(po)/' {} \\;
# Gate the X11-only KWindowSystem APIs behind HAVE_X11, exactly as
# plasma-workspace does. plasma-desktop uses KX11Extras (4 files),
# KUserTimestamp (1) and KWindowInfo (2); a Wayland-only kwindowsystem installs
# none of those headers, so each is a hard compile failure rather than a lost
# feature. X11 is compiled OUT, not added -- every call site already sits behind
# a runtime isPlatformX11() that is permanently false here.
#
# Shared with plasma-workspace: the script brace-matches each block and keeps a
# trailing `else` outside the guard, since wrapping a whole if/else-if chain
# yields invalid C++. Idempotent.
python3 "${COOKBOOK_ROOT}/local/scripts/gate-kx11extras.py" "${COOKBOOK_SOURCE}"
cmake "${COOKBOOK_SOURCE}" \
-DKF_SKIP_PO_PROCESSING=ON \
-DCMAKE_TOOLCHAIN_FILE="${COOKBOOK_ROOT}/local/recipes/qt/redox-toolchain.cmake" \
@@ -246,5 +246,34 @@ cmake "${COOKBOOK_SOURCE}" \
cmake --build . -j"${COOKBOOK_MAKE_JOBS}"
cmake --install . --prefix "${COOKBOOK_STAGE}/usr"
# KSMServerDBusInterface, installed OUTSIDE the X11 gate.
#
# plasma-desktop hard-requires it (its CMakeLists.txt:191
# find_package(KSMServerDBusInterface CONFIG REQUIRED)), but upstream generates
# it in ksmserver/CMakeLists.txt and add_subdirectory(ksmserver) sits inside
# if(WITH_X11) -- OFF here -- so a Wayland-only build never installs it and
# plasma-desktop cannot configure.
#
# Only the D-Bus INTERFACE is needed, not the ksmserver binary: the XML is a
# platform-independent interface description and upstream's
# KSMServerDBusInterfaceConfig.cmake.in is a single variable pointing at it.
# ksmserver itself is X11-only (it links X11::X11/SM/ICE and PW::KScreenLocker)
# and stays unbuilt. Same shape, and same remedy, as kscreenlocker.
#
# The XML is copied verbatim from the upstream tree -- nothing is fabricated.
install -Dm0644 "${COOKBOOK_SOURCE}/ksmserver/org.kde.KSMServerInterface.xml" \
"${COOKBOOK_STAGE}/usr/share/dbus-1/interfaces/org.kde.KSMServerInterface.xml"
mkdir -p "${COOKBOOK_STAGE}/usr/lib/cmake/KSMServerDBusInterface"
cat > "${COOKBOOK_STAGE}/usr/lib/cmake/KSMServerDBusInterface/KSMServerDBusInterfaceConfig.cmake" <<'KSMEOF'
# Generated by the Red Bear plasma-workspace recipe.
# Mirrors upstream ksmserver/KSMServerDBusInterfaceConfig.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(KSMSERVER_DBUS_INTERFACE "${PACKAGE_PREFIX_DIR}/share/dbus-1/interfaces/org.kde.KSMServerInterface.xml")
KSMEOF
test -f "${COOKBOOK_STAGE}/usr/share/dbus-1/interfaces/org.kde.KSMServerInterface.xml" \
|| { echo "ERROR: KSMServer D-Bus XML not staged" >&2; exit 1; }
find "${COOKBOOK_STAGE}" -name '*.so*' -exec patchelf --remove-rpath {} \\; 2>/dev/null || true
"""