diff options
author | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-07-08 20:57:09 +0530 |
---|---|---|
committer | Nirbheek Chauhan <nirbheek@centricular.com> | 2018-07-09 04:09:46 +0530 |
commit | 416a00308f5b0f228af3c93eb597eca8529fdbb0 (patch) | |
tree | 39e2576abdb4b6e79fa96d488e4413dc3af652dd /mesonbuild/environment.py | |
parent | 2093d45a4e1203d868d200628918472877c7ec31 (diff) | |
download | meson-416a00308f5b0f228af3c93eb597eca8529fdbb0.zip meson-416a00308f5b0f228af3c93eb597eca8529fdbb0.tar.gz meson-416a00308f5b0f228af3c93eb597eca8529fdbb0.tar.bz2 |
cross: Use ExternalProgram for cross-file exe_wrapper
We already have code to fetch and find binaries specified in a cross
file, so use the same code for exe_wrapper. This allows us to handle
the same corner-cases that were fixed for other cross binaries.
Diffstat (limited to 'mesonbuild/environment.py')
-rw-r--r-- | mesonbuild/environment.py | 19 |
1 files changed, 13 insertions, 6 deletions
diff --git a/mesonbuild/environment.py b/mesonbuild/environment.py index 0aa0b32..d281712 100644 --- a/mesonbuild/environment.py +++ b/mesonbuild/environment.py @@ -309,10 +309,13 @@ class Environment: # Used by the regenchecker script, which runs meson self.coredata.meson_command = mesonlib.meson_command self.first_invocation = True + self.cross_info = None + self.exe_wrapper = None if self.coredata.cross_file: self.cross_info = CrossBuildInfo(self.coredata.cross_file) - else: - self.cross_info = None + if 'exe_wrapper' in self.cross_info.config['binaries']: + from .dependencies import ExternalProgram + self.exe_wrapper = ExternalProgram.from_cross_info(self.cross_info, 'exe_wrapper') self.cmd_line_options = options.cmd_line_options.copy() # List of potential compilers. @@ -476,10 +479,7 @@ This is probably wrong, it should always point to the native compiler.''' % evar # Return value has to be a list of compiler 'choices' compilers = [compilers] is_cross = True - if self.cross_info.need_exe_wrapper(): - exe_wrap = self.cross_info.config['binaries'].get('exe_wrapper', None) - else: - exe_wrap = [] + exe_wrap = self.get_exe_wrapper() elif evar in os.environ: compilers = shlex.split(os.environ[evar]) # Ensure ccache exists and remove it if it doesn't @@ -969,6 +969,13 @@ This is probably wrong, it should always point to the native compiler.''' % evar out = out.split('\n')[index].lstrip('libraries: =').split(':') return [os.path.normpath(p) for p in out] + def get_exe_wrapper(self): + if not self.cross_info.need_exe_wrapper(): + from .dependencies import EmptyExternalProgram + return EmptyExternalProgram() + return self.exe_wrapper + + class CrossBuildInfo: def __init__(self, filename): self.config = {'properties': {}} |