[evolution] Bug 793107 - Add option to build with enchant 1.x or 2.x



commit 90339e55bd8f70ec9f188ab2d44f4e84e7cfaf18
Author: Rafael Fontenelle <rafaelff gnome org>
Date:   Thu Feb 8 17:43:31 2018 +0100

    Bug 793107 - Add option to build with enchant 1.x or 2.x

 CMakeLists.txt                                |   32 +++++++++++++++++++++++-
 src/composer/CMakeLists.txt                   |    1 +
 src/composer/e-msg-composer.c                 |    2 +-
 src/e-util/e-html-editor-actions.c            |    2 +-
 src/e-util/e-html-editor-spell-check-dialog.c |    2 +-
 src/e-util/e-html-editor.c                    |    2 +-
 src/e-util/e-spell-dictionary.h               |    2 +-
 7 files changed, 36 insertions(+), 7 deletions(-)
---
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 06969bf..5116de6 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -71,7 +71,8 @@ add_definitions(-DGDK_VERSION_MIN_REQUIRED=${gdk_encoded_version})
 add_definitions(-DSOUP_VERSION_MIN_REQUIRED=${soup_encoded_version})
 
 set(eds_minimum_version ${PROJECT_VERSION_MAJOR}.${PROJECT_VERSION_MINOR}.${PROJECT_VERSION_PATCH})
-set(enchant_minimum_version 1.6.0)
+set(enchant1_minimum_version 1.6.0)
+set(enchant2_minimum_version 2.2.0)
 set(gcr_minimum_version 3.4)
 set(gdk_pixbuf_minimum_version 2.24.0)
 set(gnome_desktop_minimum_version 2.91.3)
@@ -287,11 +288,38 @@ pkg_check_modules(EVOLUTION_DATA_SERVER REQUIRED
 )
 
 pkg_check_modules(A11Y REQUIRED atk)
-pkg_check_modules(ENCHANT REQUIRED enchant>=${enchant_minimum_version})
 pkg_check_modules(LIBSOUP REQUIRED libsoup-2.4>=${soup_minimum_version})
 pkg_check_modules(WEB_EXTENSION REQUIRED webkit2gtk-4.0>=${webkit2gtk_minimum_version})
 
 # ******************************
+# Enchant - support both, but better to use the same as the dependencies (gtkspell3, webkitgtk+,...)
+# ******************************
+
+add_printable_option(WITH_ENCHANT_VERSION "Set Enchant version to use, values are: 'auto' (default), 1 or 2" 
"auto")
+
+if(WITH_ENCHANT_VERSION STREQUAL "1")
+       pkg_check_modules(ENCHANT REQUIRED enchant>=${enchant1_minimum_version})
+else(WITH_ENCHANT_VERSION STREQUAL "1")
+       if(WITH_ENCHANT_VERSION STREQUAL "2")
+               pkg_check_modules(ENCHANT REQUIRED enchant-2>=${enchant2_minimum_version})
+       else(WITH_ENCHANT_VERSION STREQUAL "2")
+               pkg_check_modules(ENCHANT enchant>=${enchant1_minimum_version})
+               if(ENCHANT_FOUND)
+                       set(WITH_ENCHANT_VERSION "auto (enchant-1)")
+               else(ENCHANT_FOUND)
+                       unset(ENCHANT_FOUND)
+                       pkg_check_modules(ENCHANT enchant-2>=${enchant2_minimum_version})
+                       if(ENCHANT_FOUND)
+                               set(WITH_ENCHANT_VERSION "auto (enchant-2)")
+                       else(ENCHANT_FOUND)
+                               message(FATAL_ERROR "Cannot find enchant 1 neither enchant 2, or new-enough 
version. Install either of them "
+                                                   "or specify which to use with 
-DWITH_ENCHANT_VERSION=auto|1|2, where 'auto' is the default")
+                       endif(ENCHANT_FOUND)
+               endif(ENCHANT_FOUND)
+       endif(WITH_ENCHANT_VERSION STREQUAL "2")
+endif(WITH_ENCHANT_VERSION STREQUAL "1")
+
+# ******************************
 # Canberra / Canberra-GTK Sound
 # ******************************
 
diff --git a/src/composer/CMakeLists.txt b/src/composer/CMakeLists.txt
index c5800fd..b609d8d 100644
--- a/src/composer/CMakeLists.txt
+++ b/src/composer/CMakeLists.txt
@@ -65,6 +65,7 @@ target_include_directories(evolution-mail-composer PUBLIC
        ${CMAKE_BINARY_DIR}/src
        ${CMAKE_SOURCE_DIR}/src
        ${CMAKE_CURRENT_BINARY_DIR}
+       ${ENCHANT_INCLUDE_DIRS}
        ${CERT_UI_INCLUDE_DIRS}
        ${EVOLUTION_DATA_SERVER_INCLUDE_DIRS}
        ${GNOME_PLATFORM_INCLUDE_DIRS}
diff --git a/src/composer/e-msg-composer.c b/src/composer/e-msg-composer.c
index af4efc4..f77c56d 100644
--- a/src/composer/e-msg-composer.c
+++ b/src/composer/e-msg-composer.c
@@ -33,7 +33,7 @@
 #include <unistd.h>
 #include <ctype.h>
 #include <fcntl.h>
-#include <enchant/enchant.h>
+#include <enchant.h>
 
 #include "e-composer-from-header.h"
 #include "e-composer-text-header.h"
diff --git a/src/e-util/e-html-editor-actions.c b/src/e-util/e-html-editor-actions.c
index 1cddfc2..e32249e 100644
--- a/src/e-util/e-html-editor-actions.c
+++ b/src/e-util/e-html-editor-actions.c
@@ -22,7 +22,7 @@
 #include <gio/gio.h>
 #include <glib/gi18n-lib.h>
 #include <string.h>
-#include <enchant/enchant.h>
+#include <enchant.h>
 
 #include "e-html-editor.h"
 #include "e-html-editor-private.h"
diff --git a/src/e-util/e-html-editor-spell-check-dialog.c b/src/e-util/e-html-editor-spell-check-dialog.c
index 05a1cd7..62cd37a 100644
--- a/src/e-util/e-html-editor-spell-check-dialog.c
+++ b/src/e-util/e-html-editor-spell-check-dialog.c
@@ -23,7 +23,7 @@
 #include "e-html-editor-spell-check-dialog.h"
 
 #include <glib/gi18n-lib.h>
-#include <enchant/enchant.h>
+#include <enchant.h>
 
 #include "e-spell-checker.h"
 #include "e-spell-dictionary.h"
diff --git a/src/e-util/e-html-editor.c b/src/e-util/e-html-editor.c
index 94cf59c..4ca2b25 100644
--- a/src/e-util/e-html-editor.c
+++ b/src/e-util/e-html-editor.c
@@ -23,7 +23,7 @@
 #include <glib/gi18n-lib.h>
 
 #include <camel/camel.h>
-#include <enchant/enchant.h>
+#include <enchant.h>
 #include <libedataserver/libedataserver.h>
 
 #include "e-html-editor.h"
diff --git a/src/e-util/e-spell-dictionary.h b/src/e-util/e-spell-dictionary.h
index 97cec2c..83b0fc4 100644
--- a/src/e-util/e-spell-dictionary.h
+++ b/src/e-util/e-spell-dictionary.h
@@ -24,7 +24,7 @@
 #define E_SPELL_DICTIONARY_H
 
 #include <glib-object.h>
-#include <enchant/enchant.h>
+#include <enchant.h>
 
 /* Standard GObject macros */
 #define E_TYPE_SPELL_DICTIONARY \


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