[rhythmbox] rhythmbox-client: interactive mode requires cfmakeraw()



commit c39985878dfbc02f073aca85712844c61a07643e
Author: Jonathan Matthew <jonathan d14n org>
Date:   Wed Jan 19 17:25:20 2022 +1000

    rhythmbox-client: interactive mode requires cfmakeraw()
    
    This is a non-standard function that is available on the platforms we
    actually care about, but if we happen to be somewhere it doesn't exist,
    it'd be better to leave this niche feature out rather than fail to
    build.

 config.h.meson          |  3 +++
 meson.build             |  4 ++++
 remote/dbus/rb-client.c | 11 +++++++++++
 3 files changed, 18 insertions(+)
---
diff --git a/config.h.meson b/config.h.meson
index 5d14a8ca9..8e7468504 100644
--- a/config.h.meson
+++ b/config.h.meson
@@ -23,5 +23,8 @@
 /* Define if libsecret support is enabled */
 #mesondefine WITH_LIBSECRET
 
+/* Define if you have cfmakeraw */
+#mesondefine HAVE_CFMAKERAW
+
 /* Define to the version of this package. */
 #define VERSION "@VERSION@"
diff --git a/meson.build b/meson.build
index 1336d72e3..7a5df4182 100644
--- a/meson.build
+++ b/meson.build
@@ -139,6 +139,10 @@ endif
 have_gnu_fwrite_unlocked = cc.has_function('fwrite_unlocked')
 cdata.set('HAVE_GNU_FWRITE_UNLOCKED', have_gnu_fwrite_unlocked)
 
+# rhythmbox-client interactive mode uses this non-standard function
+have_cfmakeraw = cc.has_function('cfmakeraw', prefix: '#include <termios.h>')
+cdata.set('HAVE_CFMAKERAW', have_cfmakeraw)
+
 gdk_targets = run_command(['pkg-config', '--variable', 'targets', 'gdk-3.0']).stdout().strip()
 
 totem_plparser_uselibcamel = run_command(['pkg-config', '--variable', 'uselibcamel', 
'totem-plparser']).stdout().strip()
diff --git a/remote/dbus/rb-client.c b/remote/dbus/rb-client.c
index f73b89597..6f849d85b 100644
--- a/remote/dbus/rb-client.c
+++ b/remote/dbus/rb-client.c
@@ -138,6 +138,8 @@ static GOptionEntry args[] = {
        { NULL }
 };
 
+#if defined(HAVE_CFMAKERAW)
+
 typedef struct {
        GApplication *app;
        GDBusProxy *mpris_player;
@@ -176,6 +178,7 @@ struct {
        /* quit rhythmbox? */
 };
 
+#endif
 
 static gboolean
 annoy (GError **error)
@@ -633,6 +636,8 @@ rate_song (GDBusProxy *mpris, gdouble song_rating)
        g_hash_table_destroy (properties);
 }
 
+#if defined(HAVE_CFMAKERAW)
+
 static void
 interact_quit (InteractData *data, int ch)
 {
@@ -971,6 +976,7 @@ interact (InteractData *data)
        tcsetattr(0, TCSAFLUSH, &orig_tt);
 }
 
+#endif /* HAVE_CFMAKERAW */
 
 static void
 check_loaded_state (GVariant *state)
@@ -1144,6 +1150,7 @@ main (int argc, char **argv)
 
        /* interactive mode takes precedence over anything else */
        if (interactive) {
+#if defined(HAVE_CFMAKERAW)
                InteractData data;
                rb_debug ("entering interactive mode");
                if (!isatty(1)) {
@@ -1159,6 +1166,10 @@ main (int argc, char **argv)
 
                interact (&data);
                exit (0);
+#else
+               g_warning ("interactive mode not available on this system");
+               exit (1);
+#endif
        }
 
        /* activate or quit */


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