[libvirt] [PATCH] enable parallel builds

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



I'm not sure if this is the best way to do this, but it seems to work.

----

Enable parallel compilation of the repository when running the autobuild 
script and/or via rpmbuild.

---

 autobuild.sh    |   15 ++++++++++++++-
 libvirt.spec.in |    2 +-
 2 files changed, 15 insertions(+), 2 deletions(-)

diff --git a/autobuild.sh b/autobuild.sh
index 7ae5d1e..1a5413b 100755
--- a/autobuild.sh
+++ b/autobuild.sh
@@ -21,7 +21,20 @@ rm -rf coverage
   --with-lxc \
   --with-xen-proxy
 
-make
+# from the gdc spec file
+# if RPM_BUILD_NCPUS unset, set it
+if [ -z "$RPM_BUILD_NCPUS" ] ; then
+  if [ -x /usr/bin/getconf ] ; then
+    RPM_BUILD_NCPUS=$(/usr/bin/getconf _NPROCESSORS_ONLN)
+    if [ $RPM_BUILD_NCPUS -eq 0 ]; then
+      RPM_BUILD_NCPUS=1
+    fi
+  else
+    RPM_BUILD_NCPUS=1
+  fi
+fi
+
+make -j$RPM_BUILD_NCPUS
 make install
 
 set -o pipefail
diff --git a/libvirt.spec.in b/libvirt.spec.in
index d37c0e0..cd8e937 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -169,7 +169,7 @@ of recent versions of Linux (and other OSes).
            --with-init-script=redhat \
            --with-qemud-pid-file=%{_localstatedir}/run/libvirt_qemud.pid \
            --with-remote-file=%{_localstatedir}/run/libvirtd.pid
-make
+make %{?_smp_mflags}
 
 %install
 rm -fr %{buildroot}

--
Libvir-list mailing list
Libvir-list@xxxxxxxxxx
https://www.redhat.com/mailman/listinfo/libvir-list

[Index of Archives]     [Virt Tools]     [Libvirt Users]     [Lib OS Info]     [Fedora Users]     [Fedora Desktop]     [Fedora SELinux]     [Big List of Linux Books]     [Yosemite News]     [KDE Users]     [Fedora Tools]