summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core/glib-2.0/glib-2.0/relocate-modules.patch
blob: 65d5b43f9b6fb6b46b5288cfd89e38f5897a2515 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
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 <ross.burton@intel.com>

Port patch to 2.48
Signed-off-by: Jussi Kukkonen <jussi.kukkonen@intel.com>
---
 gio/giomodule.c | 12 +++++++++++-
 1 file changed, 11 insertions(+), 1 deletion(-)

diff --git a/gio/giomodule.c b/gio/giomodule.c
index da7c167..cc0bc7c 100644
--- a/gio/giomodule.c
+++ b/gio/giomodule.c
@@ -40,6 +40,8 @@
 #include "gnetworkmonitor.h"
 #ifdef G_OS_WIN32
 #include "gregistrysettingsbackend.h"
+#else
+#include <dlfcn.h>
 #endif
 #include <glib/gstdio.h>
 
@@ -1036,7 +1038,15 @@ get_gio_module_dir (void)
 #endif
       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
     }
 
-- 
2.1.4