Re: [gtk-osx-devel] [PATCH] make enchant to look for modules/configs in env specified dirs



On Wed, 31 Dec 2014 10:24:32 -0800
John Ralls <jralls ceridwen us> wrote:

Please file a bug report (bugzilla.gnome.org, gtk-mac-integration)
rather than sending patches to the mailing list.
sure, here it's:
https://bugzilla.gnome.org/show_bug.cgi?id=742208


IMO it would be better to use XDG at least for module-dir. Config-dir
defaults to ~/.enchant; if the stupid tarball included
enchant-cocoa.[ch] it would instead be /Library/Application
Support/Enchant, but that would require su to install dictionaries.
it'd be better if user would be able to just use bundle as it is without
su, installing needed dictionaries manually to homedir or globally (su)
if it's necessary. But suggested patch is not about dictionaries, pls
see below for more on it.

In any case it can’t be in the bundle, as that would violate the code
signature. What do you have in mind for this?

I'm porting claws-mail to gtk-osx, and it uses libenchant as front-end
for spell checking. So when bundled claws-mail is used on another
system it fails to find libenchant_myspell.so and other back-end
modules since it looks for them either at homedir or a hard-coded
installation prefix, the same goes for system-wide default
ordering config.

See
-DENCHANT_GLOBAL_MODULE_DIR=\"$(libdir)/enchant\"
-DENCHANT_GLOBAL_ORDERING=\"$(datadir)/enchant\"

providing env. variables to recognize additional directories (inside
bundle) for back-end libraries and default ordering config seems like
a convenient way to ship enchant libraries with a bundle

As for dictionaries, it's looking for them at
 /Library/Dictionaries
as it's built at present time.

Dictionaries probably shouldn't be shipped with mail client anyway,
but rather installed by user when he/she needs them either at
global /Library/Dictionaries or user's home directory.


Regards,
John Ralls



On Dec 31, 2014, at 8:48 AM, Igor Mammedov <imammedo redhat com>
wrote:

currently library looks for dictionary modules libraries and configs
only at hardcoded places i.e. at isnstall prefix and $HOME.

However it doesn't work when bundled application is moved to
system without gtk-osx build env or it's moved to another place.

Teach library check addtional pathes provided via env variables:
ENCHANT_MODULE_PATH/ENCHANT_CONFIG_PATH
which should be set by luncher script of the bundle to point
at spelling modules/configs directories.

Signed-off-by: Igor Mammedov <imammedo redhat com>
---
modulesets-stable/gtk-osx-unsupported.modules |  1 +
patches/enchant-env.patch                     | 26
++++++++++++++++++++++++++ 2 files changed, 27 insertions(+)
create mode 100644 patches/enchant-env.patch

diff --git a/modulesets-stable/gtk-osx-unsupported.modules
b/modulesets-stable/gtk-osx-unsupported.modules index
95bc531..a3b1b04 100644 ---
a/modulesets-stable/gtk-osx-unsupported.modules +++
b/modulesets-stable/gtk-osx-unsupported.modules @@ -126,6 +126,7 @@
    <branch module="1.6.0/enchant-1.6.0.tar.gz" version="1.6.0"
        repo="abisource/enchant">
 <patch
file="http://git.gnome.org/browse/gtk-osx/plain/patches/enchant-gsize.patch";
strip="1"/>
+ <patch
file="http://git.gnome.org/browse/gtk-osx/plain/patches/enchant-env.patch";
strip="1"/> </branch> <dependencies>
      <dep package="glib"/>
diff --git a/patches/enchant-env.patch b/patches/enchant-env.patch
new file mode 100644
index 0000000..7cae667
--- /dev/null
+++ b/patches/enchant-env.patch
@@ -0,0 +1,26 @@
+diff --git a/src/enchant.c b/src/enchant.c
+index 79fb21c..8a1b100 100644
+--- a/src/enchant.c
++++ b/src/enchant.c
+@@ -251,6 +251,10 @@ enchant_get_module_dirs (void)
+           }
+ #endif
+ 
++  module_dir = g_getenv("ENCHANT_MODULE_PATH");
++  if (module_dir)
++          module_dirs = enchant_slist_append_unique_path
(module_dirs, g_strdup(module_dir)); ++
+   return module_dirs;
+ }
+ 
+@@ -291,6 +295,10 @@ enchant_get_conf_dirs (void)
+   conf_dirs = enchant_slist_append_unique_path (conf_dirs,
g_strdup (ENCHANT_GLOBAL_ORDERING));
+ #endif
+ 
++  ordering_dir = g_getenv("ENCHANT_CONFIG_PATH");
++  if (ordering_dir)
++          conf_dirs = enchant_slist_append_unique_path
(conf_dirs, g_strdup(ordering_dir)); ++
+   return conf_dirs;
+ }
+ 
-- 
1.9.3 (Apple Git-50)





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