diff options
author | Modestas Vainius <modestas@vainius.eu> | 2009-10-28 15:49:34 -0400 |
---|---|---|
committer | Joey Hess <joey@gnu.kitenet.net> | 2009-10-28 15:49:34 -0400 |
commit | dace0773fe5f66fdf040f54383322e21a65fa1e8 (patch) | |
tree | d03e084c1980708e31773b1b422cfec4e5546c7d /Debian/Debhelper/Buildsystem.pm | |
parent | 834d95aaba24e5cee1c5a74078a09443f5e122a7 (diff) |
Support parallel building in makefile buildsystem
1) Add routine to Dh_Lib (used by dh and makefile.pm) which is capable of
detecting make jobserver and job control options from the MAKEFLAGS environment
variable. It also generates and returns a clean up MAKEFLAGS from these
options.
2) Add --parallel option to build system framework which allows source packages
to specify that they support parallel building. Optional value for this option is
the number of maximum parallel process to allow. However, the actual number of
parallel process (if any) for the specific build is determined from
DEB_BUILD_OPTIONS env variable as specified by Debian Policy.
By default (no --parallel option) parallel is neither enabled nor disabled
(depends on the external environment). However, dh may pass --parallel to
dh_auto_* implicitly in case 4) described below.
3) Add parallel support for makefile buildsystem. This implementation
forcefully starts a new make job server (or disables parallel) for the number
of process requested. If --parallel was not passed to the build system at all,
the build system will only clean up MAKEFLAGS from stale jobserver options to
avoid pointless make warnings.
4) If dh detects that it is being run by dpkg-buildpackage -jX and it is NOT
run with "+" prefix from debian/rules (i.e. jobserver is not reachable), it
enables --parallel implicitly. This closes: #532805.
Signed-off-by: Modestas Vainius <modestas@vainius.eu>
Diffstat (limited to 'Debian/Debhelper/Buildsystem.pm')
-rw-r--r-- | Debian/Debhelper/Buildsystem.pm | 16 |
1 files changed, 15 insertions, 1 deletions
diff --git a/Debian/Debhelper/Buildsystem.pm b/Debian/Debhelper/Buildsystem.pm index 62c45b5d..677e3bf9 100644 --- a/Debian/Debhelper/Buildsystem.pm +++ b/Debian/Debhelper/Buildsystem.pm @@ -47,7 +47,12 @@ sub DEFAULT_BUILD_DIRECTORY { # specified or empty, defaults to the current 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. +# 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). # 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 @@ -58,6 +63,7 @@ sub new { my $this = bless({ sourcedir => '.', builddir => undef, + parallel => undef, cwd => Cwd::getcwd() }, $class); if (exists $opts{sourcedir}) { @@ -71,6 +77,9 @@ sub new { if (exists $opts{builddir}) { $this->_set_builddir($opts{builddir}); } + if (defined $opts{parallel} && $opts{parallel} >= 1) { + $this->{parallel} = $opts{parallel}; + } return $this; } @@ -243,6 +252,11 @@ sub get_source_rel2builddir { return $dir; } +sub get_parallel { + my $this=shift; + return $this->{parallel}; +} + # When given a relative path to the build directory, converts it # to the path that is relative to the source directory. If $path is # not given, returns a path to the build directory that is relative |