From e672e51267ff87405700cbb80807aa6a678a06a5 Mon Sep 17 00:00:00 2001 From: Mike Gabriel Date: Sun, 25 Oct 2020 23:31:54 +0100 Subject: Port from autotools to CMake. --- data/CMakeLists.txt | 76 +++++++++++++++++++++++++++++ data/Makefile.am | 40 --------------- data/ayatana-indicator-bluetooth.desktop.in | 2 +- data/ayatana-indicator-bluetooth.service.in | 2 +- 4 files changed, 78 insertions(+), 42 deletions(-) create mode 100644 data/CMakeLists.txt delete mode 100644 data/Makefile.am (limited to 'data') diff --git a/data/CMakeLists.txt b/data/CMakeLists.txt new file mode 100644 index 0000000..a423f5b --- /dev/null +++ b/data/CMakeLists.txt @@ -0,0 +1,76 @@ + +find_package(GSettings) + +########################### +# Indicator service +########################### + +set( + INDICATOR_DIR + "${CMAKE_INSTALL_DATADIR}/ayatana/indicators" + CACHE FILEPATH "Ayatana Indicators Directory" +) + +install( + FILES "org.ayatana.indicator.bluetooth" + DESTINATION "${INDICATOR_DIR}" +) + +########################### +# Systemd Job +########################### + +pkg_check_modules(SYSTEMD systemd) +if (${SYSTEMD_FOUND}) + + # where to install + pkg_get_variable(SYSTEMD_USER_DIR systemd systemduserunitdir) + message (STATUS "${SYSTEMD_USER_DIR} is the systemd user unit file install dir") + + set (SYSTEMD_USER_NAME "${CMAKE_PROJECT_NAME}.service") + set (SYSTEMD_USER_FILE "${CMAKE_CURRENT_BINARY_DIR}/${SYSTEMD_USER_NAME}") + set (SYSTEMD_USER_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${SYSTEMD_USER_NAME}.in") + + # build it + set (pkglibexecdir "${CMAKE_INSTALL_FULL_PKGLIBEXECDIR}") + configure_file ("${SYSTEMD_USER_FILE_IN}" "${SYSTEMD_USER_FILE}") + + # install it + install (FILES "${SYSTEMD_USER_FILE}" + DESTINATION "${SYSTEMD_USER_DIR}") +endif() + +########################### +# XDG Autostart +########################### + +set( + INDICATOR_BLUETOOTH_XDG_AUTOSTART + "${CMAKE_CURRENT_BINARY_DIR}/ayatana-indicator-bluetooth.desktop" +) + +configure_file( + "ayatana-indicator-bluetooth.desktop.in" + ${INDICATOR_BLUETOOTH_XDG_AUTOSTART} + @ONLY +) + +install( + FILES "${INDICATOR_BLUETOOTH_XDG_AUTOSTART}" + DESTINATION "/etc/xdg/autostart" +) + +########################### +# GSettings +########################### + +set (SCHEMA_NAME "org.ayatana.indicator.bluetooth.gschema.xml") +set (SCHEMA_FILE "${CMAKE_CURRENT_BINARY_DIR}/${SCHEMA_NAME}") +set (SCHEMA_FILE_IN "${CMAKE_CURRENT_SOURCE_DIR}/${SCHEMA_NAME}.in") + +# generate the .xml file using intltool +set (ENV{LC_ALL} "C") +execute_process (COMMAND intltool-merge -quiet --xml-style --utf8 --no-translations "${SCHEMA_FILE_IN}" "${SCHEMA_FILE}") + +# let UseGSettings do the rest +add_schema (${SCHEMA_NAME}) diff --git a/data/Makefile.am b/data/Makefile.am deleted file mode 100644 index e9ef0b9..0000000 --- a/data/Makefile.am +++ /dev/null @@ -1,40 +0,0 @@ -BUILT_SOURCES = -EXTRA_DIST = -CLEANFILES = - -# the indicator bus file -indicatorsdir = $(datadir)/ayatana/indicators -dist_indicators_DATA = org.ayatana.indicator.bluetooth - -# the systemd unit file -systemddir = $(SYSTEMD_USERDIR) -systemd_DATA = ayatana-indicator-bluetooth.service -systemd_in = $(systemd_DATA:.service=.service.in) -$(systemd_DATA): $(systemd_in) - $(AM_V_GEN) $(SED) -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@ -BUILT_SOURCES += $(systemd_DATA) -EXTRA_DIST += $(systemd_in) -CLEANFILES += $(systemd_DATA) - -# the xdg autostart job file -xdg_autostartdir = /etc/xdg/autostart -xdg_autostart_DATA = ayatana-indicator-bluetooth.desktop -xdg_autostart_in = $(xdg_autostart_DATA:.desktop=.desktop.in) -$(xdg_autostart_DATA): $(xdg_autostart_in) - $(AM_V_GEN) $(SED) -e "s|\@pkglibexecdir\@|$(pkglibexecdir)|" $< > $@ -BUILT_SOURCES += $(xdg_autostart_DATA) -EXTRA_DIST += $(xdg_autostart_in) -CLEANFILES += $(xdg_autostart_DATA) - -# the gsettings schema -gsettings_SCHEMAS = org.ayatana.indicator.bluetooth.gschema.xml -@INTLTOOL_XML_NOMERGE_RULE@ -@GSETTINGS_RULES@ - -EXTRA_DIST += \ - org.ayatana.indicator.bluetooth.gschema.xml.in \ - ayatana-indicator-bluetooth.desktop.in - -CLEANFILES += \ - $(dbus_services_DATA) \ - $(gsettings_SCHEMAS) diff --git a/data/ayatana-indicator-bluetooth.desktop.in b/data/ayatana-indicator-bluetooth.desktop.in index 8eb5e1f..871e80a 100644 --- a/data/ayatana-indicator-bluetooth.desktop.in +++ b/data/ayatana-indicator-bluetooth.desktop.in @@ -1,7 +1,7 @@ [Desktop Entry] Type=Application Name=Ayatana Indicator Bluetooth -Exec=@pkglibexecdir@/ayatana-indicator-bluetooth/ayatana-indicator-bluetooth-service +Exec=@CMAKE_INSTALL_FULL_LIBEXECDIR@/ayatana-indicator-bluetooth/ayatana-indicator-bluetooth-service NoDisplay=true StartupNotify=false Terminal=false diff --git a/data/ayatana-indicator-bluetooth.service.in b/data/ayatana-indicator-bluetooth.service.in index 92344c8..aa513b6 100644 --- a/data/ayatana-indicator-bluetooth.service.in +++ b/data/ayatana-indicator-bluetooth.service.in @@ -4,7 +4,7 @@ PartOf=graphical-session.target PartOf=ayatana-indicators.target [Service] -ExecStart=@pkglibexecdir@/ayatana-indicator-bluetooth/ayatana-indicator-bluetooth-service +ExecStart=@CMAKE_INSTALL_FULL_LIBEXECDIR@/ayatana-indicator-bluetooth/ayatana-indicator-bluetooth-service Restart=on-failure [Install] -- cgit v1.2.3