Allow pamac to set up core numbers for compilation

Hi,
Recently I notice that pamac uses only one core of my CPU when compiling AUR packages.
I looked up in the forum and found that we need to modify the MAKEFLAGS settings in /etc/makepkg.conf or ~/.makepkg.conf

So just wondering if this feature can be added in pamac so that users don’t need to mess around with the config files?
Cheers

2 Likes

Use yay instead.

Isn’t yay also just relies on makepkg thus doesn’t make any difference here? Of course you could pass makeflags there but it’s almost the same as modifying makepkg.conf. Why one should prefer it over pamac?

3 Likes

Changing it in makepkg.conf is the preferred way, because different programs will respect this setting

makepkg is the place.
(yes yay is mostly a wrapper for pacman/makepkg, when possible)
(whereas pamac should be using ALPM itself … so it mimics pacman, does not ‘use’ pacman … all in turn using makepkg)

So you want to edit its conf file:
/etc/makepkg.conf

And set some options.

The first one is number of cores for compile. Its a simple -jX where X is the number of cores.

MAKEFLAGS="-j9"

We can also use nproc to get it automatically

MAKEFLAGS="-j$(nproc)"

Or combine that with math to accomplish something else, like all but 1 core:

MAKEFLAGS="j$(($(nproc)-1))"

You might also be interested in the compression flags.
Here threads set to 0 should use all of them:

COMPRESSXZ=(xz -c -z --threads=0 -)
COMPRESSZST=(zstd -c -z -q --threads=0 -)

(this is not required for gzip and bzip2)

5 Likes

This topic was automatically closed 36 hours after the last reply. New replies are no longer allowed.