From cfcca794e6bbfd9af02f676b15a73417f4f830e3 Mon Sep 17 00:00:00 2001 From: Danny Rawlins Date: Mon, 5 Feb 2018 13:08:20 +1100 Subject: [PATCH] hexchat: add missing patch --- hexchat/hexchat-enchant2.0.patch | 124 +++++++++++++++++++++++++++++++ 1 file changed, 124 insertions(+) create mode 100644 hexchat/hexchat-enchant2.0.patch diff --git a/hexchat/hexchat-enchant2.0.patch b/hexchat/hexchat-enchant2.0.patch new file mode 100644 index 000000000..4c08c09ac --- /dev/null +++ b/hexchat/hexchat-enchant2.0.patch @@ -0,0 +1,124 @@ +From 005858795878b92fc17b4c2127bce90a1d053483 Mon Sep 17 00:00:00 2001 +From: Patrick Griffis +Date: Fri, 24 Nov 2017 03:51:10 -0500 +Subject: [PATCH] spell-entry: Improve robustness of enchant loading and fix + 2.0 support + +- Add logging and error handling to loading symbols +- Don't load unversioned symbol +- Handle new function names in Enchant 2.0 + +Closes #2095 +--- + src/fe-gtk/sexy-spell-entry.c | 94 +++++++++++++++++++++++++------------------ + 1 file changed, 55 insertions(+), 39 deletions(-) + +diff --git a/src/fe-gtk/sexy-spell-entry.c b/src/fe-gtk/sexy-spell-entry.c +index 566abcf3e..bd31d2239 100644 +--- a/src/fe-gtk/sexy-spell-entry.c ++++ b/src/fe-gtk/sexy-spell-entry.c +@@ -159,49 +159,65 @@ initialize_enchant (void) + { + GModule *enchant; + gpointer funcptr; +- +- +- enchant = g_module_open("libenchant."G_MODULE_SUFFIX, 0); +- if (enchant == NULL) +- { +-#ifndef WIN32 +- enchant = g_module_open("libenchant.so.1", 0); +- if (enchant == NULL) +- { +-#ifdef __APPLE__ +- enchant = g_module_open("libenchant.dylib", 0); +- if (enchant == NULL) ++ gsize i; ++ const char * const libnames[] = { ++#ifdef G_OS_WIN32 ++ "libenchant.dll", + #endif +- return; +- } +-#else +- return; ++#ifdef G_OS_UNIX ++ "libenchant.so.1", ++ "libenchant.so.2", + #endif +- } +- +- have_enchant = TRUE; +- +-#define MODULE_SYMBOL(name, func) \ +- g_module_symbol(enchant, (name), &funcptr); \ +- (func) = funcptr; +- +- MODULE_SYMBOL("enchant_broker_init", enchant_broker_init) +- MODULE_SYMBOL("enchant_broker_free", enchant_broker_free) +- MODULE_SYMBOL("enchant_broker_free_dict", enchant_broker_free_dict) +- MODULE_SYMBOL("enchant_broker_list_dicts", enchant_broker_list_dicts) +- MODULE_SYMBOL("enchant_broker_request_dict", enchant_broker_request_dict) +- +- MODULE_SYMBOL("enchant_dict_add_to_personal", enchant_dict_add_to_personal) +- MODULE_SYMBOL("enchant_dict_add_to_session", enchant_dict_add_to_session) +- MODULE_SYMBOL("enchant_dict_check", enchant_dict_check) +- MODULE_SYMBOL("enchant_dict_describe", enchant_dict_describe) ++#ifdef __APPLE__ ++ "libenchant.dylib", ++#endif ++ }; ++ ++ for (i = 0; i < G_N_ELEMENTS(libnames); ++i) ++ { ++ enchant = g_module_open(libnames[i], 0); ++ if (enchant) ++ { ++ g_info ("Loaded %s", libnames[i]); ++ have_enchant = TRUE; ++ break; ++ } ++ } ++ ++ if (!have_enchant) ++ return; ++ ++#define MODULE_SYMBOL(name, func, alt_name) G_STMT_START { \ ++ const char *funcname = name; \ ++ gboolean ret = g_module_symbol(enchant, funcname, &funcptr); \ ++ if (alt_name) { \ ++ funcname = alt_name; \ ++ ret = g_module_symbol(enchant, funcname, &funcptr); \ ++ } \ ++ if (ret == FALSE) { \ ++ g_warning ("Failed to find enchant symbol %s", funcname); \ ++ have_enchant = FALSE; \ ++ return; \ ++ } \ ++ (func) = funcptr; \ ++} G_STMT_END; ++ ++ MODULE_SYMBOL("enchant_broker_init", enchant_broker_init, NULL) ++ MODULE_SYMBOL("enchant_broker_free", enchant_broker_free, NULL) ++ MODULE_SYMBOL("enchant_broker_free_dict", enchant_broker_free_dict, NULL) ++ MODULE_SYMBOL("enchant_broker_list_dicts", enchant_broker_list_dicts, NULL) ++ MODULE_SYMBOL("enchant_broker_request_dict", enchant_broker_request_dict, NULL) ++ ++ MODULE_SYMBOL("enchant_dict_add_to_personal", enchant_dict_add_to_personal, ++ "enchant_dict_add") ++ MODULE_SYMBOL("enchant_dict_add_to_session", enchant_dict_add_to_session, NULL) ++ MODULE_SYMBOL("enchant_dict_check", enchant_dict_check, NULL) ++ MODULE_SYMBOL("enchant_dict_describe", enchant_dict_describe, NULL) + MODULE_SYMBOL("enchant_dict_free_suggestions", +- enchant_dict_free_suggestions) ++ enchant_dict_free_suggestions, "enchant_dict_free_string_list") + MODULE_SYMBOL("enchant_dict_store_replacement", +- enchant_dict_store_replacement) +- MODULE_SYMBOL("enchant_dict_suggest", enchant_dict_suggest) +- +-#undef MODULE_SYMBOL ++ enchant_dict_store_replacement, NULL) ++ MODULE_SYMBOL("enchant_dict_suggest", enchant_dict_suggest, NULL) + } + + static void