Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | g-ir-tools: respect gir_dir_prefix |
| 2 | |
| 3 | Configure option gir_dir_prefix is used to configure install dir for |
| 4 | .gir files, so add its value to include file search paths. |
| 5 | |
| 6 | Upstream-Status: Accepted [https://gitlab.gnome.org/GNOME/gobject-introspection/commit/3fe995a] |
| 7 | |
| 8 | Signed-off-by: Kai Kang <kai.kang@windriver.com> |
| 9 | --- |
| 10 | Makefile-tools.am | 2 +- |
| 11 | giscanner/transformer.py | 1 + |
| 12 | tests/warn/warningtester.py | 1 + |
| 13 | tools/g-ir-tool-template.in | 10 ++++++++++ |
| 14 | 6 files changed, 15 insertions(+), 2 deletions(-) |
| 15 | |
| 16 | diff --git a/Makefile-tools.am b/Makefile-tools.am |
| 17 | index c70d9850..fcaf1e01 100644 |
| 18 | --- a/Makefile-tools.am |
| 19 | +++ b/Makefile-tools.am |
| 20 | @@ -9,7 +9,7 @@ EXTRA_DIST += \ |
| 21 | tools/g-ir-tool-template.in \ |
| 22 | tools/meson.build |
| 23 | |
| 24 | -TOOL_SUBSTITUTIONS = -e s,@libdir\@,$(libdir), -e s,@datarootdir\@,$(datarootdir), -e s,@PYTHON_CMD\@,\/usr\/bin\/env\ $(PYTHON), |
| 25 | +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 |
| 26 | |
| 27 | g-ir-scanner: tools/g-ir-tool-template.in _giscanner.la Makefile |
| 28 | $(AM_V_GEN) sed $(TOOL_SUBSTITUTIONS) -e s,@TOOL_MODULE\@,scannermain, -e s,@TOOL_FUNCTION\@,scanner_main, $< > $@.tmp && mv $@.tmp $@ |
| 29 | diff --git a/giscanner/transformer.py b/giscanner/transformer.py |
| 30 | index 335e229f..2c412339 100644 |
| 31 | --- a/giscanner/transformer.py |
| 32 | +++ b/giscanner/transformer.py |
| 33 | @@ -184,6 +184,7 @@ None.""" |
| 34 | def _get_gi_data_dirs(self): |
| 35 | data_dirs = utils.get_system_data_dirs() |
| 36 | data_dirs.append(DATADIR) |
| 37 | + data_dirs.append(GIRDIR) |
| 38 | if os.name != 'nt': |
| 39 | # For backwards compatibility, was always unconditionally added to the list. |
| 40 | data_dirs.append('/usr/share') |
| 41 | diff --git a/tests/warn/warningtester.py b/tests/warn/warningtester.py |
| 42 | index f17c8889..be5aec13 100644 |
| 43 | --- a/tests/warn/warningtester.py |
| 44 | +++ b/tests/warn/warningtester.py |
| 45 | @@ -18,6 +18,7 @@ sys.path.insert(0, path) |
| 46 | |
| 47 | # Not correct, but enough to get the tests going uninstalled |
| 48 | builtins.__dict__['DATADIR'] = path |
| 49 | +builtins.__dict__['GIRDIR'] = '' |
| 50 | |
| 51 | from giscanner.annotationparser import GtkDocCommentBlockParser |
| 52 | from giscanner.ast import Include, Namespace |
| 53 | diff --git a/tools/g-ir-tool-template.in b/tools/g-ir-tool-template.in |
| 54 | index ed33d16b..b9cf0911 100755 |
| 55 | --- a/tools/g-ir-tool-template.in |
| 56 | +++ b/tools/g-ir-tool-template.in |
| 57 | @@ -60,6 +60,16 @@ if not os.path.isdir(os.path.join(datadir, 'gir-1.0')): |
| 58 | |
| 59 | builtins.__dict__['DATADIR'] = datadir |
| 60 | |
| 61 | +# Respect gir_dir_prefix for meson and autotools |
| 62 | +girdir = '' |
| 63 | +# for meson |
| 64 | +if '@gir_dir_prefix@' and not '@gir_dir_prefix@'.startswith('@'): |
| 65 | + girdir = os.path.abspath(os.path.join(filedir, '..', '@gir_dir_prefix@')) |
| 66 | +# for autotools |
| 67 | +elif '@GIR_DIR@' and not '@GIR_DIR@'.startswith('@'): |
| 68 | + girdir = os.path.dirname(os.path.abspath('@GIR_DIR@')) |
| 69 | +builtins.__dict__['GIRDIR'] = girdir |
| 70 | + |
| 71 | # Again, relative paths first so that the installation prefix is relocatable |
| 72 | pylibdir = os.path.abspath(os.path.join(filedir, '..', 'lib', 'gobject-introspection')) |
| 73 | |
| 74 | -- |
| 75 | 2.17.0 |
| 76 | |