qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [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

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).