- make cpu limit for building configurable through _smp_ncpus_max macro - forward "port" from rhel-6 (#669638)

This commit is contained in:
Panu Matilainen 2013-06-27 10:08:01 +03:00 committed by Ville Skyttä
parent 31a511cc04
commit 5f7da21873

7
macros
View File

@ -71,10 +71,13 @@
infodir=%{?buildroot:%{buildroot}}%{_infodir} \\\ infodir=%{?buildroot:%{buildroot}}%{_infodir} \\\
install install
# Maximum number of CPU's to use when building, 0 for unlimited.
%_smp_ncpus_max 16
%_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\ %_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\
&& RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\ && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\
if [ "$RPM_BUILD_NCPUS" -gt 16 ]; then echo "-j16"; \\\ ncpus_max=%{?_smp_ncpus_max}; \\\
elif [ "$RPM_BUILD_NCPUS" -gt 1 ]; then echo "-j$RPM_BUILD_NCPUS"; fi) if [ -n "$ncpus_max" ] && [ "$ncpus_max" -gt 0 ] && [ "$RPM_BUILD_NCPUS" -gt "$ncpus_max" ]; then RPM_BUILD_NCPUS="$ncpus_max"; fi; \\\
if [ "$RPM_BUILD_NCPUS" -gt 1 ]; then echo "-j$RPM_BUILD_NCPUS"; fi)
#============================================================================== #==============================================================================
# ---- Build policy macros. # ---- Build policy macros.