Upstream-Status: Accepted [https://github.com/hexchat/hexchat/commit/5ca767f7f881f480de90882233ed833846bd8a3d]
From 5ca767f7f881f480de90882233ed833846bd8a3d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Rainer=20M=C3=BCller?= <raimue@codingfarm.de>
Date: Sat, 31 Mar 2018 00:53:56 +0200
Subject: [PATCH] Fix plugins on macOS
The switch to the meson build system broke plugins on macOS. GNU libtool
builds shared libraries with ".dylib" and shared modules (plugins) with
the extension ".so", but meson is using ".dylib" for both.
Although overriding the name_suffix for shared_module() in meson is
possible, this would be messy for other platforms as there is no way to
query the default. Therefore it seems like we have to go with ".dylib"
However, G_MODULE_SUFFIX is defined to ".so", because glib follows what
GNU libtool does. Therefore define a separate preprocessor macro that
has the correct extension.
See: https://github.com/mesonbuild/meson/issues/1160
src/common/outbound.c | 6 +++---
src/common/plugin.c | 4 ++--
src/common/plugin.h | 8 ++++++++
src/fe-gtk/plugingui.c | 4 ++--
4 files changed, 15 insertions(+), 7 deletions(-)
diff --git a/src/common/outbound.c b/src/common/outbound.c
index fe6da8c86..96fb7fe44 100644
--- a/src/common/outbound.c
+++ b/src/common/outbound.c
@@ -2610,7 +2610,7 @@ cmd_load (struct session *sess, char *tbuf, char *word[], char *word_eol[])
- if (g_str_has_suffix (word[2], "."G_MODULE_SUFFIX))
+ if (g_str_has_suffix (word[2], "."PLUGIN_SUFFIX))
@@ -3616,7 +3616,7 @@ cmd_unload (struct session *sess, char *tbuf, char *word[], char *word_eol[])
gboolean by_file = FALSE;
- if (g_str_has_suffix (word[2], "."G_MODULE_SUFFIX))
+ if (g_str_has_suffix (word[2], "."PLUGIN_SUFFIX))
switch (plugin_kill (word[2], by_file))
@@ -3641,7 +3641,7 @@ cmd_reload (struct session *sess, char *tbuf, char *word[], char *word_eol[])
gboolean by_file = FALSE;
- if (g_str_has_suffix (word[2], "."G_MODULE_SUFFIX))
+ if (g_str_has_suffix (word[2], "."PLUGIN_SUFFIX))
switch (plugin_reload (sess, word[2], by_file))
diff --git a/src/common/plugin.c b/src/common/plugin.c
index 3ad3c558e..1db11f355 100644
--- a/src/common/plugin.c
+++ b/src/common/plugin.c