* [PATCH] configure: Support empty prefixes
@ 2022-02-17 18:42 Joshua Seaton
2022-02-17 23:50 ` Paolo Bonzini
0 siblings, 1 reply; 3+ messages in thread
From: Joshua Seaton @ 2022-02-17 18:42 UTC (permalink / raw)
To: qemu-devel; +Cc: qemu-trivial, geist
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.
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
^ permalink raw reply related [flat|nested] 3+ messages in thread
* Re: [PATCH] configure: Support empty prefixes
2022-02-17 18:42 [PATCH] configure: Support empty prefixes Joshua Seaton
@ 2022-02-17 23:50 ` Paolo Bonzini
2022-02-22 17:35 ` Joshua Seaton
0 siblings, 1 reply; 3+ messages in thread
From: Paolo Bonzini @ 2022-02-17 23:50 UTC (permalink / raw)
To: Joshua Seaton, qemu-devel; +Cc: qemu-trivial, geist
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
>
^ permalink raw reply [flat|nested] 3+ messages in thread
* Re: [PATCH] configure: Support empty prefixes
2022-02-17 23:50 ` Paolo Bonzini
@ 2022-02-22 17:35 ` Joshua Seaton
0 siblings, 0 replies; 3+ messages in thread
From: Joshua Seaton @ 2022-02-22 17:35 UTC (permalink / raw)
To: Paolo Bonzini; +Cc: qemu-trivial, qemu-devel
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
> >
>
^ permalink raw reply [flat|nested] 3+ messages in thread
end of thread, other threads:[~2022-02-22 17:37 UTC | newest]
Thread overview: 3+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2022-02-17 18:42 [PATCH] configure: Support empty prefixes Joshua Seaton
2022-02-17 23:50 ` Paolo Bonzini
2022-02-22 17:35 ` Joshua Seaton
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).