diff options
Diffstat (limited to 'Debian/Debhelper')
-rw-r--r-- | Debian/Debhelper/Buildsystem.pm | 9 | ||||
-rw-r--r-- | Debian/Debhelper/Buildsystem/makefile.pm | 18 | ||||
-rw-r--r-- | Debian/Debhelper/Dh_Buildsystems.pm | 28 |
3 files changed, 20 insertions, 35 deletions
diff --git a/Debian/Debhelper/Buildsystem.pm b/Debian/Debhelper/Buildsystem.pm index 677e3bf9..7354963d 100644 --- a/Debian/Debhelper/Buildsystem.pm +++ b/Debian/Debhelper/Buildsystem.pm @@ -48,11 +48,8 @@ sub DEFAULT_BUILD_DIRECTORY { # - builddir - specifies build directory to use. Path is relative to the # current (top) directory. If undef or empty, # DEFAULT_BUILD_DIRECTORY directory will be used. -# - parallel - number of parallel process to be spawned for building -# sources. Parallel building needs to be supported by the -# underlying build system for this option to be effective. -# Defaults to undef (i.e. parallel disabled, but do not try to -# enforce this limit by messing with environment). +# - parallel - max number of parallel processes to be spawned for building +# sources (-1 = unlimited; 1 = no parallel) # Derived class can override the constructor to initialize common object # parameters. Do NOT use constructor to execute commands or otherwise # configure/setup build environment. There is absolutely no guarantee the @@ -77,7 +74,7 @@ sub new { if (exists $opts{builddir}) { $this->_set_builddir($opts{builddir}); } - if (defined $opts{parallel} && $opts{parallel} >= 1) { + if (defined $opts{parallel}) { $this->{parallel} = $opts{parallel}; } return $this; diff --git a/Debian/Debhelper/Buildsystem/makefile.pm b/Debian/Debhelper/Buildsystem/makefile.pm index ff904afd..704f9c95 100644 --- a/Debian/Debhelper/Buildsystem/makefile.pm +++ b/Debian/Debhelper/Buildsystem/makefile.pm @@ -7,8 +7,7 @@ package Debian::Debhelper::Buildsystem::makefile; use strict; -use Debian::Debhelper::Dh_Lib qw(escape_shell is_make_jobserver_unavailable - clean_jobserver_makeflags); +use Debian::Debhelper::Dh_Lib qw(escape_shell clean_jobserver_makeflags); use base 'Debian::Debhelper::Buildsystem'; sub get_makecmd_C { @@ -34,17 +33,12 @@ sub exists_make_target { sub do_make { my $this=shift; - # Avoid warnings about unavailable jobserver. - if (is_make_jobserver_unavailable()) { - clean_jobserver_makeflags(); - } + # Avoid possible warnings about unavailable jobserver, + # and force make to start a new jobserver. + clean_jobserver_makeflags(); - if (defined $this->get_parallel()) { - # Note that this will override any -j settings in MAKEFLAGS. - unshift @_, "-j" . ($this->get_parallel() > 1 ? $this->get_parallel() : 1); - # Force make to start a new jobserver. - clean_jobserver_makeflags(); - } + # Note that this will override any -j settings in MAKEFLAGS. + unshift @_, "-j" . ($this->get_parallel() > 0 ? $this->get_parallel() : ""); $this->doit_in_builddir($this->{makecmd}, @_); } diff --git a/Debian/Debhelper/Dh_Buildsystems.pm b/Debian/Debhelper/Dh_Buildsystems.pm index f43c87d4..fc06a2ac 100644 --- a/Debian/Debhelper/Dh_Buildsystems.pm +++ b/Debian/Debhelper/Dh_Buildsystems.pm @@ -113,7 +113,7 @@ sub load_all_buildsystems { sub buildsystems_init { my %args=@_; - my $max_parallel=0; + my $max_parallel=-1; # unlimited # Available command line options my %options = ( @@ -139,27 +139,21 @@ sub buildsystems_init { sub set_parallel { my $max=shift; + $opt_parallel=1; + if (exists $ENV{DEB_BUILD_OPTIONS}) { # Parse parallel=n tag - my $n; foreach my $opt (split(/\s+/, $ENV{DEB_BUILD_OPTIONS})) { - $n = $1 if $opt =~ /^parallel=(\d+)$/; - } - if (defined $n && $n > 0) { - if (!$max || $n < $max) { - $opt_parallel = $n; - } - else { - $opt_parallel = $max; + if ($opt =~ /^parallel=([-\d]+)$/) { + my $n=$1; + if ($n > 0 && ($max == -1 || $n < $max)) { + $opt_parallel = $n; + } + else { + $opt_parallel = $max; + } } } - else { - # Invalid value in the parallel tag. Disable. - $opt_parallel = 1; - } - } - else { - $opt_parallel = 1; } } |