From: Paolo Bonzini <pbonzini@redhat.com>
To: qemu-devel@nongnu.org
Subject: [PATCH 12/17] configure: move target-specific defaults to an external machine file
Date: Mon, 16 Oct 2023 08:31:22 +0200 [thread overview]
Message-ID: <20231016063127.161204-13-pbonzini@redhat.com> (raw)
In-Reply-To: <20231016063127.161204-1-pbonzini@redhat.com>
Enable Windows-specific defaults with a machine file, so that related
options can be automatically parsed and included in the help message.
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
configs/meson/windows.txt | 9 +++++++++
configure | 38 +++++++++++++++--------------------
scripts/meson-buildoptions.py | 4 +++-
scripts/meson-buildoptions.sh | 7 +++++++
4 files changed, 35 insertions(+), 23 deletions(-)
create mode 100644 configs/meson/windows.txt
diff --git a/configs/meson/windows.txt b/configs/meson/windows.txt
new file mode 100644
index 00000000000..55b192e71b1
--- /dev/null
+++ b/configs/meson/windows.txt
@@ -0,0 +1,9 @@
+# target-specific defaults, can still be overridden on
+# the command line
+
+[built-in options]
+bindir = ''
+prefix = '/qemu'
+
+[project options]
+qemu_suffix = ''
diff --git a/configure b/configure
index 211591911cc..e6787dc4111 100755
--- a/configure
+++ b/configure
@@ -246,8 +246,6 @@ default_cflags='-O2 -g'
git_submodules_action="update"
docs="auto"
EXESUF=""
-prefix="/usr/local"
-qemu_suffix="qemu"
system="yes"
linux_user=""
bsd_user=""
@@ -256,7 +254,6 @@ subdirs=""
ninja=""
python=
download="enabled"
-bindir="bin"
skip_meson=no
use_containers="yes"
gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb")
@@ -582,9 +579,6 @@ done
if test "$targetos" = "windows" ; then
EXESUF=".exe"
- prefix="/qemu"
- bindir=""
- qemu_suffix=""
fi
meson_option_build_array() {
@@ -618,6 +612,15 @@ meson_option_parse() {
fi
}
+meson_add_machine_file() {
+ if test "$cross_compile" = "yes"; then
+ meson_option_add --cross-file
+ else
+ meson_option_add --native-file
+ fi
+ meson_option_add "$1"
+}
+
for opt do
optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
case "$opt" in
@@ -625,8 +628,6 @@ for opt do
;;
--version|-V) exec cat "$source_path/VERSION"
;;
- --prefix=*) prefix="$optarg"
- ;;
--cross-prefix=*)
;;
--cc=*)
@@ -697,10 +698,6 @@ for opt do
;;
--static) static="yes"
;;
- --bindir=*) bindir="$optarg"
- ;;
- --with-suffix=*) qemu_suffix="$optarg"
- ;;
--host=*|--build=*|\
--disable-dependency-tracking|\
--sbindir=*|--sharedstatedir=*|\
@@ -857,7 +854,6 @@ Options: [defaults in brackets after descriptions]
Standard options:
--help print this message
- --prefix=PREFIX install in PREFIX [$prefix]
--target-list=LIST set target list (default: build all)
$(echo Available targets: $default_target_list | \
fold -s -w 53 | sed -e 's/^/ /')
@@ -882,8 +878,6 @@ Advanced options (experts only):
--ninja=NINJA use specified ninja [$ninja]
--smbd=SMBD use specified smbd [$smbd]
--static enable static build [$static]
- --bindir=PATH install binaries in PATH
- --with-suffix=SUFFIX suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix]
--without-default-features default all --enable-* options to "disabled"
--without-default-devices do not include any device that is not needed to
start the emulator (only use if you are including
@@ -1799,24 +1793,25 @@ if test "$skip_meson" = no; then
else
echo "endian = 'little'" >> $cross
fi
- cross_arg="--cross-file config-meson.cross"
native="config-meson.native.new"
echo "# Automatically generated by configure - do not modify" > $native
echo "[binaries]" >> $native
echo "c = [$(meson_quote $host_cc)]" >> $native
mv $native config-meson.native
- cross_arg="$cross_arg --native-file config-meson.native"
- else
- cross_arg="--native-file config-meson.cross"
+ meson_option_add --native-file
+ meson_option_add config-meson.native
fi
mv $cross config-meson.cross
+ meson_add_machine_file config-meson.cross
+ if test -f "$source_path/configs/meson/$targetos.txt"; then
+ meson_add_machine_file $source_path/configs/meson/$targetos.txt
+ fi
rm -rf meson-private meson-info meson-logs
# Built-in options
test "$download" = "disabled" && meson_option_add "--wrap-mode=nodownload"
- test "$bindir" != "bin" && meson_option_add "-Dbindir=$bindir"
test "$default_feature" = no && meson_option_add -Dauto_features=disabled
test "$static" = yes && meson_option_add -Dprefer_static=true
test "$pie" = no && meson_option_add -Db_pie=false
@@ -1828,11 +1823,10 @@ if test "$skip_meson" = no; then
test "$docs" != auto && meson_option_add "-Ddocs=$docs"
test -n "${LIB_FUZZING_ENGINE+xxx}" && meson_option_add "-Dfuzzing_engine=$LIB_FUZZING_ENGINE"
test "$plugins" = yes && meson_option_add "-Dplugins=true"
- test "$qemu_suffix" != qemu && meson_option_add "-Dqemu_suffix=$qemu_suffix"
test "$smbd" != '' && meson_option_add "-Dsmbd=$smbd"
test "$tcg" != enabled && meson_option_add "-Dtcg=$tcg"
run_meson() {
- NINJA=$ninja $meson setup --prefix "$prefix" "$@" $cross_arg "$PWD" "$source_path"
+ NINJA=$ninja $meson setup "$@" "$PWD" "$source_path"
}
eval run_meson $meson_options
if test "$?" -ne 0 ; then
diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
index b787c84e914..0c24bdc1e8c 100644
--- a/scripts/meson-buildoptions.py
+++ b/scripts/meson-buildoptions.py
@@ -28,7 +28,6 @@
SKIP_OPTIONS = {
"default_devices",
"fuzzing_engine",
- "qemu_suffix",
"smbd",
}
@@ -40,6 +39,7 @@
"malloc": "enable-malloc",
"pkgversion": "with-pkgversion",
"qemu_firmwarepath": "firmwarepath",
+ "qemu_suffix": "with-suffix",
"trace_backends": "enable-trace-backends",
"trace_file": "with-trace-file",
}
@@ -52,6 +52,7 @@
BUILTIN_OPTIONS = {
"b_coverage",
"b_lto",
+ "bindir",
"datadir",
"debug",
"includedir",
@@ -60,6 +61,7 @@
"localedir",
"localstatedir",
"mandir",
+ "prefix",
"strip",
"sysconfdir",
}
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index 22d69966606..e1522030619 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -3,6 +3,7 @@ meson_options_help() {
printf "%s\n" ' --audio-drv-list=CHOICES Set audio driver list [default] (choices: alsa/co'
printf "%s\n" ' reaudio/default/dsound/jack/oss/pa/pipewire/sdl/s'
printf "%s\n" ' ndio)'
+ printf "%s\n" ' --bindir=VALUE Executable directory [bin]'
printf "%s\n" ' --block-drv-ro-whitelist=VALUE'
printf "%s\n" ' set block driver read-only whitelist (by default'
printf "%s\n" ' affects only QEMU, not tools like qemu-img)'
@@ -62,6 +63,7 @@ meson_options_help() {
printf "%s\n" ' --localedir=VALUE Locale data directory [share/locale]'
printf "%s\n" ' --localstatedir=VALUE Localstate data directory [/var/local]'
printf "%s\n" ' --mandir=VALUE Manual page directory [share/man]'
+ printf "%s\n" ' --prefix=VALUE Installation prefix [/usr/local]'
printf "%s\n" ' --sysconfdir=VALUE Sysconf data directory [etc]'
printf "%s\n" ' --tls-priority=VALUE Default TLS protocol/cipher priority string'
printf "%s\n" ' [NORMAL]'
@@ -69,6 +71,8 @@ meson_options_help() {
printf "%s\n" ' auto/sigaltstack/ucontext/windows)'
printf "%s\n" ' --with-pkgversion=VALUE use specified string as sub-version of the'
printf "%s\n" ' package'
+ printf "%s\n" ' --with-suffix=VALUE Suffix for QEMU data/modules/config directories'
+ printf "%s\n" ' (can be empty) [qemu]'
printf "%s\n" ' --with-trace-file=VALUE Trace file prefix for simple backend [trace]'
printf "%s\n" ''
printf "%s\n" 'Optional features, enabled with --enable-FEATURE and'
@@ -229,6 +233,7 @@ _meson_option_parse() {
--disable-gcov) printf "%s" -Db_coverage=false ;;
--enable-lto) printf "%s" -Db_lto=true ;;
--disable-lto) printf "%s" -Db_lto=false ;;
+ --bindir=*) quote_sh "-Dbindir=$2" ;;
--enable-blkio) printf "%s" -Dblkio=enabled ;;
--disable-blkio) printf "%s" -Dblkio=disabled ;;
--block-drv-ro-whitelist=*) quote_sh "-Dblock_drv_ro_whitelist=$2" ;;
@@ -407,6 +412,7 @@ _meson_option_parse() {
--disable-plugins) printf "%s" -Dplugins=false ;;
--enable-png) printf "%s" -Dpng=enabled ;;
--disable-png) printf "%s" -Dpng=disabled ;;
+ --prefix=*) quote_sh "-Dprefix=$2" ;;
--enable-pvrdma) printf "%s" -Dpvrdma=enabled ;;
--disable-pvrdma) printf "%s" -Dpvrdma=disabled ;;
--enable-qcow1) printf "%s" -Dqcow1=enabled ;;
@@ -414,6 +420,7 @@ _meson_option_parse() {
--enable-qed) printf "%s" -Dqed=enabled ;;
--disable-qed) printf "%s" -Dqed=disabled ;;
--firmwarepath=*) quote_sh "-Dqemu_firmwarepath=$(meson_option_build_array $2)" ;;
+ --with-suffix=*) quote_sh "-Dqemu_suffix=$2" ;;
--enable-qga-vss) printf "%s" -Dqga_vss=enabled ;;
--disable-qga-vss) printf "%s" -Dqga_vss=disabled ;;
--enable-qom-cast-debug) printf "%s" -Dqom_cast_debug=true ;;
--
2.41.0
next prev parent reply other threads:[~2023-10-16 6:34 UTC|newest]
Thread overview: 30+ messages / expand[flat|nested] mbox.gz Atom feed top
2023-10-16 6:31 [PATCH 00/17] More build system cleanups, optional non-relocatable installs Paolo Bonzini
2023-10-16 6:31 ` [PATCH 01/17] meson: do not build shaders by default Paolo Bonzini
2023-10-16 9:04 ` Manos Pitsidianakis
2023-10-16 6:31 ` [PATCH 02/17] meson: do not use set10 Paolo Bonzini
2023-10-19 0:06 ` Richard Henderson
2023-10-16 6:31 ` [PATCH 03/17] meson, cutils: allow non-relocatable installs Paolo Bonzini
2023-10-16 7:12 ` Markus Armbruster
2023-10-16 21:29 ` Paolo Bonzini
2023-10-17 5:46 ` Markus Armbruster
2023-10-16 9:08 ` Manos Pitsidianakis
2023-10-16 9:48 ` Paolo Bonzini
2023-10-16 6:31 ` [PATCH 04/17] configure: clean up handling of CFI option Paolo Bonzini
2023-10-16 9:22 ` Philippe Mathieu-Daudé
2023-10-16 9:44 ` Paolo Bonzini
2023-10-16 13:33 ` Philippe Mathieu-Daudé
2023-10-16 6:31 ` [PATCH 05/17] hw/xen: cleanup sourcesets Paolo Bonzini
2023-10-16 6:31 ` [PATCH 06/17] hw/remote: move stub vfu_object_set_bus_irq out of stubs/ Paolo Bonzini
2023-10-16 6:31 ` [PATCH 07/17] tests/tcg/arm: move non-SVE tests out of conditional Paolo Bonzini
2023-10-16 6:31 ` [PATCH 08/17] configure, tests/tcg: simplify GDB conditionals Paolo Bonzini
2023-10-16 9:12 ` Manos Pitsidianakis
2023-10-16 6:31 ` [PATCH 09/17] configure: clean up plugin option handling Paolo Bonzini
2023-10-16 6:31 ` [PATCH 10/17] configure: clean up PIE " Paolo Bonzini
2023-10-16 6:31 ` [PATCH 11/17] configure: remove some dead cruft Paolo Bonzini
2023-10-16 9:32 ` Thomas Huth
2023-10-16 6:31 ` Paolo Bonzini [this message]
2023-10-16 6:31 ` [PATCH 13/17] configure: move environment-specific defaults to config-meson.cross Paolo Bonzini
2023-10-16 6:31 ` [PATCH 14/17] configure: unify handling of several Debian cross containers Paolo Bonzini
2023-10-16 6:31 ` [PATCH 15/17] configure, meson: use command line options to configure qemu-ga Paolo Bonzini
2023-10-16 6:31 ` [PATCH 16/17] meson-buildoptions: document the data at the top Paolo Bonzini
2023-10-16 6:31 ` [PATCH 17/17] meson: add a note on why we use config_host for program paths Paolo Bonzini
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=20231016063127.161204-13-pbonzini@redhat.com \
--to=pbonzini@redhat.com \
--cc=qemu-devel@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).