[gnome-software] Add a --disable-packagekit configure argument



commit 5c9f7b09d67c8ed1a4d8741cf6aacf755b7ee829
Author: Richard Hughes <richard hughsie com>
Date:   Wed Jan 27 14:29:10 2016 +0000

    Add a --disable-packagekit configure argument
    
    With xdg-app apps over an ostree base using PackageKit does not make sense.
    
    WOGUE: If you're reading this, no, we're not dropping PackageKit support.
    We're still planning to keep this enabled for distros like Fedora for a long
    time, but this flag makes it easier to test using jhbuild and in continuous.

 configure.ac            |   18 +++++++++++++++++-
 src/Makefile.am         |   14 ++++++++++----
 src/gs-application.c    |    9 +++++++++
 src/plugins/Makefile.am |    6 +++++-
 4 files changed, 41 insertions(+), 6 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 49b79a6..32448cb 100644
--- a/configure.ac
+++ b/configure.ac
@@ -60,7 +60,6 @@ dnl ---------------------------------------------------------------------------
 dnl - Check library dependencies
 dnl ---------------------------------------------------------------------------
 PKG_CHECK_MODULES(GTK, gtk+-3.0 >= 3.18.2 gio-unix-2.0)
-PKG_CHECK_MODULES(PACKAGEKIT, packagekit-glib2 >= 1.0.11)
 PKG_CHECK_MODULES(APPSTREAM, appstream-glib >= 0.5.5)
 PKG_CHECK_MODULES(JSON_GLIB, json-glib-1.0)
 PKG_CHECK_MODULES(SQLITE, sqlite3)
@@ -90,6 +89,22 @@ AC_ARG_ENABLE(dogtail,
               enable_dogtail=yes)
 AM_CONDITIONAL(ENABLE_DOGTAIL, test "$enable_dogtail" != no)
 
+# PackageKit
+AC_ARG_ENABLE(packagekit,
+              [AS_HELP_STRING([--enable-packagekit],
+                              [enable PackageKit support [default=auto]])],,
+              enable_packagekit=maybe)
+
+AS_IF([test "x$enable_packagekit" != "xno"], [
+    PKG_CHECK_MODULES(PACKAGEKIT,
+                      [packagekit-glib2 >= 1.0.11],
+                      [have_packagekit=yes],
+                      [have_packagekit=no])
+], [
+    have_packagekit=no
+])
+AM_CONDITIONAL(HAVE_PACKAGEKIT, test "$have_packagekit" != no)
+
 # fwupd
 AC_ARG_ENABLE(firmware,
               [AS_HELP_STRING([--enable-firmware],
@@ -198,6 +213,7 @@ echo "
         cflags:                    ${CFLAGS}
         cppflags:                  ${CPPFLAGS}
         Dogtail:                   ${enable_dogtail}
+        PackageKit support:        ${have_packagekit}
         Firmware support:          ${have_firmware}
         XDG-APP support:           ${have_xdg_app}
 "
diff --git a/src/Makefile.am b/src/Makefile.am
index bb27a78..5e8bd0d 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -96,12 +96,8 @@ bin_PROGRAMS =                                               \
        gnome-software
 
 gnome_software_SOURCES =                               \
-       $(packagekit_built_sources)                     \
-       $(packagekit_modify2_built_sources)             \
        gs-resources.c                                  \
        gs-resources.h                                  \
-       gs-dbus-helper.c                                \
-       gs-dbus-helper.h                                \
        gs-utils.c                                      \
        gs-utils.h                                      \
        gs-app.c                                        \
@@ -188,6 +184,14 @@ gnome_software_SOURCES =                           \
        gs-folders.h                                    \
        gs-main.c
 
+if HAVE_PACKAGEKIT
+gnome_software_SOURCES +=                              \
+       $(packagekit_built_sources)                     \
+       $(packagekit_modify2_built_sources)             \
+       gs-dbus-helper.c                                \
+       gs-dbus-helper.h
+endif
+
 gnome_software_LDADD =                                 \
        $(APPSTREAM_LIBS)                               \
        $(GLIB_LIBS)                                    \
@@ -202,6 +206,7 @@ gnome_software_CFLAGS =                                     \
        -DLIBEXECDIR=\"$(libexecdir)\"                  \
        $(WARN_CFLAGS)
 
+if HAVE_PACKAGEKIT
 packagekit_built_sources = gs-packagekit-generated.c gs-packagekit-generated.h
 $(packagekit_built_sources): Makefile.am org.freedesktop.PackageKit.xml
        $(AM_V_GEN) gdbus-codegen                               \
@@ -217,6 +222,7 @@ $(packagekit_modify2_built_sources): Makefile.am org.freedesktop.PackageKit.Modi
                --c-namespace Gs                                        \
                --generate-c-code gs-packagekit-modify2-generated       \
                $(srcdir)/org.freedesktop.PackageKit.Modify2.xml
+endif
 
 gs-shell-search-provider-generated.h gs-shell-search-provider-generated.c: Makefile.am 
$(srcdir)/shell-search-provider-dbus-interfaces.xml
        $(AM_V_GEN) gdbus-codegen \
diff --git a/src/gs-application.c b/src/gs-application.c
index 0af7b33..2d892a4 100644
--- a/src/gs-application.c
+++ b/src/gs-application.c
@@ -35,7 +35,10 @@
 #include <gtk/gtkx.h>
 #endif
 
+#ifdef HAVE_PACKAGEKIT
 #include "gs-dbus-helper.h"
+#endif
+
 #include "gs-first-run-dialog.h"
 #include "gs-shell.h"
 #include "gs-update-monitor.h"
@@ -54,7 +57,9 @@ struct _GsApplication {
        gint             pending_apps;
        GsShell         *shell;
        GsUpdateMonitor *update_monitor;
+#ifdef HAVE_PACKAGEKIT
        GsDbusHelper    *dbus_helper;
+#endif
        GsShellSearchProvider *search_provider;
        GNetworkMonitor *network_monitor;
        GSettings       *settings;
@@ -581,7 +586,9 @@ gs_application_startup (GApplication *application)
                                         actions, G_N_ELEMENTS (actions),
                                         application);
 
+#ifdef HAVE_PACKAGEKIT
        GS_APPLICATION (application)->dbus_helper = gs_dbus_helper_new ();
+#endif
        GS_APPLICATION (application)->settings = g_settings_new ("org.gnome.software");
        gs_application_monitor_permission (GS_APPLICATION (application));
        gs_application_monitor_updates (GS_APPLICATION (application));
@@ -614,7 +621,9 @@ gs_application_dispose (GObject *object)
        g_clear_object (&app->update_monitor);
        g_clear_object (&app->profile);
        g_clear_object (&app->network_monitor);
+#ifdef HAVE_PACKAGEKIT
        g_clear_object (&app->dbus_helper);
+#endif
        g_clear_object (&app->settings);
 
        G_OBJECT_CLASS (gs_application_parent_class)->dispose (object);
diff --git a/src/plugins/Makefile.am b/src/plugins/Makefile.am
index dee6142..8d14851 100644
--- a/src/plugins/Makefile.am
+++ b/src/plugins/Makefile.am
@@ -41,7 +41,10 @@ plugin_LTLIBRARIES =                                 \
        libgs_plugin_fedora_tagger_ratings.la           \
        libgs_plugin_fedora_tagger_usage.la             \
        libgs_plugin_epiphany.la                        \
-       libgs_plugin_icons.la                           \
+       libgs_plugin_icons.la
+
+if HAVE_PACKAGEKIT
+plugin_LTLIBRARIES +=                                  \
        libgs_plugin_systemd-updates.la                 \
        libgs_plugin_packagekit-refine.la               \
        libgs_plugin_packagekit-refresh.la              \
@@ -50,6 +53,7 @@ plugin_LTLIBRARIES =                                  \
        libgs_plugin_packagekit-proxy.la                \
        libgs_plugin_packagekit-history.la              \
        libgs_plugin_packagekit.la
+endif
 
 if HAVE_FIRMWARE
 plugin_LTLIBRARIES += libgs_plugin_fwupd.la


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