From 7409f12a828e9e1e7c2b362b6c9baf880c9143a8 Mon Sep 17 00:00:00 2001 From: Staz M Date: Tue, 14 Jun 2022 15:56:44 -0400 Subject: [PATCH] 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. --- mesonbuild/scripts/externalproject.py | 7 +++---- 1 file changed, 3 insertions(+), 4 deletions(-) diff --git a/mesonbuild/scripts/externalproject.py b/mesonbuild/scripts/externalproject.py index 6849282e4..f15f26a4e 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: