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.
pull/10510/head
Staz M 2 years ago committed by Eli Schwartz
parent 7da495f616
commit 7409f12a82
  1. 7
      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:

Loading…
Cancel
Save