1 From 4cf37d56fddcc22bcd818f6d470404f56d907f3c Mon Sep 17 00:00:00 2001
2 From: Sascha Silbe <x-yo17@se-silbe.de>
3 Date: Fri, 8 Jun 2018 13:55:10 +0200
4 Subject: [PATCH] Relocate the repository directory for native builds
6 Instead of hard-coding GOBJECT_INTROSPECTION_LIBDIR when
7 gobject-introspection is built, use dladdr() to determine where
8 GOBJECT_INTROSPECTION_LIBDIR is and use that path to calculate the
11 This fixes gobject-introspection-native accessing paths across build
12 directories (e.g. if the build directories use the same shared state
13 cache or sstate mirror).
15 Upstream-Status: Inappropriate
16 Signed-off-by: Sascha Silbe <x-yo17@se-silbe.de>
19 girepository/girepository.c | 15 +++++++++++++--
20 1 file changed, 13 insertions(+), 2 deletions(-)
22 diff --git a/girepository/girepository.c b/girepository/girepository.c
23 index c1fa3d3..efa557e 100644
24 --- a/girepository/girepository.c
25 +++ b/girepository/girepository.c
27 * Boston, MA 02111-1307, USA.
36 #include "gitypelib-internal.h"
37 #include "girepository-private.h"
42 * SECTION:girepository
43 * @short_description: GObject Introspection repository manager
44 @@ -188,9 +192,16 @@ init_globals (void)
48 - libdir = GOBJECT_INTROSPECTION_LIBDIR;
49 + Dl_info gi_lib_info;
51 - typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL);
52 + if (dladdr (g_irepository_get_default, &gi_lib_info)) {
53 + char *libdir = g_path_get_dirname (gi_lib_info.dli_fname);
54 + typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL);
57 + libdir = GOBJECT_INTROSPECTION_LIBDIR;
58 + typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL);
61 typelib_search_path = g_slist_prepend (typelib_search_path, typelib_dir);