Root/gjay/patches/0004-Don-t-build-against-or-require-dbus-glib-unless-buil.patch

Source at commit 1b3135c created 9 years 10 days ago.
By Xiangfu Liu, new package: SDL-widgets: a GUI toolkit on top of the SDL libraries
1From e812bd02096d2cd4ee8a61210d6363da227a48fa Mon Sep 17 00:00:00 2001
2From: Joshua Judson Rosen <rozzin@geekspace.com>
3Date: Tue, 26 Apr 2011 22:35:44 -0400
4Subject: [PATCH 04/17] Don't build against (or require) dbus-glib unless building something that needs it.
5
6---
7 config.h.in | 3 +++
8 configure.ac | 11 ++++++++++-
9 dbus.c | 7 +++++++
10 gjay.c | 8 ++++++++
11 gjay.h | 7 +++++++
12 5 files changed, 35 insertions(+), 1 deletions(-)
13
14diff --git a/config.h.in b/config.h.in
15index 17decf1..8833d6c 100644
16--- a/config.h.in
17+++ b/config.h.in
18@@ -88,5 +88,8 @@
19 /* Enable Audacious music player */
20 #undef WITH_AUDCLIENT
21 
22+/* Build with dbus-glib */
23+#undef WITH_DBUSGLIB
24+
25 /* Enable mpd music player */
26 #undef WITH_MPDCLIENT
27diff --git a/configure.ac b/configure.ac
28index bfe7ca4..62273bd 100644
29--- a/configure.ac
30+++ b/configure.ac
31@@ -8,12 +8,16 @@ AC_CONFIG_HEADERS([config.h])
32 AM_INIT_AUTOMAKE([1.10])
33 
34 dnl Options
35+# Don't require D-Bus unless building a component that needs it:
36+enable_dbus=no
37+
38 AC_SUBST([WITH_MPDCLIENT])
39 AC_ARG_ENABLE([mpdclient],
40               AS_HELP_STRING([--disable-mpdclient], [Disable mpd client (enabled by default)]),
41               [enable_mpdclient=$enableval],
42               [enable_mpdclient="yes"])
43 if test "$enable_mpdclient" = "yes"; then
44+ enable_dbus=yes
45   AC_DEFINE([WITH_MPDCLIENT], [1], [Enable mpd music player])
46   PKG_CHECK_MODULES([MPDCLIENT], [libmpdclient])
47 fi
48@@ -24,6 +28,7 @@ AC_ARG_ENABLE([audclient],
49               [enable_audclient=$enableval],
50               [enable_audclient="yes"])
51 if test "$enable_audclient" = "yes"; then
52+ enable_dbus=yes
53   AC_DEFINE([WITH_AUDCLIENT], [1], [Enable Audacious music player])
54   PKG_CHECK_MODULES([AUDACIOUS], [audacious])
55 fi
56@@ -39,7 +44,11 @@ AM_GNU_GETTEXT_VERSION([0.18.1])
57 
58 # Checks for libraries.
59 AM_PATH_GTK_2_0
60-PKG_CHECK_MODULES([DBUS_GLIB], [dbus-glib-1])
61+
62+if test "$enable_dbus" = "yes"; then
63+ AC_DEFINE([WITH_DBUSGLIB], [1], [Build with dbus-glib])
64+ PKG_CHECK_MODULES([DBUS_GLIB], [dbus-glib-1])
65+fi
66 
67 AX_PATH_GSL
68 dnl AC_CHECK_LIB([audclient], [audacious_remote_playlist])
69diff --git a/dbus.c b/dbus.c
70index 48a6453..81258ad 100644
71--- a/dbus.c
72+++ b/dbus.c
73@@ -17,6 +17,12 @@
74  * with this program; if not, see <http://www.gnu.org/licenses/>.
75  */
76 
77+#ifdef HAVE_CONFIG_H
78+#include "config.h"
79+#endif
80+
81+#ifdef WITH_DBUSGLIB
82+
83 #include <dbus/dbus-glib.h>
84 #include "gjay.h"
85 #include "dbus.h"
86@@ -62,3 +68,4 @@ gjay_dbus_is_running(const char *appname)
87   return running;
88 }
89 
90+#endif /* WITH_DBUSGLIB */
91diff --git a/gjay.c b/gjay.c
92index 547b72c..205065e 100644
93--- a/gjay.c
94+++ b/gjay.c
95@@ -45,7 +45,11 @@
96 #include <string.h>
97 #include <ctype.h>
98 #include "gjay.h"
99+
100+#ifdef WITH_DBUSGLIB
101 #include "dbus.h"
102+#endif /* WITH_DBUSGLIB */
103+
104 #include "analysis.h"
105 #include "ipc.h"
106 #include "playlist.h"
107@@ -468,7 +472,11 @@ static void run_as_ui(int argc, char *argv[] )
108   player_init();
109     make_app_ui();
110     gtk_widget_show_all(gjay->main_window);
111+
112+#ifdef WITH_DBUSGLIB
113     gjay->connection = gjay_dbus_connection();
114+#endif /* WITH_DBUSGLIB */
115+
116     gjay->message_window = make_message_window();
117     g_log_set_handler(NULL,
118         G_LOG_LEVEL_WARNING | G_LOG_FLAG_FATAL | G_LOG_FLAG_RECURSION,
119diff --git a/gjay.h b/gjay.h
120index 78f5180..89a0881 100644
121--- a/gjay.h
122+++ b/gjay.h
123@@ -32,7 +32,10 @@
124 #include <assert.h>
125 #include <limits.h>
126 #include <math.h>
127+
128+#ifdef WITH_DBUSGLIB
129 #include <dbus/dbus-glib.h>
130+#endif /* WITH_DBUSGLIB */
131 
132 typedef struct _GjayApp GjayApp;
133 extern GjayApp *gjay;
134@@ -77,8 +80,12 @@ gchar * parent_dir ( const char * path );
135 struct _GjayApp {
136   GjayPrefs *prefs;
137   /* Player connections/handles */
138+
139+#ifdef WITH_DBUSGLIB
140   DBusGConnection *connection;
141   DBusGProxy *player_proxy;
142+#endif /* WITH_DBUSGLIB */
143+
144 #ifdef WITH_MPDCLIENT
145   struct mpd_connection *mpdclient_connection;
146 #endif /* WITH_MPDCLIENT */
147--
1481.7.2.5
149
150

Archive Download this file



interactive