summaryrefslogtreecommitdiffstats
path: root/meta/recipes-gnome/gobject-introspection/gobject-introspection/0002-g-ir-tools-respect-gir_dir_prefix.patch
blob: 5e4176725c3f1ecfa7cb6b414f2b6d9c9e3babd9 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
g-ir-tools: respect gir_dir_prefix

Configure option gir_dir_prefix is used to configure install dir for
.gir files, so add its value to include file search paths.

Upstream-Status: Accepted [https://gitlab.gnome.org/GNOME/gobject-introspection/commit/3fe995a]

Signed-off-by: Kai Kang <kai.kang@windriver.com>
---
 Makefile-tools.am           |  2 +-
 giscanner/transformer.py    |  1 +
 tests/warn/warningtester.py |  1 +
 tools/g-ir-tool-template.in | 10 ++++++++++
 6 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/Makefile-tools.am b/Makefile-tools.am
index c70d9850..fcaf1e01 100644
--- a/Makefile-tools.am
+++ b/Makefile-tools.am
@@ -9,7 +9,7 @@ EXTRA_DIST += 				\
 	tools/g-ir-tool-template.in \
 	tools/meson.build
 
-TOOL_SUBSTITUTIONS = -e s,@libdir\@,$(libdir), -e s,@datarootdir\@,$(datarootdir), -e s,@PYTHON_CMD\@,\/usr\/bin\/env\ $(PYTHON),
+TOOL_SUBSTITUTIONS = -e s,@libdir\@,$(libdir), -e s,@datarootdir\@,$(datarootdir), -e s,@PYTHON_CMD\@,\/usr\/bin\/env\ $(PYTHON), -e s,@GIR_DIR\@,$(GIR_DIR),g
 
 g-ir-scanner: tools/g-ir-tool-template.in _giscanner.la Makefile
 	$(AM_V_GEN) sed $(TOOL_SUBSTITUTIONS) -e s,@TOOL_MODULE\@,scannermain, -e s,@TOOL_FUNCTION\@,scanner_main, $< > $@.tmp && mv $@.tmp $@
diff --git a/giscanner/transformer.py b/giscanner/transformer.py
index 335e229f..2c412339 100644
--- a/giscanner/transformer.py
+++ b/giscanner/transformer.py
@@ -184,6 +184,7 @@ None."""
     def _get_gi_data_dirs(self):
         data_dirs = utils.get_system_data_dirs()
         data_dirs.append(DATADIR)
+        data_dirs.append(GIRDIR)
         if os.name != 'nt':
             # For backwards compatibility, was always unconditionally added to the list.
             data_dirs.append('/usr/share')
diff --git a/tests/warn/warningtester.py b/tests/warn/warningtester.py
index f17c8889..be5aec13 100644
--- a/tests/warn/warningtester.py
+++ b/tests/warn/warningtester.py
@@ -18,6 +18,7 @@ sys.path.insert(0, path)
 
 # Not correct, but enough to get the tests going uninstalled
 builtins.__dict__['DATADIR'] = path
+builtins.__dict__['GIRDIR'] = ''
 
 from giscanner.annotationparser import GtkDocCommentBlockParser
 from giscanner.ast import Include, Namespace
diff --git a/tools/g-ir-tool-template.in b/tools/g-ir-tool-template.in
index ed33d16b..b9cf0911 100755
--- a/tools/g-ir-tool-template.in
+++ b/tools/g-ir-tool-template.in
@@ -60,6 +60,16 @@ if not os.path.isdir(os.path.join(datadir, 'gir-1.0')):
 
 builtins.__dict__['DATADIR'] = datadir
 
+# Respect gir_dir_prefix for meson and autotools
+girdir = ''
+# for meson
+if '@gir_dir_prefix@' and not '@gir_dir_prefix@'.startswith('@'):
+    girdir = os.path.abspath(os.path.join(filedir, '..', '@gir_dir_prefix@'))
+# for autotools
+elif '@GIR_DIR@' and not '@GIR_DIR@'.startswith('@'):
+    girdir = os.path.dirname(os.path.abspath('@GIR_DIR@'))
+builtins.__dict__['GIRDIR'] = girdir
+
 # Again, relative paths first so that the installation prefix is relocatable
 pylibdir = os.path.abspath(os.path.join(filedir, '..', 'lib', 'gobject-introspection'))
 
-- 
2.17.0