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

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