diff options
author | Panu Matilainen <pmatilai@redhat.com> | 2014-01-22 10:49:56 +0200 |
---|---|---|
committer | Panu Matilainen <pmatilai@redhat.com> | 2014-01-22 11:11:05 +0200 |
commit | 356fd73a7b24fd5fdcc093639c12dfd60f35d681 (patch) | |
tree | 196605be8f5f27ca5af0ac3dd4d6985023c3abed /platform.in | |
parent | bdee597417d02d1ae28626884b284a810299804b (diff) | |
download | rpm-356fd73a7b24fd5fdcc093639c12dfd60f35d681.tar.gz |
Make CPU limit for building configurable through _smp_ncpus_max macro
- Makes the max number of cpu's used by %{_smp_mflags} configurable
on spec, user or system level.
- Originally reported as RhBug:669638 and included in redhat-rpm-config
in RHEL/Fedora, but makes sense to have generally available.
Diffstat (limited to 'platform.in')
-rw-r--r-- | platform.in | 6 |
1 files changed, 5 insertions, 1 deletions
diff --git a/platform.in b/platform.in index 45c65a599..34ce787bf 100644 --- a/platform.in +++ b/platform.in @@ -47,9 +47,13 @@ %_defaultdocdir %{_datadir}/doc +# 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`"; \\\ - [ "$RPM_BUILD_NCPUS" -gt 1 ] && echo "-j$RPM_BUILD_NCPUS") + 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; \\\ + if [ "$RPM_BUILD_NCPUS" -gt 1 ]; then echo "-j$RPM_BUILD_NCPUS"; fi) #============================================================================== # ---- Build policy macros. |