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?

muru
  • 193,181
  • 53
  • 473
  • 722
ph0t0nix
  • 1,367
  • 1
  • 13
  • 28

4 Answers4

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"

gggf
  • 216
  • 2
  • 3
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
Spooky
  • 109
  • 5
Manuel
  • 211
  • 2
  • 2
  • 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. – Vasily Ryabov Oct 18 '21 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.

rbrito
  • 339
  • 3
  • 11
Alex Valavanis
  • 323
  • 2
  • 9
0

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

export DEB_BUILD_OPTIONS='parallel=16'
fakeroot debian/rules binary
midenok
  • 752
  • 1
  • 7
  • 13