From nobody Sun Feb 8 14:34:30 2026 Delivered-To: importer@patchew.org Received-SPF: pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) client-ip=205.139.110.61; envelope-from=libvir-list-bounces@redhat.com; helo=us-smtp-delivery-1.mimecast.com; Authentication-Results: mx.zohomail.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass(p=none dis=none) header.from=redhat.com ARC-Seal: i=1; a=rsa-sha256; t=1573227962; cv=none; d=zoho.com; s=zohoarc; b=Ru65ijjVjPyCOIiOTVHbn1XHUpvw1TkWRzIm7JUvLTM2Sne8u9+U2WY/cUOxFTp+G8UcHpDUvVZt5tYtVXVs9obdqjCRiDfRvwi6lxCJ/xcL9JIaMWZivQC96xDW7/O41N/Cyi6ZiA+UujVxIZtWKpmz9IKTYtonpXW9pLIQynU= ARC-Message-Signature: i=1; a=rsa-sha256; c=relaxed/relaxed; d=zoho.com; s=zohoarc; t=1573227962; h=Content-Type:Content-Transfer-Encoding:Date:From:In-Reply-To:List-Subscribe:List-Post:List-Id:List-Archive:List-Help:List-Unsubscribe:MIME-Version:Message-ID:References:Sender:Subject:To; bh=vA0Utf2fs6B99NoGQw7/SUlyor+u/7qxi7AeS8kwA4s=; b=O0L8vIoKXfkf5JONof41xchpbGD0WnUgfjZ/PU1ejXxSD02KcsXN3WgAJB50hEbkQIGjagzI4KgCkJs80ujgQA+O3RFmf5Jefw035809pNWW56lG5/oUclblZsptUUJTeN4BfjC65LSrZ0UGpDJvqu8QYpwTmatSylLOtrQmeZw= ARC-Authentication-Results: i=1; mx.zoho.com; dkim=pass; spf=pass (zoho.com: domain of redhat.com designates 205.139.110.61 as permitted sender) smtp.mailfrom=libvir-list-bounces@redhat.com; dmarc=pass header.from= (p=none dis=none) header.from= Return-Path: Received: from us-smtp-delivery-1.mimecast.com (us-smtp-2.mimecast.com [205.139.110.61]) by mx.zohomail.com with SMTPS id 1573227962505559.567324000542; Fri, 8 Nov 2019 07:46:02 -0800 (PST) Received: from mimecast-mx01.redhat.com (mimecast-mx01.redhat.com [209.132.183.4]) (Using TLS) by relay.mimecast.com with ESMTP id us-mta-142-t9p3N2MOM0WcaWjL2WH2_w-1; Fri, 08 Nov 2019 10:45:59 -0500 Received: from smtp.corp.redhat.com (int-mx04.intmail.prod.int.phx2.redhat.com [10.5.11.14]) (using TLSv1.2 with cipher AECDH-AES256-SHA (256/256 bits)) (No client certificate requested) by mimecast-mx01.redhat.com (Postfix) with ESMTPS id 9057E1005500; Fri, 8 Nov 2019 15:45:51 +0000 (UTC) Received: from colo-mx.corp.redhat.com (colo-mx01.intmail.prod.int.phx2.redhat.com [10.5.11.20]) by smtp.corp.redhat.com (Postfix) with ESMTPS id 691675DA7F; Fri, 8 Nov 2019 15:45:51 +0000 (UTC) Received: from lists01.pubmisc.prod.ext.phx2.redhat.com (lists01.pubmisc.prod.ext.phx2.redhat.com [10.5.19.33]) by colo-mx.corp.redhat.com (Postfix) with ESMTP id D554A18006D1; Fri, 8 Nov 2019 15:45:50 +0000 (UTC) Received: from smtp.corp.redhat.com (int-mx05.intmail.prod.int.phx2.redhat.com [10.5.11.15]) by lists01.pubmisc.prod.ext.phx2.redhat.com (8.13.8/8.13.8) with ESMTP id xA8FgRdH014020 for ; Fri, 8 Nov 2019 10:42:27 -0500 Received: by smtp.corp.redhat.com (Postfix) id B41D05D6BB; Fri, 8 Nov 2019 15:42:27 +0000 (UTC) Received: from antique-laptop.redhat.com (ovpn-200-52.brq.redhat.com [10.40.200.52]) by smtp.corp.redhat.com (Postfix) with ESMTP id CD4665D6AE for ; Fri, 8 Nov 2019 15:42:26 +0000 (UTC) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=redhat.com; s=mimecast20190719; t=1573227961; h=from:from:sender:sender:reply-to:subject:subject:date:date: message-id:message-id:to:to:cc:mime-version:mime-version: content-type:content-type: content-transfer-encoding:content-transfer-encoding: in-reply-to:in-reply-to:references:references:list-id:list-help: list-unsubscribe:list-subscribe:list-post; bh=vA0Utf2fs6B99NoGQw7/SUlyor+u/7qxi7AeS8kwA4s=; b=fLT4BpdleX0UpV/PB5LtANClupXbhO8hvrHwgMzTK0u0mIyvAVtOA3O5S3ipfrqSa2zeSA dKxFgATPhWcRseZOxWFQj1WspujEeaUHNV6l+QnjFHjhmJQGJew9GxnisUC9aYSEu+om7B /sbAcL+5DUMaQ2jaq4XkoMDNvfSjmEc= From: Pavel Hrdina To: libvir-list@redhat.com Date: Fri, 8 Nov 2019 16:42:02 +0100 Message-Id: <7e56d3e50833f8c711a3554a88eaaa6fbbc613dd.1573227570.git.phrdina@redhat.com> In-Reply-To: References: MIME-Version: 1.0 X-Scanned-By: MIMEDefang 2.79 on 10.5.11.15 X-loop: libvir-list@redhat.com Subject: [libvirt] [PATCH v4 01/20] build: mandate use of a build dir != src dir X-BeenThere: libvir-list@redhat.com X-Mailman-Version: 2.1.12 Precedence: junk List-Id: Development discussions about the libvirt library & tools List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Sender: libvir-list-bounces@redhat.com Errors-To: libvir-list-bounces@redhat.com X-Scanned-By: MIMEDefang 2.79 on 10.5.11.14 X-MC-Unique: t9p3N2MOM0WcaWjL2WH2_w-1 X-Mimecast-Spam-Score: 0 Content-Transfer-Encoding: quoted-printable X-ZohoMail-DKIM: pass (identity @redhat.com) Content-Type: text/plain; charset="utf-8" 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=C3=A9 Signed-off-by: Pavel Hrdina Reviewed-by: Daniel P. Berrang=C3=A9 --- Notes: New in v2. =20 Changes in v4: - Fixed Travis rules and documentation .travis.yml | 3 ++- README-hacking | 11 ++++++++--- README.md | 11 +++++++---- bootstrap.conf | 6 ++++++ configure.ac | 6 ++++++ docs/compiling.html.in | 10 ++++++---- docs/windows.html.in | 3 ++- libvirt.spec.in | 10 +++++++++- 8 files changed, 46 insertions(+), 14 deletions(-) diff --git a/.travis.yml b/.travis.yml index 478909d3bb..8b70c1c937 100644 --- a/.travis.yml +++ b/.travis.yml @@ -53,7 +53,8 @@ matrix: script: # We can't run 'distcheck' or 'syntax-check' because they fail on # macOS, but doing 'install' and 'dist' gives us some useful cover= age - - ./autogen.sh --prefix=3D$(pwd)/install-root && make -j3 && make = -j3 install && make -j3 dist + - mkdir build && cd build + - ../autogen.sh --prefix=3D$(pwd)/install-root && make -j3 && make= -j3 install && make -j3 dist =20 git: submodules: true diff --git a/README-hacking b/README-hacking index ec04271c6a..7da940eb13 100644 --- a/README-hacking +++ b/README-hacking @@ -11,7 +11,7 @@ We've opted to keep only the highest-level sources in the= GIT repository. This eases our maintenance burden, (fewer merges etc.), but imposes more requirements on anyone wishing to build from the just-checked-out sources. Note the requirements to build the released archive are much less and -are just the requirements of the standard ./configure && make procedure. +are just the requirements of the standard configure && make procedure. Specific development tools and versions will be checked for and listed by the bootstrap script. =20 @@ -34,10 +34,14 @@ reduce download time and disk space requirements: =20 $ export GNULIB_SRCDIR=3D/path/to/gnulib =20 +We require to have the build directory different than the source directory: + + $ mkdir build && cd build + The next step is to get all required pieces from gnulib, -to run autoreconf, and to invoke ./configure: +to run autoreconf, and to invoke ../autogen.sh: =20 - $ ./autogen.sh + $ ../autogen.sh =20 And there you are! Just =20 @@ -47,6 +51,7 @@ And there you are! Just At this point, there should be no difference between your local copy, and the GIT master copy: =20 + $ cd .. $ git diff =20 should output no difference. diff --git a/README.md b/README.md index 4d1e86259d..44b0dd87c5 100644 --- a/README.md +++ b/README.md @@ -38,11 +38,13 @@ Installation ------------ =20 Libvirt uses the GNU Autotools build system, so in general can be built -and installed with the usual commands. For example, to build in a manner -that is suitable for installing as root, use: +and installed with the usual commands, however, we mandate to have the +build directory different than the source directory. For example, to build +in a manner that is suitable for installing as root, use: =20 ``` -$ ./configure --prefix=3D/usr --sysconfdir=3D/etc --localstatedir=3D/var +$ mkdir build && cd build +$ ../configure --prefix=3D/usr --sysconfdir=3D/etc --localstatedir=3D/var $ make $ sudo make install ``` @@ -50,7 +52,8 @@ $ sudo make install While to build & install as an unprivileged user =20 ``` -$ ./configure --prefix=3D$HOME/usr +$ mkdir build && cd build +$ ../configure --prefix=3D$HOME/usr $ make $ make install ``` diff --git a/bootstrap.conf b/bootstrap.conf index 0c7de2d2aa..4c784487e2 100644 --- a/bootstrap.conf +++ b/bootstrap.conf @@ -164,3 +164,9 @@ bootstrap_post_import_hook() sed 's,\.\./\.\./\.\.,../..,g; s/^TESTS /GNULIB_TESTS /' $m > $m-t mv -f $m-t $m } + +bootstrap_epilogue() +{ + echo "$0: done. Now you can run 'mkdir build && cd build && ../config= ure'." + exit 0 +} diff --git a/configure.ac b/configure.ac index 233fbeaaf3..32b246842e 100644 --- a/configure.ac +++ b/configure.ac @@ -17,6 +17,12 @@ dnl License along with this library. If not, see dnl . =20 AC_INIT([libvirt], [5.10.0], [libvir-list@redhat.com], [], [https://libvir= t.org]) + +if test $srcdir =3D "." +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/docs/compiling.html.in b/docs/compiling.html.in index 8dcceb3eb9..5869ebb90f 100644 --- a/docs/compiling.html.in +++ b/docs/compiling.html.in @@ -9,13 +9,15 @@

Compiling a release tarball

=20

- libvirt uses the standard configure/make/install steps: + libvirt uses the standard configure/make/install steps and mandates + that the build directory is different that the source directory:

=20
 $ xz -c libvirt-x.x.x.tar.xz | tar xvf -
 $ cd libvirt-x.x.x
-$ ./configure
+$ mkdir build && cd build +$ ../configure =20

The configure script can be given options to change its defau= lt @@ -28,7 +30,7 @@ $ ./configure

=20
-$ ./configure --help
+$ ../configure --help =20

When you have determined which options you want to use (if any), @@ -49,7 +51,7 @@ $ ./configure --help

=20
-$ ./configure [possible options]
+$ ../configure [possible options]
 $ make
 $ sudo make install
=20 diff --git a/docs/windows.html.in b/docs/windows.html.in index 096d118bf7..a0ff525e1a 100644 --- a/docs/windows.html.in +++ b/docs/windows.html.in @@ -180,7 +180,8 @@

=20
-./configure \
+mkdir build && cd build
+../configure \
   --without-sasl \
   --without-polkit \
   --without-python \
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=3D$(stat --printf=3D'%Y' %{=
_specdir}/%{name}.spec)
 %endif
=20
 rm -f po/stamp-po
-%configure --with-runstatedir=3D%{_rundir} \
+
+%define _configure ../configure
+mkdir %{_vpath_builddir}
+cd %{_vpath_builddir}
+
+%configure --enable-dependency-tracking \
+           --with-runstatedir=3D%{_rundir} \
            %{?arg_qemu} \
            %{?arg_openvz} \
            %{?arg_lxc} \
@@ -1232,6 +1238,7 @@ rm -fr %{buildroot}
=20
 export SOURCE_DATE_EPOCH=3D$(stat --printf=3D'%Y' %{_specdir}/%{name}.spec)
=20
+cd %{_vpath_builddir}
 %make_install %{?_smp_mflags} SYSTEMD_UNIT_DIR=3D%{_unitdir} V=3D1
=20
 rm -f $RPM_BUILD_ROOT%{_libdir}/*.la
@@ -1313,6 +1320,7 @@ mv $RPM_BUILD_ROOT%{_datadir}/systemtap/tapset/libvir=
t_qemu_probes.stp \
 %endif
=20
 %check
+cd %{_vpath_builddir}
 if ! make %{?_smp_mflags} check VIR_TEST_DEBUG=3D1
 then
   cat test-suite.log || true
--=20
2.23.0

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