Commit 832974db authored by Henri Chain's avatar Henri Chain 🛰
Browse files

add dbus-activated systemd service

Correctly scopes spectacle in systemd service `app-org.kde.spectacle.service` when dbus-activated (while still working if systemd is not present), as per https://systemd.io/DESKTOP_ENVIRONMENTS/

uses new ECM modules:
- frameworks/extra-cmake-modules!5 to simplify the systemd service templating + install
- frameworks/extra-cmake-modules!11 to generate the dbus service file automatically
parent 0f4e2979
......@@ -12,7 +12,7 @@ cmake_minimum_required (VERSION 3.5 FATAL_ERROR)
project(Spectacle VERSION ${SPECTACLE_VERSION})
set(QT_MIN_VERSION "5.10.0")
set(KF5_MIN_VERSION "5.68.0")
set(KF5_MIN_VERSION "5.73.0")
find_package(ECM ${KF5_MIN_VERSION} REQUIRED NO_MODULE)
set(
......
# install the DBus service and interface files in the correct place
include(ECMGenerateDBusServiceFile)
include(ECMConfiguredInstall)
configure_file(org.kde.Spectacle.service.in ${CMAKE_CURRENT_BINARY_DIR}/org.kde.Spectacle.service)
# Generate and install dbus-activated systemd service
ecm_install_configured_files(INPUT app-org.kde.spectacle.service.in DESTINATION ${SYSTEMD_USER_UNIT_INSTALL_DIR})
ecm_generate_dbus_service_file(
NAME org.kde.Spectacle
EXECUTABLE "${CMAKE_INSTALL_PREFIX}/bin/spectacle --dbus"
SYSTEMD_SERVICE app-org.kde.spectacle.service
DESTINATION ${CMAKE_CURRENT_BINARY_DIR}
)
install(FILES ${CMAKE_CURRENT_BINARY_DIR}/org.kde.Spectacle.service DESTINATION ${DBUS_SERVICES_INSTALL_DIR})
install(FILES org.kde.Spectacle.xml DESTINATION ${DBUS_INTERFACES_INSTALL_DIR})
[Unit]
Description=Spectacle screenshot capture utility
[Service]
ExecStart=@CMAKE_INSTALL_PREFIX@/bin/spectacle --dbus
BusName=org.kde.Spectacle
[D-BUS Service]
Name=org.kde.Spectacle
Exec=@CMAKE_INSTALL_PREFIX@/bin/spectacle --dbus
  • Somehow after this change, the build system attempts to install files in the wrong directory (namely the one of the user building; seen when building the latest git state on the OBS):

     [   50s] -- Installing: /home/abuild/rpmbuild/BUILDROOT/spectacle-20.11.70git.20200901T061338~52bac0c-ku.11.1.x86_64/home/abuild/rpmbuild/BUILD/spectacle-20.11.70git.20200901T061338~52bac0c/build/dbus/org.kde.Spectacle.service
    Edited by Luca Beltrame
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment