diff options
author | Dylan Baker <dylan@pnwbakers.com> | 2020-06-08 12:05:05 -0700 |
---|---|---|
committer | Dylan Baker <dylan@pnwbakers.com> | 2020-06-12 11:16:24 -0700 |
commit | 18d8dbd3bda56a989bb9f6d767c7491fbbd10d45 (patch) | |
tree | a161f6894cc2c13eda171038f6b373ac55b69098 /mesonbuild/dependencies/base.py | |
parent | 01e0cc6735f4633cc3f179a0b0f877ab863a33f0 (diff) | |
download | meson-18d8dbd3bda56a989bb9f6d767c7491fbbd10d45.zip meson-18d8dbd3bda56a989bb9f6d767c7491fbbd10d45.tar.gz meson-18d8dbd3bda56a989bb9f6d767c7491fbbd10d45.tar.bz2 |
dependencies: Don't try to find a binary by "default_path" when cross compiling
Diffstat (limited to 'mesonbuild/dependencies/base.py')
-rw-r--r-- | mesonbuild/dependencies/base.py | 11 |
1 files changed, 7 insertions, 4 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py index a7b23f6..7bff082 100644 --- a/mesonbuild/dependencies/base.py +++ b/mesonbuild/dependencies/base.py @@ -78,7 +78,8 @@ class DependencyMethods(Enum): def find_external_program(env: Environment, for_machine: MachineChoice, name: str, - display_name: str, default_names: T.List[str]) -> T.Generator['ExternalProgram', None, None]: + display_name: str, default_names: T.List[str], + allow_default_for_cross: bool = True) -> T.Generator['ExternalProgram', None, None]: """Find an external program, chcking the cross file plus any default options.""" # Lookup in cross or machine file. potential_path = env.lookup_binary_entry(for_machine, name) @@ -90,12 +91,14 @@ def find_external_program(env: Environment, for_machine: MachineChoice, name: st # stop returning options. return mlog.debug('{} binary missing from cross or native file, or env var undefined.'.format(display_name)) - # Fallback on hard-coded defaults. - # TODO prefix this for the cross case instead of ignoring thing. - if env.machines.matches_build_machine(for_machine): + # Fallback on hard-coded defaults, if a default binary is allowed for use + # with cross targets, or if this is not a cross target + if allow_default_for_cross or not (for_machine is MachineChoice.HOST and env.is_cross_build(for_machine)): for potential_path in default_names: mlog.debug('Trying a default {} fallback at'.format(display_name), potential_path) yield ExternalProgram(potential_path, silent=True) + else: + mlog.debug('Default target is not allowed for cross use') class Dependency: |