aboutsummaryrefslogtreecommitdiffstats
path: root/build.macros.in
diff options
context:
space:
mode:
authorThierry Vignaud <thierry.vignaud@gmail.com>2014-10-26 09:28:52 +0100
committerThierry Vignaud <thierry.vignaud@gmail.com>2014-10-26 09:28:52 +0100
commit91ce5fc3d658e5037ba21952a2c00b17991d5f48 (patch)
tree3d497a45be2c1ed0ab74174179edd704629ae449 /build.macros.in
parent17a51f4b353f1fe6845b17064c1162237b2894ed (diff)
downloadrpm-setup-91ce5fc3d658e5037ba21952a2c00b17991d5f48.tar
rpm-setup-91ce5fc3d658e5037ba21952a2c00b17991d5f48.tar.gz
rpm-setup-91ce5fc3d658e5037ba21952a2c00b17991d5f48.tar.bz2
rpm-setup-91ce5fc3d658e5037ba21952a2c00b17991d5f48.tar.xz
rpm-setup-91ce5fc3d658e5037ba21952a2c00b17991d5f48.zip
add support for limiting parallel builds
(by defining %_smp_ncpus_max in spec file for packages needing it)
Diffstat (limited to 'build.macros.in')
-rw-r--r--build.macros.in5
1 files changed, 4 insertions, 1 deletions
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