335 lines
11 KiB
Diff
335 lines
11 KiB
Diff
|
From 3b518cadecf07f3885b2207152fff92e4f4aaff1 Mon Sep 17 00:00:00 2001
|
||
|
From: Colin Walters <walters@verbum.org>
|
||
|
Date: Thu, 17 Oct 2013 08:41:51 -0400
|
||
|
Subject: [PATCH] Only support UPower 0.9
|
||
|
|
||
|
Newer UPower drops support for APIs that duplicate systemd/logind, so
|
||
|
if we detect it, then require consumers to use the systemd backend.
|
||
|
|
||
|
https://bugzilla.gnome.org/show_bug.cgi?id=710383
|
||
|
---
|
||
|
configure.ac | 10 +++++++++-
|
||
|
gnome-session/Makefile.am | 8 ++++++--
|
||
|
gnome-session/gsm-system.c | 4 ++++
|
||
|
3 files changed, 19 insertions(+), 3 deletions(-)
|
||
|
|
||
|
diff --git a/configure.ac b/configure.ac
|
||
|
index bb3d02b..b470d3d 100644
|
||
|
--- a/configure.ac
|
||
|
+++ b/configure.ac
|
||
|
@@ -64,11 +64,18 @@ PKG_CHECK_MODULES(GNOME_SESSION,
|
||
|
glib-2.0 >= $GLIB_REQUIRED
|
||
|
gio-2.0 >= $GLIB_REQUIRED
|
||
|
dbus-glib-1 >= $DBUS_GLIB_REQUIRED
|
||
|
- upower-glib >= $UPOWER_REQUIRED
|
||
|
json-glib-1.0 >= $JSON_GLIB_REQUIRED
|
||
|
gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED
|
||
|
)
|
||
|
|
||
|
+dnl We can only support old upower
|
||
|
+dnl https://bugzilla.gnome.org/show_bug.cgi?id=710383
|
||
|
+PKG_CHECK_MODULES(UPOWER, upower-glib <= 0.9.22, have_old_upower=yes, have_old_upower=no)
|
||
|
+AS_IF([test x$have_old_upower = xyes], [
|
||
|
+ AC_DEFINE([HAVE_OLD_UPOWER], [1], [Define if we have an older upower])
|
||
|
+])
|
||
|
+AM_CONDITIONAL(HAVE_OLD_UPOWER, test x$have_old_upower = xyes)
|
||
|
+
|
||
|
PKG_CHECK_MODULES(SESSION_PROPERTIES,
|
||
|
glib-2.0 >= $GLIB_REQUIRED
|
||
|
gtk+-3.0 >= $GTK3_REQUIRED
|
||
|
@ -366,6 +373,7 @@ echo "
|
||
|
XRender support: ${have_xrender}
|
||
|
XSync support: ${have_xsync}
|
||
|
XTest support: ${have_xtest}
|
||
|
+ Legacy UPower backend: ${have_old_upower}
|
||
|
Build Docbook: ${enable_docbook_docs}
|
||
|
Build manpages: ${enable_man}
|
||
|
|
||
|
diff --git a/gnome-session/Makefile.am b/gnome-session/Makefile.am
|
||
|
index 977a398..c7ae617 100644
|
||
|
--- a/gnome-session/Makefile.am
|
||
|
+++ b/gnome-session/Makefile.am
|
||
|
@@ -10,6 +10,7 @@ noinst_PROGRAMS = \
|
||
|
AM_CPPFLAGS = \
|
||
|
$(GTK3_CFLAGS) \
|
||
|
$(GNOME_SESSION_CFLAGS) \
|
||
|
+ $(UPOWER_CFLAGS) \
|
||
|
$(DISABLE_DEPRECATED_CFLAGS)
|
||
|
|
||
|
AM_CFLAGS = $(WARN_CFLAGS)
|
||
|
@@ -29,8 +30,6 @@ gnome_session_SOURCES = \
|
||
|
gsm-fail-whale.c \
|
||
|
gsm-system.h \
|
||
|
gsm-system.c \
|
||
|
- gsm-consolekit.c \
|
||
|
- gsm-consolekit.h \
|
||
|
gsm-systemd.h \
|
||
|
gsm-systemd.c \
|
||
|
gsm-presence.h \
|
||
|
@@ -60,6 +59,10 @@ gnome_session_SOURCES = \
|
||
|
gsm-xsmp-server.c \
|
||
|
gsm-xsmp-server.h
|
||
|
|
||
|
+if HAVE_OLD_UPOWER
|
||
|
+gnome_session_SOURCES += gsm-consolekit.c gsm-consolekit.h
|
||
|
+endif
|
||
|
+
|
||
|
gnome_session_CPPFLAGS = \
|
||
|
$(AM_CPPFLAGS) \
|
||
|
$(X11_CFLAGS) \
|
||
|
@@ -86,6 +89,7 @@ gnome_session_LDADD = \
|
||
|
$(XTEST_LIBS) \
|
||
|
$(XEXT_LIBS) \
|
||
|
$(GNOME_SESSION_LIBS) \
|
||
|
+ $(UPOWER_LIBS) \
|
||
|
$(GCONF_LIBS) \
|
||
|
$(SYSTEMD_LIBS) \
|
||
|
$(GIOUNIX_LIBS) \
|
||
|
diff --git a/gnome-session/gsm-system.c b/gnome-session/gsm-system.c
|
||
|
index 0be1bf7..c0ad962 100644
|
||
|
--- a/gnome-session/gsm-system.c
|
||
|
+++ b/gnome-session/gsm-system.c
|
||
|
@@ -24,7 +24,9 @@
|
||
|
#include <glib/gi18n.h>
|
||
|
|
||
|
#include "gsm-system.h"
|
||
|
+#ifdef HAVE_OLD_UPOWER
|
||
|
#include "gsm-consolekit.h"
|
||
|
+#endif
|
||
|
#include "gsm-systemd.h"
|
||
|
|
||
|
enum {
|
||
|
@@ -202,12 +204,14 @@ gsm_get_system (void)
|
||
|
g_debug ("Using systemd for session tracking");
|
||
|
}
|
||
|
}
|
||
|
+#ifdef HAVE_OLD_UPOWER
|
||
|
if (system == NULL) {
|
||
|
system = GSM_SYSTEM (gsm_consolekit_new ());
|
||
|
if (system != NULL) {
|
||
|
g_debug ("Using ConsoleKit for session tracking");
|
||
|
}
|
||
|
}
|
||
|
+#endif
|
||
|
|
||
|
return g_object_ref (system);
|
||
|
}
|
||
|
--- gnome-session-3.10.1.orig/Makefile.in 2013-10-11 07:13:15.000000000 -0500
|
||
|
+++ gnome-session-3.10.1/Makefile.in 2013-12-09 17:26:59.675530843 -0600
|
||
|
@@ -319,6 +319,8 @@
|
||
|
STRIP = @STRIP@
|
||
|
SYSTEMD_CFLAGS = @SYSTEMD_CFLAGS@
|
||
|
SYSTEMD_LIBS = @SYSTEMD_LIBS@
|
||
|
+UPOWER_CFLAGS = @UPOWER_CFLAGS@
|
||
|
+UPOWER_LIBS = @UPOWER_LIBS@
|
||
|
USE_NLS = @USE_NLS@
|
||
|
VERSION = @VERSION@
|
||
|
WARN_CFLAGS = @WARN_CFLAGS@
|
||
|
--- gnome-session-3.10.1.orig/configure 2013-10-11 07:13:14.000000000 -0500
|
||
|
+++ gnome-session-3.10.1/configure 2013-12-09 17:27:06.074530566 -0600
|
||
|
@@ -726,6 +726,10 @@
|
||
|
X11_CFLAGS
|
||
|
SESSION_PROPERTIES_LIBS
|
||
|
SESSION_PROPERTIES_CFLAGS
|
||
|
+HAVE_OLD_UPOWER_FALSE
|
||
|
+HAVE_OLD_UPOWER_TRUE
|
||
|
+UPOWER_LIBS
|
||
|
+UPOWER_CFLAGS
|
||
|
GNOME_SESSION_LIBS
|
||
|
GNOME_SESSION_CFLAGS
|
||
|
GTK3_LIBS
|
||
|
@@ -907,6 +911,8 @@
|
||
|
GTK3_LIBS
|
||
|
GNOME_SESSION_CFLAGS
|
||
|
GNOME_SESSION_LIBS
|
||
|
+UPOWER_CFLAGS
|
||
|
+UPOWER_LIBS
|
||
|
SESSION_PROPERTIES_CFLAGS
|
||
|
SESSION_PROPERTIES_LIBS
|
||
|
X11_CFLAGS
|
||
|
@@ -1618,6 +1624,9 @@
|
||
|
C compiler flags for GNOME_SESSION, overriding pkg-config
|
||
|
GNOME_SESSION_LIBS
|
||
|
linker flags for GNOME_SESSION, overriding pkg-config
|
||
|
+ UPOWER_CFLAGS
|
||
|
+ C compiler flags for UPOWER, overriding pkg-config
|
||
|
+ UPOWER_LIBS linker flags for UPOWER, overriding pkg-config
|
||
|
SESSION_PROPERTIES_CFLAGS
|
||
|
C compiler flags for SESSION_PROPERTIES, overriding pkg-config
|
||
|
SESSION_PROPERTIES_LIBS
|
||
|
@@ -12603,14 +12612,12 @@
|
||
|
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= \$GLIB_REQUIRED
|
||
|
gio-2.0 >= \$GLIB_REQUIRED
|
||
|
dbus-glib-1 >= \$DBUS_GLIB_REQUIRED
|
||
|
- upower-glib >= \$UPOWER_REQUIRED
|
||
|
json-glib-1.0 >= \$JSON_GLIB_REQUIRED
|
||
|
gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED
|
||
|
\""; } >&5
|
||
|
($PKG_CONFIG --exists --print-errors "glib-2.0 >= $GLIB_REQUIRED
|
||
|
gio-2.0 >= $GLIB_REQUIRED
|
||
|
dbus-glib-1 >= $DBUS_GLIB_REQUIRED
|
||
|
- upower-glib >= $UPOWER_REQUIRED
|
||
|
json-glib-1.0 >= $JSON_GLIB_REQUIRED
|
||
|
gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED
|
||
|
") 2>&5
|
||
|
@@ -12620,7 +12627,6 @@
|
||
|
pkg_cv_GNOME_SESSION_CFLAGS=`$PKG_CONFIG --cflags "glib-2.0 >= $GLIB_REQUIRED
|
||
|
gio-2.0 >= $GLIB_REQUIRED
|
||
|
dbus-glib-1 >= $DBUS_GLIB_REQUIRED
|
||
|
- upower-glib >= $UPOWER_REQUIRED
|
||
|
json-glib-1.0 >= $JSON_GLIB_REQUIRED
|
||
|
gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED
|
||
|
" 2>/dev/null`
|
||
|
@@ -12638,14 +12644,12 @@
|
||
|
{ { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"glib-2.0 >= \$GLIB_REQUIRED
|
||
|
gio-2.0 >= \$GLIB_REQUIRED
|
||
|
dbus-glib-1 >= \$DBUS_GLIB_REQUIRED
|
||
|
- upower-glib >= \$UPOWER_REQUIRED
|
||
|
json-glib-1.0 >= \$JSON_GLIB_REQUIRED
|
||
|
gnome-desktop-3.0 >= \$GNOME_DESKTOP_REQUIRED
|
||
|
\""; } >&5
|
||
|
($PKG_CONFIG --exists --print-errors "glib-2.0 >= $GLIB_REQUIRED
|
||
|
gio-2.0 >= $GLIB_REQUIRED
|
||
|
dbus-glib-1 >= $DBUS_GLIB_REQUIRED
|
||
|
- upower-glib >= $UPOWER_REQUIRED
|
||
|
json-glib-1.0 >= $JSON_GLIB_REQUIRED
|
||
|
gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED
|
||
|
") 2>&5
|
||
|
@@ -12655,7 +12659,6 @@
|
||
|
pkg_cv_GNOME_SESSION_LIBS=`$PKG_CONFIG --libs "glib-2.0 >= $GLIB_REQUIRED
|
||
|
gio-2.0 >= $GLIB_REQUIRED
|
||
|
dbus-glib-1 >= $DBUS_GLIB_REQUIRED
|
||
|
- upower-glib >= $UPOWER_REQUIRED
|
||
|
json-glib-1.0 >= $JSON_GLIB_REQUIRED
|
||
|
gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED
|
||
|
" 2>/dev/null`
|
||
|
@@ -12682,7 +12685,6 @@
|
||
|
GNOME_SESSION_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "glib-2.0 >= $GLIB_REQUIRED
|
||
|
gio-2.0 >= $GLIB_REQUIRED
|
||
|
dbus-glib-1 >= $DBUS_GLIB_REQUIRED
|
||
|
- upower-glib >= $UPOWER_REQUIRED
|
||
|
json-glib-1.0 >= $JSON_GLIB_REQUIRED
|
||
|
gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED
|
||
|
" 2>&1`
|
||
|
@@ -12690,7 +12692,6 @@
|
||
|
GNOME_SESSION_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "glib-2.0 >= $GLIB_REQUIRED
|
||
|
gio-2.0 >= $GLIB_REQUIRED
|
||
|
dbus-glib-1 >= $DBUS_GLIB_REQUIRED
|
||
|
- upower-glib >= $UPOWER_REQUIRED
|
||
|
json-glib-1.0 >= $JSON_GLIB_REQUIRED
|
||
|
gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED
|
||
|
" 2>&1`
|
||
|
@@ -12701,7 +12702,6 @@
|
||
|
as_fn_error $? "Package requirements (glib-2.0 >= $GLIB_REQUIRED
|
||
|
gio-2.0 >= $GLIB_REQUIRED
|
||
|
dbus-glib-1 >= $DBUS_GLIB_REQUIRED
|
||
|
- upower-glib >= $UPOWER_REQUIRED
|
||
|
json-glib-1.0 >= $JSON_GLIB_REQUIRED
|
||
|
gnome-desktop-3.0 >= $GNOME_DESKTOP_REQUIRED
|
||
|
) were not met:
|
||
|
@@ -12739,6 +12739,93 @@
|
||
|
|
||
|
|
||
|
pkg_failed=no
|
||
|
+{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for UPOWER" >&5
|
||
|
+$as_echo_n "checking for UPOWER... " >&6; }
|
||
|
+
|
||
|
+if test -n "$UPOWER_CFLAGS"; then
|
||
|
+ pkg_cv_UPOWER_CFLAGS="$UPOWER_CFLAGS"
|
||
|
+ elif test -n "$PKG_CONFIG"; then
|
||
|
+ if test -n "$PKG_CONFIG" && \
|
||
|
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"upower-glib <= 0.9.22\""; } >&5
|
||
|
+ ($PKG_CONFIG --exists --print-errors "upower-glib <= 0.9.22") 2>&5
|
||
|
+ ac_status=$?
|
||
|
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||
|
+ test $ac_status = 0; }; then
|
||
|
+ pkg_cv_UPOWER_CFLAGS=`$PKG_CONFIG --cflags "upower-glib <= 0.9.22" 2>/dev/null`
|
||
|
+ test "x$?" != "x0" && pkg_failed=yes
|
||
|
+else
|
||
|
+ pkg_failed=yes
|
||
|
+fi
|
||
|
+ else
|
||
|
+ pkg_failed=untried
|
||
|
+fi
|
||
|
+if test -n "$UPOWER_LIBS"; then
|
||
|
+ pkg_cv_UPOWER_LIBS="$UPOWER_LIBS"
|
||
|
+ elif test -n "$PKG_CONFIG"; then
|
||
|
+ if test -n "$PKG_CONFIG" && \
|
||
|
+ { { $as_echo "$as_me:${as_lineno-$LINENO}: \$PKG_CONFIG --exists --print-errors \"upower-glib <= 0.9.22\""; } >&5
|
||
|
+ ($PKG_CONFIG --exists --print-errors "upower-glib <= 0.9.22") 2>&5
|
||
|
+ ac_status=$?
|
||
|
+ $as_echo "$as_me:${as_lineno-$LINENO}: \$? = $ac_status" >&5
|
||
|
+ test $ac_status = 0; }; then
|
||
|
+ pkg_cv_UPOWER_LIBS=`$PKG_CONFIG --libs "upower-glib <= 0.9.22" 2>/dev/null`
|
||
|
+ test "x$?" != "x0" && pkg_failed=yes
|
||
|
+else
|
||
|
+ pkg_failed=yes
|
||
|
+fi
|
||
|
+ else
|
||
|
+ pkg_failed=untried
|
||
|
+fi
|
||
|
+
|
||
|
+
|
||
|
+
|
||
|
+if test $pkg_failed = yes; then
|
||
|
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||
|
+$as_echo "no" >&6; }
|
||
|
+
|
||
|
+if $PKG_CONFIG --atleast-pkgconfig-version 0.20; then
|
||
|
+ _pkg_short_errors_supported=yes
|
||
|
+else
|
||
|
+ _pkg_short_errors_supported=no
|
||
|
+fi
|
||
|
+ if test $_pkg_short_errors_supported = yes; then
|
||
|
+ UPOWER_PKG_ERRORS=`$PKG_CONFIG --short-errors --print-errors --cflags --libs "upower-glib <= 0.9.22" 2>&1`
|
||
|
+ else
|
||
|
+ UPOWER_PKG_ERRORS=`$PKG_CONFIG --print-errors --cflags --libs "upower-glib <= 0.9.22" 2>&1`
|
||
|
+ fi
|
||
|
+ # Put the nasty error message in config.log where it belongs
|
||
|
+ echo "$UPOWER_PKG_ERRORS" >&5
|
||
|
+
|
||
|
+ have_old_upower=no
|
||
|
+elif test $pkg_failed = untried; then
|
||
|
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: no" >&5
|
||
|
+$as_echo "no" >&6; }
|
||
|
+ have_old_upower=no
|
||
|
+else
|
||
|
+ UPOWER_CFLAGS=$pkg_cv_UPOWER_CFLAGS
|
||
|
+ UPOWER_LIBS=$pkg_cv_UPOWER_LIBS
|
||
|
+ { $as_echo "$as_me:${as_lineno-$LINENO}: result: yes" >&5
|
||
|
+$as_echo "yes" >&6; }
|
||
|
+ have_old_upower=yes
|
||
|
+fi
|
||
|
+if test x$have_old_upower = xyes; then :
|
||
|
+
|
||
|
+
|
||
|
+$as_echo "#define HAVE_OLD_UPOWER 1" >>confdefs.h
|
||
|
+
|
||
|
+
|
||
|
+fi
|
||
|
+ if test x$have_old_upower = xyes; then
|
||
|
+ HAVE_OLD_UPOWER_TRUE=
|
||
|
+ HAVE_OLD_UPOWER_FALSE='#'
|
||
|
+else
|
||
|
+ HAVE_OLD_UPOWER_TRUE='#'
|
||
|
+ HAVE_OLD_UPOWER_FALSE=
|
||
|
+fi
|
||
|
+
|
||
|
+
|
||
|
+
|
||
|
+pkg_failed=no
|
||
|
{ $as_echo "$as_me:${as_lineno-$LINENO}: checking for SESSION_PROPERTIES" >&5
|
||
|
$as_echo_n "checking for SESSION_PROPERTIES... " >&6; }
|
||
|
|
||
|
@@ -16039,6 +16126,10 @@
|
||
|
as_fn_error $? "conditional \"BUILD_SESSION_SELECTOR\" was never defined.
|
||
|
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||
|
fi
|
||
|
+if test -z "${HAVE_OLD_UPOWER_TRUE}" && test -z "${HAVE_OLD_UPOWER_FALSE}"; then
|
||
|
+ as_fn_error $? "conditional \"HAVE_OLD_UPOWER\" was never defined.
|
||
|
+Usually this means the macro was only invoked conditionally." "$LINENO" 5
|
||
|
+fi
|
||
|
if test -z "${HAVE_SYSTEMD_TRUE}" && test -z "${HAVE_SYSTEMD_FALSE}"; then
|
||
|
as_fn_error $? "conditional \"HAVE_SYSTEMD\" was never defined.
|
||
|
Usually this means the macro was only invoked conditionally." "$LINENO" 5
|