This is a live mirror of the Perl 5 development currently hosted at https://github.com/perl/perl5
buildperl.pl: Add ability to build in parallel
authorKarl Williamson <khw@cpan.org>
Mon, 8 Jul 2019 20:30:11 +0000 (14:30 -0600)
committerNicolas R <atoomic@cpan.org>
Fri, 27 Sep 2019 22:39:30 +0000 (16:39 -0600)
This allows you to manually call this with a -j parameter to give the
number of parallel jobs to run, default 1.

(cherry picked from commit baffbaef885a245b50c5c20dc60b4dc180615433)
Signed-off-by: Nicolas R <atoomic@cpan.org>
dist/Devel-PPPort/devel/buildperl.pl

index 72c1929..9844ef4 100644 (file)
@@ -40,6 +40,7 @@ my %opt = (
   install   => 1,
   oneshot   => 0,
   configure => 0,
+  jobs => 1,
   'test-archives' => 0,
 );
 
@@ -161,10 +162,14 @@ GetOptions(\%opt, qw(
   test-archives=i
   patch!
   oneshot
+  jobs=i
 )) or pod2usage(2);
 
 my %current;
 
+my $job_string = "";
+$job_string = "-j$opt{jobs}" if $opt{jobs} != 1;
+
 if ($opt{patch} || $opt{oneshot}) {
   @{$opt{perl}} == 1 or die "Exactly one --perl must be given with --patch or --oneshot\n";
   my $perl = $opt{perl}[0];
@@ -359,10 +364,10 @@ sub build_and_install
   if (-f "x2p/makefile") {
     run_or_die("sed -i -e '/^.*<builtin>/d' -e '/^.*<built-in>/d' -e '/^.*<command line>/d' -e '/^.*<command-line>/d' makefile x2p/makefile");
   }
-  run_or_die("make all");
-  run("make test") if $opt{test};
+  run_or_die("make $job_string all");
+  run("TEST_JOBS=$opt{jobs} make $job_string test") if $opt{test};
   if ($opt{install}) {
-    run_or_die("make install");
+    run_or_die("make $job_string install");
   }
   else {
     print "\n*** NOT INSTALLING PERL ***\n\n";
@@ -559,6 +564,8 @@ buildperl.pl - build/install perl distributions
                               directory (extra arguments are passed to
                               Configure)
 
+  -j N                        Build and test with N parallel jobs, default 1.
+
   options tagged with [MULTI] can be given multiple times
 
   options tagged with [EXPAND] expand the following items