All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 00/21] Build system cleanups for QEMU 9.0
@ 2023-12-21 17:19 Paolo Bonzini
  2023-12-21 17:19 ` [PATCH 01/21] meson: fix type of "relocatable" option Paolo Bonzini
                   ` (20 more replies)
  0 siblings, 21 replies; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

These are cleanups that we can do with a completed conversion
and a global view of meson.build, including:

1) removal of CONFIG_ALL

2) regrouping of root meson.build into better-defined sections

3) renaming of targetos into host_os

4) cleaning up of probe_target_compiler

Plus a bunch of small cleanups here and there.

Paolo

Paolo Bonzini (21):
  meson: fix type of "relocatable" option
  meson: remove unused variable
  meson: use version_compare() to compare version
  Makefile: clean qemu-iotests output
  configure: remove unnecessary subshell
  configure: unify again the case arms in probe_target_compiler
  meson: always probe u2f and canokey if the option is enabled
  meson: remove OS definitions from config_targetos
  meson: remove CONFIG_POSIX and CONFIG_WIN32 from config_targetos
  meson: remove config_targetos
  meson: remove CONFIG_ALL
  meson: rename config_all
  meson: add more sections to main meson.build
  meson: move program checks together
  meson: move option validation a bit closer
  meson: separate host-specific checks from option validation
  meson: keep subprojects together
  meson: move CFI detection code earlier
  meson: move config-host.h definitions together
  meson: move subdirs to "Collect sources" section
  configure, meson: rename targetos to host_os

 Makefile                             |   1 +
 accel/tcg/meson.build                |   4 +-
 backends/meson.build                 |  10 +-
 block/meson.build                    |  11 +-
 bsd-user/meson.build                 |   2 +-
 chardev/meson.build                  |  28 +-
 configure                            | 154 +++---
 contrib/ivshmem-client/meson.build   |   2 +-
 contrib/ivshmem-server/meson.build   |   2 +-
 contrib/vhost-user-blk/meson.build   |   2 +-
 contrib/vhost-user-input/meson.build |   2 +-
 contrib/vhost-user-scsi/meson.build  |   2 +-
 docs/devel/build-system.rst          |  15 -
 docs/devel/kconfig.rst               |   2 +-
 fsdev/meson.build                    |   6 +-
 gdbstub/meson.build                  |   4 +-
 hw/9pfs/meson.build                  |   7 +-
 hw/acpi/meson.build                  |   5 -
 hw/cxl/meson.build                   |   2 -
 hw/display/meson.build               |   8 +-
 hw/mem/meson.build                   |   1 -
 hw/mips/meson.build                  |   2 +-
 hw/net/meson.build                   |   2 -
 hw/pci-bridge/meson.build            |   2 -
 hw/pci/meson.build                   |   1 -
 hw/ppc/meson.build                   |   8 +-
 hw/remote/meson.build                |   1 -
 hw/smbios/meson.build                |   5 -
 hw/usb/meson.build                   |   8 +-
 hw/virtio/meson.build                |   2 -
 meson.build                          | 779 +++++++++++++--------------
 meson_options.txt                    |   2 +-
 net/can/meson.build                  |   4 +-
 net/meson.build                      |  10 +-
 plugins/meson.build                  |   4 +-
 qga/meson.build                      |  50 +-
 scsi/meson.build                     |   8 +-
 storage-daemon/meson.build           |   2 +-
 system/meson.build                   |   4 +-
 target/arm/meson.build               |   2 +-
 target/mips/meson.build              |   2 +-
 tcg/meson.build                      |   2 +-
 tests/bench/meson.build              |   6 +-
 tests/fp/meson.build                 |   4 +-
 tests/meson.build                    |   4 +-
 tests/plugin/meson.build             |   2 +-
 tests/qemu-iotests/meson.build       |   2 +-
 tests/qtest/meson.build              |  20 +-
 tests/unit/meson.build               |   8 +-
 ui/dbus-display1.xml                 |  10 +-
 ui/meson.build                       |  17 +-
 util/meson.build                     |  58 +-
 52 files changed, 630 insertions(+), 671 deletions(-)

-- 
2.43.0



^ permalink raw reply	[flat|nested] 32+ messages in thread

* [PATCH 01/21] meson: fix type of "relocatable" option
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-21 17:19 ` [PATCH 02/21] meson: remove unused variable Paolo Bonzini
                   ` (19 subsequent siblings)
  20 siblings, 0 replies; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

Since the option is of boolean type, the default value should be a boolean
rather than a string.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson_options.txt | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/meson_options.txt b/meson_options.txt
index c9baeda6395..0a99a059ec8 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -101,7 +101,7 @@ option('cfi_debug', type: 'boolean', value: false,
        description: 'Verbose errors in case of CFI violation')
 option('multiprocess', type: 'feature', value: 'auto',
        description: 'Out of process device emulation support')
-option('relocatable', type : 'boolean', value : 'true',
+option('relocatable', type : 'boolean', value : true,
        description: 'toggle relocatable install')
 option('vfio_user_server', type: 'feature', value: 'disabled',
        description: 'vfio-user server support')
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 02/21] meson: remove unused variable
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
  2023-12-21 17:19 ` [PATCH 01/21] meson: fix type of "relocatable" option Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-29  9:36   ` Philippe Mathieu-Daudé
  2023-12-21 17:19 ` [PATCH 03/21] meson: use version_compare() to compare version Paolo Bonzini
                   ` (18 subsequent siblings)
  20 siblings, 1 reply; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/bench/meson.build | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/bench/meson.build b/tests/bench/meson.build
index 3c799dbd983..7e76338a52d 100644
--- a/tests/bench/meson.build
+++ b/tests/bench/meson.build
@@ -3,9 +3,9 @@ qht_bench = executable('qht-bench',
                        sources: 'qht-bench.c',
                        dependencies: [qemuutil])
 
-qtree_bench = executable('qtree-bench',
-                         sources: 'qtree-bench.c',
-                         dependencies: [qemuutil])
+executable('qtree-bench',
+           sources: 'qtree-bench.c',
+           dependencies: [qemuutil])
 
 executable('atomic_add-bench',
            sources: files('atomic_add-bench.c'),
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 03/21] meson: use version_compare() to compare version
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
  2023-12-21 17:19 ` [PATCH 01/21] meson: fix type of "relocatable" option Paolo Bonzini
  2023-12-21 17:19 ` [PATCH 02/21] meson: remove unused variable Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-21 17:19 ` [PATCH 04/21] Makefile: clean qemu-iotests output Paolo Bonzini
                   ` (17 subsequent siblings)
  20 siblings, 0 replies; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

While a simple lexicographic comparison usually works, it is less
robust than a more specific algorithm designed to compare versions.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 qga/meson.build | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/qga/meson.build b/qga/meson.build
index ff7a8496e48..a6af614891a 100644
--- a/qga/meson.build
+++ b/qga/meson.build
@@ -140,7 +140,7 @@ if targetos == 'windows'
       qemu_ga_msi_vss = ['-D', 'InstallVss']
       deps += qga_vss
     endif
-    if glib.version() < '2.73.2'
+    if glib.version().version_compare('<2.73.2')
       libpcre = 'libpcre1'
     else
       libpcre = 'libpcre2'
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 04/21] Makefile: clean qemu-iotests output
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
                   ` (2 preceding siblings ...)
  2023-12-21 17:19 ` [PATCH 03/21] meson: use version_compare() to compare version Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-21 17:19 ` [PATCH 05/21] configure: remove unnecessary subshell Paolo Bonzini
                   ` (16 subsequent siblings)
  20 siblings, 0 replies; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Makefile  | 1 +
 configure | 2 +-
 2 files changed, 2 insertions(+), 1 deletion(-)

diff --git a/Makefile b/Makefile
index 676a4a54f48..8f369903356 100644
--- a/Makefile
+++ b/Makefile
@@ -202,6 +202,7 @@ clean: recurse-clean
 		! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
 		-exec rm {} +
 	rm -f TAGS cscope.* *~ */*~
+	@$(MAKE) -Ctests/qemu-iotests clean
 
 VERSION = $(shell cat $(SRC_PATH)/VERSION)
 
diff --git a/configure b/configure
index bdda912f362..6ea8f53310e 100755
--- a/configure
+++ b/configure
@@ -1559,7 +1559,7 @@ LINKS="$LINKS pc-bios/s390-ccw/Makefile"
 LINKS="$LINKS pc-bios/vof/Makefile"
 LINKS="$LINKS .gdbinit scripts" # scripts needed by relative path in .gdbinit
 LINKS="$LINKS tests/avocado tests/data"
-LINKS="$LINKS tests/qemu-iotests/check"
+LINKS="$LINKS tests/qemu-iotests/check tests/qemu-iotests/Makefile"
 LINKS="$LINKS python"
 LINKS="$LINKS contrib/plugins/Makefile "
 for f in $LINKS ; do
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 05/21] configure: remove unnecessary subshell
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
                   ` (3 preceding siblings ...)
  2023-12-21 17:19 ` [PATCH 04/21] Makefile: clean qemu-iotests output Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-29  9:39   ` Philippe Mathieu-Daudé
  2023-12-21 17:19 ` [PATCH 06/21] configure: unify again the case arms in probe_target_compiler Paolo Bonzini
                   ` (15 subsequent siblings)
  20 siblings, 1 reply; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

Do not use a subshell to hide the shadowing of $config_host_mak.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 8 +++-----
 1 file changed, 3 insertions(+), 5 deletions(-)

diff --git a/configure b/configure
index 6ea8f53310e..c634948051b 100755
--- a/configure
+++ b/configure
@@ -1671,10 +1671,9 @@ if test "$targetos" = windows; then
 fi
 
 # tests/tcg configuration
-(config_host_mak=tests/tcg/config-host.mak
 mkdir -p tests/tcg
-echo "# Automatically generated by configure - do not modify" > $config_host_mak
-echo "SRC_PATH=$source_path" >> $config_host_mak
+echo "# Automatically generated by configure - do not modify" > tests/tcg/$config_host_mak
+echo "SRC_PATH=$source_path" >> tests/tcg/$config_host_mak
 
 tcg_tests_targets=
 for target in $target_list; do
@@ -1717,9 +1716,8 @@ for target in $target_list; do
 done
 
 if test "$tcg" = "enabled"; then
-    echo "TCG_TESTS_TARGETS=$tcg_tests_targets" >> config-host.mak
+    echo "TCG_TESTS_TARGETS=$tcg_tests_targets" >> $config_host_mak
 fi
-)
 
 if test "$skip_meson" = no; then
   cross="config-meson.cross.new"
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 06/21] configure: unify again the case arms in probe_target_compiler
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
                   ` (4 preceding siblings ...)
  2023-12-21 17:19 ` [PATCH 05/21] configure: remove unnecessary subshell Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-21 17:19 ` [PATCH 07/21] meson: always probe u2f and canokey if the option is enabled Paolo Bonzini
                   ` (14 subsequent siblings)
  20 siblings, 0 replies; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

Remove assignments that match the default, and group the
targets for debian-legacy-test-cross and debian-all-test-cross
into a single arm.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 86 +++++++++++++++++--------------------------------------
 1 file changed, 27 insertions(+), 59 deletions(-)

diff --git a/configure b/configure
index c634948051b..38ca267096f 100755
--- a/configure
+++ b/configure
@@ -1272,16 +1272,33 @@ probe_target_compiler() {
     test "$container" != no || continue
     test "$host" = "$cpu" || continue
     case $target_arch in
+      # debian-all-test-cross architectures
+
+      hppa|m68k|mips|riscv64|sparc64)
+        container_image=debian-all-test-cross
+        ;;
+      mips64)
+        container_image=debian-all-test-cross
+        container_cross_prefix=mips64-linux-gnuabi64-
+        ;;
+      ppc|ppc64|ppc64le)
+        container_image=debian-all-test-cross
+        container_cross_prefix=powerpc${target_arch#ppc}-linux-gnu-
+        ;;
+
+      # debian-legacy-test-cross architectures (need Debian 11)
+      # - libc6.1-dev-alpha-cross: https://bugs.debian.org/cgi-bin/bugreport.cgi?bug=1054412
+      # - sh4-linux-user: binaries don't run with bookworm compiler
+
+      alpha|sh4)
+        container_image=debian-legacy-test-cross
+        ;;
+
+      # architectures with individual containers
+
       aarch64)
         # We don't have any bigendian build tools so we only use this for AArch64
         container_image=debian-arm64-cross
-        container_cross_prefix=aarch64-linux-gnu-
-        container_cross_cc=${container_cross_prefix}gcc
-        ;;
-      alpha)
-        container_image=debian-legacy-test-cross
-        container_cross_prefix=alpha-linux-gnu-
-        container_cross_cc=${container_cross_prefix}gcc
         ;;
       arm)
         # We don't have any bigendian build tools so we only use this for ARM
@@ -1290,18 +1307,11 @@ probe_target_compiler() {
         ;;
       cris)
         container_image=fedora-cris-cross
-        container_cross_prefix=cris-linux-gnu-
         ;;
       hexagon)
-        container_image=debian-hexagon-cross
         container_cross_prefix=hexagon-unknown-linux-musl-
         container_cross_cc=${container_cross_prefix}clang
         ;;
-      hppa)
-        container_image=debian-all-test-cross
-        container_cross_prefix=hppa-linux-gnu-
-        container_cross_cc=${container_cross_prefix}gcc
-        ;;
       i386)
         container_image=debian-i686-cross
         container_cross_prefix=i686-linux-gnu-
@@ -1310,59 +1320,19 @@ probe_target_compiler() {
         container_image=debian-loongarch-cross
         container_cross_prefix=loongarch64-unknown-linux-gnu-
         ;;
-      m68k)
-        container_image=debian-all-test-cross
-        container_cross_prefix=m68k-linux-gnu-
-        container_cross_cc=${container_cross_prefix}gcc
-        ;;
       microblaze)
-        container_image=debian-microblaze-cross
         container_cross_prefix=microblaze-linux-musl-
         ;;
       mips64el)
         container_image=debian-mips64el-cross
         container_cross_prefix=mips64el-linux-gnuabi64-
         ;;
-      mips64)
-        container_image=debian-all-test-cross
-        container_cross_prefix=mips64-linux-gnuabi64-
-        ;;
-      mips)
-        container_image=debian-all-test-cross
-        container_cross_prefix=mips-linux-gnu-
-        ;;
-      nios2)
-        container_image=debian-nios2-cross
-        container_cross_prefix=nios2-linux-gnu-
-        ;;
-      ppc)
-        container_image=debian-all-test-cross
-        container_cross_prefix=powerpc-linux-gnu-
-        container_cross_cc=${container_cross_prefix}gcc
-        ;;
-      ppc64|ppc64le)
-        container_image=debian-all-test-cross
-        container_cross_prefix=powerpc${target_arch#ppc}-linux-gnu-
-        ;;
-      riscv64)
-        container_image=debian-all-test-cross
-        container_cross_prefix=riscv64-linux-gnu-
-        ;;
-      sh4)
-        container_image=debian-legacy-test-cross
-        container_cross_prefix=sh4-linux-gnu-
-        ;;
-      sparc64)
-        container_image=debian-all-test-cross
-        container_cross_prefix=sparc64-linux-gnu-
-        ;;
       tricore)
         container_image=debian-tricore-cross
         container_cross_prefix=tricore-
         ;;
       x86_64)
         container_image=debian-amd64-cross
-        container_cross_prefix=x86_64-linux-gnu-
         ;;
       xtensa*)
         container_image=debian-xtensa-cross
@@ -1370,12 +1340,10 @@ probe_target_compiler() {
         # default to the dc232b cpu
         container_cross_prefix=/opt/2020.07/xtensa-dc232b-elf/bin/xtensa-dc232b-elf-
         ;;
-      *)
-        # Debian and GNU architecture names usually match
-        container_image=debian-$target_arch-cross
-        container_cross_prefix=$target_arch-linux-gnu-
-        ;;
     esac
+    # Debian and GNU architecture names usually match
+    : ${container_image:=debian-$target_arch-cross}
+    : ${container_cross_prefix:=$target_arch-linux-gnu-}
     : ${container_cross_cc:=${container_cross_prefix}gcc}
     : ${container_cross_ar:=${container_cross_prefix}ar}
     : ${container_cross_as:=${container_cross_prefix}as}
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 07/21] meson: always probe u2f and canokey if the option is enabled
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
                   ` (5 preceding siblings ...)
  2023-12-21 17:19 ` [PATCH 06/21] configure: unify again the case arms in probe_target_compiler Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-21 17:19 ` [PATCH 08/21] meson: remove OS definitions from config_targetos Paolo Bonzini
                   ` (13 subsequent siblings)
  20 siblings, 0 replies; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/meson.build b/meson.build
index 6c77d9687de..de33e323d43 100644
--- a/meson.build
+++ b/meson.build
@@ -1759,12 +1759,12 @@ if not get_option('smartcard').auto() or have_system
                       version: '>=2.5.1', method: 'pkg-config')
 endif
 u2f = not_found
-if have_system
+if not get_option('u2f').auto() or have_system
   u2f = dependency('u2f-emu', required: get_option('u2f'),
                    method: 'pkg-config')
 endif
 canokey = not_found
-if have_system
+if not get_option('canokey').auto() or have_system
   canokey = dependency('canokey-qemu', required: get_option('canokey'),
                    method: 'pkg-config')
 endif
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 08/21] meson: remove OS definitions from config_targetos
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
                   ` (6 preceding siblings ...)
  2023-12-21 17:19 ` [PATCH 07/21] meson: always probe u2f and canokey if the option is enabled Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-21 17:19 ` [PATCH 09/21] meson: remove CONFIG_POSIX and CONFIG_WIN32 " Paolo Bonzini
                   ` (12 subsequent siblings)
  20 siblings, 0 replies; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

CONFIG_DARWIN, CONFIG_LINUX and CONFIG_BSD are used in some rules, but
only CONFIG_LINUX has substantial use.  Convert them all to if...endif.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 accel/tcg/meson.build  |  4 +++-
 backends/meson.build   |  4 +++-
 block/meson.build      |  4 +++-
 fsdev/meson.build      |  5 +++--
 hw/9pfs/meson.build    |  7 +++++--
 hw/display/meson.build |  7 +++++--
 hw/ppc/meson.build     |  8 +++++---
 hw/usb/meson.build     |  4 +++-
 meson.build            |  8 --------
 net/can/meson.build    |  4 +++-
 qga/meson.build        | 11 +++++------
 scsi/meson.build       |  8 +++++---
 system/meson.build     |  4 +++-
 ui/meson.build         |  7 +++----
 util/meson.build       | 14 ++++++++------
 15 files changed, 57 insertions(+), 42 deletions(-)

diff --git a/accel/tcg/meson.build b/accel/tcg/meson.build
index 8783edd06ee..1dad6bbbfbd 100644
--- a/accel/tcg/meson.build
+++ b/accel/tcg/meson.build
@@ -17,7 +17,9 @@ if get_option('plugins')
   tcg_ss.add(files('plugin-gen.c'))
 endif
 tcg_ss.add(when: libdw, if_true: files('debuginfo.c'))
-tcg_ss.add(when: 'CONFIG_LINUX', if_true: files('perf.c'))
+if targetos == 'linux'
+  tcg_ss.add(files('perf.c'))
+endif
 specific_ss.add_all(when: 'CONFIG_TCG', if_true: tcg_ss)
 
 specific_ss.add(when: ['CONFIG_SYSTEM_ONLY', 'CONFIG_TCG'], if_true: files(
diff --git a/backends/meson.build b/backends/meson.build
index 9a5cea480d1..248ce4923c6 100644
--- a/backends/meson.build
+++ b/backends/meson.build
@@ -12,7 +12,9 @@ system_ss.add([files(
 
 system_ss.add(when: 'CONFIG_POSIX', if_true: files('rng-random.c'))
 system_ss.add(when: 'CONFIG_POSIX', if_true: files('hostmem-file.c'))
-system_ss.add(when: 'CONFIG_LINUX', if_true: files('hostmem-memfd.c'))
+if targetos == 'linux'
+  system_ss.add(files('hostmem-memfd.c'))
+endif
 if keyutils.found()
     system_ss.add(keyutils, files('cryptodev-lkcf.c'))
 endif
diff --git a/block/meson.build b/block/meson.build
index 59ff6d380c0..7faed96c1e7 100644
--- a/block/meson.build
+++ b/block/meson.build
@@ -91,7 +91,9 @@ endif
 block_ss.add(when: 'CONFIG_WIN32', if_true: files('file-win32.c', 'win32-aio.c'))
 block_ss.add(when: 'CONFIG_POSIX', if_true: [files('file-posix.c'), coref, iokit])
 block_ss.add(when: libiscsi, if_true: files('iscsi-opts.c'))
-block_ss.add(when: 'CONFIG_LINUX', if_true: files('nvme.c'))
+if targetos == 'linux'
+  block_ss.add(files('nvme.c'))
+endif
 if get_option('replication').allowed()
   block_ss.add(files('replication.c'))
 endif
diff --git a/fsdev/meson.build b/fsdev/meson.build
index 1bec0659245..c76347615df 100644
--- a/fsdev/meson.build
+++ b/fsdev/meson.build
@@ -6,8 +6,9 @@ fsdev_ss.add(when: ['CONFIG_FSDEV_9P'], if_true: files(
   '9p-marshal.c',
   'qemu-fsdev.c',
 ), if_false: files('qemu-fsdev-dummy.c'))
-system_ss.add_all(when: 'CONFIG_LINUX', if_true: fsdev_ss)
-system_ss.add_all(when: 'CONFIG_DARWIN', if_true: fsdev_ss)
+if targetos in ['linux', 'darwin']
+  system_ss.add_all(fsdev_ss)
+endif
 
 if have_virtfs_proxy_helper
   executable('virtfs-proxy-helper',
diff --git a/hw/9pfs/meson.build b/hw/9pfs/meson.build
index 2944ea63c38..3eee7c268a9 100644
--- a/hw/9pfs/meson.build
+++ b/hw/9pfs/meson.build
@@ -13,8 +13,11 @@ fs_ss.add(files(
   'coth.c',
   'coxattr.c',
 ))
-fs_ss.add(when: 'CONFIG_LINUX', if_true: files('9p-util-linux.c'))
-fs_ss.add(when: 'CONFIG_DARWIN', if_true: files('9p-util-darwin.c'))
+if targetos == 'darwin'
+  fs_ss.add(files('9p-util-darwin.c'))
+elif targetos == 'linux'
+  fs_ss.add(files('9p-util-linux.c'))
+endif
 fs_ss.add(when: 'CONFIG_XEN_BUS', if_true: files('xen-9p-backend.c'))
 system_ss.add_all(when: 'CONFIG_FSDEV_9P', if_true: fs_ss)
 
diff --git a/hw/display/meson.build b/hw/display/meson.build
index 344dfe3d8c2..02b0044c9ec 100644
--- a/hw/display/meson.build
+++ b/hw/display/meson.build
@@ -69,8 +69,11 @@ if config_all_devices.has_key('CONFIG_VIRTIO_GPU')
   virtio_gpu_ss = ss.source_set()
   virtio_gpu_ss.add(when: 'CONFIG_VIRTIO_GPU',
                     if_true: [files('virtio-gpu-base.c', 'virtio-gpu.c'), pixman])
-  virtio_gpu_ss.add(when: 'CONFIG_LINUX', if_true: files('virtio-gpu-udmabuf.c'),
-                                          if_false: files('virtio-gpu-udmabuf-stubs.c'))
+  if targetos == 'linux'
+    virtio_gpu_ss.add(files('virtio-gpu-udmabuf.c'))
+  else
+    virtio_gpu_ss.add(files('virtio-gpu-udmabuf-stubs.c'))
+  endif
   virtio_gpu_ss.add(when: 'CONFIG_VHOST_USER_GPU', if_true: files('vhost-user-gpu.c'))
   hw_display_modules += {'virtio-gpu': virtio_gpu_ss}
 
diff --git a/hw/ppc/meson.build b/hw/ppc/meson.build
index ea44856d43b..3dedcf3043d 100644
--- a/hw/ppc/meson.build
+++ b/hw/ppc/meson.build
@@ -34,9 +34,11 @@ ppc_ss.add(when: ['CONFIG_PSERIES', 'CONFIG_TCG'], if_true: files(
   'spapr_softmmu.c',
 ))
 ppc_ss.add(when: 'CONFIG_SPAPR_RNG', if_true: files('spapr_rng.c'))
-ppc_ss.add(when: ['CONFIG_PSERIES', 'CONFIG_LINUX'], if_true: files(
-  'spapr_pci_vfio.c',
-))
+if targetos == 'linux'
+  ppc_ss.add(when: 'CONFIG_PSERIES', if_true: files(
+    'spapr_pci_vfio.c',
+  ))
+endif
 
 # IBM PowerNV
 ppc_ss.add(when: 'CONFIG_POWERNV', if_true: files(
diff --git a/hw/usb/meson.build b/hw/usb/meson.build
index e94149ebdeb..4b44db39cd3 100644
--- a/hw/usb/meson.build
+++ b/hw/usb/meson.build
@@ -58,7 +58,9 @@ endif
 
 # U2F
 system_ss.add(when: 'CONFIG_USB_U2F', if_true: files('u2f.c'))
-system_ss.add(when: ['CONFIG_LINUX', 'CONFIG_USB_U2F'], if_true: [libudev, files('u2f-passthru.c')])
+if targetos == 'linux'
+  system_ss.add(when: 'CONFIG_USB_U2F', if_true: [libudev, files('u2f-passthru.c')])
+endif
 if u2f.found()
   system_ss.add(when: 'CONFIG_USB_U2F', if_true: [u2f, files('u2f-emulated.c')])
 endif
diff --git a/meson.build b/meson.build
index de33e323d43..ac11adc6c13 100644
--- a/meson.build
+++ b/meson.build
@@ -2843,14 +2843,6 @@ minikconf = find_program('scripts/minikconf.py')
 config_targetos = {
   (targetos == 'windows' ? 'CONFIG_WIN32' : 'CONFIG_POSIX'): 'y'
 }
-if targetos == 'darwin'
-  config_targetos += {'CONFIG_DARWIN': 'y'}
-elif targetos == 'linux'
-  config_targetos += {'CONFIG_LINUX': 'y'}
-endif
-if targetos in bsd_oses
-  config_targetos += {'CONFIG_BSD': 'y'}
-endif
 
 config_all = {}
 config_all_devices = {}
diff --git a/net/can/meson.build b/net/can/meson.build
index 45693c82c9d..bdf6f8eee16 100644
--- a/net/can/meson.build
+++ b/net/can/meson.build
@@ -1,5 +1,7 @@
 can_ss = ss.source_set()
 can_ss.add(files('can_core.c', 'can_host.c'))
-can_ss.add(when: 'CONFIG_LINUX', if_true: files('can_socketcan.c'))
+if targetos == 'linux'
+  can_ss.add(files('can_socketcan.c'))
+endif
 
 system_ss.add_all(when: 'CONFIG_CAN_BUS', if_true: can_ss)
diff --git a/qga/meson.build b/qga/meson.build
index a6af614891a..50edaf1c3d4 100644
--- a/qga/meson.build
+++ b/qga/meson.build
@@ -72,12 +72,11 @@ qga_ss.add(when: 'CONFIG_POSIX', if_true: files(
   'commands-posix.c',
   'commands-posix-ssh.c',
 ))
-qga_ss.add(when: 'CONFIG_LINUX', if_true: files(
-  'commands-linux.c',
-))
-qga_ss.add(when: 'CONFIG_BSD', if_true: files(
-  'commands-bsd.c',
-))
+if targetos == 'linux'
+  qga_ss.add(files('commands-linux.c'))
+elif targetos in bsd_oses
+  qga_ss.add(files('commands-bsd.c'))
+endif
 qga_ss.add(when: 'CONFIG_WIN32', if_true: files(
   'channel-win32.c',
   'commands-win32.c',
diff --git a/scsi/meson.build b/scsi/meson.build
index 53f3a1f7169..0ff2b3affe0 100644
--- a/scsi/meson.build
+++ b/scsi/meson.build
@@ -1,4 +1,6 @@
 block_ss.add(files('utils.c'))
-block_ss.add(when: 'CONFIG_LINUX',
-             if_true: files('pr-manager.c', 'pr-manager-helper.c'),
-             if_false: files('pr-manager-stub.c'))
+if targetos == 'linux'
+  block_ss.add(files('pr-manager.c', 'pr-manager-helper.c'))
+else
+  block_ss.add(files('pr-manager-stub.c'))
+endif
diff --git a/system/meson.build b/system/meson.build
index 3a64dd89de1..0632a3daa8a 100644
--- a/system/meson.build
+++ b/system/meson.build
@@ -33,4 +33,6 @@ endif
 
 system_ss.add(when: seccomp, if_true: files('qemu-seccomp.c'))
 system_ss.add(when: fdt, if_true: files('device_tree.c'))
-system_ss.add(when: 'CONFIG_LINUX', if_true: files('async-teardown.c'))
+if targetos == 'linux'
+  system_ss.add('async-teardown.c')
+endif
diff --git a/ui/meson.build b/ui/meson.build
index 0ccb3387ee6..8379a788a1a 100644
--- a/ui/meson.build
+++ b/ui/meson.build
@@ -25,10 +25,9 @@ endif
 system_ss.add([spice_headers, files('spice-module.c')])
 system_ss.add(when: spice_protocol, if_true: files('vdagent.c'))
 
-system_ss.add(when: 'CONFIG_LINUX', if_true: files(
-  'input-linux.c',
-  'udmabuf.c',
-))
+if targetos == 'linux'
+  system_ss.add(files('input-linux.c', 'udmabuf.c'))
+endif
 system_ss.add(when: cocoa, if_true: files('cocoa.m'))
 
 vnc_ss = ss.source_set()
diff --git a/util/meson.build b/util/meson.build
index 174c133368a..98dd7fa5340 100644
--- a/util/meson.build
+++ b/util/meson.build
@@ -71,7 +71,9 @@ endif
 if have_system
   util_ss.add(files('crc-ccitt.c'))
   util_ss.add(when: gio, if_true: files('dbus.c'))
-  util_ss.add(when: 'CONFIG_LINUX', if_true: files('userfaultfd.c'))
+  if targetos == 'linux'
+    util_ss.add(files('userfaultfd.c'))
+  endif
 endif
 
 if have_block or have_ga
@@ -92,9 +94,6 @@ if have_block
   util_ss.add(files('iova-tree.c'))
   util_ss.add(files('iov.c', 'uri.c'))
   util_ss.add(files('nvdimm-utils.c'))
-  util_ss.add(when: 'CONFIG_LINUX', if_true: [
-    files('vhost-user-server.c'), vhost_user
-  ])
   util_ss.add(files('block-helpers.c'))
   util_ss.add(files('qemu-coroutine-sleep.c'))
   util_ss.add(files('qemu-co-shared-resource.c'))
@@ -107,8 +106,11 @@ if have_block
   else
     util_ss.add(files('filemonitor-stub.c'))
   endif
-  util_ss.add(when: 'CONFIG_LINUX', if_true: files('vfio-helpers.c'))
-  util_ss.add(when: 'CONFIG_LINUX', if_true: files('chardev_open.c'))
+  if targetos == 'linux'
+    util_ss.add(files('vhost-user-server.c'), vhost_user)
+    util_ss.add(files('vfio-helpers.c'))
+    util_ss.add(files('chardev_open.c'))
+  endif
 endif
 
 if cpu == 'aarch64'
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 09/21] meson: remove CONFIG_POSIX and CONFIG_WIN32 from config_targetos
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
                   ` (7 preceding siblings ...)
  2023-12-21 17:19 ` [PATCH 08/21] meson: remove OS definitions from config_targetos Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-21 17:19 ` [PATCH 10/21] meson: remove config_targetos Paolo Bonzini
                   ` (11 subsequent siblings)
  20 siblings, 0 replies; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

For consistency with other OSes, use if...endif for rules that are
target-independent.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 backends/meson.build |  6 ++++--
 block/meson.build    |  7 +++++--
 chardev/meson.build  | 26 ++++++++++++++------------
 hw/usb/meson.build   |  4 +++-
 meson.build          | 11 ++++++-----
 qga/meson.build      | 33 ++++++++++++++++++---------------
 ui/meson.build       |  8 ++++++--
 util/meson.build     | 44 +++++++++++++++++++++++---------------------
 8 files changed, 79 insertions(+), 60 deletions(-)

diff --git a/backends/meson.build b/backends/meson.build
index 248ce4923c6..6dee4e9203b 100644
--- a/backends/meson.build
+++ b/backends/meson.build
@@ -10,8 +10,10 @@ system_ss.add([files(
   'confidential-guest-support.c',
 ), numa])
 
-system_ss.add(when: 'CONFIG_POSIX', if_true: files('rng-random.c'))
-system_ss.add(when: 'CONFIG_POSIX', if_true: files('hostmem-file.c'))
+if targetos != 'windows'
+  system_ss.add(files('rng-random.c'))
+  system_ss.add(files('hostmem-file.c'))
+endif
 if targetos == 'linux'
   system_ss.add(files('hostmem-memfd.c'))
 endif
diff --git a/block/meson.build b/block/meson.build
index 7faed96c1e7..ddea1e40070 100644
--- a/block/meson.build
+++ b/block/meson.build
@@ -88,8 +88,11 @@ if get_option('parallels').allowed()
   block_ss.add(files('parallels.c', 'parallels-ext.c'))
 endif
 
-block_ss.add(when: 'CONFIG_WIN32', if_true: files('file-win32.c', 'win32-aio.c'))
-block_ss.add(when: 'CONFIG_POSIX', if_true: [files('file-posix.c'), coref, iokit])
+if targetos == 'windows'
+  block_ss.add(files('file-win32.c', 'win32-aio.c'))
+else
+  block_ss.add(files('file-posix.c'), coref, iokit)
+endif
 block_ss.add(when: libiscsi, if_true: files('iscsi-opts.c'))
 if targetos == 'linux'
   block_ss.add(files('nvme.c'))
diff --git a/chardev/meson.build b/chardev/meson.build
index 6d56ad32fdb..9564ace868b 100644
--- a/chardev/meson.build
+++ b/chardev/meson.build
@@ -12,20 +12,22 @@ chardev_ss.add(files(
   'char-udp.c',
   'char.c',
 ))
-chardev_ss.add(when: 'CONFIG_POSIX', if_true: [files(
-  'char-fd.c',
-  'char-pty.c',
-), util])
-if targetos in ['linux', 'gnu/kfreebsd', 'freebsd', 'dragonfly']
-  chardev_ss.add(files('char-parallel.c'))
+if targetos == 'windows'
+  chardev_ss.add(files(
+    'char-console.c',
+    'char-win-stdio.c',
+    'char-win.c',
+  ))
+else
+  chardev_ss.add(files(
+      'char-fd.c',
+      'char-pty.c',
+    ), util)
+  if targetos in ['linux', 'gnu/kfreebsd', 'freebsd', 'dragonfly']
+    chardev_ss.add(files('char-parallel.c'))
+  endif
 endif
 
-chardev_ss.add(when: 'CONFIG_WIN32', if_true: files(
-  'char-console.c',
-  'char-win-stdio.c',
-  'char-win.c',
-))
-
 chardev_ss = chardev_ss.apply(config_targetos, strict: false)
 
 system_ss.add(files(
diff --git a/hw/usb/meson.build b/hw/usb/meson.build
index 4b44db39cd3..b7755b638fc 100644
--- a/hw/usb/meson.build
+++ b/hw/usb/meson.build
@@ -44,7 +44,9 @@ system_ss.add(when: 'CONFIG_USB_STORAGE_UAS', if_true: files('dev-uas.c'))
 system_ss.add(when: 'CONFIG_USB_AUDIO', if_true: files('dev-audio.c'))
 system_ss.add(when: 'CONFIG_USB_SERIAL', if_true: files('dev-serial.c'))
 system_ss.add(when: 'CONFIG_USB_NETWORK', if_true: files('dev-network.c'))
-system_ss.add(when: ['CONFIG_POSIX', 'CONFIG_USB_STORAGE_MTP'], if_true: files('dev-mtp.c'))
+if targetos != 'windows'
+  system_ss.add(when: 'CONFIG_USB_STORAGE_MTP', if_true: files('dev-mtp.c'))
+endif
 
 # smartcard
 system_ss.add(when: 'CONFIG_USB_SMARTCARD', if_true: files('dev-smartcard-reader.c'))
diff --git a/meson.build b/meson.build
index ac11adc6c13..0a0c68050e7 100644
--- a/meson.build
+++ b/meson.build
@@ -2840,9 +2840,7 @@ endif
 ########################
 
 minikconf = find_program('scripts/minikconf.py')
-config_targetos = {
-  (targetos == 'windows' ? 'CONFIG_WIN32' : 'CONFIG_POSIX'): 'y'
-}
+config_targetos = {}
 
 config_all = {}
 config_all_devices = {}
@@ -3456,8 +3454,11 @@ if have_block
 
   # os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
   # os-win32.c does not
-  blockdev_ss.add(when: 'CONFIG_POSIX', if_true: files('os-posix.c'))
-  system_ss.add(when: 'CONFIG_WIN32', if_true: [files('os-win32.c')])
+  if targetos == 'windows'
+    system_ss.add(files('os-win32.c'))
+  else
+    blockdev_ss.add(files('os-posix.c'))
+  endif
 endif
 
 common_ss.add(files('cpu-common.c'))
diff --git a/qga/meson.build b/qga/meson.build
index 50edaf1c3d4..1113e7c7fae 100644
--- a/qga/meson.build
+++ b/qga/meson.build
@@ -67,22 +67,25 @@ qga_ss.add(files(
   'main.c',
   'cutils.c',
 ))
-qga_ss.add(when: 'CONFIG_POSIX', if_true: files(
-  'channel-posix.c',
-  'commands-posix.c',
-  'commands-posix-ssh.c',
-))
-if targetos == 'linux'
-  qga_ss.add(files('commands-linux.c'))
-elif targetos in bsd_oses
-  qga_ss.add(files('commands-bsd.c'))
+if targetos == 'windows'
+  qga_ss.add(files(
+    'channel-win32.c',
+    'commands-win32.c',
+    'service-win32.c',
+    'vss-win32.c'
+  ))
+else
+  qga_ss.add(files(
+    'channel-posix.c',
+    'commands-posix.c',
+    'commands-posix-ssh.c',
+  ))
+  if targetos == 'linux'
+    qga_ss.add(files('commands-linux.c'))
+  elif targetos in bsd_oses
+    qga_ss.add(files('commands-bsd.c'))
+  endif
 endif
-qga_ss.add(when: 'CONFIG_WIN32', if_true: files(
-  'channel-win32.c',
-  'commands-win32.c',
-  'service-win32.c',
-  'vss-win32.c'
-))
 
 qga_ss = qga_ss.apply(config_targetos, strict: false)
 
diff --git a/ui/meson.build b/ui/meson.build
index 8379a788a1a..a370494c4ab 100644
--- a/ui/meson.build
+++ b/ui/meson.build
@@ -105,7 +105,9 @@ if dbus_display
 endif
 
 if gtk.found()
-  system_ss.add(when: 'CONFIG_WIN32', if_true: files('win32-kbd-hook.c'))
+  if targetos == 'windows'
+    system_ss.add(files('win32-kbd-hook.c'))
+  endif
 
   gtk_ss = ss.source_set()
   gtk_ss.add(gtk, vte, pixman, files('gtk.c'))
@@ -119,7 +121,9 @@ if gtk.found()
 endif
 
 if sdl.found()
-  system_ss.add(when: 'CONFIG_WIN32', if_true: files('win32-kbd-hook.c'))
+  if targetos == 'windows'
+    system_ss.add(files('win32-kbd-hook.c'))
+  endif
 
   sdl_ss = ss.source_set()
   sdl_ss.add(sdl, sdl_image, pixman, glib, files(
diff --git a/util/meson.build b/util/meson.build
index 98dd7fa5340..4e970d2b488 100644
--- a/util/meson.build
+++ b/util/meson.build
@@ -3,28 +3,31 @@ util_ss.add(files('thread-context.c'), numa)
 if not config_host_data.get('CONFIG_ATOMIC64')
   util_ss.add(files('atomic64.c'))
 endif
-util_ss.add(when: 'CONFIG_POSIX', if_true: files('aio-posix.c'))
-util_ss.add(when: 'CONFIG_POSIX', if_true: files('fdmon-poll.c'))
-if config_host_data.get('CONFIG_EPOLL_CREATE1')
-  util_ss.add(files('fdmon-epoll.c'))
+if targetos != 'windows'
+  util_ss.add(files('aio-posix.c'))
+  util_ss.add(files('fdmon-poll.c'))
+  if config_host_data.get('CONFIG_EPOLL_CREATE1')
+    util_ss.add(files('fdmon-epoll.c'))
+  endif
+  util_ss.add(files('compatfd.c'))
+  util_ss.add(files('event_notifier-posix.c'))
+  util_ss.add(files('mmap-alloc.c'))
+  freebsd_dep = []
+  if targetos == 'freebsd'
+    freebsd_dep = util
+  endif
+  util_ss.add(files('oslib-posix.c'), freebsd_dep)
+  util_ss.add(files('qemu-thread-posix.c'))
+  util_ss.add(files('memfd.c'))
+  util_ss.add(files('drm.c'))
+else
+  util_ss.add(files('aio-win32.c'))
+  util_ss.add(files('event_notifier-win32.c'))
+  util_ss.add(files('oslib-win32.c'))
+  util_ss.add(files('qemu-thread-win32.c'))
+  util_ss.add(winmm, pathcch)
 endif
 util_ss.add(when: linux_io_uring, if_true: files('fdmon-io_uring.c'))
-util_ss.add(when: 'CONFIG_POSIX', if_true: files('compatfd.c'))
-util_ss.add(when: 'CONFIG_POSIX', if_true: files('event_notifier-posix.c'))
-util_ss.add(when: 'CONFIG_POSIX', if_true: files('mmap-alloc.c'))
-freebsd_dep = []
-if targetos == 'freebsd'
-  freebsd_dep = util
-endif
-util_ss.add(when: 'CONFIG_POSIX', if_true: [files('oslib-posix.c'), freebsd_dep])
-util_ss.add(when: 'CONFIG_POSIX', if_true: files('qemu-thread-posix.c'))
-util_ss.add(when: 'CONFIG_POSIX', if_true: files('memfd.c'))
-util_ss.add(when: 'CONFIG_WIN32', if_true: files('aio-win32.c'))
-util_ss.add(when: 'CONFIG_WIN32', if_true: files('event_notifier-win32.c'))
-util_ss.add(when: 'CONFIG_WIN32', if_true: files('oslib-win32.c'))
-util_ss.add(when: 'CONFIG_WIN32', if_true: files('qemu-thread-win32.c'))
-util_ss.add(when: 'CONFIG_WIN32', if_true: winmm)
-util_ss.add(when: 'CONFIG_WIN32', if_true: pathcch)
 if glib_has_gslice
   util_ss.add(files('qtree.c'))
 endif
@@ -56,7 +59,6 @@ util_ss.add(files('reserved-region.c'))
 util_ss.add(files('stats64.c'))
 util_ss.add(files('systemd.c'))
 util_ss.add(files('transactions.c'))
-util_ss.add(when: 'CONFIG_POSIX', if_true: files('drm.c'))
 util_ss.add(files('guest-random.c'))
 util_ss.add(files('yank.c'))
 util_ss.add(files('int128.c'))
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 10/21] meson: remove config_targetos
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
                   ` (8 preceding siblings ...)
  2023-12-21 17:19 ` [PATCH 09/21] meson: remove CONFIG_POSIX and CONFIG_WIN32 " Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-29  9:42   ` Philippe Mathieu-Daudé
  2023-12-21 17:19 ` [PATCH 11/21] meson: remove CONFIG_ALL Paolo Bonzini
                   ` (10 subsequent siblings)
  20 siblings, 1 reply; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

config_targetos is now empty and can be removed; its use in sourcesets
that do not involve target-specific files can be replaced with an empty
dictionary.

In fact, at this point *all* sourcesets that do not involve
target-specific files are just glorified mutable arrays.  Enforce that
they never test for symbols in "when:" by computing the set of files
without "strict: false".

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 chardev/meson.build        |  2 +-
 gdbstub/meson.build        |  4 ++--
 meson.build                | 24 ++++++++++--------------
 qga/meson.build            |  2 +-
 storage-daemon/meson.build |  2 +-
 tcg/meson.build            |  2 +-
 tests/qtest/meson.build    |  2 +-
 7 files changed, 17 insertions(+), 21 deletions(-)

diff --git a/chardev/meson.build b/chardev/meson.build
index 9564ace868b..db6840b71af 100644
--- a/chardev/meson.build
+++ b/chardev/meson.build
@@ -28,7 +28,7 @@ else
   endif
 endif
 
-chardev_ss = chardev_ss.apply(config_targetos, strict: false)
+chardev_ss = chardev_ss.apply({})
 
 system_ss.add(files(
     'char-hmp-cmds.c',
diff --git a/gdbstub/meson.build b/gdbstub/meson.build
index e5bccba34e5..da5721d8452 100644
--- a/gdbstub/meson.build
+++ b/gdbstub/meson.build
@@ -14,8 +14,8 @@ gdb_system_ss = ss.source_set()
 gdb_user_ss.add(files('gdbstub.c', 'user.c'))
 gdb_system_ss.add(files('gdbstub.c', 'system.c'))
 
-gdb_user_ss = gdb_user_ss.apply(config_targetos, strict: false)
-gdb_system_ss = gdb_system_ss.apply(config_targetos, strict: false)
+gdb_user_ss = gdb_user_ss.apply({})
+gdb_system_ss = gdb_system_ss.apply({})
 
 libgdb_user = static_library('gdb_user',
                              gdb_user_ss.sources() + genh,
diff --git a/meson.build b/meson.build
index 0a0c68050e7..48d619e0611 100644
--- a/meson.build
+++ b/meson.build
@@ -2840,7 +2840,6 @@ endif
 ########################
 
 minikconf = find_program('scripts/minikconf.py')
-config_targetos = {}
 
 config_all = {}
 config_all_devices = {}
@@ -3039,7 +3038,6 @@ target_dirs = actual_target_dirs
 # pseudo symbol replaces it.
 
 config_all += config_all_devices
-config_all += config_targetos
 config_all += config_all_disas
 config_all += {
   'CONFIG_XEN': xen.found(),
@@ -3389,7 +3387,7 @@ if enable_modules
   modulecommon = declare_dependency(link_whole: libmodulecommon, compile_args: '-DBUILD_DSO')
 endif
 
-qom_ss = qom_ss.apply(config_targetos, strict: false)
+qom_ss = qom_ss.apply({})
 libqom = static_library('qom', qom_ss.sources() + genh,
                         dependencies: [qom_ss.dependencies()],
                         name_suffix: 'fa',
@@ -3404,10 +3402,10 @@ event_loop_base = static_library('event-loop-base',
 event_loop_base = declare_dependency(link_whole: event_loop_base,
                                      dependencies: [qom])
 
-stub_ss = stub_ss.apply(config_all, strict: false)
+stub_ss = stub_ss.apply({})
 
 util_ss.add_all(trace_ss)
-util_ss = util_ss.apply(config_all, strict: false)
+util_ss = util_ss.apply({})
 libqemuutil = static_library('qemuutil',
                              build_by_default: false,
                              sources: util_ss.sources() + stub_ss.sources() + genh,
@@ -3570,7 +3568,6 @@ foreach d, list : target_modules
       foreach target : target_dirs
         if target.endswith('-softmmu')
           config_target = config_target_mak[target]
-          config_target += config_targetos
           target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])]
           c_args = ['-DNEED_CPU_H',
                     '-DCONFIG_TARGET="@0@-config-target.h"'.format(target),
@@ -3631,7 +3628,7 @@ qemu_syms = custom_target('qemu.syms', output: 'qemu.syms',
                              capture: true,
                              command: [undefsym, nm, '@INPUT@'])
 
-authz_ss = authz_ss.apply(config_targetos, strict: false)
+authz_ss = authz_ss.apply({})
 libauthz = static_library('authz', authz_ss.sources() + genh,
                           dependencies: [authz_ss.dependencies()],
                           name_suffix: 'fa',
@@ -3640,7 +3637,7 @@ libauthz = static_library('authz', authz_ss.sources() + genh,
 authz = declare_dependency(link_whole: libauthz,
                            dependencies: qom)
 
-crypto_ss = crypto_ss.apply(config_targetos, strict: false)
+crypto_ss = crypto_ss.apply({})
 libcrypto = static_library('crypto', crypto_ss.sources() + genh,
                            dependencies: [crypto_ss.dependencies()],
                            name_suffix: 'fa',
@@ -3649,7 +3646,7 @@ libcrypto = static_library('crypto', crypto_ss.sources() + genh,
 crypto = declare_dependency(link_whole: libcrypto,
                             dependencies: [authz, qom])
 
-io_ss = io_ss.apply(config_targetos, strict: false)
+io_ss = io_ss.apply({})
 libio = static_library('io', io_ss.sources() + genh,
                        dependencies: [io_ss.dependencies()],
                        link_with: libqemuutil,
@@ -3665,7 +3662,7 @@ migration = declare_dependency(link_with: libmigration,
                                dependencies: [zlib, qom, io])
 system_ss.add(migration)
 
-block_ss = block_ss.apply(config_targetos, strict: false)
+block_ss = block_ss.apply({})
 libblock = static_library('block', block_ss.sources() + genh,
                           dependencies: block_ss.dependencies(),
                           link_depends: block_syms,
@@ -3676,7 +3673,7 @@ block = declare_dependency(link_whole: [libblock],
                            link_args: '@block.syms',
                            dependencies: [crypto, io])
 
-blockdev_ss = blockdev_ss.apply(config_targetos, strict: false)
+blockdev_ss = blockdev_ss.apply({})
 libblockdev = static_library('blockdev', blockdev_ss.sources() + genh,
                              dependencies: blockdev_ss.dependencies(),
                              name_suffix: 'fa',
@@ -3685,7 +3682,7 @@ libblockdev = static_library('blockdev', blockdev_ss.sources() + genh,
 blockdev = declare_dependency(link_whole: [libblockdev],
                               dependencies: [block, event_loop_base])
 
-qmp_ss = qmp_ss.apply(config_targetos, strict: false)
+qmp_ss = qmp_ss.apply({})
 libqmp = static_library('qmp', qmp_ss.sources() + genh,
                         dependencies: qmp_ss.dependencies(),
                         name_suffix: 'fa',
@@ -3700,7 +3697,7 @@ libchardev = static_library('chardev', chardev_ss.sources() + genh,
 
 chardev = declare_dependency(link_whole: libchardev)
 
-hwcore_ss = hwcore_ss.apply(config_targetos, strict: false)
+hwcore_ss = hwcore_ss.apply({})
 libhwcore = static_library('hwcore', sources: hwcore_ss.sources() + genh,
                            name_suffix: 'fa',
                            build_by_default: false)
@@ -3757,7 +3754,6 @@ foreach target : target_dirs
             '-DCONFIG_DEVICES="@0@-config-devices.h"'.format(target)]
   link_args = emulator_link_args
 
-  config_target += config_targetos
   target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])]
   if targetos == 'linux'
     target_inc += include_directories('linux-headers', is_system: true)
diff --git a/qga/meson.build b/qga/meson.build
index 1113e7c7fae..66c0f1e56f8 100644
--- a/qga/meson.build
+++ b/qga/meson.build
@@ -87,7 +87,7 @@ else
   endif
 endif
 
-qga_ss = qga_ss.apply(config_targetos, strict: false)
+qga_ss = qga_ss.apply({})
 
 gen_tlb = []
 qga_libs = []
diff --git a/storage-daemon/meson.build b/storage-daemon/meson.build
index 5e90cd32b40..46267b63e72 100644
--- a/storage-daemon/meson.build
+++ b/storage-daemon/meson.build
@@ -5,7 +5,7 @@ qsd_ss.add(blockdev, chardev, qmp, qom, qemuutil, gnutls)
 subdir('qapi')
 
 if have_tools
-  qsd_ss = qsd_ss.apply(config_targetos, strict: false)
+  qsd_ss = qsd_ss.apply({})
   qsd = executable('qemu-storage-daemon',
                    qsd_ss.sources(),
                    dependencies: qsd_ss.dependencies(),
diff --git a/tcg/meson.build b/tcg/meson.build
index 895a11d3fa2..5afdec1e1ae 100644
--- a/tcg/meson.build
+++ b/tcg/meson.build
@@ -22,7 +22,7 @@ if get_option('tcg_interpreter')
   tcg_ss.add(files('tci.c'))
 endif
 
-tcg_ss = tcg_ss.apply(config_targetos, strict: false)
+tcg_ss = tcg_ss.apply({})
 
 libtcg_user = static_library('tcg_user',
                              tcg_ss.sources() + genh,
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index 47dabf91d04..40a8bb043e4 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -310,7 +310,7 @@ qtests = {
   'ivshmem-test': [rt, '../../contrib/ivshmem-server/ivshmem-server.c'],
   'migration-test': migration_files,
   'pxe-test': files('boot-sector.c'),
-  'qos-test': [chardev, io, qos_test_ss.apply(config_targetos, strict: false).sources()],
+  'qos-test': [chardev, io, qos_test_ss.apply({}).sources()],
   'tpm-crb-swtpm-test': [io, tpmemu_files],
   'tpm-crb-test': [io, tpmemu_files],
   'tpm-tis-swtpm-test': [io, tpmemu_files, 'tpm-tis-util.c'],
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 11/21] meson: remove CONFIG_ALL
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
                   ` (9 preceding siblings ...)
  2023-12-21 17:19 ` [PATCH 10/21] meson: remove config_targetos Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-21 17:19 ` [PATCH 12/21] meson: rename config_all Paolo Bonzini
                   ` (9 subsequent siblings)
  20 siblings, 0 replies; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

CONFIG_ALL is tricky to use and was ported over to Meson from the
recursive processing of Makefile variables.  Meson sourcesets
however have all_sources() and all_dependencies() methods that
remove the need for it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 docs/devel/build-system.rst | 15 ---------------
 fsdev/meson.build           |  1 -
 hw/acpi/meson.build         |  5 -----
 hw/cxl/meson.build          |  2 --
 hw/display/meson.build      |  1 -
 hw/mem/meson.build          |  1 -
 hw/net/meson.build          |  2 --
 hw/pci-bridge/meson.build   |  2 --
 hw/pci/meson.build          |  1 -
 hw/remote/meson.build       |  1 -
 hw/smbios/meson.build       |  5 -----
 hw/virtio/meson.build       |  2 --
 meson.build                 | 32 +++++++-------------------------
 net/meson.build             |  2 --
 14 files changed, 7 insertions(+), 65 deletions(-)

diff --git a/docs/devel/build-system.rst b/docs/devel/build-system.rst
index 43d6005881e..09caf2f8e19 100644
--- a/docs/devel/build-system.rst
+++ b/docs/devel/build-system.rst
@@ -256,21 +256,6 @@ Target-independent emulator sourcesets:
   ``system_ss`` only in system emulators, ``user_ss`` only in user-mode
   emulators.
 
-  Target-independent sourcesets must exercise particular care when using
-  ``if_false`` rules.  The ``if_false`` rule will be used correctly when linking
-  emulator binaries; however, when *compiling* target-independent files
-  into .o files, Meson may need to pick *both* the ``if_true`` and
-  ``if_false`` sides to cater for targets that want either side.  To
-  achieve that, you can add a special rule using the ``CONFIG_ALL``
-  symbol::
-
-    # Some targets have CONFIG_ACPI, some don't, so this is not enough
-    system_ss.add(when: 'CONFIG_ACPI', if_true: files('acpi.c'),
-                                        if_false: files('acpi-stub.c'))
-
-    # This is required as well:
-    system_ss.add(when: 'CONFIG_ALL', if_true: files('acpi-stub.c'))
-
 Target-dependent emulator sourcesets:
   In the target-dependent set lives CPU emulation, some device emulation and
   much glue code. This sometimes also has to be compiled multiple times,
diff --git a/fsdev/meson.build b/fsdev/meson.build
index c76347615df..db67530d7f2 100644
--- a/fsdev/meson.build
+++ b/fsdev/meson.build
@@ -1,6 +1,5 @@
 fsdev_ss = ss.source_set()
 fsdev_ss.add(files('qemu-fsdev-opts.c', 'qemu-fsdev-throttle.c'))
-fsdev_ss.add(when: 'CONFIG_ALL', if_true: files('qemu-fsdev-dummy.c'))
 fsdev_ss.add(when: ['CONFIG_FSDEV_9P'], if_true: files(
   '9p-iov-marshal.c',
   '9p-marshal.c',
diff --git a/hw/acpi/meson.build b/hw/acpi/meson.build
index fc1b952379a..5441c9b1e4c 100644
--- a/hw/acpi/meson.build
+++ b/hw/acpi/meson.build
@@ -33,9 +33,4 @@ endif
 system_ss.add(when: 'CONFIG_ACPI', if_false: files('acpi-stub.c', 'aml-build-stub.c', 'ghes-stub.c', 'acpi_interface.c'))
 system_ss.add(when: 'CONFIG_ACPI_PCI_BRIDGE', if_false: files('pci-bridge-stub.c'))
 system_ss.add_all(when: 'CONFIG_ACPI', if_true: acpi_ss)
-system_ss.add(when: 'CONFIG_ALL', if_true: files('acpi-stub.c', 'aml-build-stub.c',
-                                                  'acpi-x86-stub.c', 'ipmi-stub.c', 'ghes-stub.c',
-                                                  'acpi-mem-hotplug-stub.c', 'acpi-cpu-hotplug-stub.c',
-                                                  'acpi-pci-hotplug-stub.c', 'acpi-nvdimm-stub.c',
-                                                  'cxl-stub.c', 'pci-bridge-stub.c'))
 system_ss.add(files('acpi-qmp-cmds.c'))
diff --git a/hw/cxl/meson.build b/hw/cxl/meson.build
index ea0aebf6e3c..3e375f61a98 100644
--- a/hw/cxl/meson.build
+++ b/hw/cxl/meson.build
@@ -11,5 +11,3 @@ system_ss.add(when: 'CONFIG_CXL',
                if_false: files(
                    'cxl-host-stubs.c',
                ))
-
-system_ss.add(when: 'CONFIG_ALL', if_true: files('cxl-host-stubs.c'))
diff --git a/hw/display/meson.build b/hw/display/meson.build
index 02b0044c9ec..ac0159c516e 100644
--- a/hw/display/meson.build
+++ b/hw/display/meson.build
@@ -143,5 +143,4 @@ endif
 
 system_ss.add(when: 'CONFIG_OMAP', if_true: files('omap_lcdc.c'))
 
-system_ss.add(when: 'CONFIG_ALL', if_true: files('acpi-vga-stub.c'))
 modules += { 'hw-display': hw_display_modules }
diff --git a/hw/mem/meson.build b/hw/mem/meson.build
index ec26ef55443..faee1fe9360 100644
--- a/hw/mem/meson.build
+++ b/hw/mem/meson.build
@@ -5,7 +5,6 @@ mem_ss.add(when: 'CONFIG_NPCM7XX', if_true: files('npcm7xx_mc.c'))
 mem_ss.add(when: 'CONFIG_NVDIMM', if_true: files('nvdimm.c'))
 mem_ss.add(when: 'CONFIG_CXL_MEM_DEVICE', if_true: files('cxl_type3.c'))
 system_ss.add(when: 'CONFIG_CXL_MEM_DEVICE', if_false: files('cxl_type3_stubs.c'))
-system_ss.add(when: 'CONFIG_ALL', if_true: files('cxl_type3_stubs.c'))
 
 system_ss.add_all(when: 'CONFIG_MEM_DEVICE', if_true: mem_ss)
 
diff --git a/hw/net/meson.build b/hw/net/meson.build
index f64651c467e..9afceb06191 100644
--- a/hw/net/meson.build
+++ b/hw/net/meson.build
@@ -50,7 +50,6 @@ specific_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('virtio-net.c'))
 
 if have_vhost_net
   system_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost_net.c'), if_false: files('vhost_net-stub.c'))
-  system_ss.add(when: 'CONFIG_ALL', if_true: files('vhost_net-stub.c'))
 else
   system_ss.add(files('vhost_net-stub.c'))
 endif
@@ -69,7 +68,6 @@ system_ss.add(when: 'CONFIG_ROCKER', if_true: files(
   'rocker/rocker_of_dpa.c',
   'rocker/rocker_world.c',
 ), if_false: files('rocker/qmp-norocker.c'))
-system_ss.add(when: 'CONFIG_ALL', if_true: files('rocker/qmp-norocker.c'))
 system_ss.add(files('rocker/rocker-hmp-cmds.c'))
 
 subdir('can')
diff --git a/hw/pci-bridge/meson.build b/hw/pci-bridge/meson.build
index 6d5ad9f37b2..f2a60434dda 100644
--- a/hw/pci-bridge/meson.build
+++ b/hw/pci-bridge/meson.build
@@ -13,5 +13,3 @@ pci_ss.add(when: 'CONFIG_CXL', if_true: files('cxl_root_port.c', 'cxl_upstream.c
 pci_ss.add(when: 'CONFIG_SIMBA', if_true: files('simba.c'))
 
 system_ss.add_all(when: 'CONFIG_PCI', if_true: pci_ss)
-
-system_ss.add(when: 'CONFIG_ALL', if_true: files('pci_expander_bridge_stubs.c'))
diff --git a/hw/pci/meson.build b/hw/pci/meson.build
index b1855452f5b..b9c34b2acfe 100644
--- a/hw/pci/meson.build
+++ b/hw/pci/meson.build
@@ -20,4 +20,3 @@ system_ss.add(when: 'CONFIG_PCI_EXPRESS', if_true: files('pcie_port.c', 'pcie_ho
 system_ss.add_all(when: 'CONFIG_PCI', if_true: pci_ss)
 
 system_ss.add(when: 'CONFIG_PCI', if_false: files('pci-stub.c'))
-system_ss.add(when: 'CONFIG_ALL', if_true: files('pci-stub.c'))
diff --git a/hw/remote/meson.build b/hw/remote/meson.build
index a3aa29aaf17..41eb4971d98 100644
--- a/hw/remote/meson.build
+++ b/hw/remote/meson.build
@@ -11,7 +11,6 @@ remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('iommu.c'))
 remote_ss.add(when: 'CONFIG_VFIO_USER_SERVER', if_true: libvfio_user_dep)
 remote_ss.add(when: 'CONFIG_VFIO_USER_SERVER', if_true: files('vfio-user-obj.c'),
               if_false: files('vfio-user-obj-stub.c'))
-remote_ss.add(when: 'CONFIG_ALL', if_true: files('vfio-user-obj-stub.c'))
 
 specific_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('memory.c'))
 specific_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('proxy-memory-listener.c'))
diff --git a/hw/smbios/meson.build b/hw/smbios/meson.build
index 6eeae4b35c2..70469674621 100644
--- a/hw/smbios/meson.build
+++ b/hw/smbios/meson.build
@@ -6,8 +6,3 @@ smbios_ss.add(when: 'CONFIG_IPMI',
 
 system_ss.add_all(when: 'CONFIG_SMBIOS', if_true: smbios_ss)
 system_ss.add(when: 'CONFIG_SMBIOS', if_false: files('smbios-stub.c'))
-
-system_ss.add(when: 'CONFIG_ALL', if_true: files(
-  'smbios-stub.c',
-  'smbios_type_38-stub.c',
-))
diff --git a/hw/virtio/meson.build b/hw/virtio/meson.build
index c0055a78326..c8c1001451d 100644
--- a/hw/virtio/meson.build
+++ b/hw/virtio/meson.build
@@ -74,8 +74,6 @@ specific_virtio_ss.add_all(when: 'CONFIG_VIRTIO_PCI', if_true: virtio_pci_ss)
 system_ss.add_all(when: 'CONFIG_VIRTIO', if_true: system_virtio_ss)
 system_ss.add(when: 'CONFIG_VIRTIO', if_false: files('vhost-stub.c'))
 system_ss.add(when: 'CONFIG_VIRTIO', if_false: files('virtio-stub.c'))
-system_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-stub.c'))
-system_ss.add(when: 'CONFIG_ALL', if_true: files('virtio-stub.c'))
 system_ss.add(files('virtio-hmp-cmds.c'))
 
 specific_ss.add_all(when: 'CONFIG_VIRTIO', if_true: specific_virtio_ss)
diff --git a/meson.build b/meson.build
index 48d619e0611..49cc1886bb2 100644
--- a/meson.build
+++ b/meson.build
@@ -2843,7 +2843,6 @@ minikconf = find_program('scripts/minikconf.py')
 
 config_all = {}
 config_all_devices = {}
-config_all_disas = {}
 config_devices_mak_list = []
 config_devices_h = {}
 config_target_h = {}
@@ -2969,7 +2968,6 @@ foreach target : target_dirs
     if host_arch.startswith(k) or config_target['TARGET_BASE_ARCH'].startswith(k)
       foreach sym: v
         config_target += { sym: 'y' }
-        config_all_disas += { sym: 'y' }
       endforeach
     endif
   endforeach
@@ -3028,24 +3026,6 @@ foreach target : target_dirs
 endforeach
 target_dirs = actual_target_dirs
 
-# This configuration is used to build files that are shared by
-# multiple binaries, and then extracted out of the "common"
-# static_library target.
-#
-# We do not use all_sources()/all_dependencies(), because it would
-# build literally all source files, including devices only used by
-# targets that are not built for this compilation.  The CONFIG_ALL
-# pseudo symbol replaces it.
-
-config_all += config_all_devices
-config_all += config_all_disas
-config_all += {
-  'CONFIG_XEN': xen.found(),
-  'CONFIG_SYSTEM_ONLY': have_system,
-  'CONFIG_USER_ONLY': have_user,
-  'CONFIG_ALL': true,
-}
-
 target_configs_h = []
 foreach target: target_dirs
   target_configs_h += config_target_h[target]
@@ -3532,7 +3512,7 @@ foreach d, list : modules
 
   foreach m, module_ss : list
     if enable_modules
-      module_ss = module_ss.apply(config_all, strict: false)
+      module_ss = module_ss.apply(config_all_devices, strict: false)
       sl = static_library(d + '-' + m, [genh, module_ss.sources()],
                           dependencies: [modulecommon, module_ss.dependencies()], pic: true)
       if d == 'block'
@@ -3727,13 +3707,15 @@ common_ss.add(qom, qemuutil)
 common_ss.add_all(when: 'CONFIG_SYSTEM_ONLY', if_true: [system_ss])
 common_ss.add_all(when: 'CONFIG_USER_ONLY', if_true: user_ss)
 
-common_all = common_ss.apply(config_all, strict: false)
+# Note that this library is never used directly (only through extract_objects)
+# and is not built by default; therefore, source files not used by the build
+# configuration will be in build.ninja, but are never built by default.
 common_all = static_library('common',
                             build_by_default: false,
-                            sources: common_all.sources() + genh,
+                            sources: common_ss.all_sources() + genh,
                             include_directories: common_user_inc,
                             implicit_include_directories: false,
-                            dependencies: common_all.dependencies(),
+                            dependencies: common_ss.all_dependencies(),
                             name_suffix: 'fa')
 
 feature_to_c = find_program('scripts/feature_to_c.py')
@@ -4206,7 +4188,7 @@ if have_system
   if xen.found()
     summary_info += {'xen ctrl version':  xen.version()}
   endif
-  summary_info += {'Xen emulation':     config_all.has_key('CONFIG_XEN_EMU')}
+  summary_info += {'Xen emulation':     config_all_devices.has_key('CONFIG_XEN_EMU')}
 endif
 summary_info += {'TCG support':       config_all.has_key('CONFIG_TCG')}
 if config_all.has_key('CONFIG_TCG')
diff --git a/net/meson.build b/net/meson.build
index ce99bd4447f..a53f18ad7b4 100644
--- a/net/meson.build
+++ b/net/meson.build
@@ -41,7 +41,6 @@ system_ss.add(when: libxdp, if_true: files('af-xdp.c'))
 
 if have_vhost_net_user
   system_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost-user.c'), if_false: files('vhost-user-stub.c'))
-  system_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-user-stub.c'))
 endif
 
 if targetos == 'windows'
@@ -57,7 +56,6 @@ else
 endif
 if have_vhost_net_vdpa
   system_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost-vdpa.c'), if_false: files('vhost-vdpa-stub.c'))
-  system_ss.add(when: 'CONFIG_ALL', if_true: files('vhost-vdpa-stub.c'))
 endif
 
 vmnet_files = files(
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 12/21] meson: rename config_all
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
                   ` (10 preceding siblings ...)
  2023-12-21 17:19 ` [PATCH 11/21] meson: remove CONFIG_ALL Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-29  9:43   ` Philippe Mathieu-Daudé
  2023-12-21 17:19 ` [PATCH 13/21] meson: add more sections to main meson.build Paolo Bonzini
                   ` (8 subsequent siblings)
  20 siblings, 1 reply; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

config_all now lists only accelerators, rename it to indicate its actual
content.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/mips/meson.build     |  2 +-
 meson.build             | 16 ++++++++--------
 target/arm/meson.build  |  2 +-
 target/mips/meson.build |  2 +-
 tests/fp/meson.build    |  2 +-
 tests/meson.build       |  2 +-
 tests/qtest/meson.build |  8 ++++----
 7 files changed, 17 insertions(+), 17 deletions(-)

diff --git a/hw/mips/meson.build b/hw/mips/meson.build
index 900613fc087..f06d88f3430 100644
--- a/hw/mips/meson.build
+++ b/hw/mips/meson.build
@@ -5,7 +5,7 @@ mips_ss.add(when: 'CONFIG_LOONGSON3V', if_true: files('loongson3_bootp.c', 'loon
 mips_ss.add(when: 'CONFIG_MALTA', if_true: files('malta.c'))
 mips_ss.add(when: 'CONFIG_MIPS_CPS', if_true: files('cps.c'))
 
-if 'CONFIG_TCG' in config_all
+if 'CONFIG_TCG' in config_all_accel
 mips_ss.add(when: 'CONFIG_JAZZ', if_true: files('jazz.c'))
 mips_ss.add(when: 'CONFIG_MIPSSIM', if_true: files('mipssim.c'))
 mips_ss.add(when: 'CONFIG_FULOONG', if_true: files('fuloong2e.c'))
diff --git a/meson.build b/meson.build
index 49cc1886bb2..b5a85c4c255 100644
--- a/meson.build
+++ b/meson.build
@@ -2841,7 +2841,7 @@ endif
 
 minikconf = find_program('scripts/minikconf.py')
 
-config_all = {}
+config_all_accel = {}
 config_all_devices = {}
 config_devices_mak_list = []
 config_devices_h = {}
@@ -2929,7 +2929,7 @@ foreach target : target_dirs
   foreach sym: accelerators
     if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, [])
       config_target += { sym: 'y' }
-      config_all += { sym: 'y' }
+      config_all_accel += { sym: 'y' }
       if target in modular_tcg
         config_target += { 'CONFIG_TCG_MODULAR': 'y' }
       else
@@ -4180,18 +4180,18 @@ endif
 # Targets and accelerators
 summary_info = {}
 if have_system
-  summary_info += {'KVM support':       config_all.has_key('CONFIG_KVM')}
-  summary_info += {'HVF support':       config_all.has_key('CONFIG_HVF')}
-  summary_info += {'WHPX support':      config_all.has_key('CONFIG_WHPX')}
-  summary_info += {'NVMM support':      config_all.has_key('CONFIG_NVMM')}
+  summary_info += {'KVM support':       config_all_accel.has_key('CONFIG_KVM')}
+  summary_info += {'HVF support':       config_all_accel.has_key('CONFIG_HVF')}
+  summary_info += {'WHPX support':      config_all_accel.has_key('CONFIG_WHPX')}
+  summary_info += {'NVMM support':      config_all_accel.has_key('CONFIG_NVMM')}
   summary_info += {'Xen support':       xen.found()}
   if xen.found()
     summary_info += {'xen ctrl version':  xen.version()}
   endif
   summary_info += {'Xen emulation':     config_all_devices.has_key('CONFIG_XEN_EMU')}
 endif
-summary_info += {'TCG support':       config_all.has_key('CONFIG_TCG')}
-if config_all.has_key('CONFIG_TCG')
+summary_info += {'TCG support':       config_all_accel.has_key('CONFIG_TCG')}
+if config_all_accel.has_key('CONFIG_TCG')
   if get_option('tcg_interpreter')
     summary_info += {'TCG backend':   'TCI (TCG with bytecode interpreter, slow)'}
   else
diff --git a/target/arm/meson.build b/target/arm/meson.build
index d6c3902e676..46b5a21eb31 100644
--- a/target/arm/meson.build
+++ b/target/arm/meson.build
@@ -28,7 +28,7 @@ arm_system_ss.add(files(
 
 subdir('hvf')
 
-if 'CONFIG_TCG' in config_all
+if 'CONFIG_TCG' in config_all_accel
    subdir('tcg')
 else
     arm_ss.add(files('tcg-stubs.c'))
diff --git a/target/mips/meson.build b/target/mips/meson.build
index e57ef24ecf4..a26d1e1f792 100644
--- a/target/mips/meson.build
+++ b/target/mips/meson.build
@@ -12,7 +12,7 @@ if have_system
   subdir('sysemu')
 endif
 
-if 'CONFIG_TCG' in config_all
+if 'CONFIG_TCG' in config_all_accel
   subdir('tcg')
 endif
 
diff --git a/tests/fp/meson.build b/tests/fp/meson.build
index cbc17392d67..9ef322afc42 100644
--- a/tests/fp/meson.build
+++ b/tests/fp/meson.build
@@ -1,4 +1,4 @@
-if 'CONFIG_TCG' not in config_all
+if 'CONFIG_TCG' not in config_all_accel
   subdir_done()
 endif
 # There are namespace pollution issues on Windows, due to osdep.h
diff --git a/tests/meson.build b/tests/meson.build
index 9996a293fbb..32cc15a3ef7 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -76,7 +76,7 @@ endif
 
 subdir('decode')
 
-if 'CONFIG_TCG' in config_all
+if 'CONFIG_TCG' in config_all_accel
   subdir('fp')
 endif
 
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index 40a8bb043e4..565eff4c0a2 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -155,8 +155,8 @@ qtests_ppc = \
   qtests_filter + \
   (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) +            \
   (config_all_devices.has_key('CONFIG_M48T59') ? ['m48t59-test'] : []) +                     \
-  (config_all.has_key('CONFIG_TCG') ? ['prom-env-test'] : []) +                              \
-  (config_all.has_key('CONFIG_TCG') ? ['boot-serial-test'] : []) +                           \
+  (config_all_accel.has_key('CONFIG_TCG') ? ['prom-env-test'] : []) +                              \
+  (config_all_accel.has_key('CONFIG_TCG') ? ['boot-serial-test'] : []) +                           \
   ['boot-order-test']
 
 qtests_ppc64 = \
@@ -213,12 +213,12 @@ qtests_arm = \
 # TODO: once aarch64 TCG is fixed on ARM 32 bit host, make bios-tables-test unconditional
 qtests_aarch64 = \
   (cpu != 'arm' and unpack_edk2_blobs ? ['bios-tables-test'] : []) +                            \
-  (config_all.has_key('CONFIG_TCG') and config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ?            \
+  (config_all_accel.has_key('CONFIG_TCG') and config_all_devices.has_key('CONFIG_TPM_TIS_SYSBUS') ?            \
     ['tpm-tis-device-test', 'tpm-tis-device-swtpm-test'] : []) +                                         \
   (config_all_devices.has_key('CONFIG_XLNX_ZYNQMP_ARM') ? ['xlnx-can-test', 'fuzz-xlnx-dp-test'] : []) + \
   (config_all_devices.has_key('CONFIG_XLNX_VERSAL') ? ['xlnx-canfd-test', 'xlnx-versal-trng-test'] : []) + \
   (config_all_devices.has_key('CONFIG_RASPI') ? ['bcm2835-dma-test'] : []) +  \
-  (config_all.has_key('CONFIG_TCG') and                                            \
+  (config_all_accel.has_key('CONFIG_TCG') and                                            \
    config_all_devices.has_key('CONFIG_TPM_TIS_I2C') ? ['tpm-tis-i2c-test'] : []) + \
   ['arm-cpu-features',
    'numa-test',
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 13/21] meson: add more sections to main meson.build
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
                   ` (11 preceding siblings ...)
  2023-12-21 17:19 ` [PATCH 12/21] meson: rename config_all Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-29  9:44   ` Philippe Mathieu-Daudé
  2023-12-21 17:19 ` [PATCH 14/21] meson: move program checks together Paolo Bonzini
                   ` (7 subsequent siblings)
  20 siblings, 1 reply; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 24 ++++++++++++++++++------
 1 file changed, 18 insertions(+), 6 deletions(-)

diff --git a/meson.build b/meson.build
index b5a85c4c255..b8c64c5ecf7 100644
--- a/meson.build
+++ b/meson.build
@@ -9,6 +9,10 @@ add_test_setup('thorough', env: ['G_TEST_SLOW=1', 'SPEED=thorough'])
 
 meson.add_postconf_script(find_program('scripts/symlink-install-tree.py'))
 
+####################
+# Global variables #
+####################
+
 not_found = dependency('', required: false)
 keyval = import('keyval')
 ss = import('sourceset')
@@ -86,8 +90,16 @@ enable_modules = get_option('modules') \
   .allowed()
 have_block = have_system or have_tools
 
+############
+# Programs #
+############
+
 python = import('python').find_installation()
 
+#######################################
+# Variables for host and accelerators #
+#######################################
+
 if cpu not in supported_cpus
   host_arch = 'unknown'
 elif cpu == 'x86'
@@ -518,9 +530,9 @@ if sparse.found()
                        '-Wno-non-pointer-null'])
 endif
 
-###########################################
-# Target-specific checks and dependencies #
-###########################################
+#####################
+# Option validation #
+#####################
 
 # Fuzzing
 if get_option('fuzzing') and get_option('fuzzing_engine') == '' and \
@@ -3495,9 +3507,9 @@ specific_ss.add_all(when: 'CONFIG_TCG_BUILTIN', if_true: tcg_module_ss)
 target_modules += { 'accel' : { 'qtest': qtest_module_ss,
                                 'tcg': tcg_real_module_ss }}
 
-########################
-# Library dependencies #
-########################
+##############################################
+# Internal static_libraries and dependencies #
+##############################################
 
 modinfo_collect = find_program('scripts/modinfo-collect.py')
 modinfo_generate = find_program('scripts/modinfo-generate.py')
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 14/21] meson: move program checks together
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
                   ` (12 preceding siblings ...)
  2023-12-21 17:19 ` [PATCH 13/21] meson: add more sections to main meson.build Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-29  9:50   ` Philippe Mathieu-Daudé
  2023-12-21 17:19 ` [PATCH 15/21] meson: move option validation a bit closer Paolo Bonzini
                   ` (6 subsequent siblings)
  20 siblings, 1 reply; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 90 ++++++++++++++++++++++++++---------------------------
 1 file changed, 45 insertions(+), 45 deletions(-)

diff --git a/meson.build b/meson.build
index b8c64c5ecf7..1a1e006ba13 100644
--- a/meson.build
+++ b/meson.build
@@ -19,21 +19,8 @@ ss = import('sourceset')
 fs = import('fs')
 
 targetos = host_machine.system()
-sh = find_program('sh')
 config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
 
-cc = meson.get_compiler('c')
-all_languages = ['c']
-if targetos == 'windows' and add_languages('cpp', required: false, native: false)
-  all_languages += ['cpp']
-  cxx = meson.get_compiler('cpp')
-endif
-if targetos == 'darwin' and \
-   add_languages('objc', required: get_option('cocoa'), native: false)
-  all_languages += ['objc']
-  objc = meson.get_compiler('objc')
-endif
-
 # Temporary directory used for files created while
 # configure runs. Since it is in the build directory
 # we can safely blow away any previous version of it
@@ -94,8 +81,53 @@ have_block = have_system or have_tools
 # Programs #
 ############
 
+sh = find_program('sh')
 python = import('python').find_installation()
 
+cc = meson.get_compiler('c')
+all_languages = ['c']
+if targetos == 'windows' and add_languages('cpp', required: false, native: false)
+  all_languages += ['cpp']
+  cxx = meson.get_compiler('cpp')
+endif
+if targetos == 'darwin' and \
+   add_languages('objc', required: get_option('cocoa'), native: false)
+  all_languages += ['objc']
+  objc = meson.get_compiler('objc')
+endif
+
+dtrace = not_found
+stap = not_found
+if 'dtrace' in get_option('trace_backends')
+  dtrace = find_program('dtrace', required: true)
+  stap = find_program('stap', required: false)
+  if stap.found()
+    # Workaround to avoid dtrace(1) producing a file with 'hidden' symbol
+    # visibility. Define STAP_SDT_V2 to produce 'default' symbol visibility
+    # instead. QEMU --enable-modules depends on this because the SystemTap
+    # semaphores are linked into the main binary and not the module's shared
+    # object.
+    add_global_arguments('-DSTAP_SDT_V2',
+                         native: false, language: all_languages)
+  endif
+endif
+
+if get_option('iasl') == ''
+  iasl = find_program('iasl', required: false)
+else
+  iasl = find_program(get_option('iasl'), required: true)
+endif
+
+edk2_targets = [ 'arm-softmmu', 'aarch64-softmmu', 'i386-softmmu', 'x86_64-softmmu' ]
+unpack_edk2_blobs = false
+foreach target : edk2_targets
+  if target in target_dirs
+    bzip2 = find_program('bzip2', required: get_option('install_blobs'))
+    unpack_edk2_blobs = bzip2.found()
+    break
+  endif
+endforeach
+
 #######################################
 # Variables for host and accelerators #
 #######################################
@@ -167,38 +199,6 @@ if targetos != 'darwin'
   modular_tcg = ['i386-softmmu', 'x86_64-softmmu']
 endif
 
-edk2_targets = [ 'arm-softmmu', 'aarch64-softmmu', 'i386-softmmu', 'x86_64-softmmu' ]
-unpack_edk2_blobs = false
-foreach target : edk2_targets
-  if target in target_dirs
-    bzip2 = find_program('bzip2', required: get_option('install_blobs'))
-    unpack_edk2_blobs = bzip2.found()
-    break
-  endif
-endforeach
-
-dtrace = not_found
-stap = not_found
-if 'dtrace' in get_option('trace_backends')
-  dtrace = find_program('dtrace', required: true)
-  stap = find_program('stap', required: false)
-  if stap.found()
-    # Workaround to avoid dtrace(1) producing a file with 'hidden' symbol
-    # visibility. Define STAP_SDT_V2 to produce 'default' symbol visibility
-    # instead. QEMU --enable-modules depends on this because the SystemTap
-    # semaphores are linked into the main binary and not the module's shared
-    # object.
-    add_global_arguments('-DSTAP_SDT_V2',
-                         native: false, language: all_languages)
-  endif
-endif
-
-if get_option('iasl') == ''
-  iasl = find_program('iasl', required: false)
-else
-  iasl = find_program(get_option('iasl'), required: true)
-endif
-
 ##################
 # Compiler flags #
 ##################
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 15/21] meson: move option validation a bit closer
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
                   ` (13 preceding siblings ...)
  2023-12-21 17:19 ` [PATCH 14/21] meson: move program checks together Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-21 17:19 ` [PATCH 16/21] meson: separate host-specific checks from option validation Paolo Bonzini
                   ` (5 subsequent siblings)
  20 siblings, 0 replies; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

Not entirely possible for option that depend on compiler or dependency checks,
but it's a start.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 52 ++++++++++++++++++++++++++++------------------------
 1 file changed, 28 insertions(+), 24 deletions(-)

diff --git a/meson.build b/meson.build
index 1a1e006ba13..f7e7deeabdc 100644
--- a/meson.build
+++ b/meson.build
@@ -52,30 +52,6 @@ supported_cpus = ['ppc', 'ppc64', 's390x', 'riscv32', 'riscv64', 'x86', 'x86_64'
 cpu = host_machine.cpu_family()
 
 target_dirs = config_host['TARGET_DIRS'].split()
-have_linux_user = false
-have_bsd_user = false
-have_system = false
-foreach target : target_dirs
-  have_linux_user = have_linux_user or target.endswith('linux-user')
-  have_bsd_user = have_bsd_user or target.endswith('bsd-user')
-  have_system = have_system or target.endswith('-softmmu')
-endforeach
-have_user = have_linux_user or have_bsd_user
-have_tools = get_option('tools') \
-  .disable_auto_if(not have_system) \
-  .allowed()
-have_ga = get_option('guest_agent') \
-  .disable_auto_if(not have_system and not have_tools) \
-  .require(targetos in ['sunos', 'linux', 'windows', 'freebsd', 'netbsd', 'openbsd'],
-           error_message: 'unsupported OS for QEMU guest agent') \
-  .allowed()
-enable_modules = get_option('modules') \
-  .require(targetos != 'windows',
-           error_message: 'Modules are not available for Windows') \
-  .require(not get_option('prefer_static'),
-           error_message: 'Modules are incompatible with static linking') \
-  .allowed()
-have_block = have_system or have_tools
 
 ############
 # Programs #
@@ -576,6 +552,34 @@ have_tpm = get_option('tpm') \
   .require(targetos != 'windows', error_message: 'TPM emulation only available on POSIX systems') \
   .allowed()
 
+# type of binaries to build
+have_linux_user = false
+have_bsd_user = false
+have_system = false
+foreach target : target_dirs
+  have_linux_user = have_linux_user or target.endswith('linux-user')
+  have_bsd_user = have_bsd_user or target.endswith('bsd-user')
+  have_system = have_system or target.endswith('-softmmu')
+endforeach
+have_user = have_linux_user or have_bsd_user
+
+have_tools = get_option('tools') \
+  .disable_auto_if(not have_system) \
+  .allowed()
+have_ga = get_option('guest_agent') \
+  .disable_auto_if(not have_system and not have_tools) \
+  .require(targetos in ['sunos', 'linux', 'windows', 'freebsd', 'netbsd', 'openbsd'],
+           error_message: 'unsupported OS for QEMU guest agent') \
+  .allowed()
+
+have_block = have_system or have_tools
+enable_modules = get_option('modules') \
+  .require(targetos != 'windows',
+           error_message: 'Modules are not available for Windows') \
+  .require(not get_option('prefer_static'),
+           error_message: 'Modules are incompatible with static linking') \
+  .allowed()
+
 # vhost
 have_vhost_user = get_option('vhost_user') \
   .disable_auto_if(targetos != 'linux') \
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 16/21] meson: separate host-specific checks from option validation
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
                   ` (14 preceding siblings ...)
  2023-12-21 17:19 ` [PATCH 15/21] meson: move option validation a bit closer Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-29  9:54   ` Philippe Mathieu-Daudé
  2023-12-21 17:19 ` [PATCH 17/21] meson: keep subprojects together Paolo Bonzini
                   ` (4 subsequent siblings)
  20 siblings, 1 reply; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 97 +++++++++++++++++++++++++++--------------------------
 1 file changed, 50 insertions(+), 47 deletions(-)

diff --git a/meson.build b/meson.build
index f7e7deeabdc..e777f507ce3 100644
--- a/meson.build
+++ b/meson.build
@@ -602,53 +602,6 @@ have_vhost_net_vdpa = have_vhost_vdpa and get_option('vhost_net').allowed()
 have_vhost_net_kernel = have_vhost_kernel and get_option('vhost_net').allowed()
 have_vhost_net = have_vhost_net_kernel or have_vhost_net_user or have_vhost_net_vdpa
 
-# Target-specific libraries and flags
-libm = cc.find_library('m', required: false)
-threads = dependency('threads')
-util = cc.find_library('util', required: false)
-winmm = []
-socket = []
-version_res = []
-coref = []
-iokit = []
-emulator_link_args = []
-nvmm =not_found
-hvf = not_found
-midl = not_found
-widl = not_found
-pathcch = not_found
-host_dsosuf = '.so'
-if targetos == 'windows'
-  midl = find_program('midl', required: false)
-  widl = find_program('widl', required: false)
-  pathcch = cc.find_library('pathcch')
-  socket = cc.find_library('ws2_32')
-  winmm = cc.find_library('winmm')
-
-  win = import('windows')
-  version_res = win.compile_resources('version.rc',
-                                      depend_files: files('pc-bios/qemu-nsis.ico'),
-                                      include_directories: include_directories('.'))
-  host_dsosuf = '.dll'
-elif targetos == 'darwin'
-  coref = dependency('appleframeworks', modules: 'CoreFoundation')
-  iokit = dependency('appleframeworks', modules: 'IOKit', required: false)
-  host_dsosuf = '.dylib'
-elif targetos == 'sunos'
-  socket = [cc.find_library('socket'),
-            cc.find_library('nsl'),
-            cc.find_library('resolv')]
-elif targetos == 'haiku'
-  socket = [cc.find_library('posix_error_mapper'),
-            cc.find_library('network'),
-            cc.find_library('bsd')]
-elif targetos == 'openbsd'
-  if get_option('tcg').allowed() and target_dirs.length() > 0
-    # Disable OpenBSD W^X if available
-    emulator_link_args = cc.get_supported_link_arguments('-Wl,-z,wxneeded')
-  endif
-endif
-
 # Target-specific configuration of accelerators
 accelerators = []
 if get_option('kvm').allowed() and targetos == 'linux'
@@ -716,6 +669,56 @@ if 'CONFIG_WHPX' not in accelerators and get_option('whpx').enabled()
   error('WHPX not available on this platform')
 endif
 
+#####################################
+# Host-specific libraries and flags #
+#####################################
+
+libm = cc.find_library('m', required: false)
+threads = dependency('threads')
+util = cc.find_library('util', required: false)
+winmm = []
+socket = []
+version_res = []
+coref = []
+iokit = []
+emulator_link_args = []
+nvmm =not_found
+hvf = not_found
+midl = not_found
+widl = not_found
+pathcch = not_found
+host_dsosuf = '.so'
+if targetos == 'windows'
+  midl = find_program('midl', required: false)
+  widl = find_program('widl', required: false)
+  pathcch = cc.find_library('pathcch')
+  socket = cc.find_library('ws2_32')
+  winmm = cc.find_library('winmm')
+
+  win = import('windows')
+  version_res = win.compile_resources('version.rc',
+                                      depend_files: files('pc-bios/qemu-nsis.ico'),
+                                      include_directories: include_directories('.'))
+  host_dsosuf = '.dll'
+elif targetos == 'darwin'
+  coref = dependency('appleframeworks', modules: 'CoreFoundation')
+  iokit = dependency('appleframeworks', modules: 'IOKit', required: false)
+  host_dsosuf = '.dylib'
+elif targetos == 'sunos'
+  socket = [cc.find_library('socket'),
+            cc.find_library('nsl'),
+            cc.find_library('resolv')]
+elif targetos == 'haiku'
+  socket = [cc.find_library('posix_error_mapper'),
+            cc.find_library('network'),
+            cc.find_library('bsd')]
+elif targetos == 'openbsd'
+  if get_option('tcg').allowed() and target_dirs.length() > 0
+    # Disable OpenBSD W^X if available
+    emulator_link_args = cc.get_supported_link_arguments('-Wl,-z,wxneeded')
+  endif
+endif
+
 ################
 # Dependencies #
 ################
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 17/21] meson: keep subprojects together
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
                   ` (15 preceding siblings ...)
  2023-12-21 17:19 ` [PATCH 16/21] meson: separate host-specific checks from option validation Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-21 17:19 ` [PATCH 18/21] meson: move CFI detection code earlier Paolo Bonzini
                   ` (3 subsequent siblings)
  20 siblings, 0 replies; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

And move away dependencies that are not subprojects anymore.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 72 ++++++++++++++++++++++++++---------------------------
 1 file changed, 36 insertions(+), 36 deletions(-)

diff --git a/meson.build b/meson.build
index e777f507ce3..f8d61a46ad1 100644
--- a/meson.build
+++ b/meson.build
@@ -1538,6 +1538,25 @@ if not gnutls_crypto.found()
   endif
 endif
 
+capstone = not_found
+if not get_option('capstone').auto() or have_system or have_user
+  capstone = dependency('capstone', version: '>=3.0.5',
+                        method: 'pkg-config',
+                        required: get_option('capstone'))
+
+  # Some versions of capstone have broken pkg-config file
+  # that reports a wrong -I path, causing the #include to
+  # fail later. If the system has such a broken version
+  # do not use it.
+  if capstone.found() and not cc.compiles('#include <capstone.h>',
+                                          dependencies: [capstone])
+    capstone = not_found
+    if get_option('capstone').enabled()
+      error('capstone requested, but it does not appear to work')
+    endif
+  endif
+endif
+
 gmp = dependency('gmp', required: false, method: 'pkg-config')
 if nettle.found() and gmp.found()
   hogweed = dependency('hogweed', version: '>=3.4',
@@ -2123,6 +2142,7 @@ config_host_data.set('CONFIG_ATTR', libattr.found())
 config_host_data.set('CONFIG_BDRV_WHITELIST_TOOLS', get_option('block_drv_whitelist_in_tools'))
 config_host_data.set('CONFIG_BRLAPI', brlapi.found())
 config_host_data.set('CONFIG_BSD', targetos in bsd_oses)
+config_host_data.set('CONFIG_CAPSTONE', capstone.found())
 config_host_data.set('CONFIG_COCOA', cocoa.found())
 config_host_data.set('CONFIG_DARWIN', targetos == 'darwin')
 config_host_data.set('CONFIG_FUZZ', get_option('fuzzing'))
@@ -2186,6 +2206,7 @@ if seccomp.found()
   config_host_data.set('CONFIG_SECCOMP_SYSRAWRC', seccomp_has_sysrawrc)
 endif
 config_host_data.set('CONFIG_PIXMAN', pixman.found())
+config_host_data.set('CONFIG_SLIRP', slirp.found())
 config_host_data.set('CONFIG_SNAPPY', snappy.found())
 config_host_data.set('CONFIG_SOLARIS', targetos == 'sunos')
 if get_option('tcg').allowed()
@@ -3057,28 +3078,9 @@ genh += custom_target('config-poison.h',
                       command: [find_program('scripts/make-config-poison.sh'),
                                 target_configs_h])
 
-##############
-# Submodules #
-##############
-
-capstone = not_found
-if not get_option('capstone').auto() or have_system or have_user
-  capstone = dependency('capstone', version: '>=3.0.5',
-                        method: 'pkg-config',
-                        required: get_option('capstone'))
-
-  # Some versions of capstone have broken pkg-config file
-  # that reports a wrong -I path, causing the #include to
-  # fail later. If the system has such a broken version
-  # do not use it.
-  if capstone.found() and not cc.compiles('#include <capstone.h>',
-                                          dependencies: [capstone])
-    capstone = not_found
-    if get_option('capstone').enabled()
-      error('capstone requested, but it does not appear to work')
-    endif
-  endif
-endif
+###############
+# Subprojects #
+###############
 
 libvfio_user_dep = not_found
 if have_system and vfio_user_server_allowed
@@ -3122,9 +3124,19 @@ else
   fdt_opt = 'disabled'
 endif
 
-config_host_data.set('CONFIG_CAPSTONE', capstone.found())
 config_host_data.set('CONFIG_FDT', fdt.found())
-config_host_data.set('CONFIG_SLIRP', slirp.found())
+
+vhost_user = not_found
+if targetos == 'linux' and have_vhost_user
+  libvhost_user = subproject('libvhost-user')
+  vhost_user = libvhost_user.get_variable('vhost_user_dep')
+endif
+
+libvduse = not_found
+if have_libvduse
+  libvduse_proj = subproject('libvduse')
+  libvduse = libvduse_proj.get_variable('libvduse_dep')
+endif
 
 #####################
 # Generated sources #
@@ -3355,18 +3367,6 @@ if have_system or have_user
   ]
 endif
 
-vhost_user = not_found
-if targetos == 'linux' and have_vhost_user
-  libvhost_user = subproject('libvhost-user')
-  vhost_user = libvhost_user.get_variable('vhost_user_dep')
-endif
-
-libvduse = not_found
-if have_libvduse
-  libvduse_proj = subproject('libvduse')
-  libvduse = libvduse_proj.get_variable('libvduse_dep')
-endif
-
 # NOTE: the trace/ subdirectory needs the qapi_trace_events variable
 # that is filled in by qapi/.
 subdir('qapi')
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 18/21] meson: move CFI detection code earlier
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
                   ` (16 preceding siblings ...)
  2023-12-21 17:19 ` [PATCH 17/21] meson: keep subprojects together Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-29  9:54   ` Philippe Mathieu-Daudé
  2023-12-21 17:19 ` [PATCH 19/21] meson: move config-host.h definitions together Paolo Bonzini
                   ` (2 subsequent siblings)
  20 siblings, 1 reply; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

Keep it together with the other compiler modes, and before dependencies.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 80 ++++++++++++++++++++++++++---------------------------
 1 file changed, 40 insertions(+), 40 deletions(-)

diff --git a/meson.build b/meson.build
index f8d61a46ad1..f105462c181 100644
--- a/meson.build
+++ b/meson.build
@@ -421,6 +421,46 @@ if get_option('fuzzing')
   endif
 endif
 
+if get_option('cfi')
+  cfi_flags=[]
+  # Check for dependency on LTO
+  if not get_option('b_lto')
+    error('Selected Control-Flow Integrity but LTO is disabled')
+  endif
+  if enable_modules
+    error('Selected Control-Flow Integrity is not compatible with modules')
+  endif
+  # Check for cfi flags. CFI requires LTO so we can't use
+  # get_supported_arguments, but need a more complex "compiles" which allows
+  # custom arguments
+  if cc.compiles('int main () { return 0; }', name: '-fsanitize=cfi-icall',
+                 args: ['-flto', '-fsanitize=cfi-icall'] )
+    cfi_flags += '-fsanitize=cfi-icall'
+  else
+    error('-fsanitize=cfi-icall is not supported by the compiler')
+  endif
+  if cc.compiles('int main () { return 0; }',
+                 name: '-fsanitize-cfi-icall-generalize-pointers',
+                 args: ['-flto', '-fsanitize=cfi-icall',
+                        '-fsanitize-cfi-icall-generalize-pointers'] )
+    cfi_flags += '-fsanitize-cfi-icall-generalize-pointers'
+  else
+    error('-fsanitize-cfi-icall-generalize-pointers is not supported by the compiler')
+  endif
+  if get_option('cfi_debug')
+    if cc.compiles('int main () { return 0; }',
+                   name: '-fno-sanitize-trap=cfi-icall',
+                   args: ['-flto', '-fsanitize=cfi-icall',
+                          '-fno-sanitize-trap=cfi-icall'] )
+      cfi_flags += '-fno-sanitize-trap=cfi-icall'
+    else
+      error('-fno-sanitize-trap=cfi-icall is not supported by the compiler')
+    endif
+  endif
+  add_global_arguments(cfi_flags, native: false, language: all_languages)
+  add_global_link_arguments(cfi_flags, native: false, language: all_languages)
+endif
+
 add_global_arguments(qemu_common_flags, native: false, language: all_languages)
 add_global_link_arguments(qemu_ldflags, native: false, language: all_languages)
 
@@ -2005,46 +2045,6 @@ endif
 config_host_data.set('CONFIG_AUDIO_DRIVERS',
                      '"' + '", "'.join(audio_drivers_selected) + '", ')
 
-if get_option('cfi')
-  cfi_flags=[]
-  # Check for dependency on LTO
-  if not get_option('b_lto')
-    error('Selected Control-Flow Integrity but LTO is disabled')
-  endif
-  if enable_modules
-    error('Selected Control-Flow Integrity is not compatible with modules')
-  endif
-  # Check for cfi flags. CFI requires LTO so we can't use
-  # get_supported_arguments, but need a more complex "compiles" which allows
-  # custom arguments
-  if cc.compiles('int main () { return 0; }', name: '-fsanitize=cfi-icall',
-                 args: ['-flto', '-fsanitize=cfi-icall'] )
-    cfi_flags += '-fsanitize=cfi-icall'
-  else
-    error('-fsanitize=cfi-icall is not supported by the compiler')
-  endif
-  if cc.compiles('int main () { return 0; }',
-                 name: '-fsanitize-cfi-icall-generalize-pointers',
-                 args: ['-flto', '-fsanitize=cfi-icall',
-                        '-fsanitize-cfi-icall-generalize-pointers'] )
-    cfi_flags += '-fsanitize-cfi-icall-generalize-pointers'
-  else
-    error('-fsanitize-cfi-icall-generalize-pointers is not supported by the compiler')
-  endif
-  if get_option('cfi_debug')
-    if cc.compiles('int main () { return 0; }',
-                   name: '-fno-sanitize-trap=cfi-icall',
-                   args: ['-flto', '-fsanitize=cfi-icall',
-                          '-fno-sanitize-trap=cfi-icall'] )
-      cfi_flags += '-fno-sanitize-trap=cfi-icall'
-    else
-      error('-fno-sanitize-trap=cfi-icall is not supported by the compiler')
-    endif
-  endif
-  add_global_arguments(cfi_flags, native: false, language: all_languages)
-  add_global_link_arguments(cfi_flags, native: false, language: all_languages)
-endif
-
 have_host_block_device = (targetos != 'darwin' or
     cc.has_header('IOKit/storage/IOMedia.h'))
 
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 19/21] meson: move config-host.h definitions together
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
                   ` (17 preceding siblings ...)
  2023-12-21 17:19 ` [PATCH 18/21] meson: move CFI detection code earlier Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-21 17:19 ` [PATCH 20/21] meson: move subdirs to "Collect sources" section Paolo Bonzini
  2023-12-21 17:19 ` [PATCH 21/21] configure, meson: rename targetos to host_os Paolo Bonzini
  20 siblings, 0 replies; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 27 ++++++++++++++-------------
 1 file changed, 14 insertions(+), 13 deletions(-)

diff --git a/meson.build b/meson.build
index f105462c181..57821069e91 100644
--- a/meson.build
+++ b/meson.build
@@ -40,7 +40,6 @@ qemu_moddir = get_option('libdir') / get_option('qemu_suffix')
 qemu_desktopdir = get_option('datadir') / 'applications'
 qemu_icondir = get_option('datadir') / 'icons'
 
-config_host_data = configuration_data()
 genh = []
 qapi_trace_events = []
 
@@ -137,12 +136,6 @@ elif cpu in ['riscv64']
 else
   kvm_targets = []
 endif
-
-kvm_targets_c = '""'
-if get_option('kvm').allowed() and targetos == 'linux'
-  kvm_targets_c = '"' + '" ,"'.join(kvm_targets) + '"'
-endif
-config_host_data.set('CONFIG_KVM_TARGETS', kvm_targets_c)
 accelerator_targets = { 'CONFIG_KVM': kvm_targets }
 
 if cpu in ['x86', 'x86_64']
@@ -1107,12 +1100,6 @@ if not get_option('virglrenderer').auto() or have_system or have_vhost_user_gpu
   virgl = dependency('virglrenderer',
                      method: 'pkg-config',
                      required: get_option('virglrenderer'))
-  if virgl.found()
-    config_host_data.set('HAVE_VIRGL_D3D_INFO_EXT',
-                         cc.has_member('struct virgl_renderer_resource_info_ext', 'd3d_tex2d',
-                                       prefix: '#include <virglrenderer.h>',
-                                       dependencies: virgl))
-  endif
 endif
 rutabaga = not_found
 if not get_option('rutabaga_gfx').auto() or have_system or have_vhost_user_gpu
@@ -2004,6 +1991,8 @@ endif
 # config-host.h #
 #################
 
+config_host_data = configuration_data()
+
 audio_drivers_selected = []
 if have_system
   audio_drivers_available = {
@@ -2133,6 +2122,12 @@ endif
 
 config_host_data.set('HOST_' + host_arch.to_upper(), 1)
 
+kvm_targets_c = '""'
+if get_option('kvm').allowed() and targetos == 'linux'
+  kvm_targets_c = '"' + '" ,"'.join(kvm_targets) + '"'
+endif
+config_host_data.set('CONFIG_KVM_TARGETS', kvm_targets_c)
+
 if get_option('module_upgrades') and not enable_modules
   error('Cannot enable module-upgrades as modules are not enabled')
 endif
@@ -2232,6 +2227,12 @@ config_host_data.set('CONFIG_PNG', png.found())
 config_host_data.set('CONFIG_VNC', vnc.found())
 config_host_data.set('CONFIG_VNC_JPEG', jpeg.found())
 config_host_data.set('CONFIG_VNC_SASL', sasl.found())
+if virgl.found()
+  config_host_data.set('HAVE_VIRGL_D3D_INFO_EXT',
+                       cc.has_member('struct virgl_renderer_resource_info_ext', 'd3d_tex2d',
+                                     prefix: '#include <virglrenderer.h>',
+                                     dependencies: virgl))
+endif
 config_host_data.set('CONFIG_VIRTFS', have_virtfs)
 config_host_data.set('CONFIG_VTE', vte.found())
 config_host_data.set('CONFIG_XKBCOMMON', xkbcommon.found())
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 20/21] meson: move subdirs to "Collect sources" section
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
                   ` (18 preceding siblings ...)
  2023-12-21 17:19 ` [PATCH 19/21] meson: move config-host.h definitions together Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-29  9:55   ` Philippe Mathieu-Daudé
  2023-12-21 17:19 ` [PATCH 21/21] configure, meson: rename targetos to host_os Paolo Bonzini
  20 siblings, 1 reply; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build | 66 ++++++++++++++++++++++++++---------------------------
 1 file changed, 33 insertions(+), 33 deletions(-)

diff --git a/meson.build b/meson.build
index 57821069e91..6cf70cbfb89 100644
--- a/meson.build
+++ b/meson.build
@@ -3221,39 +3221,6 @@ foreach d : hx_headers
 endforeach
 genh += hxdep
 
-###################
-# Collect sources #
-###################
-
-authz_ss = ss.source_set()
-blockdev_ss = ss.source_set()
-block_ss = ss.source_set()
-chardev_ss = ss.source_set()
-common_ss = ss.source_set()
-crypto_ss = ss.source_set()
-hwcore_ss = ss.source_set()
-io_ss = ss.source_set()
-qmp_ss = ss.source_set()
-qom_ss = ss.source_set()
-system_ss = ss.source_set()
-specific_fuzz_ss = ss.source_set()
-specific_ss = ss.source_set()
-stub_ss = ss.source_set()
-trace_ss = ss.source_set()
-user_ss = ss.source_set()
-util_ss = ss.source_set()
-
-# accel modules
-qtest_module_ss = ss.source_set()
-tcg_module_ss = ss.source_set()
-
-modules = {}
-target_modules = {}
-hw_arch = {}
-target_arch = {}
-target_system_arch = {}
-target_user_arch = {}
-
 ###############
 # Trace files #
 ###############
@@ -3368,6 +3335,39 @@ if have_system or have_user
   ]
 endif
 
+###################
+# Collect sources #
+###################
+
+authz_ss = ss.source_set()
+blockdev_ss = ss.source_set()
+block_ss = ss.source_set()
+chardev_ss = ss.source_set()
+common_ss = ss.source_set()
+crypto_ss = ss.source_set()
+hwcore_ss = ss.source_set()
+io_ss = ss.source_set()
+qmp_ss = ss.source_set()
+qom_ss = ss.source_set()
+system_ss = ss.source_set()
+specific_fuzz_ss = ss.source_set()
+specific_ss = ss.source_set()
+stub_ss = ss.source_set()
+trace_ss = ss.source_set()
+user_ss = ss.source_set()
+util_ss = ss.source_set()
+
+# accel modules
+qtest_module_ss = ss.source_set()
+tcg_module_ss = ss.source_set()
+
+modules = {}
+target_modules = {}
+hw_arch = {}
+target_arch = {}
+target_system_arch = {}
+target_user_arch = {}
+
 # NOTE: the trace/ subdirectory needs the qapi_trace_events variable
 # that is filled in by qapi/.
 subdir('qapi')
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* [PATCH 21/21] configure, meson: rename targetos to host_os
  2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
                   ` (19 preceding siblings ...)
  2023-12-21 17:19 ` [PATCH 20/21] meson: move subdirs to "Collect sources" section Paolo Bonzini
@ 2023-12-21 17:19 ` Paolo Bonzini
  2023-12-29 10:01   ` Philippe Mathieu-Daudé
  20 siblings, 1 reply; 32+ messages in thread
From: Paolo Bonzini @ 2023-12-21 17:19 UTC (permalink / raw)
  To: qemu-devel

This variable is about the host OS, not the target.  It is used a lot
more since the Meson conversion, but the original sin dates back to 2003.
Time to fix it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 accel/tcg/meson.build                |   2 +-
 backends/meson.build                 |   4 +-
 block/meson.build                    |   4 +-
 bsd-user/meson.build                 |   2 +-
 chardev/meson.build                  |   4 +-
 configure                            |  58 ++++----
 contrib/ivshmem-client/meson.build   |   2 +-
 contrib/ivshmem-server/meson.build   |   2 +-
 contrib/vhost-user-blk/meson.build   |   2 +-
 contrib/vhost-user-input/meson.build |   2 +-
 contrib/vhost-user-scsi/meson.build  |   2 +-
 docs/devel/kconfig.rst               |   2 +-
 fsdev/meson.build                    |   2 +-
 hw/9pfs/meson.build                  |   4 +-
 hw/display/meson.build               |   2 +-
 hw/ppc/meson.build                   |   2 +-
 hw/usb/meson.build                   |   4 +-
 meson.build                          | 206 +++++++++++++--------------
 net/can/meson.build                  |   2 +-
 net/meson.build                      |   8 +-
 plugins/meson.build                  |   4 +-
 qga/meson.build                      |  16 +--
 scsi/meson.build                     |   2 +-
 system/meson.build                   |   4 +-
 tests/fp/meson.build                 |   2 +-
 tests/meson.build                    |   2 +-
 tests/plugin/meson.build             |   2 +-
 tests/qemu-iotests/meson.build       |   2 +-
 tests/qtest/meson.build              |  10 +-
 tests/unit/meson.build               |   8 +-
 ui/dbus-display1.xml                 |  10 +-
 ui/meson.build                       |   8 +-
 util/meson.build                     |   8 +-
 33 files changed, 197 insertions(+), 197 deletions(-)

diff --git a/accel/tcg/meson.build b/accel/tcg/meson.build
index 1dad6bbbfbd..d25638d6c15 100644
--- a/accel/tcg/meson.build
+++ b/accel/tcg/meson.build
@@ -17,7 +17,7 @@ if get_option('plugins')
   tcg_ss.add(files('plugin-gen.c'))
 endif
 tcg_ss.add(when: libdw, if_true: files('debuginfo.c'))
-if targetos == 'linux'
+if host_os == 'linux'
   tcg_ss.add(files('perf.c'))
 endif
 specific_ss.add_all(when: 'CONFIG_TCG', if_true: tcg_ss)
diff --git a/backends/meson.build b/backends/meson.build
index 6dee4e9203b..8b2b111497f 100644
--- a/backends/meson.build
+++ b/backends/meson.build
@@ -10,11 +10,11 @@ system_ss.add([files(
   'confidential-guest-support.c',
 ), numa])
 
-if targetos != 'windows'
+if host_os != 'windows'
   system_ss.add(files('rng-random.c'))
   system_ss.add(files('hostmem-file.c'))
 endif
-if targetos == 'linux'
+if host_os == 'linux'
   system_ss.add(files('hostmem-memfd.c'))
 endif
 if keyutils.found()
diff --git a/block/meson.build b/block/meson.build
index ddea1e40070..e1f03fd773e 100644
--- a/block/meson.build
+++ b/block/meson.build
@@ -88,13 +88,13 @@ if get_option('parallels').allowed()
   block_ss.add(files('parallels.c', 'parallels-ext.c'))
 endif
 
-if targetos == 'windows'
+if host_os == 'windows'
   block_ss.add(files('file-win32.c', 'win32-aio.c'))
 else
   block_ss.add(files('file-posix.c'), coref, iokit)
 endif
 block_ss.add(when: libiscsi, if_true: files('iscsi-opts.c'))
-if targetos == 'linux'
+if host_os == 'linux'
   block_ss.add(files('nvme.c'))
 endif
 if get_option('replication').allowed()
diff --git a/bsd-user/meson.build b/bsd-user/meson.build
index c6bfd3b2b53..39bad0ae33e 100644
--- a/bsd-user/meson.build
+++ b/bsd-user/meson.build
@@ -24,6 +24,6 @@ kvm = cc.find_library('kvm', required: true)
 bsd_user_ss.add(elf, procstat, kvm)
 
 # Pull in the OS-specific build glue, if any
-subdir(targetos)
+subdir(host_os)
 
 specific_ss.add_all(when: 'CONFIG_BSD_USER', if_true: bsd_user_ss)
diff --git a/chardev/meson.build b/chardev/meson.build
index db6840b71af..c80337d15fa 100644
--- a/chardev/meson.build
+++ b/chardev/meson.build
@@ -12,7 +12,7 @@ chardev_ss.add(files(
   'char-udp.c',
   'char.c',
 ))
-if targetos == 'windows'
+if host_os == 'windows'
   chardev_ss.add(files(
     'char-console.c',
     'char-win-stdio.c',
@@ -23,7 +23,7 @@ else
       'char-fd.c',
       'char-pty.c',
     ), util)
-  if targetos in ['linux', 'gnu/kfreebsd', 'freebsd', 'dragonfly']
+  if host_os in ['linux', 'gnu/kfreebsd', 'freebsd', 'dragonfly']
     chardev_ss.add(files('char-parallel.c'))
   endif
 endif
diff --git a/configure b/configure
index 38ca267096f..134010844d9 100755
--- a/configure
+++ b/configure
@@ -334,30 +334,30 @@ EOF
 }
 
 if check_define __linux__ ; then
-  targetos=linux
+  host_os=linux
 elif check_define _WIN32 ; then
-  targetos=windows
+  host_os=windows
 elif check_define __OpenBSD__ ; then
-  targetos=openbsd
+  host_os=openbsd
 elif check_define __sun__ ; then
-  targetos=sunos
+  host_os=sunos
 elif check_define __HAIKU__ ; then
-  targetos=haiku
+  host_os=haiku
 elif check_define __FreeBSD__ ; then
-  targetos=freebsd
+  host_os=freebsd
 elif check_define __FreeBSD_kernel__ && check_define __GLIBC__; then
-  targetos=gnu/kfreebsd
+  host_os=gnu/kfreebsd
 elif check_define __DragonFly__ ; then
-  targetos=dragonfly
+  host_os=dragonfly
 elif check_define __NetBSD__; then
-  targetos=netbsd
+  host_os=netbsd
 elif check_define __APPLE__; then
-  targetos=darwin
+  host_os=darwin
 else
   # This is a fatal error, but don't report it yet, because we
   # might be going to just print the --help text, or it might
   # be the result of a missing compiler.
-  targetos=bogus
+  host_os=bogus
 fi
 
 if test ! -z "$cpu" ; then
@@ -573,13 +573,13 @@ do
     fi
 done
 
-if test "$targetos" = "windows" ; then
+if test "$host_os" = "windows" ; then
   EXESUF=".exe"
 fi
 
 meson_option_build_array() {
   printf '['
-  (if test "$targetos" = windows; then
+  (if test "$host_os" = windows; then
     IFS=\;
   else
     IFS=:
@@ -802,7 +802,7 @@ mak_wilds=""
 
 if [ -n "$host_arch" ] && [ -d "$source_path/common-user/host/$host_arch" ]; then
     if [ "$linux_user" != no ]; then
-        if [ "$targetos" = linux ]; then
+        if [ "$host_os" = linux ]; then
             linux_user=yes
         elif [ "$linux_user" = yes ]; then
             error_exit "linux-user not supported on this architecture"
@@ -813,9 +813,9 @@ if [ -n "$host_arch" ] && [ -d "$source_path/common-user/host/$host_arch" ]; the
     fi
     if [ "$bsd_user" != no ]; then
         if [ "$bsd_user" = "" ]; then
-            test $targetos = freebsd && bsd_user=yes
+            test $host_os = freebsd && bsd_user=yes
         fi
-        if [ "$bsd_user" = yes ] && ! [ -d "$source_path/bsd-user/$targetos" ]; then
+        if [ "$bsd_user" = yes ] && ! [ -d "$source_path/bsd-user/$host_os" ]; then
             error_exit "bsd-user not supported on this host OS"
         fi
         if [ "$bsd_user" = "yes" ]; then
@@ -998,7 +998,7 @@ if test -z "$ninja"; then
     fi
 fi
 
-if test "$targetos" = "bogus"; then
+if test "$host_os" = "bogus"; then
     # Now that we know that we're not printing the help and that
     # the compiler works (so the results of the check_defines we used
     # to identify the OS are reliable), if we didn't recognize the
@@ -1007,7 +1007,7 @@ if test "$targetos" = "bogus"; then
 fi
 
 # test for any invalid configuration combinations
-if test "$targetos" = "windows" && ! has "$dlltool"; then
+if test "$host_os" = "windows" && ! has "$dlltool"; then
   if test "$plugins" = "yes"; then
     error_exit "TCG plugins requires dlltool to build on Windows platforms"
   fi
@@ -1041,7 +1041,7 @@ static THREAD int tls_var;
 int main(void) { return tls_var; }
 EOF
 
-if test "$targetos" = windows || test "$targetos" = haiku; then
+if test "$host_os" = windows || test "$host_os" = haiku; then
   if test "$pie" = "yes"; then
     error_exit "PIE not available due to missing OS support"
   fi
@@ -1540,8 +1540,8 @@ echo "# Automatically generated by configure - do not modify" > Makefile.prereqs
 
 # Mac OS X ships with a broken assembler
 if have_target i386-softmmu x86_64-softmmu && \
-        test "$targetos" != "darwin" && test "$targetos" != "sunos" && \
-        test "$targetos" != "haiku" && \
+        test "$host_os" != "darwin" && test "$host_os" != "sunos" && \
+        test "$host_os" != "haiku" && \
         probe_target_compiler i386-softmmu; then
     subdirs="$subdirs pc-bios/optionrom"
     config_mak=pc-bios/optionrom/config.mak
@@ -1605,7 +1605,7 @@ echo "NINJA=$ninja" >> $config_host_mak
 echo "EXESUF=$EXESUF" >> $config_host_mak
 
 # use included Linux headers for KVM architectures
-if test "$targetos" = "linux" && test -n "$linux_arch"; then
+if test "$host_os" = "linux" && test -n "$linux_arch"; then
   symlink "$source_path/linux-headers/asm-$linux_arch" linux-headers/asm
 fi
 
@@ -1628,13 +1628,13 @@ echo "SRC_PATH=$source_path/contrib/plugins" >> contrib/plugins/$config_host_mak
 echo "PKG_CONFIG=${pkg_config}" >> contrib/plugins/$config_host_mak
 echo "CC=$cc $CPU_CFLAGS" >> contrib/plugins/$config_host_mak
 echo "CFLAGS=${CFLAGS-$default_cflags} $EXTRA_CFLAGS" >> contrib/plugins/$config_host_mak
-if test "$targetos" = windows; then
+if test "$host_os" = windows; then
   echo "DLLTOOL=$dlltool" >> contrib/plugins/$config_host_mak
 fi
-if test "$targetos" = darwin; then
+if test "$host_os" = darwin; then
   echo "CONFIG_DARWIN=y" >> contrib/plugins/$config_host_mak
 fi
-if test "$targetos" = windows; then
+if test "$host_os" = windows; then
   echo "CONFIG_WIN32=y" >> contrib/plugins/$config_host_mak
 fi
 
@@ -1714,7 +1714,7 @@ if test "$skip_meson" = no; then
   echo "# environment defaults, can still be overridden on " >> $cross
   echo "# the command line" >> $cross
   if test -e "$source_path/.git" && \
-      { test "$targetos" = linux || test "$targetos" = "windows"; }; then
+      { test "$host_os" = linux || test "$host_os" = "windows"; }; then
       echo 'werror = true' >> $cross
   fi
   echo "[project options]" >> $cross
@@ -1751,7 +1751,7 @@ if test "$skip_meson" = no; then
   echo "windmc = [$(meson_quote $windmc)]" >> $cross
   if test "$cross_compile" = "yes"; then
     echo "[host_machine]" >> $cross
-    echo "system = '$targetos'" >> $cross
+    echo "system = '$host_os'" >> $cross
     case "$cpu" in
         i386)
             echo "cpu_family = 'x86'" >> $cross
@@ -1777,8 +1777,8 @@ if test "$skip_meson" = no; then
   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
+  if test -f "$source_path/configs/meson/$host_os.txt"; then
+    meson_add_machine_file $source_path/configs/meson/$host_os.txt
   fi
 
   rm -rf meson-private meson-info meson-logs
diff --git a/contrib/ivshmem-client/meson.build b/contrib/ivshmem-client/meson.build
index ce8dcca84dd..3c8b09af4bf 100644
--- a/contrib/ivshmem-client/meson.build
+++ b/contrib/ivshmem-client/meson.build
@@ -1,4 +1,4 @@
 executable('ivshmem-client', files('ivshmem-client.c', 'main.c'), genh,
            dependencies: glib,
-           build_by_default: targetos == 'linux',
+           build_by_default: host_os == 'linux',
            install: false)
diff --git a/contrib/ivshmem-server/meson.build b/contrib/ivshmem-server/meson.build
index c6c3c82e89f..1c8fea6594d 100644
--- a/contrib/ivshmem-server/meson.build
+++ b/contrib/ivshmem-server/meson.build
@@ -1,4 +1,4 @@
 executable('ivshmem-server', files('ivshmem-server.c', 'main.c'), genh,
            dependencies: [qemuutil, rt],
-           build_by_default: targetos == 'linux',
+           build_by_default: host_os == 'linux',
            install: false)
diff --git a/contrib/vhost-user-blk/meson.build b/contrib/vhost-user-blk/meson.build
index dcb9e2ffcd0..ac1eece37a4 100644
--- a/contrib/vhost-user-blk/meson.build
+++ b/contrib/vhost-user-blk/meson.build
@@ -1,4 +1,4 @@
 executable('vhost-user-blk', files('vhost-user-blk.c'),
            dependencies: [qemuutil, vhost_user],
-           build_by_default: targetos == 'linux',
+           build_by_default: host_os == 'linux',
            install: false)
diff --git a/contrib/vhost-user-input/meson.build b/contrib/vhost-user-input/meson.build
index 21a9ed4f15e..840d866594b 100644
--- a/contrib/vhost-user-input/meson.build
+++ b/contrib/vhost-user-input/meson.build
@@ -1,4 +1,4 @@
 executable('vhost-user-input', files('main.c'),
            dependencies: [qemuutil, vhost_user],
-           build_by_default: targetos == 'linux',
+           build_by_default: host_os == 'linux',
            install: false)
diff --git a/contrib/vhost-user-scsi/meson.build b/contrib/vhost-user-scsi/meson.build
index cc893f6f203..44be04853e4 100644
--- a/contrib/vhost-user-scsi/meson.build
+++ b/contrib/vhost-user-scsi/meson.build
@@ -1,6 +1,6 @@
 if libiscsi.found()
   executable('vhost-user-scsi', files('vhost-user-scsi.c'),
              dependencies: [qemuutil, libiscsi, vhost_user],
-             build_by_default: targetos == 'linux',
+             build_by_default: host_os == 'linux',
              install: false)
 endif
diff --git a/docs/devel/kconfig.rst b/docs/devel/kconfig.rst
index 73f52de1067..ccb9a46bd77 100644
--- a/docs/devel/kconfig.rst
+++ b/docs/devel/kconfig.rst
@@ -316,6 +316,6 @@ variable::
 
     host_kconfig = \
       (have_tpm ? ['CONFIG_TPM=y'] : []) + \
-      (targetos == 'linux' ? ['CONFIG_LINUX=y'] : []) + \
+      (host_os == 'linux' ? ['CONFIG_LINUX=y'] : []) + \
       (have_ivshmem ? ['CONFIG_IVSHMEM=y'] : []) + \
       ...
diff --git a/fsdev/meson.build b/fsdev/meson.build
index db67530d7f2..e20d7255e1e 100644
--- a/fsdev/meson.build
+++ b/fsdev/meson.build
@@ -5,7 +5,7 @@ fsdev_ss.add(when: ['CONFIG_FSDEV_9P'], if_true: files(
   '9p-marshal.c',
   'qemu-fsdev.c',
 ), if_false: files('qemu-fsdev-dummy.c'))
-if targetos in ['linux', 'darwin']
+if host_os in ['linux', 'darwin']
   system_ss.add_all(fsdev_ss)
 endif
 
diff --git a/hw/9pfs/meson.build b/hw/9pfs/meson.build
index 3eee7c268a9..f1b62fa8c80 100644
--- a/hw/9pfs/meson.build
+++ b/hw/9pfs/meson.build
@@ -13,9 +13,9 @@ fs_ss.add(files(
   'coth.c',
   'coxattr.c',
 ))
-if targetos == 'darwin'
+if host_os == 'darwin'
   fs_ss.add(files('9p-util-darwin.c'))
-elif targetos == 'linux'
+elif host_os == 'linux'
   fs_ss.add(files('9p-util-linux.c'))
 endif
 fs_ss.add(when: 'CONFIG_XEN_BUS', if_true: files('xen-9p-backend.c'))
diff --git a/hw/display/meson.build b/hw/display/meson.build
index ac0159c516e..f93a69f70f4 100644
--- a/hw/display/meson.build
+++ b/hw/display/meson.build
@@ -69,7 +69,7 @@ if config_all_devices.has_key('CONFIG_VIRTIO_GPU')
   virtio_gpu_ss = ss.source_set()
   virtio_gpu_ss.add(when: 'CONFIG_VIRTIO_GPU',
                     if_true: [files('virtio-gpu-base.c', 'virtio-gpu.c'), pixman])
-  if targetos == 'linux'
+  if host_os == 'linux'
     virtio_gpu_ss.add(files('virtio-gpu-udmabuf.c'))
   else
     virtio_gpu_ss.add(files('virtio-gpu-udmabuf-stubs.c'))
diff --git a/hw/ppc/meson.build b/hw/ppc/meson.build
index 3dedcf3043d..eba3406e7f3 100644
--- a/hw/ppc/meson.build
+++ b/hw/ppc/meson.build
@@ -34,7 +34,7 @@ ppc_ss.add(when: ['CONFIG_PSERIES', 'CONFIG_TCG'], if_true: files(
   'spapr_softmmu.c',
 ))
 ppc_ss.add(when: 'CONFIG_SPAPR_RNG', if_true: files('spapr_rng.c'))
-if targetos == 'linux'
+if host_os == 'linux'
   ppc_ss.add(when: 'CONFIG_PSERIES', if_true: files(
     'spapr_pci_vfio.c',
   ))
diff --git a/hw/usb/meson.build b/hw/usb/meson.build
index b7755b638fc..2c13c528785 100644
--- a/hw/usb/meson.build
+++ b/hw/usb/meson.build
@@ -44,7 +44,7 @@ system_ss.add(when: 'CONFIG_USB_STORAGE_UAS', if_true: files('dev-uas.c'))
 system_ss.add(when: 'CONFIG_USB_AUDIO', if_true: files('dev-audio.c'))
 system_ss.add(when: 'CONFIG_USB_SERIAL', if_true: files('dev-serial.c'))
 system_ss.add(when: 'CONFIG_USB_NETWORK', if_true: files('dev-network.c'))
-if targetos != 'windows'
+if host_os != 'windows'
   system_ss.add(when: 'CONFIG_USB_STORAGE_MTP', if_true: files('dev-mtp.c'))
 endif
 
@@ -60,7 +60,7 @@ endif
 
 # U2F
 system_ss.add(when: 'CONFIG_USB_U2F', if_true: files('u2f.c'))
-if targetos == 'linux'
+if host_os == 'linux'
   system_ss.add(when: 'CONFIG_USB_U2F', if_true: [libudev, files('u2f-passthru.c')])
 endif
 if u2f.found()
diff --git a/meson.build b/meson.build
index 6cf70cbfb89..eed49e4201b 100644
--- a/meson.build
+++ b/meson.build
@@ -18,7 +18,7 @@ keyval = import('keyval')
 ss = import('sourceset')
 fs = import('fs')
 
-targetos = host_machine.system()
+host_os = host_machine.system()
 config_host = keyval.load(meson.current_build_dir() / 'config-host.mak')
 
 # Temporary directory used for files created while
@@ -61,11 +61,11 @@ python = import('python').find_installation()
 
 cc = meson.get_compiler('c')
 all_languages = ['c']
-if targetos == 'windows' and add_languages('cpp', required: false, native: false)
+if host_os == 'windows' and add_languages('cpp', required: false, native: false)
   all_languages += ['cpp']
   cxx = meson.get_compiler('cpp')
 endif
-if targetos == 'darwin' and \
+if host_os == 'darwin' and \
    add_languages('objc', required: get_option('cocoa'), native: false)
   all_languages += ['objc']
   objc = meson.get_compiler('objc')
@@ -164,7 +164,7 @@ endif
 
 modular_tcg = []
 # Darwin does not support references to thread-local variables in modules
-if targetos != 'darwin'
+if host_os != 'darwin'
   modular_tcg = ['i386-softmmu', 'x86_64-softmmu']
 endif
 
@@ -204,18 +204,18 @@ qemu_common_flags = [
 qemu_cflags = []
 qemu_ldflags = []
 
-if targetos == 'darwin'
+if host_os == 'darwin'
   # Disable attempts to use ObjectiveC features in os/object.h since they
   # won't work when we're compiling with gcc as a C compiler.
   if compiler.get_id() == 'gcc'
     qemu_common_flags += '-DOS_OBJECT_USE_OBJC=0'
   endif
-elif targetos == 'sunos'
+elif host_os == 'sunos'
   # needed for CMSG_ macros in sys/socket.h
   qemu_common_flags += '-D_XOPEN_SOURCE=600'
   # needed for TIOCWIN* defines in termios.h
   qemu_common_flags += '-D__EXTENSIONS__'
-elif targetos == 'haiku'
+elif host_os == 'haiku'
   qemu_common_flags += ['-DB_USE_POSITIVE_POSIX_ERRORS', '-D_BSD_SOURCE', '-fPIC']
 endif
 
@@ -299,10 +299,10 @@ ucontext_probe = '''
 # For POSIX prefer ucontext, but it's not always possible. The fallback
 # is sigcontext.
 supported_backends = []
-if targetos == 'windows'
+if host_os == 'windows'
   supported_backends += ['windows']
 else
-  if targetos != 'darwin' and cc.links(ucontext_probe)
+  if host_os != 'darwin' and cc.links(ucontext_probe)
     supported_backends += ['ucontext']
   endif
   supported_backends += ['sigaltstack']
@@ -373,13 +373,13 @@ endif
 # The combination is known as "full relro", because .got.plt is read-only too.
 qemu_ldflags += cc.get_supported_link_arguments('-Wl,-z,relro', '-Wl,-z,now')
 
-if targetos == 'windows'
+if host_os == 'windows'
   qemu_ldflags += cc.get_supported_link_arguments('-Wl,--no-seh', '-Wl,--nxcompat')
   qemu_ldflags += cc.get_supported_link_arguments('-Wl,--dynamicbase', '-Wl,--high-entropy-va')
 endif
 
 # Exclude --warn-common with TSan to suppress warnings from the TSan libraries.
-if targetos != 'sunos' and not get_option('tsan')
+if host_os != 'sunos' and not get_option('tsan')
   qemu_ldflags += cc.get_supported_link_arguments('-Wl,--warn-common')
 endif
 
@@ -489,7 +489,7 @@ warn_flags = [
   '-Wshadow=local',
 ]
 
-if targetos != 'darwin'
+if host_os != 'darwin'
   warn_flags += ['-Wthread-safety']
 endif
 
@@ -509,7 +509,7 @@ if 'objc' in all_languages
   # Note sanitizer flags are not applied to Objective-C sources!
   add_project_arguments(objc.get_supported_arguments(warn_flags), native: false, language: 'objc')
 endif
-if targetos == 'linux'
+if host_os == 'linux'
   add_project_arguments('-isystem', meson.current_source_dir() / 'linux-headers',
                         '-isystem', 'linux-headers',
                         language: all_languages)
@@ -556,7 +556,7 @@ if get_option('fuzzing') and get_option('fuzzing_engine') == '' and \
 endif
 
 # Tracing backends
-if 'ftrace' in get_option('trace_backends') and targetos != 'linux'
+if 'ftrace' in get_option('trace_backends') and host_os != 'linux'
   error('ftrace is supported only on Linux')
 endif
 if 'syslog' in get_option('trace_backends') and not cc.compiles('''
@@ -571,18 +571,18 @@ endif
 
 # Miscellaneous Linux-only features
 get_option('mpath') \
-  .require(targetos == 'linux', error_message: 'Multipath is supported only on Linux')
+  .require(host_os == 'linux', error_message: 'Multipath is supported only on Linux')
 
 multiprocess_allowed = get_option('multiprocess') \
-  .require(targetos == 'linux', error_message: 'Multiprocess QEMU is supported only on Linux') \
+  .require(host_os == 'linux', error_message: 'Multiprocess QEMU is supported only on Linux') \
   .allowed()
 
 vfio_user_server_allowed = get_option('vfio_user_server') \
-  .require(targetos == 'linux', error_message: 'vfio-user server is supported only on Linux') \
+  .require(host_os == 'linux', error_message: 'vfio-user server is supported only on Linux') \
   .allowed()
 
 have_tpm = get_option('tpm') \
-  .require(targetos != 'windows', error_message: 'TPM emulation only available on POSIX systems') \
+  .require(host_os != 'windows', error_message: 'TPM emulation only available on POSIX systems') \
   .allowed()
 
 # type of binaries to build
@@ -601,13 +601,13 @@ have_tools = get_option('tools') \
   .allowed()
 have_ga = get_option('guest_agent') \
   .disable_auto_if(not have_system and not have_tools) \
-  .require(targetos in ['sunos', 'linux', 'windows', 'freebsd', 'netbsd', 'openbsd'],
+  .require(host_os in ['sunos', 'linux', 'windows', 'freebsd', 'netbsd', 'openbsd'],
            error_message: 'unsupported OS for QEMU guest agent') \
   .allowed()
 
 have_block = have_system or have_tools
 enable_modules = get_option('modules') \
-  .require(targetos != 'windows',
+  .require(host_os != 'windows',
            error_message: 'Modules are not available for Windows') \
   .require(not get_option('prefer_static'),
            error_message: 'Modules are incompatible with static linking') \
@@ -615,14 +615,14 @@ enable_modules = get_option('modules') \
 
 # vhost
 have_vhost_user = get_option('vhost_user') \
-  .disable_auto_if(targetos != 'linux') \
-  .require(targetos != 'windows',
+  .disable_auto_if(host_os != 'linux') \
+  .require(host_os != 'windows',
            error_message: 'vhost-user is not available on Windows').allowed()
 have_vhost_vdpa = get_option('vhost_vdpa') \
-  .require(targetos == 'linux',
+  .require(host_os == 'linux',
            error_message: 'vhost-vdpa is only available on Linux').allowed()
 have_vhost_kernel = get_option('vhost_kernel') \
-  .require(targetos == 'linux',
+  .require(host_os == 'linux',
            error_message: 'vhost-kernel is only available on Linux').allowed()
 have_vhost_user_crypto = get_option('vhost_crypto') \
   .require(have_vhost_user,
@@ -637,10 +637,10 @@ have_vhost_net = have_vhost_net_kernel or have_vhost_net_user or have_vhost_net_
 
 # Target-specific configuration of accelerators
 accelerators = []
-if get_option('kvm').allowed() and targetos == 'linux'
+if get_option('kvm').allowed() and host_os == 'linux'
   accelerators += 'CONFIG_KVM'
 endif
-if get_option('whpx').allowed() and targetos == 'windows'
+if get_option('whpx').allowed() and host_os == 'windows'
   if get_option('whpx').enabled() and host_machine.cpu() != 'x86_64'
     error('WHPX requires 64-bit host')
   elif cc.has_header('winhvplatform.h', required: get_option('whpx')) and \
@@ -655,7 +655,7 @@ if get_option('hvf').allowed()
     accelerators += 'CONFIG_HVF'
   endif
 endif
-if targetos == 'netbsd'
+if host_os == 'netbsd'
   nvmm = cc.find_library('nvmm', required: get_option('nvmm'))
   if nvmm.found()
     accelerators += 'CONFIG_NVMM'
@@ -721,7 +721,7 @@ midl = not_found
 widl = not_found
 pathcch = not_found
 host_dsosuf = '.so'
-if targetos == 'windows'
+if host_os == 'windows'
   midl = find_program('midl', required: false)
   widl = find_program('widl', required: false)
   pathcch = cc.find_library('pathcch')
@@ -733,19 +733,19 @@ if targetos == 'windows'
                                       depend_files: files('pc-bios/qemu-nsis.ico'),
                                       include_directories: include_directories('.'))
   host_dsosuf = '.dll'
-elif targetos == 'darwin'
+elif host_os == 'darwin'
   coref = dependency('appleframeworks', modules: 'CoreFoundation')
   iokit = dependency('appleframeworks', modules: 'IOKit', required: false)
   host_dsosuf = '.dylib'
-elif targetos == 'sunos'
+elif host_os == 'sunos'
   socket = [cc.find_library('socket'),
             cc.find_library('nsl'),
             cc.find_library('resolv')]
-elif targetos == 'haiku'
+elif host_os == 'haiku'
   socket = [cc.find_library('posix_error_mapper'),
             cc.find_library('network'),
             cc.find_library('bsd')]
-elif targetos == 'openbsd'
+elif host_os == 'openbsd'
   if get_option('tcg').allowed() and target_dirs.length() > 0
     # Disable OpenBSD W^X if available
     emulator_link_args = cc.get_supported_link_arguments('-Wl,-z,wxneeded')
@@ -774,7 +774,7 @@ endif
 
 # This workaround is required due to a bug in pkg-config file for glib as it
 # doesn't define GLIB_STATIC_COMPILATION for pkg-config --static
-if targetos == 'windows' and get_option('prefer_static')
+if host_os == 'windows' and get_option('prefer_static')
   glib_cflags += ['-DGLIB_STATIC_COMPILATION']
 endif
 
@@ -1035,12 +1035,12 @@ if vde.found() and not cc.links('''
 endif
 
 pulse = not_found
-if not get_option('pa').auto() or (targetos == 'linux' and have_system)
+if not get_option('pa').auto() or (host_os == 'linux' and have_system)
   pulse = dependency('libpulse', required: get_option('pa'),
                      method: 'pkg-config')
 endif
 alsa = not_found
-if not get_option('alsa').auto() or (targetos == 'linux' and have_system)
+if not get_option('alsa').auto() or (host_os == 'linux' and have_system)
   alsa = dependency('alsa', required: get_option('alsa'),
                     method: 'pkg-config')
 endif
@@ -1050,7 +1050,7 @@ if not get_option('jack').auto() or have_system
                     method: 'pkg-config')
 endif
 pipewire = not_found
-if not get_option('pipewire').auto() or (targetos == 'linux' and have_system)
+if not get_option('pipewire').auto() or (host_os == 'linux' and have_system)
   pipewire = dependency('libpipewire-0.3', version: '>=0.3.60',
                     required: get_option('pipewire'),
                     method: 'pkg-config')
@@ -1095,7 +1095,7 @@ if not get_option('zstd').auto() or have_block
 endif
 virgl = not_found
 
-have_vhost_user_gpu = have_tools and targetos == 'linux' and pixman.found()
+have_vhost_user_gpu = have_tools and host_os == 'linux' and pixman.found()
 if not get_option('virglrenderer').auto() or have_system or have_vhost_user_gpu
   virgl = dependency('virglrenderer',
                      method: 'pkg-config',
@@ -1120,7 +1120,7 @@ if not get_option('curl').auto() or have_block
                     required: get_option('curl'))
 endif
 libudev = not_found
-if targetos == 'linux' and (have_system or have_tools)
+if host_os == 'linux' and (have_system or have_tools)
   libudev = dependency('libudev',
                        method: 'pkg-config',
                        required: get_option('libudev'))
@@ -1128,7 +1128,7 @@ endif
 
 mpathlibs = [libudev]
 mpathpersist = not_found
-if targetos == 'linux' and have_tools and get_option('mpath').allowed()
+if host_os == 'linux' and have_tools and get_option('mpath').allowed()
   mpath_test_source = '''
     #include <libudev.h>
     #include <mpath_persist.h>
@@ -1199,7 +1199,7 @@ if have_system and get_option('curses').allowed()
       return 0;
     }'''
 
-  curses_dep_list = targetos == 'windows' ? ['ncurses', 'ncursesw'] : ['ncursesw']
+  curses_dep_list = host_os == 'windows' ? ['ncurses', 'ncursesw'] : ['ncursesw']
   curses = dependency(curses_dep_list,
                       required: false,
                       method: 'pkg-config')
@@ -1216,13 +1216,13 @@ if have_system and get_option('curses').allowed()
   endif
   if not curses.found()
     has_curses_h = cc.has_header('curses.h', args: curses_compile_args)
-    if targetos != 'windows' and not has_curses_h
+    if host_os != 'windows' and not has_curses_h
       message('Trying with /usr/include/ncursesw')
       curses_compile_args += ['-I/usr/include/ncursesw']
       has_curses_h = cc.has_header('curses.h', args: curses_compile_args)
     endif
     if has_curses_h
-      curses_libname_list = (targetos == 'windows' ? ['pdcurses'] : ['ncursesw', 'cursesw'])
+      curses_libname_list = (host_os == 'windows' ? ['pdcurses'] : ['ncursesw', 'cursesw'])
       foreach curses_libname : curses_libname_list
         libcurses = cc.find_library(curses_libname,
                                     required: false)
@@ -1445,7 +1445,7 @@ oss = not_found
 if get_option('oss').allowed() and have_system
   if not cc.has_header('sys/soundcard.h')
     # not found
-  elif targetos == 'netbsd'
+  elif host_os == 'netbsd'
     oss = cc.find_library('ossaudio', required: get_option('oss'))
   else
     oss = declare_dependency()
@@ -1458,7 +1458,7 @@ if get_option('oss').allowed() and have_system
   endif
 endif
 dsound = not_found
-if not get_option('dsound').auto() or (targetos == 'windows' and have_system)
+if not get_option('dsound').auto() or (host_os == 'windows' and have_system)
   if cc.has_header('dsound.h')
     dsound = declare_dependency(link_args: ['-lole32', '-ldxguid'])
   endif
@@ -1471,7 +1471,7 @@ if not get_option('dsound').auto() or (targetos == 'windows' and have_system)
 endif
 
 coreaudio = not_found
-if not get_option('coreaudio').auto() or (targetos == 'darwin' and have_system)
+if not get_option('coreaudio').auto() or (host_os == 'darwin' and have_system)
   coreaudio = dependency('appleframeworks', modules: 'CoreAudio',
                          required: get_option('coreaudio'))
 endif
@@ -1811,7 +1811,7 @@ endif
 have_xen_pci_passthrough = get_option('xen_pci_passthrough') \
   .require(xen.found(),
            error_message: 'Xen PCI passthrough requested but Xen not enabled') \
-  .require(targetos == 'linux',
+  .require(host_os == 'linux',
            error_message: 'Xen PCI passthrough not available on this platform') \
   .require(cpu == 'x86'  or cpu == 'x86_64',
            error_message: 'Xen PCI passthrough not available on this platform') \
@@ -1906,7 +1906,7 @@ has_statx = cc.has_header_symbol('sys/stat.h', 'STATX_BASIC_STATS', prefix: gnu_
 has_statx_mnt_id = cc.has_header_symbol('sys/stat.h', 'STATX_MNT_ID', prefix: gnu_source_prefix)
 
 have_vhost_user_blk_server = get_option('vhost_user_blk_server') \
-  .require(targetos == 'linux',
+  .require(host_os == 'linux',
            error_message: 'vhost_user_blk_server requires linux') \
   .require(have_vhost_user,
            error_message: 'vhost_user_blk_server requires vhost-user support') \
@@ -1934,18 +1934,18 @@ if get_option('fuse_lseek').allowed()
   endif
 endif
 
-have_libvduse = (targetos == 'linux')
+have_libvduse = (host_os == 'linux')
 if get_option('libvduse').enabled()
-    if targetos != 'linux'
+    if host_os != 'linux'
         error('libvduse requires linux')
     endif
 elif get_option('libvduse').disabled()
     have_libvduse = false
 endif
 
-have_vduse_blk_export = (have_libvduse and targetos == 'linux')
+have_vduse_blk_export = (have_libvduse and host_os == 'linux')
 if get_option('vduse_blk_export').enabled()
-    if targetos != 'linux'
+    if host_os != 'linux'
         error('vduse_blk_export requires linux')
     elif not have_libvduse
         error('vduse_blk_export requires libvduse support')
@@ -2013,7 +2013,7 @@ if have_system
   # Default to native drivers first, OSS second, SDL third
   audio_drivers_priority = \
     [ 'pa', 'coreaudio', 'dsound', 'sndio', 'oss' ] + \
-    (targetos == 'linux' ? [] : [ 'sdl' ])
+    (host_os == 'linux' ? [] : [ 'sdl' ])
   audio_drivers_default = []
   foreach k: audio_drivers_priority
     if audio_drivers_available[k]
@@ -2034,7 +2034,7 @@ endif
 config_host_data.set('CONFIG_AUDIO_DRIVERS',
                      '"' + '", "'.join(audio_drivers_selected) + '", ')
 
-have_host_block_device = (targetos != 'darwin' or
+have_host_block_device = (host_os != 'darwin' or
     cc.has_header('IOKit/storage/IOMedia.h'))
 
 dbus_display = get_option('dbus_display') \
@@ -2045,17 +2045,17 @@ dbus_display = get_option('dbus_display') \
   .allowed()
 
 have_virtfs = get_option('virtfs') \
-    .require(targetos == 'linux' or targetos == 'darwin',
+    .require(host_os == 'linux' or host_os == 'darwin',
              error_message: 'virtio-9p (virtfs) requires Linux or macOS') \
-    .require(targetos == 'linux' or cc.has_function('pthread_fchdir_np'),
+    .require(host_os == 'linux' or cc.has_function('pthread_fchdir_np'),
              error_message: 'virtio-9p (virtfs) on macOS requires the presence of pthread_fchdir_np') \
-    .require(targetos == 'darwin' or libattr.found(),
+    .require(host_os == 'darwin' or libattr.found(),
              error_message: 'virtio-9p (virtfs) on Linux requires libattr-devel') \
     .disable_auto_if(not have_tools and not have_system) \
     .allowed()
 
 have_virtfs_proxy_helper = get_option('virtfs_proxy_helper') \
-    .require(targetos != 'darwin', error_message: 'the virtfs proxy helper is incompatible with macOS') \
+    .require(host_os != 'darwin', error_message: 'the virtfs proxy helper is incompatible with macOS') \
     .require(have_virtfs, error_message: 'the virtfs proxy helper requires that virtfs is enabled') \
     .disable_auto_if(not have_tools) \
     .require(libcap_ng.found(), error_message: 'the virtfs proxy helper requires libcap-ng') \
@@ -2110,12 +2110,12 @@ if enable_modules
 endif
 
 have_slirp_smbd = get_option('slirp_smbd') \
-  .require(targetos != 'windows', error_message: 'Host smbd not supported on this platform.') \
+  .require(host_os != 'windows', error_message: 'Host smbd not supported on this platform.') \
   .allowed()
 if have_slirp_smbd
   smbd_path = get_option('smbd')
   if smbd_path == ''
-    smbd_path = (targetos == 'sunos' ? '/usr/sfw/sbin/smbd' : '/usr/sbin/smbd')
+    smbd_path = (host_os == 'sunos' ? '/usr/sfw/sbin/smbd' : '/usr/sbin/smbd')
   endif
   config_host_data.set_quoted('CONFIG_SMBD_COMMAND', smbd_path)
 endif
@@ -2123,7 +2123,7 @@ endif
 config_host_data.set('HOST_' + host_arch.to_upper(), 1)
 
 kvm_targets_c = '""'
-if get_option('kvm').allowed() and targetos == 'linux'
+if get_option('kvm').allowed() and host_os == 'linux'
   kvm_targets_c = '"' + '" ,"'.join(kvm_targets) + '"'
 endif
 config_host_data.set('CONFIG_KVM_TARGETS', kvm_targets_c)
@@ -2136,16 +2136,16 @@ config_host_data.set('CONFIG_MODULE_UPGRADES', get_option('module_upgrades'))
 config_host_data.set('CONFIG_ATTR', libattr.found())
 config_host_data.set('CONFIG_BDRV_WHITELIST_TOOLS', get_option('block_drv_whitelist_in_tools'))
 config_host_data.set('CONFIG_BRLAPI', brlapi.found())
-config_host_data.set('CONFIG_BSD', targetos in bsd_oses)
+config_host_data.set('CONFIG_BSD', host_os in bsd_oses)
 config_host_data.set('CONFIG_CAPSTONE', capstone.found())
 config_host_data.set('CONFIG_COCOA', cocoa.found())
-config_host_data.set('CONFIG_DARWIN', targetos == 'darwin')
+config_host_data.set('CONFIG_DARWIN', host_os == 'darwin')
 config_host_data.set('CONFIG_FUZZ', get_option('fuzzing'))
 config_host_data.set('CONFIG_GCOV', get_option('b_coverage'))
 config_host_data.set('CONFIG_LIBUDEV', libudev.found())
-config_host_data.set('CONFIG_LINUX', targetos == 'linux')
-config_host_data.set('CONFIG_POSIX', targetos != 'windows')
-config_host_data.set('CONFIG_WIN32', targetos == 'windows')
+config_host_data.set('CONFIG_LINUX', host_os == 'linux')
+config_host_data.set('CONFIG_POSIX', host_os != 'windows')
+config_host_data.set('CONFIG_WIN32', host_os == 'windows')
 config_host_data.set('CONFIG_LZO', lzo.found())
 config_host_data.set('CONFIG_MPATH', mpathpersist.found())
 config_host_data.set('CONFIG_BLKIO', blkio.found())
@@ -2203,7 +2203,7 @@ endif
 config_host_data.set('CONFIG_PIXMAN', pixman.found())
 config_host_data.set('CONFIG_SLIRP', slirp.found())
 config_host_data.set('CONFIG_SNAPPY', snappy.found())
-config_host_data.set('CONFIG_SOLARIS', targetos == 'sunos')
+config_host_data.set('CONFIG_SOLARIS', host_os == 'sunos')
 if get_option('tcg').allowed()
   config_host_data.set('CONFIG_TCG', 1)
   config_host_data.set('CONFIG_TCG_INTERPRETER', tcg_arch == 'tci')
@@ -2304,7 +2304,7 @@ config_host_data.set('HAVE_PTY_H', cc.has_header('pty.h'))
 config_host_data.set('HAVE_SYS_DISK_H', cc.has_header('sys/disk.h'))
 config_host_data.set('HAVE_SYS_IOCCOM_H', cc.has_header('sys/ioccom.h'))
 config_host_data.set('HAVE_SYS_KCOV_H', cc.has_header('sys/kcov.h'))
-if targetos == 'windows'
+if host_os == 'windows'
   config_host_data.set('HAVE_AFUNIX_H', cc.has_header('afunix.h'))
 endif
 
@@ -2686,7 +2686,7 @@ config_host_data.set('CONFIG_USBFS', have_linux_user and cc.compiles('''
   int main(void) { return 0; }'''))
 
 have_keyring = get_option('keyring') \
-  .require(targetos == 'linux', error_message: 'keyring is only available on Linux') \
+  .require(host_os == 'linux', error_message: 'keyring is only available on Linux') \
   .require(cc.compiles('''
     #include <errno.h>
     #include <asm/unistd.h>
@@ -2795,9 +2795,9 @@ endif
 
 if get_option('membarrier').disabled()
   have_membarrier = false
-elif targetos == 'windows'
+elif host_os == 'windows'
   have_membarrier = true
-elif targetos == 'linux'
+elif host_os == 'linux'
   have_membarrier = cc.compiles('''
     #include <linux/membarrier.h>
     #include <sys/syscall.h>
@@ -2834,7 +2834,7 @@ config_host_data.set('CONFIG_AF_VSOCK', cc.has_header_symbol(
 
 have_vss = false
 have_vss_sdk = false # old xp/2003 SDK
-if targetos == 'windows' and 'cpp' in all_languages
+if host_os == 'windows' and 'cpp' in all_languages
   have_vss = cxx.compiles('''
     #define __MIDL_user_allocate_free_DEFINED__
     #include <vss.h>
@@ -2845,7 +2845,7 @@ config_host_data.set('HAVE_VSS_SDK', have_vss_sdk)
 
 # Older versions of MinGW do not import _lock_file and _unlock_file properly.
 # This was fixed for v6.0.0 with commit b48e3ac8969d.
-if targetos == 'windows'
+if host_os == 'windows'
   config_host_data.set('HAVE__LOCK_FILE', cc.links('''
     #include <stdio.h>
     int main(void) {
@@ -2855,7 +2855,7 @@ if targetos == 'windows'
     }''', name: '_lock_file and _unlock_file'))
 endif
 
-if targetos == 'windows'
+if host_os == 'windows'
   mingw_has_setjmp_longjmp = cc.links('''
     #include <setjmp.h>
     int main(void) {
@@ -2925,7 +2925,7 @@ host_kconfig = \
   (have_vhost_vdpa ? ['CONFIG_VHOST_VDPA=y'] : []) + \
   (have_vhost_kernel ? ['CONFIG_VHOST_KERNEL=y'] : []) + \
   (have_virtfs ? ['CONFIG_VIRTFS=y'] : []) + \
-  (targetos == 'linux' ? ['CONFIG_LINUX=y'] : []) + \
+  (host_os == 'linux' ? ['CONFIG_LINUX=y'] : []) + \
   (have_pvrdma ? ['CONFIG_PVRDMA=y'] : []) + \
   (multiprocess_allowed ? ['CONFIG_MULTIPROCESS_ALLOWED=y'] : []) + \
   (vfio_user_server_allowed ? ['CONFIG_VFIO_USER_SERVER_ALLOWED=y'] : []) + \
@@ -2939,7 +2939,7 @@ fdt_required = []
 foreach target : target_dirs
   config_target = { 'TARGET_NAME': target.split('-')[0] }
   if target.endswith('linux-user')
-    if targetos != 'linux'
+    if host_os != 'linux'
       if default_targets
         continue
       endif
@@ -2947,7 +2947,7 @@ foreach target : target_dirs
     endif
     config_target += { 'CONFIG_LINUX_USER': 'y' }
   elif target.endswith('bsd-user')
-    if targetos not in bsd_oses
+    if host_os not in bsd_oses
       if default_targets
         continue
       endif
@@ -3128,7 +3128,7 @@ endif
 config_host_data.set('CONFIG_FDT', fdt.found())
 
 vhost_user = not_found
-if targetos == 'linux' and have_vhost_user
+if host_os == 'linux' and have_vhost_user
   libvhost_user = subproject('libvhost-user')
   vhost_user = libvhost_user.get_variable('vhost_user_dep')
 endif
@@ -3452,7 +3452,7 @@ if have_block
 
   # os-posix.c contains POSIX-specific functions used by qemu-storage-daemon,
   # os-win32.c does not
-  if targetos == 'windows'
+  if host_os == 'windows'
     system_ss.add(files('os-win32.c'))
   else
     blockdev_ss.add(files('os-posix.c'))
@@ -3740,7 +3740,7 @@ common_all = static_library('common',
 
 feature_to_c = find_program('scripts/feature_to_c.py')
 
-if targetos == 'darwin'
+if host_os == 'darwin'
   entitlement = find_program('scripts/entitlement.sh')
 endif
 
@@ -3757,7 +3757,7 @@ foreach target : target_dirs
   link_args = emulator_link_args
 
   target_inc = [include_directories('target' / config_target['TARGET_BASE_ARCH'])]
-  if targetos == 'linux'
+  if host_os == 'linux'
     target_inc += include_directories('linux-headers', is_system: true)
   endif
   if target.endswith('-softmmu')
@@ -3787,7 +3787,7 @@ foreach target : target_dirs
     endif
     if 'CONFIG_BSD_USER' in config_target
       base_dir = 'bsd-user'
-      target_inc += include_directories('bsd-user/' / targetos)
+      target_inc += include_directories('bsd-user/' / host_os)
       target_inc += include_directories('bsd-user/host/' / host_arch)
       dir = base_dir / abi
       arch_srcs += files(dir / 'signal.c', dir / 'target_arch_cpu.c')
@@ -3844,7 +3844,7 @@ foreach target : target_dirs
       'sources': files('system/main.c'),
       'dependencies': []
     }]
-    if targetos == 'windows' and (sdl.found() or gtk.found())
+    if host_os == 'windows' and (sdl.found() or gtk.found())
       execs += [{
         'name': 'qemu-system-' + target_name + 'w',
         'win_subsystem': 'windows',
@@ -3871,7 +3871,7 @@ foreach target : target_dirs
   endif
   foreach exe: execs
     exe_name = exe['name']
-    if targetos == 'darwin'
+    if host_os == 'darwin'
       exe_name += '-unsigned'
     endif
 
@@ -3884,7 +3884,7 @@ foreach target : target_dirs
                link_args: link_args,
                win_subsystem: exe['win_subsystem'])
 
-    if targetos == 'darwin'
+    if host_os == 'darwin'
       icon = 'pc-bios/qemu.rsrc'
       build_input = [emulator, files(icon)]
       install_input = [
@@ -3940,7 +3940,7 @@ endforeach
 
 if get_option('plugins')
   install_headers('include/qemu/qemu-plugin.h')
-  if targetos == 'windows'
+  if host_os == 'windows'
     # On windows, we want to deliver the qemu_plugin_api.lib file in the qemu installer,
     # so that plugin authors can compile against it.
     install_data(win32_qemu_plugin_api_lib, install_dir: 'lib')
@@ -3981,7 +3981,7 @@ if have_tools
     subdir('contrib/vhost-user-scsi')
   endif
 
-  if targetos == 'linux'
+  if host_os == 'linux'
     executable('qemu-bridge-helper', files('qemu-bridge-helper.c'),
                dependencies: [qemuutil, libcap_ng],
                install: true,
@@ -4048,7 +4048,7 @@ summary(summary_info, bool_yn: true, section: 'Build environment')
 # Directories
 summary_info += {'Install prefix':    get_option('prefix')}
 summary_info += {'BIOS directory':    qemu_datadir}
-pathsep = targetos == 'windows' ? ';' : ':'
+pathsep = host_os == 'windows' ? ';' : ':'
 summary_info += {'firmware path':     pathsep.join(get_option('qemu_firmwarepath'))}
 summary_info += {'binary directory':  get_option('prefix') / get_option('bindir')}
 summary_info += {'library directory': get_option('prefix') / get_option('libdir')}
@@ -4056,7 +4056,7 @@ summary_info += {'module directory':  qemu_moddir}
 summary_info += {'libexec directory': get_option('prefix') / get_option('libexecdir')}
 summary_info += {'include directory': get_option('prefix') / get_option('includedir')}
 summary_info += {'config directory':  get_option('prefix') / get_option('sysconfdir')}
-if targetos != 'windows'
+if host_os != 'windows'
   summary_info += {'local state directory': get_option('prefix') / get_option('localstatedir')}
   summary_info += {'Manual directory':      get_option('prefix') / get_option('mandir')}
 else
@@ -4079,7 +4079,7 @@ if config_host.has_key('GDB')
 endif
 summary_info += {'iasl':              iasl}
 summary_info += {'genisoimage':       config_host['GENISOIMAGE']}
-if targetos == 'windows' and have_ga
+if host_os == 'windows' and have_ga
   summary_info += {'wixl':            wixl}
 endif
 if slirp.found() and have_system
@@ -4177,7 +4177,7 @@ if get_option('cfi')
 endif
 summary_info += {'strip binaries':    get_option('strip')}
 summary_info += {'sparse':            sparse}
-summary_info += {'mingw32 support':   targetos == 'windows'}
+summary_info += {'mingw32 support':   host_os == 'windows'}
 summary(summary_info, bool_yn: true, section: 'Compilation')
 
 # snarf the cross-compilation information for tests
@@ -4276,7 +4276,7 @@ summary(summary_info, bool_yn: true, section: 'Crypto')
 
 # UI
 summary_info = {}
-if targetos == 'darwin'
+if host_os == 'darwin'
   summary_info += {'Cocoa support':           cocoa}
 endif
 summary_info += {'SDL support':       sdl}
@@ -4300,15 +4300,15 @@ summary(summary_info, bool_yn: true, section: 'User interface')
 
 # Audio backends
 summary_info = {}
-if targetos not in ['darwin', 'haiku', 'windows']
+if host_os not in ['darwin', 'haiku', 'windows']
   summary_info += {'OSS support':     oss}
   summary_info += {'sndio support':   sndio}
-elif targetos == 'darwin'
+elif host_os == 'darwin'
   summary_info += {'CoreAudio support': coreaudio}
-elif targetos == 'windows'
+elif host_os == 'windows'
   summary_info += {'DirectSound support': dsound}
 endif
-if targetos == 'linux'
+if host_os == 'linux'
   summary_info += {'ALSA support':    alsa}
   summary_info += {'PulseAudio support': pulse}
 endif
@@ -4318,7 +4318,7 @@ summary(summary_info, bool_yn: true, section: 'Audio backends')
 
 # Network backends
 summary_info = {}
-if targetos == 'darwin'
+if host_os == 'darwin'
   summary_info += {'vmnet.framework support': vmnet}
 endif
 summary_info += {'AF_XDP support':    libxdp}
@@ -4355,7 +4355,7 @@ summary_info += {'OpenGL support (epoxy)': opengl}
 summary_info += {'GBM':               gbm}
 summary_info += {'libiscsi support':  libiscsi}
 summary_info += {'libnfs support':    libnfs}
-if targetos == 'windows'
+if host_os == 'windows'
   if have_ga
     summary_info += {'QGA VSS support':   have_qga_vss}
   endif
@@ -4397,20 +4397,20 @@ if host_arch == 'unknown'
   endif
 endif
 
-if not supported_oses.contains(targetos)
+if not supported_oses.contains(host_os)
   message()
   warning('UNSUPPORTED HOST OS')
   message()
-  message('Support for host OS ' + targetos + 'is not currently maintained.')
+  message('Support for host OS ' + host_os + 'is not currently maintained.')
   message('configure has succeeded and you can continue to build, but')
   message('the QEMU project does not guarantee that QEMU will compile or')
   message('work on this operating system. You can help by volunteering')
   message('to maintain it and providing a build host for our continuous')
   message('integration setup. This will ensure that future versions of QEMU')
-  message('will keep working on ' + targetos + '.')
+  message('will keep working on ' + host_os + '.')
 endif
 
-if host_arch == 'unknown' or not supported_oses.contains(targetos)
+if host_arch == 'unknown' or not supported_oses.contains(host_os)
   message()
   message('If you want to help supporting QEMU on this platform, please')
   message('contact the developers at qemu-devel@nongnu.org.')
@@ -4424,8 +4424,8 @@ if get_option('relocatable') and \
   warning('bindir not included within prefix, the installation will not be relocatable.')
   actually_reloc = false
 endif
-if not actually_reloc and (targetos == 'windows' or get_option('relocatable'))
-  if targetos == 'windows'
+if not actually_reloc and (host_os == 'windows' or get_option('relocatable'))
+  if host_os == 'windows'
     message()
     warning('Windows installs should usually be relocatable.')
   endif
diff --git a/net/can/meson.build b/net/can/meson.build
index bdf6f8eee16..af3b27921cd 100644
--- a/net/can/meson.build
+++ b/net/can/meson.build
@@ -1,6 +1,6 @@
 can_ss = ss.source_set()
 can_ss.add(files('can_core.c', 'can_host.c'))
-if targetos == 'linux'
+if host_os == 'linux'
   can_ss.add(files('can_socketcan.c'))
 endif
 
diff --git a/net/meson.build b/net/meson.build
index a53f18ad7b4..9432a588e4e 100644
--- a/net/meson.build
+++ b/net/meson.build
@@ -43,13 +43,13 @@ if have_vhost_net_user
   system_ss.add(when: 'CONFIG_VIRTIO_NET', if_true: files('vhost-user.c'), if_false: files('vhost-user-stub.c'))
 endif
 
-if targetos == 'windows'
+if host_os == 'windows'
   system_ss.add(files('tap-win32.c'))
-elif targetos == 'linux'
+elif host_os == 'linux'
   system_ss.add(files('tap.c', 'tap-linux.c'))
-elif targetos in bsd_oses
+elif host_os in bsd_oses
   system_ss.add(files('tap.c', 'tap-bsd.c'))
-elif targetos == 'sunos'
+elif host_os == 'sunos'
   system_ss.add(files('tap.c', 'tap-solaris.c'))
 else
   system_ss.add(files('tap.c', 'tap-stub.c'))
diff --git a/plugins/meson.build b/plugins/meson.build
index 6b2d7a92926..51b4350c2a0 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -1,7 +1,7 @@
 plugin_ldflags = []
 # Modules need more symbols than just those in plugins/qemu-plugins.symbols
 if not enable_modules
-  if targetos == 'darwin'
+  if host_os == 'darwin'
     configure_file(
       input: files('qemu-plugins.symbols'),
       output: 'qemu-plugins-ld64.symbols',
@@ -14,7 +14,7 @@ if not enable_modules
 endif
 
 if get_option('plugins')
-  if targetos == 'windows'
+  if host_os == 'windows'
     dlltool = find_program('dlltool', required: true)
 
     # Generate a .lib file for plugins to link against.
diff --git a/qga/meson.build b/qga/meson.build
index 66c0f1e56f8..1c3d2a3d1b7 100644
--- a/qga/meson.build
+++ b/qga/meson.build
@@ -7,7 +7,7 @@ if not have_ga
 endif
 
 have_qga_vss = get_option('qga_vss') \
-  .require(targetos == 'windows',
+  .require(host_os == 'windows',
            error_message: 'VSS support requires Windows') \
   .require('cpp' in all_languages,
            error_message: 'VSS support requires a C++ compiler') \
@@ -67,7 +67,7 @@ qga_ss.add(files(
   'main.c',
   'cutils.c',
 ))
-if targetos == 'windows'
+if host_os == 'windows'
   qga_ss.add(files(
     'channel-win32.c',
     'commands-win32.c',
@@ -80,9 +80,9 @@ else
     'commands-posix.c',
     'commands-posix-ssh.c',
   ))
-  if targetos == 'linux'
+  if host_os == 'linux'
     qga_ss.add(files('commands-linux.c'))
-  elif targetos in bsd_oses
+  elif host_os in bsd_oses
     qga_ss.add(files('commands-bsd.c'))
   endif
 endif
@@ -91,7 +91,7 @@ qga_ss = qga_ss.apply({})
 
 gen_tlb = []
 qga_libs = []
-if targetos == 'windows'
+if host_os == 'windows'
   qga_libs += ['-lws2_32', '-lwinmm', '-lpowrprof', '-lwtsapi32', '-lwininet', '-liphlpapi', '-lnetapi32',
                '-lsetupapi', '-lcfgmgr32']
   if have_qga_vss
@@ -101,7 +101,7 @@ if targetos == 'windows'
 endif
 
 qga_objs = []
-if targetos == 'windows'
+if host_os == 'windows'
   windmc = find_program('windmc', required: true)
   windres = find_program('windres', required: true)
 
@@ -123,7 +123,7 @@ qga = executable('qemu-ga', qga_ss.sources() + qga_objs,
                  install: true)
 all_qga += qga
 
-if targetos == 'windows'
+if host_os == 'windows'
   qemu_ga_msi_arch = {
     'x86': ['-D', 'Arch=32'],
     'x86_64': ['-a', 'x64', '-D', 'Arch=64']
@@ -185,7 +185,7 @@ test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
 # the leak detector in build-oss-fuzz Gitlab CI test. we should re-enable
 # this when an alternative is implemented or when the underlying glib
 # issue is identified/fix
-#if targetos != 'windows'
+#if host_os != 'windows'
 if false
   srcs = [files('commands-posix-ssh.c')]
   i = 0
diff --git a/scsi/meson.build b/scsi/meson.build
index 0ff2b3affe0..cdb91e11b0e 100644
--- a/scsi/meson.build
+++ b/scsi/meson.build
@@ -1,5 +1,5 @@
 block_ss.add(files('utils.c'))
-if targetos == 'linux'
+if host_os == 'linux'
   block_ss.add(files('pr-manager.c', 'pr-manager-helper.c'))
 else
   block_ss.add(files('pr-manager-stub.c'))
diff --git a/system/meson.build b/system/meson.build
index 0632a3daa8a..25e21172505 100644
--- a/system/meson.build
+++ b/system/meson.build
@@ -33,6 +33,6 @@ endif
 
 system_ss.add(when: seccomp, if_true: files('qemu-seccomp.c'))
 system_ss.add(when: fdt, if_true: files('device_tree.c'))
-if targetos == 'linux'
-  system_ss.add('async-teardown.c')
+if host_os == 'linux'
+  system_ss.add(files('async-teardown.c'))
 endif
diff --git a/tests/fp/meson.build b/tests/fp/meson.build
index 9ef322afc42..4ab89aaa960 100644
--- a/tests/fp/meson.build
+++ b/tests/fp/meson.build
@@ -3,7 +3,7 @@ if 'CONFIG_TCG' not in config_all_accel
 endif
 # There are namespace pollution issues on Windows, due to osdep.h
 # bringing in Windows headers that define a FLOAT128 type.
-if targetos == 'windows'
+if host_os == 'windows'
   subdir_done()
 endif
 
diff --git a/tests/meson.build b/tests/meson.build
index 32cc15a3ef7..0a6f96f8f84 100644
--- a/tests/meson.build
+++ b/tests/meson.build
@@ -68,7 +68,7 @@ test_deps = {
   'test-qht-par': qht_bench,
 }
 
-if have_tools and have_vhost_user and targetos == 'linux'
+if have_tools and have_vhost_user and host_os == 'linux'
   executable('vhost-user-bridge',
              sources: files('vhost-user-bridge.c'),
              dependencies: [qemuutil, vhost_user])
diff --git a/tests/plugin/meson.build b/tests/plugin/meson.build
index 28a929dbcc0..e18183aaeda 100644
--- a/tests/plugin/meson.build
+++ b/tests/plugin/meson.build
@@ -1,7 +1,7 @@
 t = []
 if get_option('plugins')
   foreach i : ['bb', 'empty', 'insn', 'mem', 'syscall']
-    if targetos == 'windows'
+    if host_os == 'windows'
       t += shared_module(i, files(i + '.c') + '../../contrib/plugins/win32_linker.c',
                         include_directories: '../../include/qemu',
                         link_depends: [win32_qemu_plugin_api_lib],
diff --git a/tests/qemu-iotests/meson.build b/tests/qemu-iotests/meson.build
index 53847cb98fc..fad340ad595 100644
--- a/tests/qemu-iotests/meson.build
+++ b/tests/qemu-iotests/meson.build
@@ -1,4 +1,4 @@
-if not have_tools or targetos == 'windows'
+if not have_tools or host_os == 'windows'
   subdir_done()
 endif
 
diff --git a/tests/qtest/meson.build b/tests/qtest/meson.build
index 565eff4c0a2..f25bffcc20a 100644
--- a/tests/qtest/meson.build
+++ b/tests/qtest/meson.build
@@ -38,8 +38,8 @@ qtests_cxl = \
 #        for the availability of the default NICs in the tests
 qtests_filter = \
   (get_option('default_devices') and slirp.found() ? ['test-netfilter'] : []) + \
-  (get_option('default_devices') and targetos != 'windows' ? ['test-filter-mirror'] : []) + \
-  (get_option('default_devices') and targetos != 'windows' ? ['test-filter-redirector'] : [])
+  (get_option('default_devices') and host_os != 'windows' ? ['test-filter-mirror'] : []) + \
+  (get_option('default_devices') and host_os != 'windows' ? ['test-filter-redirector'] : [])
 
 qtests_i386 = \
   (slirp.found() ? ['pxe-test'] : []) + \
@@ -48,7 +48,7 @@ qtests_i386 = \
   (config_all_devices.has_key('CONFIG_ISA_TESTDEV') ? ['endianness-test'] : []) +           \
   (config_all_devices.has_key('CONFIG_SGA') ? ['boot-serial-test'] : []) +                  \
   (config_all_devices.has_key('CONFIG_ISA_IPMI_KCS') ? ['ipmi-kcs-test'] : []) +            \
-  (targetos == 'linux' and                                                                  \
+  (host_os == 'linux' and                                                                  \
    config_all_devices.has_key('CONFIG_ISA_IPMI_BT') and
    config_all_devices.has_key('CONFIG_IPMI_EXTERN') ? ['ipmi-bt-test'] : []) +              \
   (config_all_devices.has_key('CONFIG_WDT_IB700') ? ['wdt_ib700-test'] : []) +              \
@@ -74,7 +74,7 @@ qtests_i386 = \
   (config_all_devices.has_key('CONFIG_SB16') ? ['fuzz-sb16-test'] : []) +                   \
   (config_all_devices.has_key('CONFIG_SDHCI_PCI') ? ['fuzz-sdcard-test'] : []) +            \
   (config_all_devices.has_key('CONFIG_ESP_PCI') ? ['am53c974-test'] : []) +                 \
-  (targetos != 'windows' and                                                                \
+  (host_os != 'windows' and                                                                \
    config_all_devices.has_key('CONFIG_ACPI_ERST') ? ['erst-test'] : []) +                   \
   (config_all_devices.has_key('CONFIG_PCIE_PORT') and                                       \
    config_all_devices.has_key('CONFIG_VIRTIO_NET') and                                      \
@@ -277,7 +277,7 @@ if config_all_devices.has_key('CONFIG_VIRTIO_SERIAL')
   qos_test_ss.add(files('virtio-serial-test.c'))
 endif
 
-if targetos != 'windows'
+if host_os != 'windows'
   qos_test_ss.add(files('e1000e-test.c'))
 endif
 if have_virtfs
diff --git a/tests/unit/meson.build b/tests/unit/meson.build
index a05d4710904..69f9c050504 100644
--- a/tests/unit/meson.build
+++ b/tests/unit/meson.build
@@ -100,7 +100,7 @@ if have_block
   }
   if gnutls.found() and \
      tasn1.found() and \
-     targetos != 'windows'
+     host_os != 'windows'
     tests += {
       'test-crypto-tlscredsx509': ['crypto-tls-x509-helpers.c', 'pkix_asn1_tab.c',
                                    tasn1, crypto, gnutls],
@@ -115,7 +115,7 @@ if have_block
   if xts == 'private'
     tests += {'test-crypto-xts': [crypto, io]}
   endif
-  if targetos != 'windows'
+  if host_os != 'windows'
     tests += {
       'test-image-locking': [testblock],
       'test-nested-aio-poll': [testblock],
@@ -150,7 +150,7 @@ if have_system
   # are not runnable under TSan due to a known issue.
   # https://github.com/google/sanitizers/issues/1116
   if not get_option('tsan')
-    if targetos != 'windows'
+    if host_os != 'windows'
         tests += {
           'test-char': ['socket-helpers.c', qom, io, chardev]
         }
@@ -162,7 +162,7 @@ if have_system
   endif
 endif
 
-if have_ga and targetos == 'linux'
+if have_ga and host_os == 'linux'
   tests += {'test-qga': ['../qtest/libqmp.c']}
   test_deps += {'test-qga': qga}
 endif
diff --git a/ui/dbus-display1.xml b/ui/dbus-display1.xml
index f0e2fac2127..ce35d64eea1 100644
--- a/ui/dbus-display1.xml
+++ b/ui/dbus-display1.xml
@@ -71,7 +71,7 @@
         :dbus:iface:`org.qemu.Display1.Listener` interface.
     -->
     <method name="RegisterListener">
-      <?if $(env.TARGETOS) == windows?>
+      <?if $(env.HOST_OS) == windows?>
       <arg type="ay" name="listener" direction="in">
         <annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
       </arg>
@@ -370,7 +370,7 @@
       </arg>
     </method>
 
-    <?if $(env.TARGETOS) != windows?>
+    <?if $(env.HOST_OS) != windows?>
     <!--
         ScanoutDMABUF:
         @dmabuf: the DMABUF file descriptor.
@@ -694,7 +694,7 @@
         :dbus:iface:`org.qemu.Display1.AudioOutListener` interface.
     -->
     <method name="RegisterOutListener">
-      <?if $(env.TARGETOS) == windows?>
+      <?if $(env.HOST_OS) == windows?>
       <arg type="ay" name="listener" direction="in">
         <annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
       </arg>
@@ -715,7 +715,7 @@
         :dbus:iface:`org.qemu.Display1.AudioInListener` interface.
     -->
     <method name="RegisterInListener">
-      <?if $(env.TARGETOS) == windows?>
+      <?if $(env.HOST_OS) == windows?>
       <arg type="ay" name="listener" direction="in">
         <annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
       </arg>
@@ -976,7 +976,7 @@
         The current handler, if any, will be replaced.
     -->
     <method name="Register">
-      <?if $(env.TARGETOS) == windows?>
+      <?if $(env.HOST_OS) == windows?>
       <arg type="ay" name="listener" direction="in">
         <annotation name="org.gtk.GDBus.C.ForceGVariant" value="true"/>
       </arg>
diff --git a/ui/meson.build b/ui/meson.build
index a370494c4ab..376e0d771ba 100644
--- a/ui/meson.build
+++ b/ui/meson.build
@@ -25,7 +25,7 @@ endif
 system_ss.add([spice_headers, files('spice-module.c')])
 system_ss.add(when: spice_protocol, if_true: files('vdagent.c'))
 
-if targetos == 'linux'
+if host_os == 'linux'
   system_ss.add(files('input-linux.c', 'udmabuf.c'))
 endif
 system_ss.add(when: cocoa, if_true: files('cocoa.m'))
@@ -75,7 +75,7 @@ endif
 if dbus_display
   dbus_ss = ss.source_set()
   env = environment()
-  env.set('TARGETOS', targetos)
+  env.set('HOST_OS', host_os)
   xml = custom_target('dbus-display preprocess',
                       input: 'dbus-display1.xml',
                       output: 'dbus-display1.xml',
@@ -105,7 +105,7 @@ if dbus_display
 endif
 
 if gtk.found()
-  if targetos == 'windows'
+  if host_os == 'windows'
     system_ss.add(files('win32-kbd-hook.c'))
   endif
 
@@ -121,7 +121,7 @@ if gtk.found()
 endif
 
 if sdl.found()
-  if targetos == 'windows'
+  if host_os == 'windows'
     system_ss.add(files('win32-kbd-hook.c'))
   endif
 
diff --git a/util/meson.build b/util/meson.build
index 4e970d2b488..af3bf5692d8 100644
--- a/util/meson.build
+++ b/util/meson.build
@@ -3,7 +3,7 @@ util_ss.add(files('thread-context.c'), numa)
 if not config_host_data.get('CONFIG_ATOMIC64')
   util_ss.add(files('atomic64.c'))
 endif
-if targetos != 'windows'
+if host_os != 'windows'
   util_ss.add(files('aio-posix.c'))
   util_ss.add(files('fdmon-poll.c'))
   if config_host_data.get('CONFIG_EPOLL_CREATE1')
@@ -13,7 +13,7 @@ if targetos != 'windows'
   util_ss.add(files('event_notifier-posix.c'))
   util_ss.add(files('mmap-alloc.c'))
   freebsd_dep = []
-  if targetos == 'freebsd'
+  if host_os == 'freebsd'
     freebsd_dep = util
   endif
   util_ss.add(files('oslib-posix.c'), freebsd_dep)
@@ -73,7 +73,7 @@ endif
 if have_system
   util_ss.add(files('crc-ccitt.c'))
   util_ss.add(when: gio, if_true: files('dbus.c'))
-  if targetos == 'linux'
+  if host_os == 'linux'
     util_ss.add(files('userfaultfd.c'))
   endif
 endif
@@ -108,7 +108,7 @@ if have_block
   else
     util_ss.add(files('filemonitor-stub.c'))
   endif
-  if targetos == 'linux'
+  if host_os == 'linux'
     util_ss.add(files('vhost-user-server.c'), vhost_user)
     util_ss.add(files('vfio-helpers.c'))
     util_ss.add(files('chardev_open.c'))
-- 
2.43.0



^ permalink raw reply related	[flat|nested] 32+ messages in thread

* Re: [PATCH 02/21] meson: remove unused variable
  2023-12-21 17:19 ` [PATCH 02/21] meson: remove unused variable Paolo Bonzini
@ 2023-12-29  9:36   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-12-29  9:36 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 21/12/23 18:19, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   tests/bench/meson.build | 6 +++---
>   1 file changed, 3 insertions(+), 3 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 05/21] configure: remove unnecessary subshell
  2023-12-21 17:19 ` [PATCH 05/21] configure: remove unnecessary subshell Paolo Bonzini
@ 2023-12-29  9:39   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-12-29  9:39 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 21/12/23 18:19, Paolo Bonzini wrote:
> Do not use a subshell to hide the shadowing of $config_host_mak.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   configure | 8 +++-----
>   1 file changed, 3 insertions(+), 5 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 10/21] meson: remove config_targetos
  2023-12-21 17:19 ` [PATCH 10/21] meson: remove config_targetos Paolo Bonzini
@ 2023-12-29  9:42   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-12-29  9:42 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 21/12/23 18:19, Paolo Bonzini wrote:
> config_targetos is now empty and can be removed; its use in sourcesets
> that do not involve target-specific files can be replaced with an empty
> dictionary.
> 
> In fact, at this point *all* sourcesets that do not involve
> target-specific files are just glorified mutable arrays.  Enforce that
> they never test for symbols in "when:" by computing the set of files
> without "strict: false".

Cool!

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   chardev/meson.build        |  2 +-
>   gdbstub/meson.build        |  4 ++--
>   meson.build                | 24 ++++++++++--------------
>   qga/meson.build            |  2 +-
>   storage-daemon/meson.build |  2 +-
>   tcg/meson.build            |  2 +-
>   tests/qtest/meson.build    |  2 +-
>   7 files changed, 17 insertions(+), 21 deletions(-)



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 12/21] meson: rename config_all
  2023-12-21 17:19 ` [PATCH 12/21] meson: rename config_all Paolo Bonzini
@ 2023-12-29  9:43   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-12-29  9:43 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 21/12/23 18:19, Paolo Bonzini wrote:
> config_all now lists only accelerators, rename it to indicate its actual
> content.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   hw/mips/meson.build     |  2 +-
>   meson.build             | 16 ++++++++--------
>   target/arm/meson.build  |  2 +-
>   target/mips/meson.build |  2 +-
>   tests/fp/meson.build    |  2 +-
>   tests/meson.build       |  2 +-
>   tests/qtest/meson.build |  8 ++++----
>   7 files changed, 17 insertions(+), 17 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 13/21] meson: add more sections to main meson.build
  2023-12-21 17:19 ` [PATCH 13/21] meson: add more sections to main meson.build Paolo Bonzini
@ 2023-12-29  9:44   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-12-29  9:44 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 21/12/23 18:19, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   meson.build | 24 ++++++++++++++++++------
>   1 file changed, 18 insertions(+), 6 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 14/21] meson: move program checks together
  2023-12-21 17:19 ` [PATCH 14/21] meson: move program checks together Paolo Bonzini
@ 2023-12-29  9:50   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-12-29  9:50 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 21/12/23 18:19, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   meson.build | 90 ++++++++++++++++++++++++++---------------------------
>   1 file changed, 45 insertions(+), 45 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 16/21] meson: separate host-specific checks from option validation
  2023-12-21 17:19 ` [PATCH 16/21] meson: separate host-specific checks from option validation Paolo Bonzini
@ 2023-12-29  9:54   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-12-29  9:54 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 21/12/23 18:19, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   meson.build | 97 +++++++++++++++++++++++++++--------------------------
>   1 file changed, 50 insertions(+), 47 deletions(-

[...]

> -elif targetos == 'openbsd'
> -  if get_option('tcg').allowed() and target_dirs.length() > 0
> -    # Disable OpenBSD W^X if available
> -    emulator_link_args = cc.get_supported_link_arguments('-Wl,-z,wxneeded')
> -  endif
> -endif
> -
>   # Target-specific configuration of accelerators
>   accelerators = []
>   if get_option('kvm').allowed() and targetos == 'linux'
> @@ -716,6 +669,56 @@ if 'CONFIG_WHPX' not in accelerators and get_option('whpx').enabled()
>     error('WHPX not available on this platform')
>   endif

[*]

> +#####################################
> +# Host-specific libraries and flags #
> +#####################################
> +
> +libm = cc.find_library('m', required: false)
> +threads = dependency('threads')
> +util = cc.find_library('util', required: false)
> +winmm = []
> +socket = []
> +version_res = []
> +coref = []
> +iokit = []
> +emulator_link_args = []

This ...

> +nvmm =not_found
> +hvf = not_found

... could be moved at [*] with 'accelerators'.
(missing space around nvmm)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>

> +midl = not_found
> +widl = not_found
> +pathcch = not_found
> +host_dsosuf = '.so'
> +if targetos == 'windows'
> +  midl = find_program('midl', required: false)
> +  widl = find_program('widl', required: false)
> +  pathcch = cc.find_library('pathcch')
> +  socket = cc.find_library('ws2_32')
> +  winmm = cc.find_library('winmm')

[...]


^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 18/21] meson: move CFI detection code earlier
  2023-12-21 17:19 ` [PATCH 18/21] meson: move CFI detection code earlier Paolo Bonzini
@ 2023-12-29  9:54   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-12-29  9:54 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 21/12/23 18:19, Paolo Bonzini wrote:
> Keep it together with the other compiler modes, and before dependencies.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   meson.build | 80 ++++++++++++++++++++++++++---------------------------
>   1 file changed, 40 insertions(+), 40 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 20/21] meson: move subdirs to "Collect sources" section
  2023-12-21 17:19 ` [PATCH 20/21] meson: move subdirs to "Collect sources" section Paolo Bonzini
@ 2023-12-29  9:55   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-12-29  9:55 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 21/12/23 18:19, Paolo Bonzini wrote:
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   meson.build | 66 ++++++++++++++++++++++++++---------------------------
>   1 file changed, 33 insertions(+), 33 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 32+ messages in thread

* Re: [PATCH 21/21] configure, meson: rename targetos to host_os
  2023-12-21 17:19 ` [PATCH 21/21] configure, meson: rename targetos to host_os Paolo Bonzini
@ 2023-12-29 10:01   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 32+ messages in thread
From: Philippe Mathieu-Daudé @ 2023-12-29 10:01 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 21/12/23 18:19, Paolo Bonzini wrote:
> This variable is about the host OS, not the target.  It is used a lot
> more since the Meson conversion, but the original sin dates back to 2003.
> Time to fix it.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>   accel/tcg/meson.build                |   2 +-
>   backends/meson.build                 |   4 +-
>   block/meson.build                    |   4 +-
>   bsd-user/meson.build                 |   2 +-
>   chardev/meson.build                  |   4 +-
>   configure                            |  58 ++++----
>   contrib/ivshmem-client/meson.build   |   2 +-
>   contrib/ivshmem-server/meson.build   |   2 +-
>   contrib/vhost-user-blk/meson.build   |   2 +-
>   contrib/vhost-user-input/meson.build |   2 +-
>   contrib/vhost-user-scsi/meson.build  |   2 +-
>   docs/devel/kconfig.rst               |   2 +-
>   fsdev/meson.build                    |   2 +-
>   hw/9pfs/meson.build                  |   4 +-
>   hw/display/meson.build               |   2 +-
>   hw/ppc/meson.build                   |   2 +-
>   hw/usb/meson.build                   |   4 +-
>   meson.build                          | 206 +++++++++++++--------------
>   net/can/meson.build                  |   2 +-
>   net/meson.build                      |   8 +-
>   plugins/meson.build                  |   4 +-
>   qga/meson.build                      |  16 +--
>   scsi/meson.build                     |   2 +-
>   system/meson.build                   |   4 +-
>   tests/fp/meson.build                 |   2 +-
>   tests/meson.build                    |   2 +-
>   tests/plugin/meson.build             |   2 +-
>   tests/qemu-iotests/meson.build       |   2 +-
>   tests/qtest/meson.build              |  10 +-
>   tests/unit/meson.build               |   8 +-
>   ui/dbus-display1.xml                 |  10 +-
>   ui/meson.build                       |   8 +-
>   util/meson.build                     |   8 +-
>   33 files changed, 197 insertions(+), 197 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>



^ permalink raw reply	[flat|nested] 32+ messages in thread

end of thread, other threads:[~2023-12-29 10:03 UTC | newest]

Thread overview: 32+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2023-12-21 17:19 [PATCH 00/21] Build system cleanups for QEMU 9.0 Paolo Bonzini
2023-12-21 17:19 ` [PATCH 01/21] meson: fix type of "relocatable" option Paolo Bonzini
2023-12-21 17:19 ` [PATCH 02/21] meson: remove unused variable Paolo Bonzini
2023-12-29  9:36   ` Philippe Mathieu-Daudé
2023-12-21 17:19 ` [PATCH 03/21] meson: use version_compare() to compare version Paolo Bonzini
2023-12-21 17:19 ` [PATCH 04/21] Makefile: clean qemu-iotests output Paolo Bonzini
2023-12-21 17:19 ` [PATCH 05/21] configure: remove unnecessary subshell Paolo Bonzini
2023-12-29  9:39   ` Philippe Mathieu-Daudé
2023-12-21 17:19 ` [PATCH 06/21] configure: unify again the case arms in probe_target_compiler Paolo Bonzini
2023-12-21 17:19 ` [PATCH 07/21] meson: always probe u2f and canokey if the option is enabled Paolo Bonzini
2023-12-21 17:19 ` [PATCH 08/21] meson: remove OS definitions from config_targetos Paolo Bonzini
2023-12-21 17:19 ` [PATCH 09/21] meson: remove CONFIG_POSIX and CONFIG_WIN32 " Paolo Bonzini
2023-12-21 17:19 ` [PATCH 10/21] meson: remove config_targetos Paolo Bonzini
2023-12-29  9:42   ` Philippe Mathieu-Daudé
2023-12-21 17:19 ` [PATCH 11/21] meson: remove CONFIG_ALL Paolo Bonzini
2023-12-21 17:19 ` [PATCH 12/21] meson: rename config_all Paolo Bonzini
2023-12-29  9:43   ` Philippe Mathieu-Daudé
2023-12-21 17:19 ` [PATCH 13/21] meson: add more sections to main meson.build Paolo Bonzini
2023-12-29  9:44   ` Philippe Mathieu-Daudé
2023-12-21 17:19 ` [PATCH 14/21] meson: move program checks together Paolo Bonzini
2023-12-29  9:50   ` Philippe Mathieu-Daudé
2023-12-21 17:19 ` [PATCH 15/21] meson: move option validation a bit closer Paolo Bonzini
2023-12-21 17:19 ` [PATCH 16/21] meson: separate host-specific checks from option validation Paolo Bonzini
2023-12-29  9:54   ` Philippe Mathieu-Daudé
2023-12-21 17:19 ` [PATCH 17/21] meson: keep subprojects together Paolo Bonzini
2023-12-21 17:19 ` [PATCH 18/21] meson: move CFI detection code earlier Paolo Bonzini
2023-12-29  9:54   ` Philippe Mathieu-Daudé
2023-12-21 17:19 ` [PATCH 19/21] meson: move config-host.h definitions together Paolo Bonzini
2023-12-21 17:19 ` [PATCH 20/21] meson: move subdirs to "Collect sources" section Paolo Bonzini
2023-12-29  9:55   ` Philippe Mathieu-Daudé
2023-12-21 17:19 ` [PATCH 21/21] configure, meson: rename targetos to host_os Paolo Bonzini
2023-12-29 10:01   ` Philippe Mathieu-Daudé

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.