]> git.ipfire.org Git - thirdparty/openembedded/openembedded-core-contrib.git/blob
644cab929dd67dd02c1cc9082b3d563aad451f01
[thirdparty/openembedded/openembedded-core-contrib.git] /
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
5
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
9 repository directory.
10
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).
14
15 Upstream-Status: Inappropriate
16 Signed-off-by: Sascha Silbe <x-yo17@se-silbe.de>
17 ---
18 girepository/girepository.c | 15 +++++++++++++--
19 1 file changed, 13 insertions(+), 2 deletions(-)
20
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
25 @@ -21,6 +21,8 @@
26 * Boston, MA 02111-1307, USA.
27 */
28
29 +#define _GNU_SOURCE
30 +
31 #include "config.h"
32
33 #include <stdio.h>
34 @@ -34,6 +36,8 @@
35 #include "gitypelib-internal.h"
36 #include "girepository-private.h"
37
38 +#include <dlfcn.h>
39 +
40 /**
41 * SECTION:girepository
42 * @short_description: GObject Introspection repository manager
43 @@ -191,9 +195,16 @@ init_globals (void)
44 g_free (custom_dirs);
45 }
46
47 - libdir = GOBJECT_INTROSPECTION_LIBDIR;
48 + Dl_info gi_lib_info;
49
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);
54 + g_free (libdir);
55 + } else {
56 + libdir = GOBJECT_INTROSPECTION_LIBDIR;
57 + typelib_dir = g_build_filename (libdir, "girepository-1.0", NULL);
58 + }
59
60 search_path = g_slist_prepend (search_path, typelib_dir);
61
62 --
63 2.11.0
64