How to tell rpmbuild the number of simultaneous jobs? (make -j)

On Fedora 15, setting the environment variable RPM_BUILD_NCPUS allows you to configure the number up to 16 simultaneous jobs. For example to set the number of simultaneous jobs to 12, so rpmbuild will call make -j12:

$ export RPM_BUILD_NCPUS=12

But if you need more than 16 simultaneous jobs, you will need to edit ~/.rpmmacros file. To allow numbers greater than 16, I've modified this file to:


[peter@notepeter ~]$ cat .rpmmacros

%_topdir %(echo $HOME)/rpmbuild

%_smp_mflags %( \
[ -z "$RPM_BUILD_NCPUS" ] \\\
&& RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
if [ "$RPM_BUILD_NCPUS" -gt 16 ]; then \\\
echo "-j$RPM_BUILD_NCPUS"; \\\
elif [ "$RPM_BUILD_NCPUS" -gt 3 ]; then \\\
echo "-j$RPM_BUILD_NCPUS"; \\\
else \\\
echo "-j3"; \\\
fi )

%__arch_install_post \
[ "%{buildarch}" = "noarch" ] || QA_CHECK_RPATHS=1 ; \
case "${QA_CHECK_RPATHS:-}" in [1yY]*) /usr/lib/rpm/check-rpaths ;; esac \
/usr/lib/rpm/check-buildroot

There were the number 16 where is the $RPM_BUILD_NCPUS.

Reference:
Fedora Source RPM

Popular posts from this blog

Adding a serial console to the Buffalo Air Station WZR-1750DHP

Buffalo WZR-1750DHP + OpenWRT