qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] configure: add support for psuedo-"in source tree" builds


From: Daniel P . Berrangé
Subject: Re: [PATCH] configure: add support for psuedo-"in source tree" builds
Date: Fri, 21 Aug 2020 10:15:48 +0100
User-agent: Mutt/1.14.5 (2020-06-23)

On Thu, Aug 20, 2020 at 12:42:20PM -0500, Eric Blake wrote:
> On 8/20/20 11:55 AM, Daniel P. Berrangé wrote:
> > Meson requires the build dir to be separate from the source tree. Many
> > people are used to just running "./configure && make" though and the
> > meson conversion breaks that.
> > 
> > This introduces some backcompat support to make it appear as if an
> > "in source tree" build is being done, but with the the results in the
> > "build/" directory. This allows "./configure && make" to work as it
> > did historically, albeit with the output binaries staying under build/.
> > 
> > Signed-off-by: Daniel P. Berrangé <berrange@redhat.com>
> > ---
> 
> In addition to reviews you already have,
> 
> 
> > I've not tested it beyond that. Note it blows away the "build/"
> > dir each time ./configure is run so it is pristine each time.
> 
> I definitely like the idea of only blowing away what we created - but if we
> created build, then recreating it for each new configure run is nice.
> 
> > 
> > We could optionally symlink binaries from build/ into $PWD
> > if poeople think that is important, eg by changing GNUmakefile
> > to have:
> > 
> > recurse: all
> >     for bin in `find build -maxdepth 1 -type f -executable | grep -v -E 
> > '(ninjatool|config.status)'`; \
> 
> Using -maxdepth gets rid of the need to pre-create empty directories for
> nested binaries, but also loses out on binaries such as
> x86_64-softmmu/qemu-system-x86_64.  Oh, it looks like meson creates
> qemu-system-x86_64 as a binary in the top level, then a symlink in its old
> location.  Populating symlinks to ALL old locations is thus trickier than
> what you are proposing here, so it is fine to save that for a followup patch
> (let's get the bare minimum in first, so that at least ./configure && make
> works, before we worry about back-compat symlinks).
> 
> > 
> > This goes on top of Paolo's most recent meson port v175 posting,
> > or whatever number it is upto now :-)
> 
> Nice comment for reviewers, but doesn't quite need to be preserved in git.
> 
> > 
> >   .gitignore |  2 ++
> >   configure  | 40 ++++++++++++++++++++++++++++++++--------
> >   2 files changed, 34 insertions(+), 8 deletions(-)
> > 
> > diff --git a/.gitignore b/.gitignore
> > index 92311284ef..4ccb9ed975 100644
> > --- a/.gitignore
> > +++ b/.gitignore
> > @@ -1,3 +1,5 @@
> > +/GNUmakefile
> > +/build/
> >   /.doctrees
> >   /config-devices.*
> >   /config-all-devices.*
> > diff --git a/configure b/configure
> > index cc5f58f31a..a5c88ad1ac 100755
> > --- a/configure
> > +++ b/configure
> > @@ -11,6 +11,38 @@ unset CLICOLOR_FORCE GREP_OPTIONS
> >   # Don't allow CCACHE, if present, to use cached results of compile tests!
> >   export CCACHE_RECACHE=yes
> > +source_path=$(cd "$(dirname -- "$0")"; pwd)
> 
> This behaves wrong if CDPATH is set in the environment.  We should really
> include CDPATH in our environment sanitization at the top of the file.

This code is pre-existing, so any fixes wrt CDPATH can be done by
a different patch.

> 
> > +
> > +if printf %s\\n "$source_path" "$PWD" | grep -q "[[:space:]:]";
> > +then
> > +  error_exit "main directory cannot contain spaces nor colons"
> > +fi
> > +
> > +if test "$PWD" == "$source_path"
> 
> bashism; s/==/=/ or you will break configure on dash systems
> 
> > +then
> > +    echo "Using './build' as the directory for build output"
> 
> Do we want a way for a user to type './configure builddir=build/' and 'make
> builddir=build/' so they can specify different builddir overrides per
> invocation (of course, where builddir defaults to 'build/' if not
> specified)?  But hardcoding to _just_ ./build/ for getting this patch in
> quickly is fine.

Adding "builddir=build" as an option would be introducing new
functionality that doesn't already exist. The goal is just to
do some minimal work to preserve existing functionality. If
people want control over the name of their build dir, then
they can do that by using a out-of-source tree build already.

> 
> > +    rm -rf build
> > +    mkdir -p build
> > +    cat > GNUmakefile <<EOF
> 
> If you use 'EOF' or \EOF here, then...
> 
> > +
> > +ifeq (\$(MAKECMDGOALS),)
> 
> you wouldn't have to escape all these $.  Looking through the file...

Ah, subtle, but nice.


Regards,
Daniel
-- 
|: https://berrange.com      -o-    https://www.flickr.com/photos/dberrange :|
|: https://libvirt.org         -o-            https://fstop138.berrange.com :|
|: https://entangle-photo.org    -o-    https://www.instagram.com/dberrange :|




reply via email to

[Prev in Thread] Current Thread [Next in Thread]