diff options
author | Xavier Claessens <xavier.claessens@collabora.com> | 2022-03-18 21:27:54 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2022-10-25 17:24:56 -0400 |
commit | e68fcac919b332c7f9469672a243d2aab1bfea0a (patch) | |
tree | 40da43e7c28f22a156246abb303e2d949636bc9b /mesonbuild/compilers | |
parent | 2961adb8c89fa8ccfbc8e24cd9f1115bd3abeee1 (diff) | |
download | meson-e68fcac919b332c7f9469672a243d2aab1bfea0a.zip meson-e68fcac919b332c7f9469672a243d2aab1bfea0a.tar.gz meson-e68fcac919b332c7f9469672a243d2aab1bfea0a.tar.bz2 |
compilers: Make sure to not use ccache in compiler checks
ccache was used in all command lines but disabled using CCACHE_DISABLE
in Compiler.compile() method. Wrapping invokations still has a cost,
especially on Windows.
With sccache things are even worse because CCACHE_DISABLE was not
respected at all, making configure *extremely* slow on Windows when
sccache is installed.
Diffstat (limited to 'mesonbuild/compilers')
-rw-r--r-- | mesonbuild/compilers/compilers.py | 7 | ||||
-rw-r--r-- | mesonbuild/compilers/mixins/clike.py | 5 | ||||
-rw-r--r-- | mesonbuild/compilers/mixins/elbrus.py | 6 | ||||
-rw-r--r-- | mesonbuild/compilers/mixins/gnu.py | 2 | ||||
-rw-r--r-- | mesonbuild/compilers/rust.py | 2 |
5 files changed, 10 insertions, 12 deletions
diff --git a/mesonbuild/compilers/compilers.py b/mesonbuild/compilers/compilers.py index bcd5820..771d543 100644 --- a/mesonbuild/compilers/compilers.py +++ b/mesonbuild/compilers/compilers.py @@ -503,6 +503,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): linker: T.Optional['DynamicLinker'] = None, full_version: T.Optional[str] = None, is_cross: bool = False): self.exelist = ccache + exelist + self.exelist_no_ccache = exelist # In case it's been overridden by a child class already if not hasattr(self, 'file_suffixes'): self.file_suffixes = lang_suffixes[self.language] @@ -593,8 +594,8 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): def symbols_have_underscore_prefix(self, env: 'Environment') -> bool: raise EnvironmentException('%s does not support symbols_have_underscore_prefix ' % self.get_id()) - def get_exelist(self) -> T.List[str]: - return self.exelist.copy() + def get_exelist(self, ccache: bool = True) -> T.List[str]: + return self.exelist.copy() if ccache else self.exelist_no_ccache.copy() def get_linker_exelist(self) -> T.List[str]: return self.linker.get_exelist() @@ -815,7 +816,7 @@ class Compiler(HoldableObject, metaclass=abc.ABCMeta): if extra_args: commands += extra_args # Generate full command-line with the exelist - command_list = self.get_exelist() + commands.to_native() + command_list = self.get_exelist(ccache=not no_ccache) + commands.to_native() mlog.debug('Running compile:') mlog.debug('Working directory: ', tmpdirname) mlog.debug('Command line: ', ' '.join(command_list), '\n') diff --git a/mesonbuild/compilers/mixins/clike.py b/mesonbuild/compilers/mixins/clike.py index e1baa84..b4824d5 100644 --- a/mesonbuild/compilers/mixins/clike.py +++ b/mesonbuild/compilers/mixins/clike.py @@ -179,9 +179,6 @@ class CLikeCompiler(Compiler): def get_depfile_suffix(self) -> str: return 'd' - def get_exelist(self) -> T.List[str]: - return self.exelist.copy() - def get_preprocess_only_args(self) -> T.List[str]: return ['-E', '-P'] @@ -1194,7 +1191,7 @@ class CLikeCompiler(Compiler): if self.id != 'clang': raise mesonlib.MesonException('Cannot find framework path with non-clang compiler') # Construct the compiler command-line - commands = self.get_exelist() + ['-v', '-E', '-'] + commands = self.get_exelist(ccache=False) + ['-v', '-E', '-'] commands += self.get_always_args() # Add CFLAGS/CXXFLAGS/OBJCFLAGS/OBJCXXFLAGS from the env commands += env.coredata.get_external_args(self.for_machine, self.language) diff --git a/mesonbuild/compilers/mixins/elbrus.py b/mesonbuild/compilers/mixins/elbrus.py index aac9811..4cab777 100644 --- a/mesonbuild/compilers/mixins/elbrus.py +++ b/mesonbuild/compilers/mixins/elbrus.py @@ -48,7 +48,7 @@ class ElbrusCompiler(GnuLikeCompiler): def get_library_dirs(self, env: 'Environment', elf_class: T.Optional[int] = None) -> T.List[str]: os_env = os.environ.copy() os_env['LC_ALL'] = 'C' - stdo = Popen_safe(self.exelist + ['--print-search-dirs'], env=os_env)[1] + stdo = Popen_safe(self.get_exelist(ccache=False) + ['--print-search-dirs'], env=os_env)[1] for line in stdo.split('\n'): if line.startswith('libraries:'): # lcc does not include '=' in --print-search-dirs output. Also it could show nonexistent dirs. @@ -59,7 +59,7 @@ class ElbrusCompiler(GnuLikeCompiler): def get_program_dirs(self, env: 'Environment') -> T.List[str]: os_env = os.environ.copy() os_env['LC_ALL'] = 'C' - stdo = Popen_safe(self.exelist + ['--print-search-dirs'], env=os_env)[1] + stdo = Popen_safe(self.get_exelist(ccache=False) + ['--print-search-dirs'], env=os_env)[1] for line in stdo.split('\n'): if line.startswith('programs:'): # lcc does not include '=' in --print-search-dirs output. @@ -70,7 +70,7 @@ class ElbrusCompiler(GnuLikeCompiler): def get_default_include_dirs(self) -> T.List[str]: os_env = os.environ.copy() os_env['LC_ALL'] = 'C' - p = subprocess.Popen(self.exelist + ['-xc', '-E', '-v', '-'], env=os_env, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE) + p = subprocess.Popen(self.get_exelist(ccache=False) + ['-xc', '-E', '-v', '-'], env=os_env, stdin=subprocess.DEVNULL, stdout=subprocess.PIPE, stderr=subprocess.PIPE) stderr = p.stderr.read().decode('utf-8', errors='replace') includes = [] for line in stderr.split('\n'): diff --git a/mesonbuild/compilers/mixins/gnu.py b/mesonbuild/compilers/mixins/gnu.py index eb1c534..552c559 100644 --- a/mesonbuild/compilers/mixins/gnu.py +++ b/mesonbuild/compilers/mixins/gnu.py @@ -184,7 +184,7 @@ class GnuLikeCompiler(Compiler, metaclass=abc.ABCMeta): return gnulike_instruction_set_args.get(instruction_set, None) def get_default_include_dirs(self) -> T.List[str]: - return gnulike_default_include_dirs(tuple(self.exelist), self.language).copy() + return gnulike_default_include_dirs(tuple(self.get_exelist(ccache=False)), self.language).copy() @abc.abstractmethod def openmp_flags(self) -> T.List[str]: diff --git a/mesonbuild/compilers/rust.py b/mesonbuild/compilers/rust.py index 3cd73f7..9e5ebc8 100644 --- a/mesonbuild/compilers/rust.py +++ b/mesonbuild/compilers/rust.py @@ -110,7 +110,7 @@ class RustCompiler(Compiler): return rust_buildtype_args[buildtype] def get_sysroot(self) -> str: - cmd = self.exelist + ['--print', 'sysroot'] + cmd = self.get_exelist(ccache=False) + ['--print', 'sysroot'] p, stdo, stde = Popen_safe(cmd) return stdo.split('\n', maxsplit=1)[0] |