Support rootless KAuth install for local development

Add PLASMA_MOBILE_LOCAL_KAUTH_INSTALL CMake option to redirect KAuth
helper executables, D-Bus service files, and polkit policy files into
CMAKE_INSTALL_PREFIX instead of hardcoded /usr paths.

Guard KF6Auth find_package calls in helper subdirectories with
if(NOT TARGET KF6::AuthCore) to avoid re-running find_package after
the top-level override, which would revert generated service Exec
paths back to /usr/libexec/kf6/kauth.
This commit is contained in:
Marco Allegretti 2026-04-08 19:06:55 +02:00
parent 31fe7c0d37
commit 523c3a6728
3 changed files with 14 additions and 2 deletions

View file

@ -18,6 +18,7 @@ set(CMAKE_CXX_STANDARD 20)
set(CMAKE_CXX_STANDARD_REQUIRED ON) set(CMAKE_CXX_STANDARD_REQUIRED ON)
option(INSTALL_SYSTEMD_SERVICE "Install a systemd service file to start the session" OFF) option(INSTALL_SYSTEMD_SERVICE "Install a systemd service file to start the session" OFF)
option(PLASMA_MOBILE_LOCAL_KAUTH_INSTALL "Install KAuth helpers and policies into CMAKE_INSTALL_PREFIX for local rootless development" OFF)
find_package(ECM ${KF6_MIN_VERSION} REQUIRED NO_MODULE) find_package(ECM ${KF6_MIN_VERSION} REQUIRED NO_MODULE)
set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH}) set(CMAKE_MODULE_PATH ${ECM_MODULE_PATH})
@ -124,6 +125,13 @@ set_package_properties(KF6::AuthCore PROPERTIES
PURPOSE "Allows Plasma Mobile to configure Waydroid" PURPOSE "Allows Plasma Mobile to configure Waydroid"
) )
if(PLASMA_MOBILE_LOCAL_KAUTH_INSTALL)
set(KAUTH_HELPER_INSTALL_DIR "${CMAKE_INSTALL_FULL_LIBEXECDIR}/kf6/kauth")
set(KAUTH_HELPER_INSTALL_ABSOLUTE_DIR "${KAUTH_HELPER_INSTALL_DIR}")
set(KAUTH_POLICY_FILES_INSTALL_DIR "${CMAKE_INSTALL_FULL_DATADIR}/polkit-1/actions")
set(INSTALL_BROKEN_KAUTH_POLICY_FILES ON)
endif()
include(CheckIncludeFiles) include(CheckIncludeFiles)
ecm_find_qmlmodule(org.kde.pipewire 0.1) ecm_find_qmlmodule(org.kde.pipewire 0.1)

View file

@ -12,7 +12,9 @@ target_link_libraries(waydroidhelper
install(TARGETS waydroidhelper DESTINATION ${KAUTH_HELPER_INSTALL_DIR}) install(TARGETS waydroidhelper DESTINATION ${KAUTH_HELPER_INSTALL_DIR})
find_package(KF6Auth NO_MODULE) if(NOT TARGET KF6::AuthCore)
find_package(KF6Auth NO_MODULE REQUIRED)
endif()
kauth_install_helper_files(waydroidhelper org.kde.plasma.mobileshell.waydroidhelper root) kauth_install_helper_files(waydroidhelper org.kde.plasma.mobileshell.waydroidhelper root)
kauth_install_actions(org.kde.plasma.mobileshell.waydroidhelper waydroidhelper.actions) kauth_install_actions(org.kde.plasma.mobileshell.waydroidhelper waydroidhelper.actions)

View file

@ -13,7 +13,9 @@ target_link_libraries(flashlighthelper
install(TARGETS flashlighthelper DESTINATION ${KAUTH_HELPER_INSTALL_DIR}) install(TARGETS flashlighthelper DESTINATION ${KAUTH_HELPER_INSTALL_DIR})
find_package(KF6Auth NO_MODULE) if(NOT TARGET KF6::AuthCore)
find_package(KF6Auth NO_MODULE REQUIRED)
endif()
kauth_install_helper_files(flashlighthelper org.kde.plasma.mobileshell.flashlighthelper root) kauth_install_helper_files(flashlighthelper org.kde.plasma.mobileshell.flashlighthelper root)
kauth_install_actions(org.kde.plasma.mobileshell.flashlighthelper flashlighthelper.actions) kauth_install_actions(org.kde.plasma.mobileshell.flashlighthelper flashlighthelper.actions)