[gnome-latex] build: add option to disable dconf migration support



commit 58de4f730b6fdb57a2c60852e83b688a050b4770
Author: Tom Schoonjans <Tom Schoonjans diamond ac uk>
Date:   Wed May 2 20:26:53 2018 +0100

    build: add option to disable dconf migration support
    
    dconf is not available on Mac OS X or Windows.
    
    It is also useful on Linux because dconf has an unstable API: if dconf
    breaks its API in the future and gnome-latex is unmaintained, it will
    still be possible to compile gnome-latex by disabling the dconf
    migration support.
    
    Fixes https://gitlab.gnome.org/GNOME/gnome-latex/issues/56

 configure.ac                     | 15 ++++++++++++++-
 src/liblatexila/Makefile.am      | 16 ++++++++++++++--
 src/liblatexila/latexila-utils.c |  8 ++++++++
 3 files changed, 36 insertions(+), 3 deletions(-)
---
diff --git a/configure.ac b/configure.ac
index 6c85764..a1ba4dd 100644
--- a/configure.ac
+++ b/configure.ac
@@ -102,10 +102,23 @@ PKG_CHECK_MODULES([DEP], [
        tepl-4 >= ${TEPL_REQUIRED_VERSION}
        gspell-1 >= ${GSPELL_REQUIRED_VERSION}
        gee-0.8 >= ${GEE_REQUIRED_VERSION}
-       dconf
        gsettings-desktop-schemas
 ])
 
+AC_ARG_ENABLE([dconf_migration],[AS_HELP_STRING([--disable-dconf-migration],[do not add support for dconf 
migration])],[enable_dconf_migration=$enableval],[enable_dconf_migration=check])
+FOUND_DCONF_MIGRATION=
+if test x$enable_dconf_migration != xno ; then
+       PKG_CHECK_MODULES([DCONF_DEP], [dconf], [
+               FOUND_DCONF_MIGRATION=yes
+               AC_DEFINE([HAVE_DCONF_MIGRATION], [], [Enable DConf migration support])
+               ], [FOUND_DCONF_MIGRATION=no])
+       if test x$enable_dconf_migration = xyes && test x$FOUND_DCONF_MIGRATION = xno ; then
+               AC_MSG_ERROR([Enabling dconf migration support requires the presence of dconf])
+       fi
+fi
+
+AM_CONDITIONAL([DCONF_MIGRATION_BUILD], [test x$FOUND_DCONF_MIGRATION = xyes])
+
 # Native Language Support
 AX_REQUIRE_DEFINED([IT_PROG_INTLTOOL])
 IT_PROG_INTLTOOL([0.50.1])
diff --git a/src/liblatexila/Makefile.am b/src/liblatexila/Makefile.am
index de28d9b..7c0b708 100644
--- a/src/liblatexila/Makefile.am
+++ b/src/liblatexila/Makefile.am
@@ -7,6 +7,7 @@ liblatexila_la_CPPFLAGS =               \
 
 liblatexila_la_CFLAGS =                        \
        $(DEP_CFLAGS)                   \
+       $(DCONF_DEP_CFLAGS)             \
        $(WARN_CFLAGS)                  \
        $(CODE_COVERAGE_CFLAGS)         \
        -I$(top_builddir)/src/evince
@@ -16,6 +17,7 @@ liblatexila_la_LDFLAGS = \
 
 liblatexila_la_LIBADD =                \
        $(DEP_LIBS)             \
+       $(DCONF_DEP_LIBS)       \
        $(CODE_COVERAGE_LIBS)   \
        ../evince/libevince.la
 
@@ -64,15 +66,25 @@ liblatexila_public_c_files =                        \
        $(NULL)
 
 liblatexila_private_headers =                  \
-       dh-dconf-migration.h                    \
        latexila-templates-common.h             \
        $(NULL)
 
+if DCONF_MIGRATION_BUILD
+liblatexila_private_headers +=                 \
+       dh-dconf-migration.h                    \
+       $(NULL)
+endif
+
 liblatexila_private_c_files =                  \
-       dh-dconf-migration.c                    \
        latexila-templates-common.c             \
        $(NULL)
 
+if DCONF_MIGRATION_BUILD
+liblatexila_private_c_files +=                 \
+       dh-dconf-migration.c                    \
+       $(NULL)
+endif
+
 liblatexila_public_built_sources =     \
        latexila-enum-types.c           \
        latexila-enum-types.h           \
diff --git a/src/liblatexila/latexila-utils.c b/src/liblatexila/latexila-utils.c
index 82e2ed6..9f107e0 100644
--- a/src/liblatexila/latexila-utils.c
+++ b/src/liblatexila/latexila-utils.c
@@ -30,9 +30,12 @@
  * Various utility functions.
  */
 
+#include "config.h"
 #include "latexila-utils.h"
 #include <string.h>
+#ifdef HAVE_DCONF_MIGRATION
 #include "dh-dconf-migration.h"
+#endif
 #include "latexila-synctex.h"
 
 static gint
@@ -493,6 +496,8 @@ latexila_utils_join_widgets (GtkWidget *widget_top,
 static void
 migrate_latexila_to_gnome_latex_gsettings (void)
 {
+
+#ifdef HAVE_DCONF_MIGRATION
        DhDconfMigration *migration;
        gint i;
 
@@ -562,6 +567,9 @@ migrate_latexila_to_gnome_latex_gsettings (void)
        }
 
        _dh_dconf_migration_free (migration);
+#else
+       g_warning("dconf migration not supported!");
+#endif
 }
 
 static void


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