[gnome-online-accounts/wip/modules: 2/8] build: Groundwork for splitting the providers into loadable modules



commit 6661737a12acb05ce684bf42da47d1903b08c0f5
Author: Debarshi Ray <debarshir gnome org>
Date:   Tue Apr 29 16:51:30 2014 +0200

    build: Groundwork for splitting the providers into loadable modules
    
    Fixes: https://bugzilla.gnome.org/729173

 Makefile.am                  |   10 ++++++++++
 configure.ac                 |    6 ++++++
 src/goabackend/Makefile.am   |   11 +++++++++++
 src/goabackend/goaprovider.c |    2 ++
 4 files changed, 29 insertions(+), 0 deletions(-)
---
diff --git a/Makefile.am b/Makefile.am
index 354c316..9fd5740 100644
--- a/Makefile.am
+++ b/Makefile.am
@@ -28,4 +28,14 @@ GITIGNOREFILES = \
        m4 \
        $(NULL)
 
+install-exec-hook:
+       if test -n "$(GIO_QUERYMODULES)" -a -z "$(DESTDIR)"; then \
+               $(GIO_QUERYMODULES) $(GOA_MODULE_DIR) ;           \
+       fi
+
+uninstall-hook:
+       if test -n "$(GIO_QUERYMODULES)" -a -z "$(DESTDIR)"; then \
+               $(GIO_QUERYMODULES) $(GOA_MODULE_DIR) ;           \
+       fi
+
 -include $(top_srcdir)/git.mk
diff --git a/configure.ac b/configure.ac
index 7f1c5ed..0f7582b 100644
--- a/configure.ac
+++ b/configure.ac
@@ -147,6 +147,12 @@ if test "$enable_inspector" != "no"; then
   AC_DEFINE(GOA_INSPECTOR_ENABLED, 1, [Enable a WebKitWebInspector for the embedded web view])
 fi
 
+AC_PATH_PROG(GIO_QUERYMODULES, gio-querymodules)
+AC_SUBST(GIO_QUERYMODULES)
+
+GOA_MODULE_DIR='${libdir}/goa-1.0/modules'
+AC_SUBST(GOA_MODULE_DIR)
+
 # service providers
 #
 
diff --git a/src/goabackend/Makefile.am b/src/goabackend/Makefile.am
index ab41d6d..e91bb48 100644
--- a/src/goabackend/Makefile.am
+++ b/src/goabackend/Makefile.am
@@ -2,6 +2,8 @@
 NULL =
 CLEANFILES =
 EXTRA_DIST =
+goamodule_LTLIBRARIES =
+goamoduledir = $(GOA_MODULE_DIR)
 
 AM_CPPFLAGS =                                                  \
        -I$(top_builddir)/src -I$(top_srcdir)/src               \
@@ -12,6 +14,7 @@ AM_CPPFLAGS =                                                         \
        -DG_LOG_DOMAIN=\"GoaBackend\"                           \
        -DGOA_BACKEND_COMPILATION                               \
        -DGOA_API_IS_SUBJECT_TO_CHANGE                          \
+       -DGOA_MODULE_DIR=\"$(GOA_MODULE_DIR)\"                  \
        -DPACKAGE_LIBEXEC_DIR=\""$(libexecdir)"\"               \
        -DPACKAGE_SYSCONF_DIR=\""$(sysconfdir)"\"               \
        -DPACKAGE_DATA_DIR=\""$(pkgdatadir)"\"                  \
@@ -23,6 +26,14 @@ AM_CPPFLAGS =                                                        \
        $(WARN_CFLAGS)                                          \
        $(NULL)
 
+module_flags =                                                         \
+       -export-dynamic                                                 \
+       -avoid-version                                                  \
+       -module                                                         \
+       -no-undefined                                                   \
+       -export-symbols-regex '^g_io_module_(load|unload|query)'        \
+       $(NULL)
+
 # ----------------------------------------------------------------------------------------------------
 
 goabackendenumtypes.h: goabackendenums.h goabackendenumtypes.h.template
diff --git a/src/goabackend/goaprovider.c b/src/goabackend/goaprovider.c
index 971b84c..f78a65b 100644
--- a/src/goabackend/goaprovider.c
+++ b/src/goabackend/goaprovider.c
@@ -762,6 +762,8 @@ ensure_builtins_loaded (void)
     {
       static volatile GType type = 0;
 
+      g_io_modules_scan_all_in_directory (GOA_MODULE_DIR);
+
       /* The order is in which the providers' types are created is
        * important because it affects the order in which they are
        * returned by goa_provider_get_all.


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