[gobject-introspection/wip/smcv/search-paths: 5/6] girepository: Search the same paths as the Python code
- From: Simon McVittie <smcv src gnome org>
- To: commits-list gnome org
- Cc:
- Subject: [gobject-introspection/wip/smcv/search-paths: 5/6] girepository: Search the same paths as the Python code
- Date: Fri, 12 Feb 2021 10:57:27 +0000 (UTC)
commit 789cacb8fa926175abd999294c46d3e298da85d2
Author: Simon McVittie <smcv debian org>
Date: Wed Feb 10 12:01:44 2021 +0000
girepository: Search the same paths as the Python code
The Python code historically always searched DATADIR/gir-1.0 (always)
and /usr/share/gir-1.0 (only on Unix). Do the same here.
If using gir_dir_prefix, for example -Dgir_dir_prefix=lib64, this
provides backwards compatibility with pre-existing GIR that might
already be stored in DATADIR/gir-1.0.
Signed-off-by: Simon McVittie <smcv debian org>
girepository/girparser.c | 13 +++++++++++++
meson.build | 1 +
2 files changed, 14 insertions(+)
---
diff --git a/girepository/girparser.c b/girepository/girparser.c
index 6747c3a5..1d9d3c6c 100644
--- a/girepository/girparser.c
+++ b/girepository/girparser.c
@@ -329,6 +329,19 @@ locate_gir (GIrParser *parser,
if (g_file_test (path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
return path;
g_free (path);
+
+ path = g_build_filename (GOBJECT_INTROSPECTION_DATADIR, GIR_SUFFIX, girname, NULL);
+ if (g_file_test (path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
+ return path;
+ g_free (path);
+
+#ifdef G_OS_UNIX
+ path = g_build_filename ("/usr/share", GIR_SUFFIX, girname, NULL);
+ if (g_file_test (path, G_FILE_TEST_EXISTS | G_FILE_TEST_IS_REGULAR))
+ return path;
+ g_free (path);
+#endif
+
return NULL;
}
diff --git a/meson.build b/meson.build
index 629abba3..d5fdfde3 100644
--- a/meson.build
+++ b/meson.build
@@ -98,6 +98,7 @@ else
gir_dir_pc_prefix = join_paths('${prefix}', gir_dir_prefix)
endif
girdir = join_paths(get_option('prefix'), gir_dir_prefix, 'gir-1.0')
+config.set_quoted('GOBJECT_INTROSPECTION_DATADIR', join_paths(get_option('prefix'), get_option('datadir')))
config.set_quoted('GIR_DIR', girdir)
config.set_quoted('GOBJECT_INTROSPECTION_LIBDIR', join_paths(get_option('prefix'), get_option('libdir')))
[
Date Prev][
Date Next] [
Thread Prev][
Thread Next]
[
Thread Index]
[
Date Index]
[
Author Index]