aboutsummaryrefslogtreecommitdiff
path: root/mesonbuild/dependencies/base.py
diff options
context:
space:
mode:
authorDylan Baker <dylan@pnwbakers.com>2018-01-16 09:15:16 -0800
committerJussi Pakkanen <jpakkane@gmail.com>2018-01-30 06:45:58 +1100
commitbcc3cbb93e5d03e659a3f2a8b23f0f3ac49db010 (patch)
tree4645f3510d58bd1eef039199b982e62f215a99ae /mesonbuild/dependencies/base.py
parent5f3c282e6e48c6223882c15bba64cad27f5ab5e5 (diff)
downloadmeson-bcc3cbb93e5d03e659a3f2a8b23f0f3ac49db010.zip
meson-bcc3cbb93e5d03e659a3f2a8b23f0f3ac49db010.tar.gz
meson-bcc3cbb93e5d03e659a3f2a8b23f0f3ac49db010.tar.bz2
dependencies: Allow setting config-tool binaries in cross file
This allows for much easier cross compiler configuration for tools like LLVM. This patch does honor the 'native' keyword, and falls back to searching PATH if the binary name is not specified. I'd be fine with either removing the fallback behavior, or marking it as deprecated and removing it later. Fixes #2921
Diffstat (limited to 'mesonbuild/dependencies/base.py')
-rw-r--r--mesonbuild/dependencies/base.py15
1 files changed, 14 insertions, 1 deletions
diff --git a/mesonbuild/dependencies/base.py b/mesonbuild/dependencies/base.py
index 560e389..f89e631 100644
--- a/mesonbuild/dependencies/base.py
+++ b/mesonbuild/dependencies/base.py
@@ -212,6 +212,7 @@ class ConfigToolDependency(ExternalDependency):
def __init__(self, name, environment, language, kwargs):
super().__init__('config-tool', environment, language, kwargs)
self.name = name
+ self.native = kwargs.get('native', False)
self.tools = listify(kwargs.get('tools', self.tools))
req_version = kwargs.get('version', None)
@@ -260,8 +261,20 @@ class ConfigToolDependency(ExternalDependency):
if not isinstance(versions, list) and versions is not None:
versions = listify(versions)
+ if self.env.is_cross_build() and not self.native:
+ cross_file = self.env.cross_info.config['binaries']
+ try:
+ tools = [cross_file[self.tool_name]]
+ except KeyError:
+ mlog.warning('No entry for {0} specified in your cross file. '
+ 'Falling back to searching PATH. This may find a '
+ 'native version of {0}!'.format(self.tool_name))
+ tools = self.tools
+ else:
+ tools = self.tools
+
best_match = (None, None)
- for tool in self.tools:
+ for tool in tools:
try:
p, out = Popen_safe([tool, '--version'])[:2]
except (FileNotFoundError, PermissionError):