aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorFlorian Müllner <fmuellner@gnome.org>2017-05-28 10:47:50 +0200
committerFlorian Müllner <fmuellner@gnome.org>2017-06-11 21:48:15 +0200
commita3dda095bc6bd3725984daab3cfa02cb90d6bf21 (patch)
tree4a1608973cb71f60ac399a1123a82089620c65db
parent4b8dc3b7463fa2512d58ca3f65f8eaddfd126ff5 (diff)
downloadmeson-a3dda095bc6bd3725984daab3cfa02cb90d6bf21.zip
meson-a3dda095bc6bd3725984daab3cfa02cb90d6bf21.tar.gz
meson-a3dda095bc6bd3725984daab3cfa02cb90d6bf21.tar.bz2
gnome: Guard all cflags passed to g-ir-scanner
While g-ir-scanner's compatible -I and -D flags cover what most dependencies use, there's no guarantee that a dependency's cflags don't include more exotic flags that conflict with the tool's own options. For a real world example, mozjs-38 has '-include some-header-file.h', which translates to '--include nclude another-file-to-scan.h' for the scanner; unless for some reason there's an 'nclude' GIR available on the system, the target will thus fail. For this purpose, g-ir-scanner allows explicitly marking some flags as preprocessor/compiler flags by guarding them with --cflags-begin and --cflags-end. Make sure it is used this for all cflags, not only for global and project flags.
-rw-r--r--mesonbuild/modules/gnome.py13
1 files changed, 6 insertions, 7 deletions
diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py
index e873084..6ec7040 100644
--- a/mesonbuild/modules/gnome.py
+++ b/mesonbuild/modules/gnome.py
@@ -459,10 +459,6 @@ class GnomeModule(ExtensionModule):
sanitize = compiler.get_options().get('b_sanitize')
if sanitize:
cflags += compilers.sanitizer_compile_args(sanitize)
- if cflags:
- scan_command += ['--cflags-begin']
- scan_command += cflags
- scan_command += ['--cflags-end']
if kwargs.get('symbol_prefix'):
sym_prefix = kwargs.pop('symbol_prefix')
if not isinstance(sym_prefix, str):
@@ -525,9 +521,12 @@ class GnomeModule(ExtensionModule):
# ldflags will be misinterpreted by gir scanner (showing
# spurious dependencies) but building GStreamer fails if they
# are not used here.
- cflags, ldflags, gi_includes = self._get_dependencies_flags(deps, state, depends,
- use_gir_args=True)
- scan_command += list(cflags)
+ dep_cflags, ldflags, gi_includes = self._get_dependencies_flags(deps, state, depends,
+ use_gir_args=True)
+ cflags += list(dep_cflags)
+ scan_command += ['--cflags-begin']
+ scan_command += cflags
+ scan_command += ['--cflags-end']
# need to put our output directory first as we need to use the
# generated libraries instead of any possibly installed system/prefix
# ones.