qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
From: Paolo Bonzini <pbonzini@redhat.com>
To: Joshua Seaton <josh.a.seaton@gmail.com>, qemu-devel@nongnu.org
Cc: qemu-trivial@nongnu.org, geist@foobox.com
Subject: Re: [PATCH] configure: Support empty prefixes
Date: Fri, 18 Feb 2022 00:50:25 +0100	[thread overview]
Message-ID: <eb099ea1-f88e-8b4f-22ab-863952c04f32@redhat.com> (raw)
In-Reply-To: <CAPbYy+_14jeLBzihGjY-v0L1inZ1CGc+8TFu7NuPiaZie8skyg@mail.gmail.com>

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	other threads:[~2022-02-17 23:52 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2022-02-17 18:42 [PATCH] configure: Support empty prefixes Joshua Seaton
2022-02-17 23:50 ` Paolo Bonzini [this message]
2022-02-22 17:35   ` Joshua Seaton

Reply instructions:

You may reply publicly to this message via plain-text email
using any one of the following methods:

* Save the following mbox file, import it into your mail client,
  and reply-to-all from there: mbox

  Avoid top-posting and favor interleaved quoting:
  https://en.wikipedia.org/wiki/Posting_style#Interleaved_style

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=eb099ea1-f88e-8b4f-22ab-863952c04f32@redhat.com \
    --to=pbonzini@redhat.com \
    --cc=geist@foobox.com \
    --cc=josh.a.seaton@gmail.com \
    --cc=qemu-devel@nongnu.org \
    --cc=qemu-trivial@nongnu.org \
    /path/to/YOUR_REPLY

  https://kernel.org/pub/software/scm/git/docs/git-send-email.html

* If your mail client supports setting the In-Reply-To header
  via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line before the message body.
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).