[geary/wip/enchant2: 1/2] Support building with Enchant 2.x



commit 7b6ae4954120b68375f0d839cfb6962f03f6c2a0
Author: Michael Gratton <mike vee net>
Date:   Wed Jan 16 10:05:08 2019 +1100

    Support building with Enchant 2.x
    
    This adds support for Enchant 2 named "enchant" and Enchant 2 named
    "enchant-2" (!)

 bindings/vapi/enchant-2.vapi | 34 ++++++++++++++++++++++++++++++++++
 meson.build                  |  8 +++++++-
 org.gnome.Geary.json         | 13 -------------
 3 files changed, 41 insertions(+), 14 deletions(-)
---
diff --git a/bindings/vapi/enchant-2.vapi b/bindings/vapi/enchant-2.vapi
new file mode 100644
index 00000000..c4a030f7
--- /dev/null
+++ b/bindings/vapi/enchant-2.vapi
@@ -0,0 +1,34 @@
+[CCode (cheader_filename = "enchant.h")]
+namespace Enchant {
+       public delegate void BrokerDescribeFn (string provider_name, string provider_desc, string 
provider_dll_file);
+       public delegate void DictDescribeFn (string lang_tag, string provider_name, string provider_desc, 
string provider_file);
+
+       [Compact]
+       [CCode (free_function = "enchant_broker_free")]
+       public class Broker {
+               [CCode (cname = "enchant_broker_init")]
+               public Broker ();
+
+               public unowned Dict request_dict (string tag);
+               public unowned Dict request_pwl_dict (string pwl);
+               public void free_dict (Dict dict);
+               public int dict_exists (string tag);
+               public void set_ordering (string tag, string ordering);
+               public void describe (BrokerDescribeFn fn);
+               public void list_dicts (DictDescribeFn fn);
+               public unowned string get_error ();
+       }
+
+       [Compact]
+       public class Dict {
+               public int check (string word, long len = -1);
+               public unowned string[] suggest (string word, long len = -1);
+               public void free_string_list ([CCode (array_length = false)] string[] string_list);
+               public void add_to_session (string word, long len = -1);
+               public int is_in_session (string word, long len = -1);
+               public void store_replacement ( string mis, long mis_len, string cor, long cor_len);
+               public void add_to_pwl ( string word, long len = -1);
+               public void describe (DictDescribeFn fn);
+               public unowned string get_error ();
+       }
+}
diff --git a/meson.build b/meson.build
index ab69eb28..e0d6f2b5 100644
--- a/meson.build
+++ b/meson.build
@@ -52,7 +52,7 @@ sqlite = dependency('sqlite3', version: '>= 3.12')
 webkit2gtk = dependency('webkit2gtk-4.0', version: '>=' + target_webkit)
 
 # Secondary deps - keep sorted alphabetically
-enchant = dependency('enchant', version: '>= 1.6')
+enchant = dependency('enchant-2', version: '>=2.1', required: false) # see below
 gck = dependency('gck-1')
 gcr = dependency('gcr-3', version: '>= 3.10.1')
 gdk = dependency('gdk-3.0', version: '>=' + target_gtk)
@@ -76,6 +76,12 @@ posix = valac.find_library('posix')
 webkit2gtk = dependency('webkit2gtk-4.0', version: '>=' + target_webkit)
 webkit2gtk_web_extension = dependency('webkit2gtk-web-extension-4.0', version: '>=' + target_webkit)
 
+# Can currently use either Enchant 1 or 2
+if not enchant.found()
+  enchant = dependency('enchant', version: '>=1.6')
+endif
+
+
 # Libunwind system dependencies above ensures appropriate versions,
 # but this declared depencency is what we actually build against so we
 # can include the custom VAPI correctly. We need to add unwind_lib to
diff --git a/org.gnome.Geary.json b/org.gnome.Geary.json
index e956d74d..93c45ff3 100644
--- a/org.gnome.Geary.json
+++ b/org.gnome.Geary.json
@@ -107,19 +107,6 @@
                 }
             ]
         },
-        {
-            "name" : "enchant",
-            "cleanup" : [
-                "/bin"
-             ],
-             "sources" : [
-                {
-                    "type" : "archive",
-                    "url" : 
"https://github.com/AbiWord/enchant/releases/download/enchant-1-6-1/enchant-1.6.1.tar.gz";,
-                    "sha256" : "bef0d9c0fef2e4e8746956b68e4d6c6641f6b85bd2908d91731efb68eba9e3f5"
-                }
-            ]
-        },
         {
             "name": "geary",
             "buildsystem": "meson",


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