parallel building without make
Recently dpkg-buildpackage got the option to build in parallel via the -j
option. This means that debian/rules is called with that option set, and sets
parallel=n in DEB_BUILD_OPTIONS.
The problem is that for build systems not using make (eg, scons), this option is
not inherited. Of course, one could parse DEB_BUILD_OPTIONS and find if
parallel=n is set and then call the build system with the equivalent option.
However this means that, although one specified n threads of execution, there
can be more than n threads concurrently. Consider this case:
build: build-indep build-arch
build-arch:
scons -j$(NTHREADS) buildProgram
build-indep:
scons -j$(NTHREADS) buildDocumentation
Where NTHREADS is calculated from DEB_BUILD_OPTIONS. If I call dpkg-buildpackage
with -j2, I will get build-arch and build-indep running concurrently, which
means I will actually get 4 scons threads running instead of the intended 2.
What should I do? I see 3 options:
1- Don't use the -j flag in scons
2- Use the -j flag and potentially use more threads than specified
3- Use the -j flag with a lower number (eg, NTHREADS/2).
Any opinions?
--
Felipe Sateler
Reply to: