summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNirbheek Chauhan <nirbheek.chauhan@gmail.com>2019-09-07 14:59:20 +0000
committerNirbheek Chauhan <nirbheek.chauhan@gmail.com>2019-09-07 14:59:20 +0000
commit031b3de2ea5dc7218e82ad2f91c8e0be66d5af4b (patch)
tree4c0fae18d3b9b3a6587fc8d34d33ef3f7c4c1bff
parent1e91cb0f366949b61b862fe6d14175a3ee7fbfc1 (diff)
parent036f6ca7e3ef810498f2fd2ce9c9c1c2a3278f3c (diff)
downloadglib-031b3de2ea5dc7218e82ad2f91c8e0be66d5af4b.tar.gz
Merge branch 'fix-gmodule-macos' into 'master'
gmodule: use dl implementation on macOS Closes #1887 See merge request GNOME/glib!1091
-rw-r--r--gmodule/meson.build4
-rw-r--r--tests/meson.build28
-rw-r--r--tests/module-test.c4
3 files changed, 29 insertions, 7 deletions
diff --git a/gmodule/meson.build b/gmodule/meson.build
index d38ad2df1..5fce96de1 100644
--- a/gmodule/meson.build
+++ b/gmodule/meson.build
@@ -13,12 +13,12 @@ if host_system == 'windows'
# dlopen() filepath must be of the form /path/libname.a(libname.so)
elif host_system == 'aix'
g_module_impl = 'G_MODULE_IMPL_AR'
+elif have_dlopen_dlsym
+ g_module_impl = 'G_MODULE_IMPL_DL'
# NSLinkModule (dyld) in system libraries (Darwin)
elif cc.has_function('NSLinkModule')
g_module_impl = 'G_MODULE_IMPL_DYLD'
g_module_need_uscore = 1
-elif have_dlopen_dlsym
- g_module_impl = 'G_MODULE_IMPL_DL'
endif
# additional checks for G_MODULE_IMPL_DL
diff --git a/tests/meson.build b/tests/meson.build
index ce3044258..e4ea22692 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -44,9 +44,17 @@ tests = {
'type-test' : {},
'unicode-caseconv' : {},
'unicode-encoding' : {},
- 'module-test' : {
+ 'module-test-library' : {
'dependencies' : [libgmodule_dep],
'export_dynamic' : true,
+ 'source': 'module-test.c',
+ 'c_args': ['-DMODULE_TYPE="library"'],
+ },
+ 'module-test-plugin' : {
+ 'dependencies' : [libgmodule_dep],
+ 'export_dynamic' : true,
+ 'source': 'module-test.c',
+ 'c_args': ['-DMODULE_TYPE="plugin"'],
},
'cxx-test' : {
'source' : 'cxx-test.cpp',
@@ -87,11 +95,25 @@ if installed_tests_enabled
)
endif
+module_suffix = []
+# Keep the autotools convention for shared module suffix because GModule
+# depends on it: https://gitlab.gnome.org/GNOME/glib/issues/520
+if ['darwin', 'ios'].contains(host_machine.system())
+ module_suffix = 'so'
+endif
+
foreach module : ['moduletestplugin_a', 'moduletestplugin_b']
- shared_module(module, 'lib@0@.c'.format(module),
+ shared_module(module + '_plugin', 'lib@0@.c'.format(module),
+ dependencies : [libglib_dep, libgmodule_dep],
+ install_dir : installed_tests_execdir,
+ install : installed_tests_enabled,
+ name_suffix : module_suffix
+ )
+ shared_library(module + '_library', 'lib@0@.c'.format(module),
dependencies : [libglib_dep, libgmodule_dep],
install_dir : installed_tests_execdir,
- install : installed_tests_enabled
+ install : installed_tests_enabled,
+ name_suffix : module_suffix
)
endforeach
diff --git a/tests/module-test.c b/tests/module-test.c
index 8047b74ec..e0e6423f6 100644
--- a/tests/module-test.c
+++ b/tests/module-test.c
@@ -90,8 +90,8 @@ main (int argc,
if (!g_module_supported ())
g_error ("dynamic modules not supported");
- plugin_a = g_test_build_filename (G_TEST_BUILT, MODULE_FILENAME_PREFIX "moduletestplugin_a", NULL);
- plugin_b = g_test_build_filename (G_TEST_BUILT, MODULE_FILENAME_PREFIX "moduletestplugin_b", NULL);
+ plugin_a = g_test_build_filename (G_TEST_BUILT, MODULE_FILENAME_PREFIX "moduletestplugin_a_" MODULE_TYPE, NULL);
+ plugin_b = g_test_build_filename (G_TEST_BUILT, MODULE_FILENAME_PREFIX "moduletestplugin_b_" MODULE_TYPE, NULL);
/* module handles */