From 91ce5fc3d658e5037ba21952a2c00b17991d5f48 Mon Sep 17 00:00:00 2001 From: Thierry Vignaud Date: Sun, 26 Oct 2014 09:28:52 +0100 Subject: add support for limiting parallel builds (by defining %_smp_ncpus_max in spec file for packages needing it) --- NEWS | 3 +++ build.macros.in | 5 ++++- 2 files changed, 7 insertions(+), 1 deletion(-) diff --git a/NEWS b/NEWS index 8d7a355..c9f4cb2 100644 --- a/NEWS +++ b/NEWS @@ -1,3 +1,6 @@ +- add support for limiting parallel builds by defining + %_smp_ncpus_max in spec file for packages needing it + Version 2.6 - 14 October 2014, by Pascal Terjan - support being passed the egg-info directory diff --git a/build.macros.in b/build.macros.in index 94bc858..5d2a6fe 100644 --- a/build.macros.in +++ b/build.macros.in @@ -207,9 +207,12 @@ GCONF_CONFIG_SOURCE=`%{_gconftool_bin} --get-default-source` %{_gconftool_bin} - export CFLAGS="%optflags"; export CXXFLAGS="%optflags"; export RPM_OPT_FLAGS="%optflags" \ %{nil} - +# Maximum number of CPU's to use when building, 0 for unlimited. +%_smp_ncpus_max 0 %_smp_mflags %([ -z "$RPM_BUILD_NCPUS" ] \\\ && RPM_BUILD_NCPUS="`/usr/bin/getconf _NPROCESSORS_ONLN`"; \\\ + ncpus_max=%{?_smp_ncpus_max}; \\\ + if [ -n "$ncpus_max" ] && [ "$ncpus_max" -gt 0 ] && [ "$RPM_BUILD_NCPUS" -gt "$ncpus_max" ]; then RPM_BUILD_NCPUS="$ncpus_max"; fi; \\\ [ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-j$RPM_BUILD_NCPUS") %_make_bin make -- cgit v1.2.1