From 8c623acdbea3ecc2812bbaafcfc892758fa978da Mon Sep 17 00:00:00 2001 From: Ross Burton Date: Fri, 11 Mar 2016 15:35:55 +0000 Subject: [PATCH] glib-2.0: relocate the GIO module directory for native builds Instead of hard-coding GIO_MODULE_PATH when glib is built, use dladdr() to determine where libglib.so is and use that path to calculate GIO_MODULES_DIR. This solves relocation problems with GIOModule for native builds of glib. Upstream-Status: Inappropriate Signed-off-by: Ross Burton Port patch to 2.48 Signed-off-by: Jussi Kukkonen --- gio/giomodule.c | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/gio/giomodule.c b/gio/giomodule.c index 1007abd..5380982 100644 --- a/gio/giomodule.c +++ b/gio/giomodule.c @@ -44,6 +44,8 @@ #include "gnetworkmonitor.h" #ifdef G_OS_WIN32 #include "gregistrysettingsbackend.h" +#else +#include #endif #include @@ -1149,7 +1151,15 @@ get_gio_module_dir (void) NULL); g_free (install_dir); #else - module_dir = g_strdup (GIO_MODULE_DIR); + Dl_info info; + + if (dladdr (g_io_module_new, &info)) { + char *libdir = g_path_get_dirname (info.dli_fname); + module_dir = g_build_filename (libdir, "gio", "modules", NULL); + g_free (libdir); + } else { + module_dir = g_strdup (GIO_MODULE_DIR); + } #endif }