qemu-devel
[Top][All Lists]
Advanced

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

Re: [PATCH] configure: Support empty prefixes


From: Joshua Seaton
Subject: Re: [PATCH] configure: Support empty prefixes
Date: Tue, 22 Feb 2022 09:35:24 -0800

Hi Paolo,

Thanks for the quick response (and apologies about my delayed one).

My project has automated scripts to build a number of other tools. The
way we conventionally go about it is
```
path/to/configure '--prefix=' ...
make
make install DEST_DIR=$destdir
```

We currently build an earlier v5 version of QEMU this way. I am trying
to update things to start building v6 and hit the empty-prefix issue
in doing so.
You are of course right though that this is easily worked around:
```
path/to/configure "--prefix=$destdir" ...
make
make install
```
works fine and I've happily updated things on my side to reflect that.

My particular use-case aside, my understanding is that accepting empty
`--prefix` values is a widespread convention for configure scripts,
one which was previously supported by this project too (at least
unofficially). Is that accurate?
If the patch/feature is unwanted, that's completely okay by me;
although I'd be curious to hear why it might be regarded as
undesirable.


Joshua.





On Thu, Feb 17, 2022 at 3:50 PM Paolo Bonzini <pbonzini@redhat.com> wrote:
>
> On 2/17/22 19:42, Joshua Seaton wrote:
> > At least as of v5 (before the meson build), empty `--prefix` values were
> > supported; this seems to have fallen out along the way. This change
> > reintroduces support.
>
> What is the usecase exactly?  QEMU supports relocatable installation so
> if you want you can use --prefix=/nonexistent and then move the
> resulting tree wherever you want.
>
> Paolo
>
> > Tested locally with empty and non-empty values of `--prefix`.
> >
> > Signed-off-by: Joshua Seaton <josh.a.seaton@gmail.com>
> > ---
> >   configure | 33 ++++++++++++++++++++++++---------
> >   1 file changed, 24 insertions(+), 9 deletions(-)
> >
> > diff --git a/configure b/configure
> > index 3a29eff5cc..87a32e52e4 100755
> > --- a/configure
> > +++ b/configure
> > @@ -1229,20 +1229,30 @@ case $git_submodules_action in
> >       ;;
> >   esac
> >
> > -libdir="${libdir:-$prefix/lib}"
> > -libexecdir="${libexecdir:-$prefix/libexec}"
> > -includedir="${includedir:-$prefix/include}"
> > +# Emits a relative path in the case of an empty prefix.
> > +prefix_subdir() {
> > +    dir="$1"
> > +    if test -z "$prefix" ; then
> > +        echo "$dir"
> > +    else
> > +        echo "$prefix/$dir"
> > +    fi
> > +}
> > +
> > +libdir="${libdir:-$(prefix_subdir lib)}"
> > +libexecdir="${libexecdir:-$(prefix_subdir libexec)}"
> > +includedir="${includedir:-$(prefix_subdir include)}"
> >
> >   if test "$mingw32" = "yes" ; then
> >       bindir="${bindir:-$prefix}"
> >   else
> > -    bindir="${bindir:-$prefix/bin}"
> > +    bindir="${bindir:-$(prefix_subdir bin)}"
> >   fi
> > -mandir="${mandir:-$prefix/share/man}"
> > -datadir="${datadir:-$prefix/share}"
> > -docdir="${docdir:-$prefix/share/doc}"
> > -sysconfdir="${sysconfdir:-$prefix/etc}"
> > -local_statedir="${local_statedir:-$prefix/var}"
> > +mandir="${mandir:-$(prefix_subdir share/man)}"
> > +datadir="${datadir:-$(prefix_subdir share)}"
> > +docdir="${docdir:-$(prefix_subdir share/doc)}"
> > +sysconfdir="${sysconfdir:-$(prefix_subdir etc)}"
> > +local_statedir="${local_statedir:-$(prefix_subdir var)}"
> >   firmwarepath="${firmwarepath:-$datadir/qemu-firmware}"
> >   localedir="${localedir:-$datadir/locale}"
> >
> > @@ -3763,6 +3773,11 @@ if test "$skip_meson" = no; then
> >     mv $cross config-meson.cross
> >
> >     rm -rf meson-private meson-info meson-logs
> > +
> > +  # Workaround for a meson bug preventing empty prefixes:
> > +  # see https://github.com/mesonbuild/meson/issues/6946.
> > +  prefix="${prefix:-/}"
> > +
> >     run_meson() {
> >       NINJA=$ninja $meson setup \
> >           --prefix "$prefix" \
> > --
> > 2.35.1.265.g69c8d7142f-goog
> >
>



reply via email to

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