22

I am trying to make a package of a piece of software that I've (co-) written. I'm using

debuild -i -us -uc -b 

And in principle that works fine. In order to shorten compilation time I'd like to debuild to run make in parallel (like I normally do by running make -j4, for example). I've found a few locations on the web that suggest the following:

debuild -eDEB_BUILD_OPTIONS="parallel=4" -us -uc -b
debuild -j4 -us -uc -b

Another site suggested to add some code to the debian/rules file that basically sets

MAKEFLAGS += -j4

However, none of these seems to work. Have I missed something? or should I change something in the autoconf/automake settings of the source?

4 Answers 4

20

It has to be enabled in debian/rules. If the package uses dh, there is a line like this in debian/rules:

dh $@

Change that to

dh $@ --parallel

Then your commands will work, at least DEB_BUILD_OPTIONS="parallel=4"

2
  • 5
    Just remember to export DEB_BUILD_OPTIONS to make all the tools happy.
    – rbrito
    Jul 25, 2017 at 3:14
  • 4
    The --parallel option is no longer needed, just set the environment variable.
    – gps
    May 19, 2019 at 21:39
11

I recommend using the DEB_BUILD_OPTIONS environment variable, as described in section 4.9.1 of the Debian Policy Manual.

DEB_BUILD_OPTIONS='parallel=4' debuild -i -us -uc -b
1
  • BTW, this env variable doesn't work for dpkg-buildpackage command. It has its own option -j=4 which works. But equal sign = is important. Oct 18, 2021 at 15:07
10

With debhelper 10, you no longer need to supply the --parallel option in debian/rules; it now runs parallel builds by default. See the release notes

The answer, is therefore, just to set the contents of debian/compat to 10 and to update the debhelper version to >=10 in debian/control.

0

To sum-up all the above, that worked for me:

export DEB_BUILD_OPTIONS='parallel=16'
fakeroot debian/rules binary

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .