summaryrefslogtreecommitdiffstats
path: root/meta/recipes-core
diff options
context:
space:
mode:
authorRoss Burton <ross.burton@intel.com>2016-03-11 15:35:55 +0000
committerRichard Purdie <richard.purdie@linuxfoundation.org>2016-03-12 22:11:47 +0000
commit4489ef1f6d9ee2ebb8bcf65ebebaf7646a9c9fcf (patch)
treeaffca514d17977742ce0c01d3978711b29ccc8d9 /meta/recipes-core
parentcf3402eb82aaa8aa4f9886003cbc0ce82637c3b2 (diff)
downloadpoky-4489ef1f6d9ee2ebb8bcf65ebebaf7646a9c9fcf.tar.gz
glib-2.0: relocate the GIO module directory for native builds
Glib hard-codes the install path in search path for GIO modules, which causes problems when glib-2.0-native is restored from sstate with a different build directory. In the future we should relocate symbols directly using the same system that the eSDK uses, but for now use dladdr() to look up where the library was loaded from to build the search path. (From OE-Core rev: 0a009dbfff32566341b2888530423f90f1b3d945) Signed-off-by: Ross Burton <ross.burton@intel.com> Signed-off-by: Richard Purdie <richard.purdie@linuxfoundation.org>
Diffstat (limited to 'meta/recipes-core')
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0/relocate-modules.patch49
-rw-r--r--meta/recipes-core/glib-2.0/glib-2.0_2.46.2.bb3
2 files changed, 51 insertions, 1 deletions
diff --git a/meta/recipes-core/glib-2.0/glib-2.0/relocate-modules.patch b/meta/recipes-core/glib-2.0/glib-2.0/relocate-modules.patch
new file mode 100644
index 0000000000..f9e3f3dbaa
--- /dev/null
+++ b/meta/recipes-core/glib-2.0/glib-2.0/relocate-modules.patch
@@ -0,0 +1,49 @@
1Instead of hard-coding GIO_MODULE_PATH when glib is built, use dladdr() to
2determine where libglib.so is and use that path to calculate GIO_MODULES_DIR.
3
4This solves relocation problems with GIOModule for native builds of glib.
5
6Upstream-Status: Inappropriate
7Signed-off-by: Ross Burton <ross.burton@intel.com>
8
9diff --git a/gio/giomodule.c b/gio/giomodule.c
10index 56c498c..a2e32b7 100644
11--- a/gio/giomodule.c
12+++ b/gio/giomodule.c
13@@ -47,6 +47,27 @@
14 #include "gdesktopappinfo.h"
15 #endif
16
17+#include <dlfcn.h>
18+
19+/*
20+ * Generate a GIO module directory based on where glib is installed
21+ */
22+static const char *
23+_get_gio_module_dir (void)
24+{
25+ Dl_info info;
26+
27+ if (dladdr (g_io_module_new, &info)) {
28+ char *libdir = g_path_get_dirname (info.dli_fname);
29+ char *dir = g_build_filename (libdir, "gio", "modules", NULL);
30+ g_free (libdir);
31+ return dir;
32+ } else {
33+ return GIO_MODULE_DIR;
34+ }
35+}
36+
37+
38 /**
39 * SECTION:giomodule
40 * @short_description: Loadable GIO Modules
41@@ -1057,7 +1078,7 @@ _g_io_modules_ensure_loaded (void)
42 /* Then load the compiled in path */
43 module_dir = g_getenv ("GIO_MODULE_DIR");
44 if (module_dir == NULL)
45- module_dir = GIO_MODULE_DIR;
46+ module_dir = _get_gio_module_dir ();
47
48 g_io_modules_scan_all_in_directory_with_scope (module_dir, scope);
49
diff --git a/meta/recipes-core/glib-2.0/glib-2.0_2.46.2.bb b/meta/recipes-core/glib-2.0/glib-2.0_2.46.2.bb
index bf3cadeb76..2a2efae977 100644
--- a/meta/recipes-core/glib-2.0/glib-2.0_2.46.2.bb
+++ b/meta/recipes-core/glib-2.0/glib-2.0_2.46.2.bb
@@ -18,7 +18,8 @@ SRC_URI = "${GNOME_MIRROR}/glib/${SHRT_VER}/glib-${PV}.tar.xz \
18 file://gi-exclude.patch \ 18 file://gi-exclude.patch \
19 " 19 "
20 20
21SRC_URI_append_class-native = " file://glib-gettextize-dir.patch" 21SRC_URI_append_class-native = " file://glib-gettextize-dir.patch \
22 file://relocate-modules.patch"
22 23
23SRC_URI[md5sum] = "7f815d6e46df68e070cb421ed7f1139e" 24SRC_URI[md5sum] = "7f815d6e46df68e070cb421ed7f1139e"
24SRC_URI[sha256sum] = "5031722e37036719c1a09163cc6cf7c326e4c4f1f1e074b433c156862bd733db" 25SRC_URI[sha256sum] = "5031722e37036719c1a09163cc6cf7c326e4c4f1f1e074b433c156862bd733db"