[gnome-flashback/wip/systemd-user-units: 2/2] add --enable-systemd-session configure option



commit 350a7060c524e1cf62208959fcfe5796fe6afeaf
Author: Alberts Muktupāvels <alberts muktupavels gmail com>
Date:   Fri Aug 16 16:20:04 2019 +0300

    add --enable-systemd-session configure option

 configure.ac                                             | 16 ++++++++++++++++
 data/Makefile.am                                         | 13 +++++++++++--
 data/applications/Makefile.am                            |  9 +++++++--
 ...lashback.desktop.in => gnome-flashback.desktop.in.in} |  1 +
 data/systemd/Makefile.am                                 |  4 ++++
 po/POTFILES.in                                           |  2 +-
 6 files changed, 40 insertions(+), 5 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 0380d79..14a340e 100644
--- a/configure.ac
+++ b/configure.ac
@@ -269,6 +269,22 @@ PKG_CHECK_EXISTS([xrandr >= 1.5.0],
                  AC_DEFINE([HAVE_XRANDR15], [1],
                            [Define if XRandR is 1.5.0 or newer]))
 
+dnl **************************************************************************
+dnl Systemd session
+dnl **************************************************************************
+
+AC_ARG_ENABLE([systemd-session],
+              [AS_HELP_STRING([--enable-systemd-session], [enable systemd session support])],
+              [enable_systemd_session="$enableval"], [enable_systemd_session="yes"])
+
+HIDDEN_UNDER_SYSTEMD="false"
+AS_IF([test "x$enable_systemd_session" = "xyes"], [
+  HIDDEN_UNDER_SYSTEMD="true"
+])
+
+AM_CONDITIONAL([ENABLE_SYSTEMD_SESSION], [test "x$enable_systemd_session" = "xyes"])
+AC_SUBST([HIDDEN_UNDER_SYSTEMD])
+
 dnl **************************************************************************
 dnl Process .in files
 dnl **************************************************************************
diff --git a/data/Makefile.am b/data/Makefile.am
index 7fe152b..51c2ed1 100644
--- a/data/Makefile.am
+++ b/data/Makefile.am
@@ -18,12 +18,19 @@ libexec_SCRIPTS = \
        gnome-flashback-metacity \
        $(NULL)
 
+if ENABLE_SYSTEMD_SESSION
+session_management=--systemd
+else
+session_management=--builtin
+endif
+
 gnome-flashback-compiz: Makefile
        $(AM_V_GEN) (echo '#!/bin/sh' && echo '' && \
                     echo 'if [ -z $$XDG_CURRENT_DESKTOP ]; then' && \
                     echo '  export XDG_CURRENT_DESKTOP="GNOME-Flashback:GNOME"' && \
                     echo 'fi' && echo '' && \
-                    echo 'exec gnome-session --session=gnome-flashback-compiz "$$@"') > $@
+                    echo -n 'exec gnome-session $(session_management) ' && \
+                    echo '--session=gnome-flashback-compiz "$$@"') > $@
        $(AM_V_at) chmod a+x $@
 
 gnome-flashback-metacity: Makefile
@@ -31,7 +38,9 @@ gnome-flashback-metacity: Makefile
                     echo 'if [ -z $$XDG_CURRENT_DESKTOP ]; then' && \
                     echo '  export XDG_CURRENT_DESKTOP="GNOME-Flashback:GNOME"' && \
                     echo 'fi' && echo '' && \
-                    echo 'exec gnome-session --session=gnome-flashback-metacity --disable-acceleration-check 
"$$@"') > $@
+                    echo -n 'exec gnome-session $(session_management) ' && \
+                    echo -n '--session=gnome-flashback-metacity ' && \
+                    echo '--disable-acceleration-check "$$@"') > $@
        $(AM_V_at) chmod a+x $@
 
 CLEANFILES = \
diff --git a/data/applications/Makefile.am b/data/applications/Makefile.am
index 160f3a5..7bce9dd 100644
--- a/data/applications/Makefile.am
+++ b/data/applications/Makefile.am
@@ -1,21 +1,26 @@
 NULL =
 
-desktop_in_files = \
+desktop_in_in_files = \
        gnome-flashback.desktop.in \
        $(NULL)
 
 desktopdir = $(datadir)/applications
+desktop_in_files = $(desktop_in_in_files:.desktop.in.in=.desktop.in)
 desktop_DATA = $(desktop_in_files:.desktop.in=.desktop)
 
+%.desktop.in: %.desktop.in.in
+       $(AM_V_GEN) sed -e 's,[@]hidden_under_systemd[@],$(HIDDEN_UNDER_SYSTEMD),g' < $< > $@
+
 %.desktop: %.desktop.in
        $(AM_V_GEN) $(MSGFMT) --desktop --template $< -o $@-t \
                -d $(top_srcdir)/po && mv $@-t $@
 
 EXTRA_DIST = \
-       $(desktop_in_files) \
+       $(desktop_in_in_files) \
        $(NULL)
 
 CLEANFILES = \
+       $(desktop_in_files) \
        $(desktop_DATA) \
        $(NULL)
 
diff --git a/data/applications/gnome-flashback.desktop.in b/data/applications/gnome-flashback.desktop.in.in
similarity index 80%
rename from data/applications/gnome-flashback.desktop.in
rename to data/applications/gnome-flashback.desktop.in.in
index 9a18615..ea9921a 100644
--- a/data/applications/gnome-flashback.desktop.in
+++ b/data/applications/gnome-flashback.desktop.in.in
@@ -7,3 +7,4 @@ NoDisplay=true
 X-GNOME-Autostart-Phase=Initialization
 X-GNOME-Autostart-Notify=true
 X-GNOME-AutoRestart=true
+X-GNOME-HiddenUnderSystemd=@hidden_under_systemd@
diff --git a/data/systemd/Makefile.am b/data/systemd/Makefile.am
index a6bb326..fc21012 100644
--- a/data/systemd/Makefile.am
+++ b/data/systemd/Makefile.am
@@ -1,5 +1,7 @@
 NULL =
 
+if ENABLE_SYSTEMD_SESSION
+
 service_in_files = gnome-flashback.service.in
 service_files = $(service_in_files:.service.in=.service)
 
@@ -22,6 +24,8 @@ CLEANFILES = \
        $(service_files) \
        $(NULL)
 
+endif
+
 EXTRA_DIST = \
        $(service_in_files) \
        $(target_files) \
diff --git a/po/POTFILES.in b/po/POTFILES.in
index d6935f3..e4c6143 100644
--- a/po/POTFILES.in
+++ b/po/POTFILES.in
@@ -1,7 +1,7 @@
 # List of source files containing translatable strings.
 # Please keep this file sorted alphabetically.
 backends/gf-monitor.c
-data/applications/gnome-flashback.desktop.in
+data/applications/gnome-flashback.desktop.in.in
 data/autostart/gnome-flashback-nm-applet.desktop.in
 data/autostart/gnome-flashback-screensaver.desktop.in
 data/directories/X-GNOME-Flashback-Settings.directory.desktop.in


[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]