1
0
mirror of https://gitlab.com/libvirt/libvirt.git synced 2024-12-22 17:34:18 +03:00

build: mandate use of a build dir != src dir

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@redhat.com>
Signed-off-by: Pavel Hrdina <phrdina@redhat.com>
Reviewed-by: Daniel P. Berrangé <berrange@redhat.com>
This commit is contained in:
Pavel Hrdina 2019-11-06 15:55:12 +01:00
parent 3d46d684d1
commit f96395e78e
8 changed files with 47 additions and 15 deletions

View File

@ -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 coverage
- ./autogen.sh --prefix=$(pwd)/install-root && make -j3 && make -j3 install && make -j3 dist
- mkdir build && cd build
- ../autogen.sh --prefix=$(pwd)/install-root && make -j3 && make -j3 install && make -j3 dist
git:
submodules: true

View File

@ -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.
@ -34,10 +34,14 @@ reduce download time and disk space requirements:
$ export GNULIB_SRCDIR=/path/to/gnulib
The next step is to get all required pieces from gnulib,
to run autoreconf, and to invoke ./configure:
We require to have the build directory different than the source directory:
$ ./autogen.sh
$ mkdir build && cd build
The next step is to get all required pieces from gnulib,
to run autoreconf, and to invoke ../autogen.sh:
$ ../autogen.sh
And there you are! Just
@ -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:
$ cd ..
$ git diff
should output no difference.

View File

@ -38,11 +38,13 @@ Installation
------------
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:
```
$ ./configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
$ mkdir build && cd build
$ ../configure --prefix=/usr --sysconfdir=/etc --localstatedir=/var
$ make
$ sudo make install
```
@ -50,7 +52,8 @@ $ sudo make install
While to build & install as an unprivileged user
```
$ ./configure --prefix=$HOME/usr
$ mkdir build && cd build
$ ../configure --prefix=$HOME/usr
$ make
$ make install
```

View File

@ -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 && ../configure'."
exit 0
}

View File

@ -17,6 +17,12 @@ dnl License along with this library. If not, see
dnl <http://www.gnu.org/licenses/>.
AC_INIT([libvirt], [5.10.0], [libvir-list@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])

View File

@ -9,13 +9,15 @@
<h2><a id="compiling">Compiling a release tarball</a></h2>
<p>
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:
</p>
<pre>
$ xz -c libvirt-x.x.x.tar.xz | tar xvf -
$ cd libvirt-x.x.x
$ ./configure</pre>
$ mkdir build &amp;&amp; cd build
$ ../configure</pre>
<p>
The <i>configure</i> script can be given options to change its default
@ -28,7 +30,7 @@ $ ./configure</pre>
</p>
<pre>
$ ./configure <i>--help</i></pre>
$ ../configure <i>--help</i></pre>
<p>
When you have determined which options you want to use (if any),
@ -49,7 +51,7 @@ $ ./configure <i>--help</i></pre>
</p>
<pre>
$ ./configure <i>[possible options]</i>
$ ../configure <i>[possible options]</i>
$ make
$ <b>sudo</b> <i>make install</i></pre>

View File

@ -180,7 +180,8 @@
</p>
<pre>
./configure \
mkdir build &amp;&amp; cd build
../configure \
--without-sasl \
--without-polkit \
--without-python \

View File

@ -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