Detect 'ccache' in evars and cross-info files

Then, only use it if it's actually available.

Closes https://github.com/mesonbuild/meson/issues/1471
This commit is contained in:
Nirbheek Chauhan 2017-03-24 19:04:43 +05:30 committed by Jussi Pakkanen
parent 650ad9dc88
commit cfc3605b73
1 changed files with 18 additions and 4 deletions

View File

@ -377,16 +377,30 @@ class Environment:
C, C++, ObjC, ObjC++, Fortran so consolidate it here.
'''
if self.is_cross_build() and want_cross:
compilers = [mesonlib.stringlistify(self.cross_info.config['binaries'][lang])]
ccache = []
compilers = mesonlib.stringlistify(self.cross_info.config['binaries'][lang])
# Ensure ccache exists and remove it if it doesn't
if compilers[0] == 'ccache':
compilers = compilers[1:]
ccache = self.detect_ccache()
else:
ccache = []
# 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 = []
elif evar in os.environ:
compilers = [shlex.split(os.environ[evar])]
ccache = []
compilers = shlex.split(os.environ[evar])
# Ensure ccache exists and remove it if it doesn't
if compilers[0] == 'ccache':
compilers = compilers[1:]
ccache = self.detect_ccache()
else:
ccache = []
# Return value has to be a list of compiler 'choices'
compilers = [compilers]
is_cross = False
exe_wrap = None
else: