diff options
author | Staz M <staz@staz.io> | 2022-06-14 15:56:44 -0400 |
---|---|---|
committer | Eli Schwartz <eschwartz93@gmail.com> | 2022-06-17 18:56:38 -0400 |
commit | 7409f12a828e9e1e7c2b362b6c9baf880c9143a8 (patch) | |
tree | e78b179d770ca5ba9a0bad8bc2351c51ab6bc1ec | |
parent | 7da495f616c6aa9363623a5447f897299ad872a4 (diff) | |
download | meson-7409f12a828e9e1e7c2b362b6c9baf880c9143a8.zip meson-7409f12a828e9e1e7c2b362b6c9baf880c9143a8.tar.gz meson-7409f12a828e9e1e7c2b362b6c9baf880c9143a8.tar.bz2 |
always run external projects multi-threaded if possible
The check for if the project supports the -j flag was needlessly
complex. We support two types of project:
- waf, always supports -j
- make, if GNU, supports -j
We never checked waf, and the make check assumed that the entire
command, rather than just the last component, was "make". It also
neglects "gmake".
Since any possible build command *may* support -j, always run the
--version check. Detect either build command in the output.
-rw-r--r-- | mesonbuild/scripts/externalproject.py | 7 |
1 files changed, 3 insertions, 4 deletions
diff --git a/mesonbuild/scripts/externalproject.py b/mesonbuild/scripts/externalproject.py index 6849282..f15f26a 100644 --- a/mesonbuild/scripts/externalproject.py +++ b/mesonbuild/scripts/externalproject.py @@ -48,16 +48,15 @@ class ExternalProject: with open(self.stampfile, 'w', encoding='utf-8'): pass - def gnu_make(self) -> bool: + def supports_jobs_flag(self) -> bool: p, o, e = Popen_safe(self.make + ['--version']) - if p.returncode == 0 and 'GNU Make' in o: + if p.returncode == 0 and ('GNU Make' in o or 'waf' in o): return True return False def build(self) -> int: - is_make = self.make[0] == 'make' make_cmd = self.make.copy() - if is_make and self.gnu_make(): + if self.supports_jobs_flag(): make_cmd.append(f'-j{multiprocessing.cpu_count()}') rc = self._run('build', make_cmd) if rc != 0: |