Introduce %_smp_build_ncpus macro

This macro offers %{_smp_mflags}, but without the -j prefix, to signify
the configured number of processor cores to use.
We can use this to pass that number to utilities that do not understand
the -j number syntax, for example:
`cmake --build %_cmake__builddir --verbose --parallel %_smp_build_ncpus'

The name was picked to be compatible with RH:
https://github.com/rpm-software-management/rpm/blob/rpm-4.16.1.3/platform.in#L51
We preserve ALT semantics though.
This commit is contained in:
Arseny Maslennikov 2021-06-04 17:50:01 +03:00
parent 46c42b83ee
commit 87424e1d65

View File

@ -242,7 +242,8 @@ PATH=/usr/libexec/rpm-build:$PATH\
%_make_bin make
%__nprocs %getncpus
%_smp_mflags -j${NPROCS:-%__nprocs}
%_smp_build_ncpus ${NPROCS:-%__nprocs}
%_smp_mflags -j%_smp_build_ncpus
%make_build %_make_bin %_smp_mflags
%make_install %_make_bin INSTALL="/usr/libexec/rpm-build/install -p"