Brad Bishop | 1a4b7ee | 2018-12-16 17:11:34 -0800 | [diff] [blame^] | 1 | Ensure that in a cross compile only the target flags are passed to gtk-doc, and |
| 2 | not the native flags. |
| 3 | |
| 4 | Upstream-Status: Submitted [https://github.com/mesonbuild/meson/pull/4261] |
| 5 | Signed-off-by: Ross Burton <ross.burton@intel.com> |
| 6 | |
| 7 | diff --git a/mesonbuild/modules/gnome.py b/mesonbuild/modules/gnome.py |
| 8 | index 4af33304..8751f53c 100644 |
| 9 | --- a/mesonbuild/modules/gnome.py |
| 10 | +++ b/mesonbuild/modules/gnome.py |
| 11 | @@ -851,17 +851,30 @@ This will become a hard error in the future.''') |
| 12 | if not isinstance(incd.held_object, (str, build.IncludeDirs)): |
| 13 | raise MesonException( |
| 14 | 'Gir include dirs should be include_directories().') |
| 15 | + |
| 16 | cflags.update(get_include_args(inc_dirs)) |
| 17 | - cflags.update(state.environment.coredata.get_external_args('c')) |
| 18 | + if state.environment.is_cross_build(): |
| 19 | + cflags.update(state.environment.cross_info.config["properties"].get('c_args', "")) |
| 20 | + else: |
| 21 | + cflags.update(state.environment.coredata.get_external_args('c')) |
| 22 | + |
| 23 | ldflags = OrderedSet() |
| 24 | ldflags.update(internal_ldflags) |
| 25 | - ldflags.update(state.environment.coredata.get_external_link_args('c')) |
| 26 | + if state.environment.is_cross_build(): |
| 27 | + ldflags.update(state.environment.cross_info.config["properties"].get('c_link_args', "")) |
| 28 | + else: |
| 29 | + ldflags.update(state.environment.coredata.get_external_link_args('c')) |
| 30 | ldflags.update(external_ldflags) |
| 31 | + |
| 32 | if cflags: |
| 33 | args += ['--cflags=%s' % ' '.join(cflags)] |
| 34 | if ldflags: |
| 35 | args += ['--ldflags=%s' % ' '.join(ldflags)] |
| 36 | - compiler = state.environment.coredata.compilers.get('c') |
| 37 | + |
| 38 | + if state.environment.is_cross_build(): |
| 39 | + compiler = state.environment.coredata.cross_compilers.get('c') |
| 40 | + else: |
| 41 | + compiler = state.environment.coredata.compilers.get('c') |
| 42 | if compiler: |
| 43 | args += ['--cc=%s' % ' '.join(compiler.get_exelist())] |
| 44 | args += ['--ld=%s' % ' '.join(compiler.get_linker_exelist())] |