[gnome-software] Make GUDev optional



commit bcac137e0618efc3aedae5df8dc607743edd2573
Author: Richard Hughes <richard hughsie com>
Date:   Tue Sep 6 09:21:44 2016 +0100

    Make GUDev optional
    
    Fixes: https://bugzilla.gnome.org/show_bug.cgi?id=770927

 configure.ac                   |   24 +++++++++++++++++++++++-
 contrib/gnome-software.spec.in |    1 +
 src/plugins/Makefile.am        |    7 ++++++-
 3 files changed, 30 insertions(+), 2 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index ccedf3f..d801c6a 100644
--- a/configure.ac
+++ b/configure.ac
@@ -91,7 +91,6 @@ PKG_CHECK_MODULES(SQLITE, sqlite3)
 PKG_CHECK_MODULES(SOUP, libsoup-2.4 >= 2.51.92)
 PKG_CHECK_MODULES(GSETTINGS_DESKTOP_SCHEMAS, gsettings-desktop-schemas >= 3.11.5)
 PKG_CHECK_MODULES(LIBSECRET, libsecret-1)
-PKG_CHECK_MODULES(GUDEV, gudev-1.0)
 AC_PATH_PROG(APPSTREAM_UTIL, [appstream-util], [unfound])
 
 # use -lm
@@ -369,6 +368,28 @@ AC_ARG_ENABLE(webapps,
               enable_webapps=yes)
 AM_CONDITIONAL(HAVE_WEBAPPS, [test "x$enable_webapps" = "xyes"])
 
+# GUDev
+AC_ARG_ENABLE(gudev,
+              [AS_HELP_STRING([--enable-gudev],
+                              [enable GUDev support [default=auto]])],,
+              enable_gudev=maybe)
+AS_IF([test "x$enable_gudev" != "xno"], [
+    PKG_CHECK_MODULES(GUDEV,
+                      gudev-1.0,
+                      [have_gudev=yes],
+                      [have_gudev=no])
+], [
+    have_gudev=no
+])
+AS_IF([test "x$have_gudev" = "xyes"], [
+    AC_DEFINE(HAVE_GUDEV, 1, [Build GUDev support])
+], [
+    AS_IF([test "x$enable_gudev" = "xyes"], [
+          AC_MSG_ERROR([GUDEV support requested but 'gudev-1.0' was not found])
+    ])
+])
+AM_CONDITIONAL(HAVE_GUDEV, test x$have_gudev = xyes)
+
 # this refers to the gnome-software plugin API version
 # this is not in any way related to a package or soname version
 GS_PLUGIN_API_VERSION=11
@@ -425,6 +446,7 @@ echo "
         GtkSpell support:          ${have_gtkspell}
         GNOME desktop support:     ${have_gnome_desktop}
         RPM support:               ${have_rpm}
+        GUDev support:             ${have_gudev}
         Steam support:             ${enable_steam}
         GNOME Shell ext. support:  ${enable_shell_extensions}
         ODRS support:              ${enable_odrs}
diff --git a/contrib/gnome-software.spec.in b/contrib/gnome-software.spec.in
index d9c61b9..7be4ecd 100644
--- a/contrib/gnome-software.spec.in
+++ b/contrib/gnome-software.spec.in
@@ -90,6 +90,7 @@ the source tree. Most users do not need this subpackage installed.
 %build
 %configure \
     --disable-static \
+    --enable-gudev \
 %if %{with packagekit}
     --enable-packagekit \
 %else
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index e2c3c44..331a436 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -40,7 +40,6 @@ plugin_LTLIBRARIES =                                  \
        libgs_plugin_hardcoded-popular.la               \
        libgs_plugin_hardcoded-featured.la              \
        libgs_plugin_fedora-distro-upgrades.la          \
-       libgs_plugin_modalias.la                        \
        libgs_plugin_provenance.la                      \
        libgs_plugin_provenance-license.la              \
        libgs_plugin_repos.la                           \
@@ -67,6 +66,10 @@ if HAVE_WEBAPPS
 plugin_LTLIBRARIES += libgs_plugin_epiphany.la
 endif
 
+if HAVE_GUDEV
+plugin_LTLIBRARIES += libgs_plugin_modalias.la
+endif
+
 if HAVE_UBUNTU_REVIEWS
 plugin_LTLIBRARIES += libgs_plugin_ubuntu-reviews.la
 endif
@@ -131,10 +134,12 @@ libgs_plugin_fedora_distro_upgrades_la_LIBADD = $(GS_PLUGIN_LIBS) $(JSON_GLIB_LI
 libgs_plugin_fedora_distro_upgrades_la_LDFLAGS = -module -avoid-version
 libgs_plugin_fedora_distro_upgrades_la_CFLAGS = $(GS_PLUGIN_CFLAGS) $(JSON_GLIB_CFLAGS) $(WARN_CFLAGS)
 
+if HAVE_GUDEV
 libgs_plugin_modalias_la_SOURCES = gs-plugin-modalias.c
 libgs_plugin_modalias_la_LIBADD = $(GS_PLUGIN_LIBS) $(GUDEV_LIBS)
 libgs_plugin_modalias_la_LDFLAGS = -module -avoid-version
 libgs_plugin_modalias_la_CFLAGS = $(GS_PLUGIN_CFLAGS) $(WARN_CFLAGS)
+endif
 
 libgs_plugin_provenance_la_SOURCES = gs-plugin-provenance.c
 libgs_plugin_provenance_la_LIBADD = $(GS_PLUGIN_LIBS)


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