From: Daniel P. Berrangé <berrange(a)redhat.com>
Historically we've allowed builds in the main src dir, but meson does
not support this. Explicitly force separate build dir in autotools to
align with meson. We must re-enable dependency tracking which the RPM
%configure macro turns off. Without this, the build dir doesn't get
the source directory tree mirrored.
Signed-off-by: Daniel P. Berrangé <berrange(a)redhat.com>
---
Notes:
New in v2.
configure.ac | 6 ++++++
libvirt.spec.in | 10 +++++++++-
2 files changed, 15 insertions(+), 1 deletion(-)
diff --git a/configure.ac b/configure.ac
index 8b53b6ada9..476bba2800 100644
--- a/configure.ac
+++ b/configure.ac
@@ -17,6 +17,12 @@ dnl License along with this library. If not, see
dnl <
http://www.gnu.org/licenses/>.
AC_INIT([libvirt], [5.9.0], [libvir-list(a)redhat.com], [], [
https://libvirt.org])
+
+if test $srcdir = "."
+then
+ AC_MSG_ERROR([Build directory must be different from source directory])
+fi
+
AC_CONFIG_SRCDIR([src/libvirt.c])
AC_CONFIG_AUX_DIR([build-aux])
AC_CONFIG_HEADERS([config.h])
diff --git a/libvirt.spec.in b/libvirt.spec.in
index dcad08cb5f..723ced3535 100644
--- a/libvirt.spec.in
+++ b/libvirt.spec.in
@@ -1163,7 +1163,13 @@ export SOURCE_DATE_EPOCH=$(stat --printf='%Y'
%{_specdir}/%{name}.spec)
%endif
rm -f po/stamp-po
-%configure --with-runstatedir=%{_rundir} \
+
+%define _configure ../configure
+mkdir %{_vpath_builddir}
+cd %{_vpath_builddir}
+
+%configure --enable-dependency-tracking \
+ --with-runstatedir=%{_rundir} \
%{?arg_qemu} \
%{?arg_openvz} \
%{?arg_lxc} \
@@ -1232,6 +1238,7 @@ rm -fr %{buildroot}
export SOURCE_DATE_EPOCH=$(stat --printf='%Y' %{_specdir}/%{name}.spec)
+cd %{_vpath_builddir}
%make_install %{?_smp_mflags} SYSTEMD_UNIT_DIR=%{_unitdir} V=1
rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
@@ -1313,6 +1320,7 @@ mv
$RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvirt_qemu_probes.stp \
%endif
%check
+cd %{_vpath_builddir}
if ! make %{?_smp_mflags} check VIR_TEST_DEBUG=1
then
cat test-suite.log || true
--
2.21.0