Blame SOURCES/redhat-rpm-config-9.1.0-ncpus-max.patch

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