1 From 31ef4cce83c1770ea1e816d91b7e258fbf170035 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>
18 girepository/girepository.c | 15 +++++++++++++--
19 1 file changed, 13 insertions(+), 2 deletions(-)
21 diff --git a/girepository/girepository.c b/girepository/girepository.c
22 index 10282c72..60c45104 100644
23 --- a/girepository/girepository.c
24 +++ b/girepository/girepository.c
26 * Boston, MA 02111-1307, USA.
35 #include "gitypelib-internal.h"
36 #include "girepository-private.h"
41 * SECTION:girepository
42 * @short_description: GObject Introspection repository manager
43 @@ -191,9 +195,16 @@ init_globals (void)
47 - libdir = GOBJECT_INTROSPECTION_LIBDIR;
48 + Dl_info gi_lib_info;
50 - typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL);
51 + if (dladdr (g_irepository_get_default, &gi_lib_info)) {
52 + char *libdir = g_path_get_dirname (gi_lib_info.dli_fname);
53 + typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL);
56 + libdir = GOBJECT_INTROSPECTION_LIBDIR;
57 + typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL);
60 search_path = g_slist_prepend (search_path, typelib_dir);