diff options
-rwxr-xr-x | dist-tools/makerelease.pl | 13 |
1 files changed, 11 insertions, 2 deletions
diff --git a/dist-tools/makerelease.pl b/dist-tools/makerelease.pl index b0183888..6523d595 100755 --- a/dist-tools/makerelease.pl +++ b/dist-tools/makerelease.pl @@ -17,6 +17,7 @@ my $lzsufx = '.tar.lz'; use POSIX qw(strftime); use Getopt::Long; use strict vars; +use warnings; # check environment (-r "NEWS" and -r "fetchmail.c" and -r "configure.ac") or die "Please cd to the top-level source directory!"; @@ -116,8 +117,16 @@ if (system("mkdir -p autobuild && cd autobuild " . " && ../configure -C --silent --with-ssl")) { die("Configuration failure\n"); } print "### Test-building the software...\n"; -if (system("cd autobuild && make -s clean" - . " && make " . ($verbose ? '' : '-s') . " check distcheck")) { +my $ncpu; +open(my $p, "-|", "nproc 2>/dev/null || gnproc 2>/dev/null || sysctl -n hw.ncpu 2>/dev/null || getconf _NPROCESSORS_CONF 2>/dev/null || echo 2") or die "cannot find number of CPUs"; +if (not defined ($ncpu = <$p>)) { die "cannot read number of CPUs"; } +close $p or die "could not find number of CPUs"; + +print "### CPUs for make: $ncpu\n"; + +if ($ncpu < 1) { warn "ncpus unplausible, assuming 2"; $ncpu = 2; } + +if (system("cd autobuild && make -j$ncpu " . ($verbose ? '' : '-s') . " check distcheck")) { die("Compilation failure\n"); } |