qemu-devel.nongnu.org archive mirror
 help / color / mirror / Atom feed
* [PULL 00/32] x86 and build system changes for 2023-10-18
@ 2023-10-18  8:27 Paolo Bonzini
  2023-10-18  8:27 ` [PULL 01/32] iotests: get rid of '..' in path environment output Paolo Bonzini
                   ` (32 more replies)
  0 siblings, 33 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel

The following changes since commit 800485762e6564e04e2ab315132d477069562d91:

  Merge tag 'python-pull-request' of https://gitlab.com/jsnow/qemu into staging (2023-10-16 12:37:48 -0400)

are available in the Git repository at:

  https://gitlab.com/bonzini/qemu.git tags/for-upstream

for you to fetch changes up to 528148980adb78bc368a5254204e2ea98e4f6b6c:

  configure: define "pkg-config" in addition to "pkgconfig" (2023-10-18 10:01:02 +0200)

----------------------------------------------------------------
* build system and Python cleanups
* fix netbsd VM build
* allow non-relocatable installs
* allow using command line options to configure qemu-ga
* target/i386: check intercept for XSETBV
* target/i386: fix CPUID_HT exposure

----------------------------------------------------------------
Emmanouil Pitsidianakis (1):
      scripts/get_maintainer.pl: don't print parentheses

John Snow (2):
      iotests: get rid of '..' in path environment output
      iotests: use the correct python to run linters

Paolo Bonzini (26):
      target/i386: check intercept for XSETBV
      tests/vm: netbsd: install dtc
      tests/docker: avoid invalid escape in Python string
      docs/sphinx: avoid invalid escape in Python string
      target/hexagon: avoid invalid escape in Python string
      tests/avocado: avoid invalid escape in Python string
      tests/vm: avoid invalid escape in Python string
      tracetool: avoid invalid escape in Python string
      meson: do not build shaders by default
      meson: do not use set10
      meson, cutils: allow non-relocatable installs
      configure: clean up handling of CFI option
      hw/xen: cleanup sourcesets
      hw/remote: move stub vfu_object_set_bus_irq out of stubs/
      tests/tcg/arm: move non-SVE tests out of conditional
      configure, tests/tcg: simplify GDB conditionals
      configure: clean up plugin option handling
      configure: clean up PIE option handling
      configure: remove some dead cruft
      configure: move target-specific defaults to an external machine file
      configure: move environment-specific defaults to config-meson.cross
      configure: unify handling of several Debian cross containers
      configure, meson: use command line options to configure qemu-ga
      meson-buildoptions: document the data at the top
      meson: add a note on why we use config_host for program paths
      configure: define "pkg-config" in addition to "pkgconfig"

Thomas Huth (1):
      scripts: Mark feature_to_c.py as non-executable to fix a build issue

Xiaoyao Li (1):
      target/i386/cpu: Fix CPUID_HT exposure

Yonggang Luo (1):
      Revert "configure: Add workaround for ccache and clang"

 configs/meson/windows.txt                          |   9 +
 configure                                          | 288 +++++++--------------
 docs/sphinx/hxtool.py                              |   2 +-
 hw/arm/meson.build                                 |   1 -
 hw/i386/meson.build                                |   1 -
 hw/remote/meson.build                              |   4 +-
 .../remote/vfio-user-obj-stub.c                    |   0
 hw/xen/meson.build                                 |  11 +-
 include/qemu/compiler.h                            |  15 ++
 meson.build                                        |  31 ++-
 meson_options.txt                                  |   9 +
 qga/meson.build                                    |   9 +-
 scripts/feature_to_c.py                            |   0
 scripts/get_maintainer.pl                          |   1 +
 scripts/meson-buildoptions.py                      |  32 ++-
 scripts/meson-buildoptions.sh                      |  26 +-
 scripts/tracetool/__init__.py                      |  14 +-
 scripts/tracetool/format/log_stap.py               |   2 +-
 stubs/meson.build                                  |   1 -
 target/hexagon/hex_common.py                       |   4 +-
 target/i386/cpu.c                                  |   1 +
 target/i386/kvm/kvm.c                              |   2 +
 target/i386/svm.h                                  |   1 +
 target/i386/tcg/translate.c                        |   1 +
 tests/avocado/virtio_check_params.py               |   2 +-
 tests/docker/docker.py                             |   2 +-
 tests/qemu-iotests/linters.py                      |   2 +-
 tests/qemu-iotests/testenv.py                      |   2 +-
 tests/tcg/aarch64/Makefile.target                  |  16 +-
 tests/tcg/multiarch/Makefile.target                |  18 +-
 tests/tcg/multiarch/system/Makefile.softmmu-target |  15 +-
 tests/tcg/s390x/Makefile.target                    |   6 +-
 tests/unit/test-coroutine.c                        |   2 +-
 tests/vm/basevm.py                                 |   6 +-
 tests/vm/netbsd                                    |   6 +-
 ui/shader/meson.build                              |   1 +
 util/cutils.c                                      |  11 +-
 util/qemu-coroutine.c                              |   4 +-
 38 files changed, 283 insertions(+), 275 deletions(-)
 create mode 100644 configs/meson/windows.txt
 rename stubs/vfio-user-obj.c => hw/remote/vfio-user-obj-stub.c (100%)
 mode change 100755 => 100644 scripts/feature_to_c.py
-- 
2.41.0



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

* [PULL 01/32] iotests: get rid of '..' in path environment output
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 02/32] iotests: use the correct python to run linters Paolo Bonzini
                   ` (31 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: John Snow

From: John Snow <jsnow@redhat.com>

Resolve the build_root before we append more items onto it so that the
environment output is more concise with less parent directory confetti
in it.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-ID: <20230621002121.1609612-4-jsnow@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/qemu-iotests/testenv.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qemu-iotests/testenv.py b/tests/qemu-iotests/testenv.py
index 9a37ad91529..e67ebd254b1 100644
--- a/tests/qemu-iotests/testenv.py
+++ b/tests/qemu-iotests/testenv.py
@@ -216,7 +216,7 @@ def __init__(self, source_dir: str, build_dir: str,
         self.source_iotests = source_dir
         self.build_iotests = build_dir
 
-        self.build_root = os.path.join(self.build_iotests, '..', '..')
+        self.build_root = Path(self.build_iotests).parent.parent
 
         self.init_directories()
 
-- 
2.41.0



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

* [PULL 02/32] iotests: use the correct python to run linters
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
  2023-10-18  8:27 ` [PULL 01/32] iotests: get rid of '..' in path environment output Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 03/32] Revert "configure: Add workaround for ccache and clang" Paolo Bonzini
                   ` (30 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: John Snow

From: John Snow <jsnow@redhat.com>

Whichever python is used to run iotest 297 should be the one used to
actually run the linters.

Signed-off-by: John Snow <jsnow@redhat.com>
Message-ID: <20230621002121.1609612-5-jsnow@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/qemu-iotests/linters.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/qemu-iotests/linters.py b/tests/qemu-iotests/linters.py
index 65c4c4e8272..9fb3fd14497 100644
--- a/tests/qemu-iotests/linters.py
+++ b/tests/qemu-iotests/linters.py
@@ -68,7 +68,7 @@ def run_linter(
     :raise CalledProcessError: If the linter process exits with failure.
     """
     subprocess.run(
-        ('python3', '-m', tool, *args),
+        (sys.executable, '-m', tool, *args),
         env=env,
         check=True,
         stdout=subprocess.PIPE if suppress_output else None,
-- 
2.41.0



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

* [PULL 03/32] Revert "configure: Add workaround for ccache and clang"
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
  2023-10-18  8:27 ` [PULL 01/32] iotests: get rid of '..' in path environment output Paolo Bonzini
  2023-10-18  8:27 ` [PULL 02/32] iotests: use the correct python to run linters Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 04/32] target/i386/cpu: Fix CPUID_HT exposure Paolo Bonzini
                   ` (29 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: Yonggang Luo

From: Yonggang Luo <luoyonggang@gmail.com>

This reverts commit fd0e60530f10078f488fa3e9591cc7db5732989c.

According to https://peter.eisentraut.org/blog/2014/12/01/ccache-and-clang-part-3
it's already fixed in new version of ccache

According to https://ccache.dev/manual/4.8.html#config_run_second_cpp
CCACHE_CPP2 are default to true for new version ccache

Signed-off-by: Yonggang Luo <luoyonggang@gmail.com>
Message-ID: <20231009165113.498-1-luoyonggang@gmail.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 32 --------------------------------
 1 file changed, 32 deletions(-)

diff --git a/configure b/configure
index 96d0dd5ffc9..d6103a0141f 100755
--- a/configure
+++ b/configure
@@ -1166,34 +1166,6 @@ EOF
   fi
 fi
 
-########################################
-# check if ccache is interfering with
-# semantic analysis of macros
-
-unset CCACHE_CPP2
-ccache_cpp2=no
-cat > $TMPC << EOF
-static const int Z = 1;
-#define fn() ({ Z; })
-#define TAUT(X) ((X) == Z)
-#define PAREN(X, Y) (X == Y)
-#define ID(X) (X)
-int main(void)
-{
-    int x = 0, y = 0;
-    x = ID(x);
-    x = fn();
-    fn();
-    if (PAREN(x, y)) return 0;
-    if (TAUT(Z)) return 0;
-    return 0;
-}
-EOF
-
-if ! compile_object "-Werror"; then
-    ccache_cpp2=yes
-fi
-
 ##########################################
 # functions to probe cross compilers
 
@@ -1726,10 +1698,6 @@ if test "$default_targets" = "yes"; then
   echo "CONFIG_DEFAULT_TARGETS=y" >> $config_host_mak
 fi
 
-if test "$ccache_cpp2" = "yes"; then
-  echo "export CCACHE_CPP2=y" >> $config_host_mak
-fi
-
 # contrib/plugins configuration
 echo "# Automatically generated by configure - do not modify" > contrib/plugins/$config_host_mak
 echo "SRC_PATH=$source_path/contrib/plugins" >> contrib/plugins/$config_host_mak
-- 
2.41.0



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

* [PULL 04/32] target/i386/cpu: Fix CPUID_HT exposure
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (2 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 03/32] Revert "configure: Add workaround for ccache and clang" Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 05/32] target/i386: check intercept for XSETBV Paolo Bonzini
                   ` (28 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: Xiaoyao Li

From: Xiaoyao Li <xiaoyao.li@intel.com>

When explicitly booting a multiple vcpus vm with "-cpu +ht", it gets
warning of

  warning: host doesn't support requested feature: CPUID.01H:EDX.ht [bit 28]

Make CPUID_HT as supported unconditionally can resolve the warning.
However it introduces another issue that it also expose CPUID_HT to
guest when "-cpu host/max" with only 1 vcpu. To fix this, need mark
CPUID_HT as the no_autoenable_flags.

Signed-off-by: Xiaoyao Li <xiaoyao.li@intel.com>
Message-ID: <20231010060539.210258-1-xiaoyao.li@intel.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/cpu.c     | 1 +
 target/i386/kvm/kvm.c | 2 ++
 2 files changed, 3 insertions(+)

diff --git a/target/i386/cpu.c b/target/i386/cpu.c
index 3aab05ddadc..bdca901dfaa 100644
--- a/target/i386/cpu.c
+++ b/target/i386/cpu.c
@@ -778,6 +778,7 @@ FeatureWordInfo feature_word_info[FEATURE_WORDS] = {
         },
         .cpuid = {.eax = 1, .reg = R_EDX, },
         .tcg_features = TCG_FEATURES,
+        .no_autoenable_flags = CPUID_HT,
     },
     [FEAT_1_ECX] = {
         .type = CPUID_FEATURE_WORD,
diff --git a/target/i386/kvm/kvm.c b/target/i386/kvm/kvm.c
index f6c7f7e2686..ab72bcdfad1 100644
--- a/target/i386/kvm/kvm.c
+++ b/target/i386/kvm/kvm.c
@@ -373,6 +373,8 @@ uint32_t kvm_arch_get_supported_cpuid(KVMState *s, uint32_t function,
     if (function == 1 && reg == R_EDX) {
         /* KVM before 2.6.30 misreports the following features */
         ret |= CPUID_MTRR | CPUID_PAT | CPUID_MCE | CPUID_MCA;
+        /* KVM never reports CPUID_HT but QEMU can support when vcpus > 1 */
+        ret |= CPUID_HT;
     } else if (function == 1 && reg == R_ECX) {
         /* We can set the hypervisor flag, even if KVM does not return it on
          * GET_SUPPORTED_CPUID
-- 
2.41.0



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

* [PULL 05/32] target/i386: check intercept for XSETBV
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (3 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 04/32] target/i386/cpu: Fix CPUID_HT exposure Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 06/32] tests/vm: netbsd: install dtc Paolo Bonzini
                   ` (27 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel

Note that this intercept is special; it is checked before the #GP
exception.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/i386/svm.h           | 1 +
 target/i386/tcg/translate.c | 1 +
 2 files changed, 2 insertions(+)

diff --git a/target/i386/svm.h b/target/i386/svm.h
index f9a785489d8..1bd78447306 100644
--- a/target/i386/svm.h
+++ b/target/i386/svm.h
@@ -132,6 +132,7 @@
 /* only included in documentation, maybe wrong */
 #define SVM_EXIT_MONITOR	0x08a
 #define SVM_EXIT_MWAIT		0x08b
+#define SVM_EXIT_XSETBV		0x08d
 #define SVM_EXIT_NPF  		0x400
 
 #define SVM_EXIT_ERR		-1
diff --git a/target/i386/tcg/translate.c b/target/i386/tcg/translate.c
index d2061ec44a0..4f6f9fa7e52 100644
--- a/target/i386/tcg/translate.c
+++ b/target/i386/tcg/translate.c
@@ -5916,6 +5916,7 @@ static bool disas_insn(DisasContext *s, CPUState *cpu)
                                  | PREFIX_REPZ | PREFIX_REPNZ))) {
                 goto illegal_op;
             }
+            gen_svm_check_intercept(s, SVM_EXIT_XSETBV);
             if (!check_cpl0(s)) {
                 break;
             }
-- 
2.41.0



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

* [PULL 06/32] tests/vm: netbsd: install dtc
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (4 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 05/32] target/i386: check intercept for XSETBV Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 07/32] scripts: Mark feature_to_c.py as non-executable to fix a build issue Paolo Bonzini
                   ` (26 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth

Install dtc as it is now a mandatory external dependency in order to build QEMU.

Co-developed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/vm/netbsd | 6 +++++-
 1 file changed, 5 insertions(+), 1 deletion(-)

diff --git a/tests/vm/netbsd b/tests/vm/netbsd
index c7e3f1e7357..40b27a34694 100755
--- a/tests/vm/netbsd
+++ b/tests/vm/netbsd
@@ -40,6 +40,9 @@ class NetBSDVM(basevm.BaseVM):
         "gsed",
         "gettext-tools",
 
+        # libs: basic
+        "dtc",
+
         # libs: crypto
         "gnutls",
 
@@ -67,7 +70,8 @@ class NetBSDVM(basevm.BaseVM):
         mkdir src build; cd src;
         tar -xf /dev/rld1a;
         cd ../build
-        ../src/configure --disable-opengl {configure_opts};
+        ../src/configure --disable-opengl --extra-ldflags=-L/usr/pkg/lib \
+                          --extra-cflags=-I/usr/pkg/include {configure_opts};
         gmake --output-sync -j{jobs} {target} {verbose};
     """
     poweroff = "/sbin/poweroff"
-- 
2.41.0



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

* [PULL 07/32] scripts: Mark feature_to_c.py as non-executable to fix a build issue
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (5 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 06/32] tests/vm: netbsd: install dtc Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 08/32] scripts/get_maintainer.pl: don't print parentheses Paolo Bonzini
                   ` (25 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth

From: Thomas Huth <thuth@redhat.com>

Meson tries to run scripts via the shebang line if they files are
marked as executable. If "python3" is not in the $PATH, or if it
is a version that is too old, then the script execution fails.
We should make sure to run scripts via the python3 interpreter
that is used for Meson itself. For this, the files need to be marked
as non-executable, then meson will use the python3 binary that has
been used to run itself.

Fixes: 956af7daad ("gdbstub: Introduce GDBFeature structure")
Signed-off-by: Thomas Huth <thuth@redhat.com>
Message-ID: <20231016094917.19044-1-thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/feature_to_c.py | 0
 1 file changed, 0 insertions(+), 0 deletions(-)
 mode change 100755 => 100644 scripts/feature_to_c.py

diff --git a/scripts/feature_to_c.py b/scripts/feature_to_c.py
old mode 100755
new mode 100644
-- 
2.41.0



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

* [PULL 08/32] scripts/get_maintainer.pl: don't print parentheses
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (6 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 07/32] scripts: Mark feature_to_c.py as non-executable to fix a build issue Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 09/32] tests/docker: avoid invalid escape in Python string Paolo Bonzini
                   ` (24 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: Emmanouil Pitsidianakis, Philippe Mathieu-Daudé

From: Emmanouil Pitsidianakis <manos.pitsidianakis@linaro.org>

When called from git-send-email, some results contain unclosed
parentheses from the subsystem title, for example:

    (cc-cmd) Adding cc: qemu-ppc@nongnu.org (open list:PowerNV (Non-Virt...) from: 'scripts/get_maintainer.pl --nogit-fallback'
    (cc-cmd) Adding cc: qemu-devel@nongnu.org (open list:All patches CC here) from: 'scripts/get_maintainer.pl --nogit-fallback'
    Unmatched () '(open list:PowerNV (Non-Virt...)' '' at /usr/lib/git-core/git-send-email line 642.
    error: unable to extract a valid address from: qemu-ppc@nongnu.org (open list:PowerNV (Non-Virt...)
    What to do with this address? ([q]uit|[d]rop|[e]dit): d

This commit removes all parentheses from results.

Signed-off-by: Emmanouil Pitsidianakis <manos.pitsidianakis@linaro.org>
Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Message-ID: <20231013091628.669415-1-manos.pitsidianakis@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/get_maintainer.pl | 1 +
 1 file changed, 1 insertion(+)

diff --git a/scripts/get_maintainer.pl b/scripts/get_maintainer.pl
index 02fa828100e..00a0870b267 100755
--- a/scripts/get_maintainer.pl
+++ b/scripts/get_maintainer.pl
@@ -907,6 +907,7 @@ sub get_subsystem_name {
     if (length($subsystem) > 20) {
 	$subsystem = substr($subsystem, 0, 17);
 	$subsystem =~ s/\s*$//;
+	$subsystem =~ s/[()]//g;
 	$subsystem = $subsystem . "...";
     }
     return $subsystem;
-- 
2.41.0



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

* [PULL 09/32] tests/docker: avoid invalid escape in Python string
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (7 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 08/32] scripts/get_maintainer.pl: don't print parentheses Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 10/32] docs/sphinx: " Paolo Bonzini
                   ` (23 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable

This is an error in Python 3.12; fix it by using a raw string literal.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/docker/docker.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/docker/docker.py b/tests/docker/docker.py
index 688ef62989c..3b8a26704df 100755
--- a/tests/docker/docker.py
+++ b/tests/docker/docker.py
@@ -186,7 +186,7 @@ def _check_binfmt_misc(executable):
               (binary))
         return None, True
 
-    m = re.search("interpreter (\S+)\n", entry)
+    m = re.search(r"interpreter (\S+)\n", entry)
     interp = m.group(1)
     if interp and interp != executable:
         print("binfmt_misc for %s does not point to %s, using %s" %
-- 
2.41.0



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

* [PULL 10/32] docs/sphinx: avoid invalid escape in Python string
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (8 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 09/32] tests/docker: avoid invalid escape in Python string Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 11/32] target/hexagon: " Paolo Bonzini
                   ` (22 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable

This is an error in Python 3.12; fix it by using a raw string literal.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 docs/sphinx/hxtool.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/docs/sphinx/hxtool.py b/docs/sphinx/hxtool.py
index fb0649a3d5b..9f6b9d87dcc 100644
--- a/docs/sphinx/hxtool.py
+++ b/docs/sphinx/hxtool.py
@@ -49,7 +49,7 @@ def serror(file, lnum, errtext):
 
 def parse_directive(line):
     """Return first word of line, if any"""
-    return re.split('\W', line)[0]
+    return re.split(r'\W', line)[0]
 
 def parse_defheading(file, lnum, line):
     """Handle a DEFHEADING directive"""
-- 
2.41.0



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

* [PULL 11/32] target/hexagon: avoid invalid escape in Python string
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (9 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 10/32] docs/sphinx: " Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 12/32] tests/avocado: " Paolo Bonzini
                   ` (21 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable

This is an error in Python 3.12; fix it by using a raw string literal.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 target/hexagon/hex_common.py | 4 ++--
 1 file changed, 2 insertions(+), 2 deletions(-)

diff --git a/target/hexagon/hex_common.py b/target/hexagon/hex_common.py
index dce1b852a7b..0da65d6dd6a 100755
--- a/target/hexagon/hex_common.py
+++ b/target/hexagon/hex_common.py
@@ -45,7 +45,7 @@ def uniquify(seq):
 immre = re.compile(r"[#]([rRsSuUm])(\d+)(?:[:](\d+))?")
 reg_or_immre = re.compile(
     r"(((?<!DUP)[MNRCOPQXSGVZA])([stuvwxyzdefg]+)"
-    + "([.]?[LlHh]?)(\d+S?))|([#]([rRsSuUm])(\d+)[:]?(\d+)?)"
+    r"([.]?[LlHh]?)(\d+S?))|([#]([rRsSuUm])(\d+)[:]?(\d+)?)"
 )
 relimmre = re.compile(r"[#]([rR])(\d+)(?:[:](\d+))?")
 absimmre = re.compile(r"[#]([sSuUm])(\d+)(?:[:](\d+))?")
@@ -337,7 +337,7 @@ def read_attribs_file(name):
 
 
 def read_overrides_file(name):
-    overridere = re.compile("#define fGEN_TCG_([A-Za-z0-9_]+)\(.*")
+    overridere = re.compile(r"#define fGEN_TCG_([A-Za-z0-9_]+)\(.*")
     for line in open(name, "rt").readlines():
         if not overridere.match(line):
             continue
-- 
2.41.0



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

* [PULL 12/32] tests/avocado: avoid invalid escape in Python string
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (10 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 11/32] target/hexagon: " Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 13/32] tests/vm: " Paolo Bonzini
                   ` (20 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable

This is an error in Python 3.12; fix it by using a raw string literal.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/avocado/virtio_check_params.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/tests/avocado/virtio_check_params.py b/tests/avocado/virtio_check_params.py
index f4314ef824f..5fe370a1793 100644
--- a/tests/avocado/virtio_check_params.py
+++ b/tests/avocado/virtio_check_params.py
@@ -43,7 +43,7 @@
 class VirtioMaxSegSettingsCheck(QemuSystemTest):
     @staticmethod
     def make_pattern(props):
-        pattern_items = ['{0} = \w+'.format(prop) for prop in props]
+        pattern_items = [r'{0} = \w+'.format(prop) for prop in props]
         return '|'.join(pattern_items)
 
     def query_virtqueue(self, vm, dev_type_name):
-- 
2.41.0



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

* [PULL 13/32] tests/vm: avoid invalid escape in Python string
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (11 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 12/32] tests/avocado: " Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 14/32] tracetool: " Paolo Bonzini
                   ` (19 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable

This is an error in Python 3.12; fix it by using a raw string literal
or by double-escaping the backslash.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/vm/basevm.py | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)

diff --git a/tests/vm/basevm.py b/tests/vm/basevm.py
index 8aef4cff967..61725b83254 100644
--- a/tests/vm/basevm.py
+++ b/tests/vm/basevm.py
@@ -331,8 +331,8 @@ def console_init(self, timeout = None):
     def console_log(self, text):
         for line in re.split("[\r\n]", text):
             # filter out terminal escape sequences
-            line = re.sub("\x1b\[[0-9;?]*[a-zA-Z]", "", line)
-            line = re.sub("\x1b\([0-9;?]*[a-zA-Z]", "", line)
+            line = re.sub("\x1b\\[[0-9;?]*[a-zA-Z]", "", line)
+            line = re.sub("\x1b\\([0-9;?]*[a-zA-Z]", "", line)
             # replace unprintable chars
             line = re.sub("\x1b", "<esc>", line)
             line = re.sub("[\x00-\x1f]", ".", line)
@@ -530,7 +530,7 @@ def get_qemu_version(qemu_path):
        and return the major number."""
     output = subprocess.check_output([qemu_path, '--version'])
     version_line = output.decode("utf-8")
-    version_num = re.split(' |\(', version_line)[3].split('.')[0]
+    version_num = re.split(r' |\(', version_line)[3].split('.')[0]
     return int(version_num)
 
 def parse_config(config, args):
-- 
2.41.0



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

* [PULL 14/32] tracetool: avoid invalid escape in Python string
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (12 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 13/32] tests/vm: " Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 15/32] meson: do not build shaders by default Paolo Bonzini
                   ` (18 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: qemu-stable

This is an error in Python 3.12; fix it by using a raw string literal.

Cc: qemu-stable@nongnu.org
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/tracetool/__init__.py        | 14 +++++++-------
 scripts/tracetool/format/log_stap.py |  2 +-
 2 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/scripts/tracetool/__init__.py b/scripts/tracetool/__init__.py
index 33cf85e2b04..b29594d75e0 100644
--- a/scripts/tracetool/__init__.py
+++ b/scripts/tracetool/__init__.py
@@ -210,12 +210,12 @@ class Event(object):
 
     """
 
-    _CRE = re.compile("((?P<props>[\w\s]+)\s+)?"
-                      "(?P<name>\w+)"
-                      "\((?P<args>[^)]*)\)"
-                      "\s*"
-                      "(?:(?:(?P<fmt_trans>\".+),)?\s*(?P<fmt>\".+))?"
-                      "\s*")
+    _CRE = re.compile(r"((?P<props>[\w\s]+)\s+)?"
+                      r"(?P<name>\w+)"
+                      r"\((?P<args>[^)]*)\)"
+                      r"\s*"
+                      r"(?:(?:(?P<fmt_trans>\".+),)?\s*(?P<fmt>\".+))?"
+                      r"\s*")
 
     _VALID_PROPS = set(["disable", "vcpu"])
 
@@ -326,7 +326,7 @@ def __repr__(self):
                                           fmt)
     # Star matching on PRI is dangerous as one might have multiple
     # arguments with that format, hence the non-greedy version of it.
-    _FMT = re.compile("(%[\d\.]*\w+|%.*?PRI\S+)")
+    _FMT = re.compile(r"(%[\d\.]*\w+|%.*?PRI\S+)")
 
     def formats(self):
         """List conversion specifiers in the argument print format string."""
diff --git a/scripts/tracetool/format/log_stap.py b/scripts/tracetool/format/log_stap.py
index 0b6549d534a..b49afababd6 100644
--- a/scripts/tracetool/format/log_stap.py
+++ b/scripts/tracetool/format/log_stap.py
@@ -83,7 +83,7 @@ def c_fmt_to_stap(fmt):
     # and "%ll" is not valid at all. Similarly the size_t
     # based "%z" size qualifier is not valid. We just
     # strip all size qualifiers for sanity.
-    fmt = re.sub("%(\d*)(l+|z)(x|u|d)", "%\\1\\3", "".join(bits))
+    fmt = re.sub(r"%(\d*)(l+|z)(x|u|d)", r"%\1\3", "".join(bits))
     return fmt
 
 def generate(events, backend, group):
-- 
2.41.0



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

* [PULL 15/32] meson: do not build shaders by default
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (13 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 14/32] tracetool: " Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 16/32] meson: do not use set10 Paolo Bonzini
                   ` (17 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: Emmanouil Pitsidianakis

They are not needed when building user-mode emulators.

Reviewed-by: Emmanouil Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 ui/shader/meson.build | 1 +
 1 file changed, 1 insertion(+)

diff --git a/ui/shader/meson.build b/ui/shader/meson.build
index 592bf596b9a..3137e65578e 100644
--- a/ui/shader/meson.build
+++ b/ui/shader/meson.build
@@ -10,5 +10,6 @@ foreach e : shaders
                 output: output,
                 capture: true,
                 input: files('@0@.@1@'.format(e[0], e[1])),
+                build_by_default: false,
                 command: [shaderinclude, '@INPUT0@'])
 endforeach
-- 
2.41.0



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

* [PULL 16/32] meson: do not use set10
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (14 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 15/32] meson: do not build shaders by default Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 17/32] meson, cutils: allow non-relocatable installs Paolo Bonzini
                   ` (16 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel

Make all items of config-host.h consistent.  To keep the --disable-coroutine-pool
code visible to the compiler, mutuate the IS_ENABLED() macro from Linux.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 include/qemu/compiler.h     | 15 +++++++++++++++
 meson.build                 |  2 +-
 tests/unit/test-coroutine.c |  2 +-
 util/qemu-coroutine.c       |  4 ++--
 4 files changed, 19 insertions(+), 4 deletions(-)

diff --git a/include/qemu/compiler.h b/include/qemu/compiler.h
index 1109482a000..c797f0d4572 100644
--- a/include/qemu/compiler.h
+++ b/include/qemu/compiler.h
@@ -212,4 +212,19 @@
 # define QEMU_USED
 #endif
 
+/*
+ * Ugly CPP trick that is like "defined FOO", but also works in C
+ * code.  Useful to replace #ifdef with "if" statements; assumes
+ * the symbol was defined with Meson's "config.set()", so it is empty
+ * if defined.
+ */
+#define IS_ENABLED(x)                  IS_EMPTY(x)
+
+#define IS_EMPTY_JUNK_                 junk,
+#define IS_EMPTY(value)                IS_EMPTY_(IS_EMPTY_JUNK_##value)
+
+/* Expands to either SECOND_ARG(junk, 1, 0) or SECOND_ARG(IS_EMPTY_JUNK_CONFIG_FOO 1, 0)  */
+#define SECOND_ARG(first, second, ...) second
+#define IS_EMPTY_(junk_maybecomma)     SECOND_ARG(junk_maybecomma 1, 0)
+
 #endif /* COMPILER_H */
diff --git a/meson.build b/meson.build
index bd65a111aa8..010d2c649c2 100644
--- a/meson.build
+++ b/meson.build
@@ -2194,7 +2194,7 @@ if get_option('debug_stack_usage') and have_coroutine_pool
   message('Disabling coroutine pool to measure stack usage')
   have_coroutine_pool = false
 endif
-config_host_data.set10('CONFIG_COROUTINE_POOL', have_coroutine_pool)
+config_host_data.set('CONFIG_COROUTINE_POOL', have_coroutine_pool)
 config_host_data.set('CONFIG_DEBUG_GRAPH_LOCK', get_option('debug_graph_lock'))
 config_host_data.set('CONFIG_DEBUG_MUTEX', get_option('debug_mutex'))
 config_host_data.set('CONFIG_DEBUG_STACK_USAGE', get_option('debug_stack_usage'))
diff --git a/tests/unit/test-coroutine.c b/tests/unit/test-coroutine.c
index b0d21d673a0..a2563647e74 100644
--- a/tests/unit/test-coroutine.c
+++ b/tests/unit/test-coroutine.c
@@ -645,7 +645,7 @@ int main(int argc, char **argv)
      * with a sentinel value.  If there is no freelist this would legitimately
      * crash, so skip it.
      */
-    if (CONFIG_COROUTINE_POOL) {
+    if (IS_ENABLED(CONFIG_COROUTINE_POOL)) {
         g_test_add_func("/basic/no-dangling-access", test_no_dangling_access);
     }
 
diff --git a/util/qemu-coroutine.c b/util/qemu-coroutine.c
index 17a88f65053..5fd2dbaf8bb 100644
--- a/util/qemu-coroutine.c
+++ b/util/qemu-coroutine.c
@@ -57,7 +57,7 @@ Coroutine *qemu_coroutine_create(CoroutineEntry *entry, void *opaque)
 {
     Coroutine *co = NULL;
 
-    if (CONFIG_COROUTINE_POOL) {
+    if (IS_ENABLED(CONFIG_COROUTINE_POOL)) {
         CoroutineQSList *alloc_pool = get_ptr_alloc_pool();
 
         co = QSLIST_FIRST(alloc_pool);
@@ -99,7 +99,7 @@ static void coroutine_delete(Coroutine *co)
 {
     co->caller = NULL;
 
-    if (CONFIG_COROUTINE_POOL) {
+    if (IS_ENABLED(CONFIG_COROUTINE_POOL)) {
         if (release_pool_size < qatomic_read(&pool_max_size) * 2) {
             QSLIST_INSERT_HEAD_ATOMIC(&release_pool, co, pool_next);
             qatomic_inc(&release_pool_size);
-- 
2.41.0



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

* [PULL 17/32] meson, cutils: allow non-relocatable installs
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (15 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 16/32] meson: do not use set10 Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18 11:37   ` Michael Tokarev
  2023-10-18  8:27 ` [PULL 18/32] configure: clean up handling of CFI option Paolo Bonzini
                   ` (15 subsequent siblings)
  32 siblings, 1 reply; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: Michael Tokarev, Emmanouil Pitsidianakis

Say QEMU is configured with bindir = "/usr/bin" and a firmware path
that starts with "/usr/share/qemu".  Ever since QEMU 5.2, QEMU's
install has been relocatable: if you move qemu-system-x86_64 from
/usr/bin to /home/username/bin, it will start looking for firmware in
/home/username/share/qemu.  Previously, you would get a non-relocatable
install where the moved QEMU will keep looking for firmware in
/usr/share/qemu.

Windows almost always wants relocatable installs, and in fact that
is why QEMU 5.2 introduced relocatability in the first place.
However, newfangled distribution mechanisms such as AppImage
(https://docs.appimage.org/reference/best-practices.html), and
possibly NixOS, also dislike using at runtime the absolute paths
that were established at build time.

On POSIX systems you almost never care; if you do, your usecase
dictates which one is desirable, so there's no single answer.
Obviously relocatability works fine most of the time, because not many
people have complained about QEMU's switch to relocatable install,
and that's why until now there was no way to disable relocatability.

But a non-relocatable, non-modular binary can help if you want to do
experiments with old firmware and new QEMU or vice versa (because you
can just upgrade/downgrade the firmware package, and use rpm2cpio or
similar to extract the QEMU binaries outside /usr), so allow both.
This patch allows one to build a non-relocatable install using a new
option to configure.  Why?  Because it's not too hard, and because
it helps the user double check the relocatability of their install.

Note that the same code that handles relocation also lets you run QEMU
from the build tree and pick e.g. firmware files from the source tree
transparently.  Therefore that part remains active with this patch,
even if you configure with --disable-relocatable.

Suggested-by: Michael Tokarev <mjt@tls.msk.ru>
Reviewed-by: Emmanouil Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 meson.build                   | 20 ++++++++++++++++++++
 meson_options.txt             |  2 ++
 scripts/meson-buildoptions.sh |  3 +++
 util/cutils.c                 | 11 ++++++++---
 4 files changed, 33 insertions(+), 3 deletions(-)

diff --git a/meson.build b/meson.build
index 010d2c649c2..1be9f92f7da 100644
--- a/meson.build
+++ b/meson.build
@@ -2111,6 +2111,7 @@ config_host_data.set('CONFIG_OPENGL', opengl.found())
 config_host_data.set('CONFIG_PLUGIN', get_option('plugins'))
 config_host_data.set('CONFIG_RBD', rbd.found())
 config_host_data.set('CONFIG_RDMA', rdma.found())
+config_host_data.set('CONFIG_RELOCATABLE', get_option('relocatable'))
 config_host_data.set('CONFIG_SAFESTACK', get_option('safe_stack'))
 config_host_data.set('CONFIG_SDL', sdl.found())
 config_host_data.set('CONFIG_SDL_IMAGE', sdl_image.found())
@@ -4054,6 +4055,7 @@ if 'simple' in get_option('trace_backends')
 endif
 summary_info += {'D-Bus display':     dbus_display}
 summary_info += {'QOM debugging':     get_option('qom_cast_debug')}
+summary_info += {'Relocatable install': get_option('relocatable')}
 summary_info += {'vhost-kernel support': have_vhost_kernel}
 summary_info += {'vhost-net support': have_vhost_net}
 summary_info += {'vhost-user support': have_vhost_user}
@@ -4356,3 +4358,21 @@ if host_arch == 'unknown' or not supported_oses.contains(targetos)
   message('If you want to help supporting QEMU on this platform, please')
   message('contact the developers at qemu-devel@nongnu.org.')
 endif
+
+actually_reloc = get_option('relocatable')
+# check if get_relocated_path() is actually able to relocate paths
+if get_option('relocatable') and \
+  not (get_option('prefix') / get_option('bindir')).startswith(get_option('prefix') / '')
+  message()
+  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'
+    message()
+    warning('Windows installs should usually be relocatable.')
+  endif
+  message()
+  message('QEMU will have to be installed under ' + get_option('prefix') + '.')
+  message('Use --disable-relocatable to remove this warning.')
+endif
diff --git a/meson_options.txt b/meson_options.txt
index 6a17b909680..e237b268469 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -101,6 +101,8 @@ 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',
+       description: 'toggle relocatable install')
 option('vfio_user_server', type: 'feature', value: 'disabled',
        description: 'vfio-user server support')
 option('dbus_display', type: 'feature', value: 'auto',
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index 2a74b0275b3..d4b89e6b443 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -17,6 +17,7 @@ meson_options_help() {
   printf "%s\n" '                           code for the Hexagon frontend'
   printf "%s\n" '  --disable-install-blobs  install provided firmware blobs'
   printf "%s\n" '  --disable-qom-cast-debug cast debugging support'
+  printf "%s\n" '  --disable-relocatable    toggle relocatable install'
   printf "%s\n" '  --docdir=VALUE           Base directory for documentation installation'
   printf "%s\n" '                           (can be empty) [share/doc]'
   printf "%s\n" '  --enable-block-drv-whitelist-in-tools'
@@ -421,6 +422,8 @@ _meson_option_parse() {
     --disable-rbd) printf "%s" -Drbd=disabled ;;
     --enable-rdma) printf "%s" -Drdma=enabled ;;
     --disable-rdma) printf "%s" -Drdma=disabled ;;
+    --enable-relocatable) printf "%s" -Drelocatable=true ;;
+    --disable-relocatable) printf "%s" -Drelocatable=false ;;
     --enable-replication) printf "%s" -Dreplication=enabled ;;
     --disable-replication) printf "%s" -Dreplication=disabled ;;
     --enable-rng-none) printf "%s" -Drng_none=true ;;
diff --git a/util/cutils.c b/util/cutils.c
index c99d26c5e2d..64f817b477b 100644
--- a/util/cutils.c
+++ b/util/cutils.c
@@ -1178,9 +1178,11 @@ char *get_relocated_path(const char *dir)
 #else
         g_string_append(result, dir);
 #endif
-    } else if (!starts_with_prefix(dir) || !starts_with_prefix(bindir)) {
-        g_string_assign(result, dir);
-    } else {
+        goto out;
+    }
+
+    if (IS_ENABLED(CONFIG_RELOCATABLE) &&
+        starts_with_prefix(dir) && starts_with_prefix(bindir)) {
         g_string_assign(result, exec_dir);
 
         /* Advance over common components.  */
@@ -1203,7 +1205,10 @@ char *get_relocated_path(const char *dir)
             assert(G_IS_DIR_SEPARATOR(dir[-1]));
             g_string_append(result, dir - 1);
         }
+        goto out;
     }
 
+    g_string_assign(result, dir);
+out:
     return g_string_free(result, false);
 }
-- 
2.41.0



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

* [PULL 18/32] configure: clean up handling of CFI option
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (16 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 17/32] meson, cutils: allow non-relocatable installs Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 19/32] hw/xen: cleanup sourcesets Paolo Bonzini
                   ` (14 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: Philippe Mathieu-Daudé

Avoid that --enable-cfi --disable-cfi leaves b_lto set to true.

Reviewed-by: Philippe Mathieu-Daudé <philmd@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 13 +++++++------
 1 file changed, 7 insertions(+), 6 deletions(-)

diff --git a/configure b/configure
index d6103a0141f..9f782054509 100755
--- a/configure
+++ b/configure
@@ -625,7 +625,10 @@ meson_option_build_array() {
 
 meson_options=
 meson_option_add() {
-  meson_options="$meson_options $(quote_sh "$1")"
+  local arg
+  for arg; do
+    meson_options="$meson_options $(quote_sh "$arg")"
+  done
 }
 meson_option_parse() {
   meson_options="$meson_options $(_meson_option_parse "$@")"
@@ -767,11 +770,9 @@ for opt do
   ;;
   --disable-werror) werror="no"
   ;;
-  --enable-cfi)
-      cfi="true";
-      meson_option_add -Db_lto=true
+  --enable-cfi) cfi=true
   ;;
-  --disable-cfi) cfi="false"
+  --disable-cfi) cfi=false
   ;;
   --disable-download) download="disabled"; git_submodules_action=validate;
   ;;
@@ -1845,7 +1846,7 @@ if test "$skip_meson" = no; then
   test "$werror" = yes && meson_option_add -Dwerror=true
 
   # QEMU options
-  test "$cfi" != false && meson_option_add "-Dcfi=$cfi"
+  test "$cfi" != false && meson_option_add "-Dcfi=$cfi" "-Db_lto=$cfi"
   test "$docs" != auto && meson_option_add "-Ddocs=$docs"
   test -n "${LIB_FUZZING_ENGINE+xxx}" && meson_option_add "-Dfuzzing_engine=$LIB_FUZZING_ENGINE"
   test "$plugins" = yes && meson_option_add "-Dplugins=true"
-- 
2.41.0



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

* [PULL 19/32] hw/xen: cleanup sourcesets
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (17 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 18/32] configure: clean up handling of CFI option Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 20/32] hw/remote: move stub vfu_object_set_bus_irq out of stubs/ Paolo Bonzini
                   ` (13 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel

xen_ss is added unconditionally to arm_ss and i386_ss (the only
targets that can have CONFIG_XEN enabled) and its contents are gated by
CONFIG_XEN; xen_specific_ss has no condition for its constituent files
but is gated on CONFIG_XEN when its added to specific_ss.

So xen_ss is a duplicate of xen_specific_ss, though defined in a
different way.  Merge the two by eliminating xen_ss.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/arm/meson.build  |  1 -
 hw/i386/meson.build |  1 -
 hw/xen/meson.build  | 11 ++++-------
 3 files changed, 4 insertions(+), 9 deletions(-)

diff --git a/hw/arm/meson.build b/hw/arm/meson.build
index 11eb9112f88..a6feaf1af95 100644
--- a/hw/arm/meson.build
+++ b/hw/arm/meson.build
@@ -64,7 +64,6 @@ arm_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmuv3.c'))
 arm_ss.add(when: 'CONFIG_FSL_IMX6UL', if_true: files('fsl-imx6ul.c', 'mcimx6ul-evk.c'))
 arm_ss.add(when: 'CONFIG_NRF51_SOC', if_true: files('nrf51_soc.c'))
 arm_ss.add(when: 'CONFIG_XEN', if_true: files('xen_arm.c'))
-arm_ss.add_all(xen_ss)
 
 system_ss.add(when: 'CONFIG_ARM_SMMUV3', if_true: files('smmu-common.c'))
 system_ss.add(when: 'CONFIG_EXYNOS4', if_true: files('exynos4_boards.c'))
diff --git a/hw/i386/meson.build b/hw/i386/meson.build
index ff879069c98..369c6bf823b 100644
--- a/hw/i386/meson.build
+++ b/hw/i386/meson.build
@@ -32,6 +32,5 @@ subdir('kvm')
 subdir('xen')
 
 i386_ss.add_all(xenpv_ss)
-i386_ss.add_all(xen_ss)
 
 hw_arch += {'i386': i386_ss}
diff --git a/hw/xen/meson.build b/hw/xen/meson.build
index 277f9f292b4..d887fa9ba43 100644
--- a/hw/xen/meson.build
+++ b/hw/xen/meson.build
@@ -12,6 +12,10 @@ system_ss.add(when: ['CONFIG_XEN', xen], if_true: files(
 ))
 
 xen_specific_ss = ss.source_set()
+xen_specific_ss.add(files(
+  'xen-mapcache.c',
+  'xen-hvm-common.c',
+))
 if have_xen_pci_passthrough
   xen_specific_ss.add(files(
     'xen-host-pci-device.c',
@@ -26,10 +30,3 @@ else
 endif
 
 specific_ss.add_all(when: ['CONFIG_XEN', xen], if_true: xen_specific_ss)
-
-xen_ss = ss.source_set()
-
-xen_ss.add(when: 'CONFIG_XEN', if_true: files(
-  'xen-mapcache.c',
-  'xen-hvm-common.c',
-))
-- 
2.41.0



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

* [PULL 20/32] hw/remote: move stub vfu_object_set_bus_irq out of stubs/
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (18 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 19/32] hw/xen: cleanup sourcesets Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 21/32] tests/tcg/arm: move non-SVE tests out of conditional Paolo Bonzini
                   ` (12 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 hw/remote/meson.build                                   | 4 +++-
 stubs/vfio-user-obj.c => hw/remote/vfio-user-obj-stub.c | 0
 stubs/meson.build                                       | 1 -
 3 files changed, 3 insertions(+), 2 deletions(-)
 rename stubs/vfio-user-obj.c => hw/remote/vfio-user-obj-stub.c (100%)

diff --git a/hw/remote/meson.build b/hw/remote/meson.build
index a1e8708c732..a3aa29aaf17 100644
--- a/hw/remote/meson.build
+++ b/hw/remote/meson.build
@@ -7,9 +7,11 @@ remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('remote-obj.c'))
 remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('proxy.c'))
 remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('iohub.c'))
 remote_ss.add(when: 'CONFIG_MULTIPROCESS', if_true: files('iommu.c'))
-remote_ss.add(when: 'CONFIG_VFIO_USER_SERVER', if_true: files('vfio-user-obj.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/stubs/vfio-user-obj.c b/hw/remote/vfio-user-obj-stub.c
similarity index 100%
rename from stubs/vfio-user-obj.c
rename to hw/remote/vfio-user-obj-stub.c
diff --git a/stubs/meson.build b/stubs/meson.build
index cde44972bf8..0bf25e6ca53 100644
--- a/stubs/meson.build
+++ b/stubs/meson.build
@@ -65,4 +65,3 @@ else
   stub_ss.add(files('qdev.c'))
 endif
 stub_ss.add(files('semihost-all.c'))
-stub_ss.add(when: 'CONFIG_VFIO_USER_SERVER', if_false: files('vfio-user-obj.c'))
-- 
2.41.0



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

* [PULL 21/32] tests/tcg/arm: move non-SVE tests out of conditional
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (19 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 20/32] hw/remote: move stub vfu_object_set_bus_irq out of stubs/ Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 22/32] configure, tests/tcg: simplify GDB conditionals Paolo Bonzini
                   ` (11 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel

test-aes, sha1-vector and sha512-vector need not be conditional on
$(CROSS_CC_HAS_SVE), reorganize the "if"s to move them outside.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 tests/tcg/aarch64/Makefile.target | 10 ++++------
 1 file changed, 4 insertions(+), 6 deletions(-)

diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target
index 2efacf9a5a3..d01b8ff47c8 100644
--- a/tests/tcg/aarch64/Makefile.target
+++ b/tests/tcg/aarch64/Makefile.target
@@ -73,11 +73,6 @@ endif
 # System Registers Tests
 AARCH64_TESTS += sysregs
 
-ifneq ($(CROSS_CC_HAS_SVE),)
-# SVE ioctl test
-AARCH64_TESTS += sve-ioctls
-sve-ioctls: CFLAGS+=-march=armv8.1-a+sve
-
 AARCH64_TESTS += test-aes
 test-aes: CFLAGS += -O -march=armv8-a+aes
 test-aes: test-aes-main.c.inc
@@ -100,12 +95,15 @@ sha512-vector: sha512.c
 TESTS += sha512-vector
 
 ifneq ($(CROSS_CC_HAS_SVE),)
+# SVE ioctl test
+AARCH64_TESTS += sve-ioctls
+sve-ioctls: CFLAGS+=-march=armv8.1-a+sve
+
 sha512-sve: CFLAGS=-O3 -march=armv8.1-a+sve
 sha512-sve: sha512.c
 	$(CC) $(CFLAGS) $(EXTRA_CFLAGS) $< -o $@ $(LDFLAGS)
 
 TESTS += sha512-sve
-endif
 
 ifeq ($(HOST_GDB_SUPPORTS_ARCH),y)
 GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py
-- 
2.41.0



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

* [PULL 22/32] configure, tests/tcg: simplify GDB conditionals
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (20 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 21/32] tests/tcg/arm: move non-SVE tests out of conditional Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 23/32] configure: clean up plugin option handling Paolo Bonzini
                   ` (10 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: Emmanouil Pitsidianakis

Unify HAVE_GDB_BIN (currently in config-host.mak) and
HOST_GDB_SUPPORTS_ARCH into a single GDB variable in
config-target.mak.

Reviewed-by: Emmanouil Pitsidianakis <manos.pitsidianakis@linaro.org>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                                     | 30 +++++++++----------
 meson.build                                   |  4 +--
 tests/tcg/aarch64/Makefile.target             |  6 ++--
 tests/tcg/multiarch/Makefile.target           | 18 ++++-------
 .../multiarch/system/Makefile.softmmu-target  | 15 ++++------
 tests/tcg/s390x/Makefile.target               |  6 ++--
 6 files changed, 33 insertions(+), 46 deletions(-)

diff --git a/configure b/configure
index 9f782054509..ffcfabb8d36 100755
--- a/configure
+++ b/configure
@@ -1140,6 +1140,18 @@ if test "$tcg" = "auto"; then
   fi
 fi
 
+#########################################
+# gdb test
+
+if test -n "$gdb_bin"; then
+    gdb_version=$($gdb_bin --version | head -n 1)
+    if version_ge ${gdb_version##* } 9.1; then
+        gdb_arches=$($python "$source_path/scripts/probe-gdb-support.py" $gdb_bin)
+    else
+        gdb_bin=""
+    fi
+fi
+
 ##########################################
 # big/little endian test
 cat > $TMPC << EOF
@@ -1660,17 +1672,7 @@ fi
 
 echo "SRC_PATH=$source_path" >> $config_host_mak
 echo "TARGET_DIRS=$target_list" >> $config_host_mak
-
-if test -n "$gdb_bin"; then
-    gdb_version=$($gdb_bin --version | head -n 1)
-    if version_ge ${gdb_version##* } 9.1; then
-        echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak
-        gdb_arches=$($python "$source_path/scripts/probe-gdb-support.py" $gdb_bin)
-    else
-        gdb_bin=""
-    fi
-fi
-
+echo "GDB=$gdb_bin" >> $config_host_mak
 if test "$container" != no; then
     echo "RUNC=$runc" >> $config_host_mak
 fi
@@ -1715,10 +1717,6 @@ mkdir -p tests/tcg
 echo "# Automatically generated by configure - do not modify" > $config_host_mak
 echo "SRC_PATH=$source_path" >> $config_host_mak
 
-# versioned checked in the main config_host.mak above
-if test -n "$gdb_bin"; then
-    echo "HAVE_GDB_BIN=$gdb_bin" >> $config_host_mak
-fi
 if test "$plugins" = "yes" ; then
     echo "CONFIG_PLUGIN=y" >> $config_host_mak
 fi
@@ -1755,7 +1753,7 @@ for target in $target_list; do
 
       # will GDB work with these binaries?
       if test "${gdb_arches#*$arch}" != "$gdb_arches"; then
-          echo "HOST_GDB_SUPPORTS_ARCH=y" >> "$config_target_mak"
+          echo "GDB=$gdb_bin" >> $config_target_mak
       fi
 
       echo "run-tcg-tests-$target: $qemu\$(EXESUF)" >> Makefile.prereqs
diff --git a/meson.build b/meson.build
index 1be9f92f7da..2bda62a2b1b 100644
--- a/meson.build
+++ b/meson.build
@@ -4021,8 +4021,8 @@ summary(summary_info, bool_yn: true, section: 'Directories')
 summary_info = {}
 summary_info += {'python':            '@0@ (version: @1@)'.format(python.full_path(), python.language_version())}
 summary_info += {'sphinx-build':      sphinx_build}
-if config_host.has_key('HAVE_GDB_BIN')
-  summary_info += {'gdb':             config_host['HAVE_GDB_BIN']}
+if config_host.has_key('GDB')
+  summary_info += {'gdb':             config_host['GDB']}
 endif
 summary_info += {'iasl':              iasl}
 summary_info += {'genisoimage':       config_host['GENISOIMAGE']}
diff --git a/tests/tcg/aarch64/Makefile.target b/tests/tcg/aarch64/Makefile.target
index d01b8ff47c8..62b38c792fb 100644
--- a/tests/tcg/aarch64/Makefile.target
+++ b/tests/tcg/aarch64/Makefile.target
@@ -105,19 +105,19 @@ sha512-sve: sha512.c
 
 TESTS += sha512-sve
 
-ifeq ($(HOST_GDB_SUPPORTS_ARCH),y)
+ifneq ($(GDB),)
 GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py
 
 run-gdbstub-sysregs: sysregs
 	$(call run-test, $@, $(GDB_SCRIPT) \
-		--gdb $(HAVE_GDB_BIN) \
+		--gdb $(GDB) \
 		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
 		--bin $< --test $(AARCH64_SRC)/gdbstub/test-sve.py, \
 	basic gdbstub SVE support)
 
 run-gdbstub-sve-ioctls: sve-ioctls
 	$(call run-test, $@, $(GDB_SCRIPT) \
-		--gdb $(HAVE_GDB_BIN) \
+		--gdb $(GDB) \
 		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
 		--bin $< --test $(AARCH64_SRC)/gdbstub/test-sve-ioctl.py, \
 	basic gdbstub SVE ZLEN support)
diff --git a/tests/tcg/multiarch/Makefile.target b/tests/tcg/multiarch/Makefile.target
index 43bddeaf212..f3bfaf1a228 100644
--- a/tests/tcg/multiarch/Makefile.target
+++ b/tests/tcg/multiarch/Makefile.target
@@ -63,45 +63,39 @@ run-test-mmap: test-mmap
 run-test-mmap-%: test-mmap
 	$(call run-test, test-mmap-$*, $(QEMU) -p $* $<, $< ($* byte pages))
 
-ifneq ($(HAVE_GDB_BIN),)
-ifeq ($(HOST_GDB_SUPPORTS_ARCH),y)
+ifneq ($(GDB),)
 GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py
 
 run-gdbstub-sha1: sha1
 	$(call run-test, $@, $(GDB_SCRIPT) \
-		--gdb $(HAVE_GDB_BIN) \
+		--gdb $(GDB) \
 		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
 		--bin $< --test $(MULTIARCH_SRC)/gdbstub/sha1.py, \
 	basic gdbstub support)
 
 run-gdbstub-qxfer-auxv-read: sha1
 	$(call run-test, $@, $(GDB_SCRIPT) \
-		--gdb $(HAVE_GDB_BIN) \
+		--gdb $(GDB) \
 		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
 		--bin $< --test $(MULTIARCH_SRC)/gdbstub/test-qxfer-auxv-read.py, \
 	basic gdbstub qXfer:auxv:read support)
 
 run-gdbstub-proc-mappings: sha1
 	$(call run-test, $@, $(GDB_SCRIPT) \
-		--gdb $(HAVE_GDB_BIN) \
+		--gdb $(GDB) \
 		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
 		--bin $< --test $(MULTIARCH_SRC)/gdbstub/test-proc-mappings.py, \
 	proc mappings support)
 
 run-gdbstub-thread-breakpoint: testthread
 	$(call run-test, $@, $(GDB_SCRIPT) \
-		--gdb $(HAVE_GDB_BIN) \
+		--gdb $(GDB) \
 		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
 		--bin $< --test $(MULTIARCH_SRC)/gdbstub/test-thread-breakpoint.py, \
 	hitting a breakpoint on non-main thread)
-
 else
 run-gdbstub-%:
-	$(call skip-test, "gdbstub test $*", "no guest arch support")
-endif
-else
-run-gdbstub-%:
-	$(call skip-test, "gdbstub test $*", "need working gdb")
+	$(call skip-test, "gdbstub test $*", "need working gdb with $(patsubst -%,,$(TARGET_NAME)) support")
 endif
 EXTRA_RUNS += run-gdbstub-sha1 run-gdbstub-qxfer-auxv-read \
 	      run-gdbstub-proc-mappings run-gdbstub-thread-breakpoint
diff --git a/tests/tcg/multiarch/system/Makefile.softmmu-target b/tests/tcg/multiarch/system/Makefile.softmmu-target
index 90810a32b2f..dee4f58dea1 100644
--- a/tests/tcg/multiarch/system/Makefile.softmmu-target
+++ b/tests/tcg/multiarch/system/Makefile.softmmu-target
@@ -14,13 +14,12 @@ VPATH+=$(MULTIARCH_SYSTEM_SRC)
 MULTIARCH_TEST_SRCS=$(wildcard $(MULTIARCH_SYSTEM_SRC)/*.c)
 MULTIARCH_TESTS = $(patsubst $(MULTIARCH_SYSTEM_SRC)/%.c, %, $(MULTIARCH_TEST_SRCS))
 
-ifneq ($(HAVE_GDB_BIN),)
-ifeq ($(HOST_GDB_SUPPORTS_ARCH),y)
+ifneq ($(GDB),)
 GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py
 
 run-gdbstub-memory: memory
 	$(call run-test, $@, $(GDB_SCRIPT) \
-		--gdb $(HAVE_GDB_BIN) \
+		--gdb $(GDB) \
 		--qemu $(QEMU) \
 		--output $<.gdb.out \
 		--qargs \
@@ -29,7 +28,7 @@ run-gdbstub-memory: memory
 	softmmu gdbstub support)
 run-gdbstub-interrupt: interrupt
 	$(call run-test, $@, $(GDB_SCRIPT) \
-		--gdb $(HAVE_GDB_BIN) \
+		--gdb $(GDB) \
 		--qemu $(QEMU) \
 		--output $<.gdb.out \
 		--qargs \
@@ -38,7 +37,7 @@ run-gdbstub-interrupt: interrupt
 	softmmu gdbstub support)
 run-gdbstub-untimely-packet: hello
 	$(call run-test, $@, $(GDB_SCRIPT) \
-		--gdb $(HAVE_GDB_BIN) \
+		--gdb $(GDB) \
 		--gdb-args "-ex 'set debug remote 1'" \
 		--output untimely-packet.gdb.out \
 		--stderr untimely-packet.gdb.err \
@@ -51,11 +50,7 @@ run-gdbstub-untimely-packet: hello
 		"GREP", file untimely-packet.gdb.err)
 else
 run-gdbstub-%:
-	$(call skip-test, "gdbstub test $*", "no guest arch support")
-endif
-else
-run-gdbstub-%:
-	$(call skip-test, "gdbstub test $*", "need working gdb")
+	$(call skip-test, "gdbstub test $*", "need working gdb with $(patsubst -%,,$(TARGET_NAME)) support")
 endif
 
 MULTIARCH_RUNS += run-gdbstub-memory run-gdbstub-interrupt run-gdbstub-untimely-packet
diff --git a/tests/tcg/s390x/Makefile.target b/tests/tcg/s390x/Makefile.target
index c650aefe5c1..826f0a18e43 100644
--- a/tests/tcg/s390x/Makefile.target
+++ b/tests/tcg/s390x/Makefile.target
@@ -81,12 +81,12 @@ $(Z15_TESTS): CFLAGS+=-march=z15 -O2
 TESTS+=$(Z15_TESTS)
 endif
 
-ifeq ($(HOST_GDB_SUPPORTS_ARCH),y)
+ifneq ($(GDB),)
 GDB_SCRIPT=$(SRC_PATH)/tests/guest-debug/run-test.py
 
 run-gdbstub-signals-s390x: signals-s390x
 	$(call run-test, $@, $(GDB_SCRIPT) \
-		--gdb $(HAVE_GDB_BIN) \
+		--gdb $(GDB) \
 		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
 		--bin $< --test $(S390X_SRC)/gdbstub/test-signals-s390x.py, \
 	mixing signals and debugging)
@@ -95,7 +95,7 @@ hello-s390x-asm: CFLAGS+=-nostdlib
 
 run-gdbstub-svc: hello-s390x-asm
 	$(call run-test, $@, $(GDB_SCRIPT) \
-		--gdb $(HAVE_GDB_BIN) \
+		--gdb $(GDB) \
 		--qemu $(QEMU) --qargs "$(QEMU_OPTS)" \
 		--bin $< --test $(S390X_SRC)/gdbstub/test-svc.py, \
 	single-stepping svc)
-- 
2.41.0



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

* [PULL 23/32] configure: clean up plugin option handling
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (21 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 22/32] configure, tests/tcg: simplify GDB conditionals Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 24/32] configure: clean up PIE " Paolo Bonzini
                   ` (9 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel

Keep together all the conditions that lead to disabling plugins, and
remove now-dead code.

Since the option was not in SKIP_OPTIONS, it was present twice in
the help message, both from configure and from meson-buildoptions.sh.
Remove the duplication and take the occasion to document the option as
autodetected, which it is.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 39 +++++++++++++++--------------------
 scripts/meson-buildoptions.py | 17 ++++++++++-----
 scripts/meson-buildoptions.sh |  2 +-
 3 files changed, 30 insertions(+), 28 deletions(-)

diff --git a/configure b/configure
index ffcfabb8d36..688577bebd8 100755
--- a/configure
+++ b/configure
@@ -377,7 +377,6 @@ fi
 
 case $targetos in
 windows)
-  plugins="no"
   pie="no"
 ;;
 haiku)
@@ -741,7 +740,6 @@ for opt do
       default_cflags='-O0 -g'
   ;;
   --disable-tcg) tcg="disabled"
-                 plugins="no"
   ;;
   --enable-tcg) tcg="enabled"
   ;;
@@ -778,11 +776,7 @@ for opt do
   ;;
   --enable-download) download="enabled"; git_submodules_action=update;
   ;;
-  --enable-plugins) if test "$targetos" = "windows"; then
-                        error_exit "TCG plugins not currently supported on Windows platforms"
-                    else
-                        plugins="yes"
-                    fi
+  --enable-plugins) plugins="yes"
   ;;
   --disable-plugins) plugins="no"
   ;;
@@ -808,11 +802,6 @@ then
     git_submodules_action="validate"
 fi
 
-# test for any invalid configuration combinations
-if test "$plugins" = "yes" -a "$tcg" = "disabled"; then
-    error_exit "Can't enable plugins on non-TCG builds"
-fi
-
 if ! test -f "$source_path/subprojects/keycodemapdb/README" \
     && test "$download" = disabled
 then
@@ -923,8 +912,6 @@ Advanced options (experts only):
   --enable-debug           enable common debug build options
   --disable-werror         disable compilation abort on warning
   --cpu=CPU                Build for host CPU [$cpu]
-  --enable-plugins
-                           enable plugins via shared library loading
   --disable-containers     don't use containers for cross-building
   --container-engine=TYPE  which container engine to use [$container_engine]
   --gdb=GDB-path           gdb to use for gdbstub tests [$gdb_bin]
@@ -1066,15 +1053,27 @@ if test "$targetos" = "bogus"; then
     error_exit "Unrecognized host OS (uname -s reports '$(uname -s)')"
 fi
 
+# test for any invalid configuration combinations
+if test "$targetos" = "windows"; then
+  if test "$plugins" = "yes"; then
+    error_exit "TCG plugins not currently supported on Windows platforms"
+  fi
+  plugins="no"
+fi
+if test "$tcg" = "disabled" ; then
+  if test "$plugins" = "yes"; then
+    error_exit "Can't enable plugins on non-TCG builds"
+  fi
+  plugins="no"
+fi
 if test "$static" = "yes" ; then
   if test "$plugins" = "yes"; then
     error_exit "static and plugins are mutually incompatible"
-  else
-    plugins="no"
   fi
+  plugins="no"
 fi
-test "$plugins" = "" && plugins=yes
-if test "$plugins" = "yes"; then
+if test "$plugins" != "no"; then
+  plugins=yes
   subdirs="$subdirs contrib/plugins"
 fi
 
@@ -1717,10 +1716,6 @@ mkdir -p tests/tcg
 echo "# Automatically generated by configure - do not modify" > $config_host_mak
 echo "SRC_PATH=$source_path" >> $config_host_mak
 
-if test "$plugins" = "yes" ; then
-    echo "CONFIG_PLUGIN=y" >> $config_host_mak
-fi
-
 tcg_tests_targets=
 for target in $target_list; do
   arch=${target%%-*}
diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
index 8d2e526132a..b787c84e914 100644
--- a/scripts/meson-buildoptions.py
+++ b/scripts/meson-buildoptions.py
@@ -44,6 +44,11 @@
     "trace_file": "with-trace-file",
 }
 
+# Options that configure autodetects, even though meson defines them as boolean
+AUTO_OPTIONS = {
+    "plugins",
+}
+
 BUILTIN_OPTIONS = {
     "b_coverage",
     "b_lto",
@@ -168,6 +173,7 @@ def cli_metavar(opt):
 
 def print_help(options):
     print("meson_options_help() {")
+    feature_opts = []
     for opt in sorted(options, key=cli_help_key):
         key = cli_help_key(opt)
         # The first section includes options that have an arguments,
@@ -176,7 +182,7 @@ def print_help(options):
             metavar = cli_metavar(opt)
             left = f"--{key}={metavar}"
             help_line(left, opt, 27, True)
-        elif opt["type"] == "boolean":
+        elif opt["type"] == "boolean" and opt["name"] not in AUTO_OPTIONS:
             left = f"--{key}"
             help_line(left, opt, 27, False)
         elif allow_arg(opt):
@@ -185,16 +191,17 @@ def print_help(options):
             else:
                 left = f"--{key}=CHOICE"
             help_line(left, opt, 27, True)
+        else:
+            feature_opts.append(opt)
 
     sh_print()
     sh_print("Optional features, enabled with --enable-FEATURE and")
     sh_print("disabled with --disable-FEATURE, default is enabled if available")
     sh_print("(unless built with --without-default-features):")
     sh_print()
-    for opt in options:
-        key = opt["name"].replace("_", "-")
-        if opt["type"] != "boolean" and not allow_arg(opt):
-            help_line(key, opt, 18, False)
+    for opt in sorted(feature_opts, key=cli_option):
+        key = cli_option(opt)
+        help_line(key, opt, 18, False)
     print("}")
 
 
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index d4b89e6b443..22d69966606 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -40,7 +40,6 @@ meson_options_help() {
   printf "%s\n" '                           jemalloc/system/tcmalloc)'
   printf "%s\n" '  --enable-module-upgrades try to load modules from alternate paths for'
   printf "%s\n" '                           upgrades'
-  printf "%s\n" '  --enable-plugins         TCG plugins via shared library loading'
   printf "%s\n" '  --enable-rng-none        dummy RNG, avoid using /dev/(u)random and'
   printf "%s\n" '                           getrandom()'
   printf "%s\n" '  --enable-safe-stack      SafeStack Stack Smash Protection (requires'
@@ -149,6 +148,7 @@ meson_options_help() {
   printf "%s\n" '  pa              PulseAudio sound support'
   printf "%s\n" '  parallels       parallels image format support'
   printf "%s\n" '  pipewire        PipeWire sound support'
+  printf "%s\n" '  plugins         TCG plugins via shared library loading'
   printf "%s\n" '  png             PNG support with libpng'
   printf "%s\n" '  pvrdma          Enable PVRDMA support'
   printf "%s\n" '  qcow1           qcow1 image format support'
-- 
2.41.0



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

* [PULL 24/32] configure: clean up PIE option handling
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (22 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 23/32] configure: clean up plugin option handling Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 25/32] configure: remove some dead cruft Paolo Bonzini
                   ` (8 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel

Keep together all the conditions that lead to disabling PIE.

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

diff --git a/configure b/configure
index 688577bebd8..5c1d618f102 100755
--- a/configure
+++ b/configure
@@ -373,17 +373,6 @@ else
   targetos=bogus
 fi
 
-# OS specific
-
-case $targetos in
-windows)
-  pie="no"
-;;
-haiku)
-  pie="no"
-;;
-esac
-
 if test ! -z "$cpu" ; then
   # command line argument
   :
@@ -1088,19 +1077,23 @@ static THREAD int tls_var;
 int main(void) { return tls_var; }
 EOF
 
-if test "$static" = "yes"; then
-  if test "$pie" != "no" && compile_prog "-Werror -fPIE -DPIE" "-static-pie"; then
+if test "$targetos" = windows || test "$targetos" = haiku; then
+  if test "$pie" = "yes"; then
+    error_exit "PIE not available due to missing OS support"
+  fi
+  pie=no
+fi
+
+if test "$pie" != "no"; then
+  if test "$static" = "yes"; then
+    pie_ldflags=-static-pie
+  else
+    pie_ldflags=-pie
+  fi
+  if compile_prog "-Werror -fPIE -DPIE" "$pie_ldflags"; then
     pie="yes"
   elif test "$pie" = "yes"; then
     error_exit "-static-pie not available due to missing toolchain support"
-  else
-    pie="no"
-  fi
-elif test "$pie" != "no"; then
-  if compile_prog "-Werror -fPIE -DPIE" "-pie"; then
-    pie="yes"
-  elif test "$pie" = "yes"; then
-    error_exit "PIE not available due to missing toolchain support"
   else
     echo "Disabling PIE due to missing toolchain support"
     pie="no"
-- 
2.41.0



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

* [PULL 25/32] configure: remove some dead cruft
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (23 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 24/32] configure: clean up PIE " Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 26/32] configure: move target-specific defaults to an external machine file Paolo Bonzini
                   ` (7 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth

print_error is only invoked in one place, and $git is unused.

Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 7 +------
 1 file changed, 1 insertion(+), 6 deletions(-)

diff --git a/configure b/configure
index 5c1d618f102..0994f54530c 100755
--- a/configure
+++ b/configure
@@ -94,7 +94,7 @@ quote_sh() {
     printf "%s" "$1" | sed "s,','\\\\'',g; s,.*,'&',"
 }
 
-print_error() {
+error_exit() {
     (echo
     echo "ERROR: $1"
     while test -n "$2"; do
@@ -102,10 +102,6 @@ print_error() {
         shift
     done
     echo) >&2
-}
-
-error_exit() {
-    print_error "$@"
     exit 1
 }
 
@@ -248,7 +244,6 @@ done
 
 default_cflags='-O2 -g'
 git_submodules_action="update"
-git="git"
 docs="auto"
 EXESUF=""
 prefix="/usr/local"
-- 
2.41.0



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

* [PULL 26/32] configure: move target-specific defaults to an external machine file
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (24 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 25/32] configure: remove some dead cruft Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 27/32] configure: move environment-specific defaults to config-meson.cross Paolo Bonzini
                   ` (6 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel

Enable Windows-specific defaults with a machine file, so that related
options can be automatically parsed and included in the help message.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configs/meson/windows.txt     |  9 +++++++++
 configure                     | 37 ++++++++++++++---------------------
 scripts/meson-buildoptions.py |  4 +++-
 scripts/meson-buildoptions.sh |  7 +++++++
 4 files changed, 34 insertions(+), 23 deletions(-)
 create mode 100644 configs/meson/windows.txt

diff --git a/configs/meson/windows.txt b/configs/meson/windows.txt
new file mode 100644
index 00000000000..55b192e71b1
--- /dev/null
+++ b/configs/meson/windows.txt
@@ -0,0 +1,9 @@
+# target-specific defaults, can still be overridden on
+# the command line
+
+[built-in options]
+bindir = ''
+prefix = '/qemu'
+
+[project options]
+qemu_suffix = ''
diff --git a/configure b/configure
index 0994f54530c..8f23c8d1655 100755
--- a/configure
+++ b/configure
@@ -246,8 +246,6 @@ default_cflags='-O2 -g'
 git_submodules_action="update"
 docs="auto"
 EXESUF=""
-prefix="/usr/local"
-qemu_suffix="qemu"
 system="yes"
 linux_user=""
 bsd_user=""
@@ -256,7 +254,6 @@ subdirs=""
 ninja=""
 python=
 download="enabled"
-bindir="bin"
 skip_meson=no
 use_containers="yes"
 gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb")
@@ -583,9 +580,6 @@ done
 
 if test "$targetos" = "windows" ; then
   EXESUF=".exe"
-  prefix="/qemu"
-  bindir=""
-  qemu_suffix=""
 fi
 
 meson_option_build_array() {
@@ -622,6 +616,14 @@ meson_option_parse() {
   fi
 }
 
+meson_add_machine_file() {
+  if test "$cross_compile" = "yes"; then
+    meson_option_add --cross-file "$1"
+  else
+    meson_option_add --native-file "$1"
+  fi
+}
+
 for opt do
   optarg=$(expr "x$opt" : 'x[^=]*=\(.*\)')
   case "$opt" in
@@ -629,8 +631,6 @@ for opt do
   ;;
   --version|-V) exec cat "$source_path/VERSION"
   ;;
-  --prefix=*) prefix="$optarg"
-  ;;
   --cross-prefix=*)
   ;;
   --cc=*)
@@ -701,10 +701,6 @@ for opt do
   ;;
   --static) static="yes"
   ;;
-  --bindir=*) bindir="$optarg"
-  ;;
-  --with-suffix=*) qemu_suffix="$optarg"
-  ;;
   --host=*|--build=*|\
   --disable-dependency-tracking|\
   --sbindir=*|--sharedstatedir=*|\
@@ -861,7 +857,6 @@ Options: [defaults in brackets after descriptions]
 
 Standard options:
   --help                   print this message
-  --prefix=PREFIX          install in PREFIX [$prefix]
   --target-list=LIST       set target list (default: build all)
 $(echo Available targets: $default_target_list | \
   fold -s -w 53 | sed -e 's/^/                           /')
@@ -886,8 +881,6 @@ Advanced options (experts only):
   --ninja=NINJA            use specified ninja [$ninja]
   --smbd=SMBD              use specified smbd [$smbd]
   --static                 enable static build [$static]
-  --bindir=PATH            install binaries in PATH
-  --with-suffix=SUFFIX     suffix for QEMU data inside datadir/libdir/sysconfdir/docdir [$qemu_suffix]
   --without-default-features default all --enable-* options to "disabled"
   --without-default-devices  do not include any device that is not needed to
                            start the emulator (only use if you are including
@@ -1803,24 +1796,25 @@ if test "$skip_meson" = no; then
     else
         echo "endian = 'little'" >> $cross
     fi
-    cross_arg="--cross-file config-meson.cross"
 
     native="config-meson.native.new"
     echo "# Automatically generated by configure - do not modify" > $native
     echo "[binaries]" >> $native
     echo "c = [$(meson_quote $host_cc)]" >> $native
     mv $native config-meson.native
-    cross_arg="$cross_arg --native-file config-meson.native"
-  else
-    cross_arg="--native-file config-meson.cross"
+    meson_option_add --native-file
+    meson_option_add config-meson.native
   fi
   mv $cross config-meson.cross
+  meson_add_machine_file config-meson.cross
+  if test -f "$source_path/configs/meson/$targetos.txt"; then
+    meson_add_machine_file $source_path/configs/meson/$targetos.txt
+  fi
 
   rm -rf meson-private meson-info meson-logs
 
   # Built-in options
   test "$download" = "disabled" && meson_option_add "--wrap-mode=nodownload"
-  test "$bindir" != "bin" && meson_option_add "-Dbindir=$bindir"
   test "$default_feature" = no && meson_option_add -Dauto_features=disabled
   test "$static" = yes && meson_option_add -Dprefer_static=true
   test "$pie" = no && meson_option_add -Db_pie=false
@@ -1831,11 +1825,10 @@ if test "$skip_meson" = no; then
   test "$docs" != auto && meson_option_add "-Ddocs=$docs"
   test -n "${LIB_FUZZING_ENGINE+xxx}" && meson_option_add "-Dfuzzing_engine=$LIB_FUZZING_ENGINE"
   test "$plugins" = yes && meson_option_add "-Dplugins=true"
-  test "$qemu_suffix" != qemu && meson_option_add "-Dqemu_suffix=$qemu_suffix"
   test "$smbd" != '' && meson_option_add "-Dsmbd=$smbd"
   test "$tcg" != enabled && meson_option_add "-Dtcg=$tcg"
   run_meson() {
-    NINJA=$ninja $meson setup --prefix "$prefix" "$@" $cross_arg "$PWD" "$source_path"
+    NINJA=$ninja $meson setup "$@" "$PWD" "$source_path"
   }
   eval run_meson $meson_options
   if test "$?" -ne 0 ; then
diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
index b787c84e914..0c24bdc1e8c 100644
--- a/scripts/meson-buildoptions.py
+++ b/scripts/meson-buildoptions.py
@@ -28,7 +28,6 @@
 SKIP_OPTIONS = {
     "default_devices",
     "fuzzing_engine",
-    "qemu_suffix",
     "smbd",
 }
 
@@ -40,6 +39,7 @@
     "malloc": "enable-malloc",
     "pkgversion": "with-pkgversion",
     "qemu_firmwarepath": "firmwarepath",
+    "qemu_suffix": "with-suffix",
     "trace_backends": "enable-trace-backends",
     "trace_file": "with-trace-file",
 }
@@ -52,6 +52,7 @@
 BUILTIN_OPTIONS = {
     "b_coverage",
     "b_lto",
+    "bindir",
     "datadir",
     "debug",
     "includedir",
@@ -60,6 +61,7 @@
     "localedir",
     "localstatedir",
     "mandir",
+    "prefix",
     "strip",
     "sysconfdir",
 }
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index 22d69966606..e1522030619 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -3,6 +3,7 @@ meson_options_help() {
   printf "%s\n" '  --audio-drv-list=CHOICES Set audio driver list [default] (choices: alsa/co'
   printf "%s\n" '                           reaudio/default/dsound/jack/oss/pa/pipewire/sdl/s'
   printf "%s\n" '                           ndio)'
+  printf "%s\n" '  --bindir=VALUE           Executable directory [bin]'
   printf "%s\n" '  --block-drv-ro-whitelist=VALUE'
   printf "%s\n" '                           set block driver read-only whitelist (by default'
   printf "%s\n" '                           affects only QEMU, not tools like qemu-img)'
@@ -62,6 +63,7 @@ meson_options_help() {
   printf "%s\n" '  --localedir=VALUE        Locale data directory [share/locale]'
   printf "%s\n" '  --localstatedir=VALUE    Localstate data directory [/var/local]'
   printf "%s\n" '  --mandir=VALUE           Manual page directory [share/man]'
+  printf "%s\n" '  --prefix=VALUE           Installation prefix [/usr/local]'
   printf "%s\n" '  --sysconfdir=VALUE       Sysconf data directory [etc]'
   printf "%s\n" '  --tls-priority=VALUE     Default TLS protocol/cipher priority string'
   printf "%s\n" '                           [NORMAL]'
@@ -69,6 +71,8 @@ meson_options_help() {
   printf "%s\n" '                           auto/sigaltstack/ucontext/windows)'
   printf "%s\n" '  --with-pkgversion=VALUE  use specified string as sub-version of the'
   printf "%s\n" '                           package'
+  printf "%s\n" '  --with-suffix=VALUE      Suffix for QEMU data/modules/config directories'
+  printf "%s\n" '                           (can be empty) [qemu]'
   printf "%s\n" '  --with-trace-file=VALUE  Trace file prefix for simple backend [trace]'
   printf "%s\n" ''
   printf "%s\n" 'Optional features, enabled with --enable-FEATURE and'
@@ -229,6 +233,7 @@ _meson_option_parse() {
     --disable-gcov) printf "%s" -Db_coverage=false ;;
     --enable-lto) printf "%s" -Db_lto=true ;;
     --disable-lto) printf "%s" -Db_lto=false ;;
+    --bindir=*) quote_sh "-Dbindir=$2" ;;
     --enable-blkio) printf "%s" -Dblkio=enabled ;;
     --disable-blkio) printf "%s" -Dblkio=disabled ;;
     --block-drv-ro-whitelist=*) quote_sh "-Dblock_drv_ro_whitelist=$2" ;;
@@ -407,6 +412,7 @@ _meson_option_parse() {
     --disable-plugins) printf "%s" -Dplugins=false ;;
     --enable-png) printf "%s" -Dpng=enabled ;;
     --disable-png) printf "%s" -Dpng=disabled ;;
+    --prefix=*) quote_sh "-Dprefix=$2" ;;
     --enable-pvrdma) printf "%s" -Dpvrdma=enabled ;;
     --disable-pvrdma) printf "%s" -Dpvrdma=disabled ;;
     --enable-qcow1) printf "%s" -Dqcow1=enabled ;;
@@ -414,6 +420,7 @@ _meson_option_parse() {
     --enable-qed) printf "%s" -Dqed=enabled ;;
     --disable-qed) printf "%s" -Dqed=disabled ;;
     --firmwarepath=*) quote_sh "-Dqemu_firmwarepath=$(meson_option_build_array $2)" ;;
+    --with-suffix=*) quote_sh "-Dqemu_suffix=$2" ;;
     --enable-qga-vss) printf "%s" -Dqga_vss=enabled ;;
     --disable-qga-vss) printf "%s" -Dqga_vss=disabled ;;
     --enable-qom-cast-debug) printf "%s" -Dqom_cast_debug=true ;;
-- 
2.41.0



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

* [PULL 27/32] configure: move environment-specific defaults to config-meson.cross
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (25 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 26/32] configure: move target-specific defaults to an external machine file Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 28/32] configure: unify handling of several Debian cross containers Paolo Bonzini
                   ` (5 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel

Store the -Werror and SMBD defaults in the machine file, which still allows
them to be overridden on the command line and enables automatic parsing
of the related options.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 37 +++++++++++++----------------------
 scripts/meson-buildoptions.py |  3 ++-
 scripts/meson-buildoptions.sh |  5 +++++
 3 files changed, 21 insertions(+), 24 deletions(-)

diff --git a/configure b/configure
index 8f23c8d1655..200570a3d18 100755
--- a/configure
+++ b/configure
@@ -258,7 +258,6 @@ skip_meson=no
 use_containers="yes"
 gdb_bin=$(command -v "gdb-multiarch" || command -v "gdb")
 gdb_arches=""
-werror=""
 
 # Don't accept a target_list environment variable.
 unset target_list
@@ -314,7 +313,6 @@ objcopy="${OBJCOPY-${cross_prefix}objcopy}"
 ld="${LD-${cross_prefix}ld}"
 ranlib="${RANLIB-${cross_prefix}ranlib}"
 nm="${NM-${cross_prefix}nm}"
-smbd="$SMBD"
 strip="${STRIP-${cross_prefix}strip}"
 widl="${WIDL-${cross_prefix}widl}"
 windres="${WINDRES-${cross_prefix}windres}"
@@ -651,8 +649,6 @@ for opt do
   ;;
   --ninja=*) ninja="$optarg"
   ;;
-  --smbd=*) smbd="$optarg"
-  ;;
   --extra-cflags=*)
   ;;
   --extra-cxxflags=*)
@@ -744,10 +740,6 @@ for opt do
   ;;
   --disable-pie) pie="no"
   ;;
-  --enable-werror) werror="yes"
-  ;;
-  --disable-werror) werror="no"
-  ;;
   --enable-cfi) cfi=true
   ;;
   --disable-cfi) cfi=false
@@ -879,7 +871,6 @@ Advanced options (experts only):
   --cross-prefix-ARCH=PREFIX cross compiler prefix when building ARCH guest test cases
   --python=PYTHON          use specified python [$python]
   --ninja=NINJA            use specified ninja [$ninja]
-  --smbd=SMBD              use specified smbd [$smbd]
   --static                 enable static build [$static]
   --without-default-features default all --enable-* options to "disabled"
   --without-default-devices  do not include any device that is not needed to
@@ -887,7 +878,6 @@ Advanced options (experts only):
                            desired devices in configs/devices/)
   --with-devices-ARCH=NAME override default configs/devices
   --enable-debug           enable common debug build options
-  --disable-werror         disable compilation abort on warning
   --cpu=CPU                Build for host CPU [$cpu]
   --disable-containers     don't use containers for cross-building
   --container-engine=TYPE  which container engine to use [$container_engine]
@@ -1011,17 +1001,6 @@ if test -z "$ninja"; then
     fi
 fi
 
-# Consult white-list to determine whether to enable werror
-# by default.  Only enable by default for git builds
-if test -z "$werror" ; then
-    if test -e "$source_path/.git" && \
-        { test "$targetos" = linux || test "$targetos" = "windows"; }; then
-        werror="yes"
-    else
-        werror="no"
-    fi
-fi
-
 if test "$targetos" = "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
@@ -1764,6 +1743,20 @@ if test "$skip_meson" = no; then
   test -n "$objcc" && echo "objc_args = [$(meson_quote $OBJCFLAGS $EXTRA_OBJCFLAGS)]" >> $cross
   echo "c_link_args = [$(meson_quote $CFLAGS $LDFLAGS $EXTRA_CFLAGS $EXTRA_LDFLAGS)]" >> $cross
   echo "cpp_link_args = [$(meson_quote $CXXFLAGS $LDFLAGS $EXTRA_CXXFLAGS $EXTRA_LDFLAGS)]" >> $cross
+
+  # Only enable by default for git builds and on select OSes
+  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
+      echo 'werror = true' >> $cross
+  fi
+  echo "[project options]" >> $cross
+  if test "$SMBD" != ''; then
+    echo "smbd = $(meson_quote "$SMBD")" >> $cross
+  fi
+
+  echo >> $cross
   echo "[binaries]" >> $cross
   echo "c = [$(meson_quote $cc $CPU_CFLAGS)]" >> $cross
   test -n "$cxx" && echo "cpp = [$(meson_quote $cxx $CPU_CFLAGS)]" >> $cross
@@ -1818,14 +1811,12 @@ if test "$skip_meson" = no; then
   test "$default_feature" = no && meson_option_add -Dauto_features=disabled
   test "$static" = yes && meson_option_add -Dprefer_static=true
   test "$pie" = no && meson_option_add -Db_pie=false
-  test "$werror" = yes && meson_option_add -Dwerror=true
 
   # QEMU options
   test "$cfi" != false && meson_option_add "-Dcfi=$cfi" "-Db_lto=$cfi"
   test "$docs" != auto && meson_option_add "-Ddocs=$docs"
   test -n "${LIB_FUZZING_ENGINE+xxx}" && meson_option_add "-Dfuzzing_engine=$LIB_FUZZING_ENGINE"
   test "$plugins" = yes && meson_option_add "-Dplugins=true"
-  test "$smbd" != '' && meson_option_add "-Dsmbd=$smbd"
   test "$tcg" != enabled && meson_option_add "-Dtcg=$tcg"
   run_meson() {
     NINJA=$ninja $meson setup "$@" "$PWD" "$source_path"
diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
index 0c24bdc1e8c..2e88732a291 100644
--- a/scripts/meson-buildoptions.py
+++ b/scripts/meson-buildoptions.py
@@ -28,7 +28,6 @@
 SKIP_OPTIONS = {
     "default_devices",
     "fuzzing_engine",
-    "smbd",
 }
 
 OPTION_NAMES = {
@@ -47,6 +46,7 @@
 # Options that configure autodetects, even though meson defines them as boolean
 AUTO_OPTIONS = {
     "plugins",
+    "werror",
 }
 
 BUILTIN_OPTIONS = {
@@ -64,6 +64,7 @@
     "prefix",
     "strip",
     "sysconfdir",
+    "werror",
 }
 
 LINE_WIDTH = 76
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index e1522030619..dec33820163 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -64,6 +64,7 @@ meson_options_help() {
   printf "%s\n" '  --localstatedir=VALUE    Localstate data directory [/var/local]'
   printf "%s\n" '  --mandir=VALUE           Manual page directory [share/man]'
   printf "%s\n" '  --prefix=VALUE           Installation prefix [/usr/local]'
+  printf "%s\n" '  --smbd=VALUE             Path to smbd for slirp networking'
   printf "%s\n" '  --sysconfdir=VALUE       Sysconf data directory [etc]'
   printf "%s\n" '  --tls-priority=VALUE     Default TLS protocol/cipher priority string'
   printf "%s\n" '                           [NORMAL]'
@@ -205,6 +206,7 @@ meson_options_help() {
   printf "%s\n" '  vpc             vpc image format support'
   printf "%s\n" '  vte             vte support for the gtk UI'
   printf "%s\n" '  vvfat           vvfat image format support'
+  printf "%s\n" '  werror          Treat warnings as errors'
   printf "%s\n" '  whpx            WHPX acceleration support'
   printf "%s\n" '  xen             Xen backend support'
   printf "%s\n" '  xen-pci-passthrough'
@@ -453,6 +455,7 @@ _meson_option_parse() {
     --disable-slirp-smbd) printf "%s" -Dslirp_smbd=disabled ;;
     --enable-smartcard) printf "%s" -Dsmartcard=enabled ;;
     --disable-smartcard) printf "%s" -Dsmartcard=disabled ;;
+    --smbd=*) quote_sh "-Dsmbd=$2" ;;
     --enable-snappy) printf "%s" -Dsnappy=enabled ;;
     --disable-snappy) printf "%s" -Dsnappy=disabled ;;
     --enable-sndio) printf "%s" -Dsndio=enabled ;;
@@ -529,6 +532,8 @@ _meson_option_parse() {
     --disable-vte) printf "%s" -Dvte=disabled ;;
     --enable-vvfat) printf "%s" -Dvvfat=enabled ;;
     --disable-vvfat) printf "%s" -Dvvfat=disabled ;;
+    --enable-werror) printf "%s" -Dwerror=true ;;
+    --disable-werror) printf "%s" -Dwerror=false ;;
     --enable-whpx) printf "%s" -Dwhpx=enabled ;;
     --disable-whpx) printf "%s" -Dwhpx=disabled ;;
     --enable-xen) printf "%s" -Dxen=enabled ;;
-- 
2.41.0



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

* [PULL 28/32] configure: unify handling of several Debian cross containers
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (26 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 27/32] configure: move environment-specific defaults to config-meson.cross Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 29/32] configure, meson: use command line options to configure qemu-ga Paolo Bonzini
                   ` (4 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel

The Debian and GNU architecture names match very often, even though
there are common cases (32-bit Arm or 64-bit x86) where they do not
and other cases in which the GNU triplet is actually a quadruplet.
But it is still possible to group the common case into a single
case inside probe_target_compiler.

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

diff --git a/configure b/configure
index 200570a3d18..4b24c572d56 100755
--- a/configure
+++ b/configure
@@ -1281,10 +1281,6 @@ probe_target_compiler() {
         container_cross_prefix=aarch64-linux-gnu-
         container_cross_cc=${container_cross_prefix}gcc
         ;;
-      alpha)
-        container_image=debian-alpha-cross
-        container_cross_prefix=alpha-linux-gnu-
-        ;;
       arm)
         # We don't have any bigendian build tools so we only use this for ARM
         container_image=debian-armhf-cross
@@ -1299,10 +1295,6 @@ probe_target_compiler() {
         container_cross_prefix=hexagon-unknown-linux-musl-
         container_cross_cc=${container_cross_prefix}clang
         ;;
-      hppa)
-        container_image=debian-hppa-cross
-        container_cross_prefix=hppa-linux-gnu-
-        ;;
       i386)
         container_image=fedora-i386-cross
         container_cross_prefix=
@@ -1311,10 +1303,6 @@ probe_target_compiler() {
         container_image=debian-loongarch-cross
         container_cross_prefix=loongarch64-unknown-linux-gnu-
         ;;
-      m68k)
-        container_image=debian-m68k-cross
-        container_cross_prefix=m68k-linux-gnu-
-        ;;
       microblaze)
         container_image=debian-microblaze-cross
         container_cross_prefix=microblaze-linux-musl-
@@ -1327,14 +1315,6 @@ probe_target_compiler() {
         container_image=debian-mips64-cross
         container_cross_prefix=mips64-linux-gnuabi64-
         ;;
-      mipsel)
-        container_image=debian-mipsel-cross
-        container_cross_prefix=mipsel-linux-gnu-
-        ;;
-      mips)
-        container_image=debian-mips-cross
-        container_cross_prefix=mips-linux-gnu-
-        ;;
       nios2)
         container_image=debian-nios2-cross
         container_cross_prefix=nios2-linux-gnu-
@@ -1349,22 +1329,6 @@ probe_target_compiler() {
         container_cross_prefix=powerpc${target_arch#ppc}-linux-gnu-
         container_cross_cc=${container_cross_prefix}gcc-10
         ;;
-      riscv64)
-        container_image=debian-riscv64-test-cross
-        container_cross_prefix=riscv64-linux-gnu-
-        ;;
-      s390x)
-        container_image=debian-s390x-cross
-        container_cross_prefix=s390x-linux-gnu-
-        ;;
-      sh4)
-        container_image=debian-sh4-cross
-        container_cross_prefix=sh4-linux-gnu-
-        ;;
-      sparc64)
-        container_image=debian-sparc64-cross
-        container_cross_prefix=sparc64-linux-gnu-
-        ;;
       tricore)
         container_image=debian-tricore-cross
         container_cross_prefix=tricore-
@@ -1379,6 +1343,11 @@ 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
     : ${container_cross_cc:=${container_cross_prefix}gcc}
     : ${container_cross_ar:=${container_cross_prefix}ar}
-- 
2.41.0



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

* [PULL 29/32] configure, meson: use command line options to configure qemu-ga
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (27 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 28/32] configure: unify handling of several Debian cross containers Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 30/32] meson-buildoptions: document the data at the top Paolo Bonzini
                   ` (3 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel

Preserve the functionality of the environment variables, but
allow using the command line instead.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 16 +++++++++-------
 meson_options.txt             |  7 +++++++
 qga/meson.build               |  9 ++++++---
 scripts/meson-buildoptions.sh |  9 +++++++++
 4 files changed, 31 insertions(+), 10 deletions(-)

diff --git a/configure b/configure
index 4b24c572d56..8827a29bf4c 100755
--- a/configure
+++ b/configure
@@ -1592,12 +1592,6 @@ echo >> $config_host_mak
 
 echo all: >> $config_host_mak
 
-if test "$targetos" = "windows"; then
-  echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER-QEMU}" >> $config_host_mak
-  echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO-Linux}" >> $config_host_mak
-  echo "QEMU_GA_VERSION=${QEMU_GA_VERSION-$(cat "$source_path"/VERSION)}" >> $config_host_mak
-fi
-
 echo "SRC_PATH=$source_path" >> $config_host_mak
 echo "TARGET_DIRS=$target_list" >> $config_host_mak
 echo "GDB=$gdb_bin" >> $config_host_mak
@@ -1724,6 +1718,15 @@ if test "$skip_meson" = no; then
   if test "$SMBD" != ''; then
     echo "smbd = $(meson_quote "$SMBD")" >> $cross
   fi
+  if test "${QEMU_GA_MANUFACTURER}" != ''; then
+    echo "qemu_ga_manufacturer = $(meson_quote "${QEMU_GA_MANUFACTURER}")" >> $cross
+  fi
+  if test "${QEMU_GA_DISTRO}" != ''; then
+    echo "qemu_ga_distro = $(meson_quote "${QEMU_GA_DISTRO}")" >> $cross
+  fi
+  if test "${QEMU_GA_VERSION}" != ''; then
+    echo "qemu_ga_version = $(meson_quote "${QEMU_GA_VERSION}")" >> $cross
+  fi
 
   echo >> $cross
   echo "[binaries]" >> $cross
@@ -1775,7 +1778,6 @@ if test "$skip_meson" = no; then
 
   rm -rf meson-private meson-info meson-logs
 
-  # Built-in options
   test "$download" = "disabled" && meson_option_add "--wrap-mode=nodownload"
   test "$default_feature" = no && meson_option_add -Dauto_features=disabled
   test "$static" = yes && meson_option_add -Dprefer_static=true
diff --git a/meson_options.txt b/meson_options.txt
index e237b268469..1b0c02b4a58 100644
--- a/meson_options.txt
+++ b/meson_options.txt
@@ -353,5 +353,12 @@ option('qom_cast_debug', type: 'boolean', value: true,
 option('slirp_smbd', type : 'feature', value : 'auto',
        description: 'use smbd (at path --smbd=*) in slirp networking')
 
+option('qemu_ga_manufacturer', type: 'string', value: 'QEMU',
+       description: '"manufacturer" name for qemu-ga registry entries')
+option('qemu_ga_distro', type: 'string', value: 'Linux',
+       description: 'second path element in qemu-ga registry entries')
+option('qemu_ga_version', type: 'string', value: '',
+       description: 'version number for qemu-ga installer')
+
 option('hexagon_idef_parser', type : 'boolean', value : true,
        description: 'use idef-parser to automatically generate TCG code for the Hexagon frontend')
diff --git a/qga/meson.build b/qga/meson.build
index 59cae0cc6ee..940a51d55db 100644
--- a/qga/meson.build
+++ b/qga/meson.build
@@ -145,6 +145,9 @@ if targetos == 'windows'
     else
       libpcre = 'libpcre2'
     endif
+    qga_msi_version = get_option('qemu_ga_version') == '' \
+      ? project.version() \
+      : get_option('qemu_ga_version')
     qga_msi = custom_target('QGA MSI',
                             input: files('installer/qemu-ga.wxs'),
                             output: 'qemu-ga-@0@.msi'.format(host_arch),
@@ -155,9 +158,9 @@ if targetos == 'windows'
                               qemu_ga_msi_vss,
                               '-D', 'BUILD_DIR=' + meson.project_build_root(),
                               '-D', 'BIN_DIR=' + glib_pc.get_variable('bindir'),
-                              '-D', 'QEMU_GA_VERSION=' + config_host['QEMU_GA_VERSION'],
-                              '-D', 'QEMU_GA_MANUFACTURER=' + config_host['QEMU_GA_MANUFACTURER'],
-                              '-D', 'QEMU_GA_DISTRO=' + config_host['QEMU_GA_DISTRO'],
+                              '-D', 'QEMU_GA_VERSION=' + qga_msi_version,
+                              '-D', 'QEMU_GA_MANUFACTURER=' + get_option('qemu_ga_manufacturer'),
+                              '-D', 'QEMU_GA_DISTRO=' + get_option('qemu_ga_distro'),
                               '-D', 'LIBPCRE=' + libpcre,
                             ])
     all_qga += [qga_msi]
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index dec33820163..bda88993bd1 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -64,6 +64,12 @@ meson_options_help() {
   printf "%s\n" '  --localstatedir=VALUE    Localstate data directory [/var/local]'
   printf "%s\n" '  --mandir=VALUE           Manual page directory [share/man]'
   printf "%s\n" '  --prefix=VALUE           Installation prefix [/usr/local]'
+  printf "%s\n" '  --qemu-ga-distro=VALUE   second path element in qemu-ga registry entries'
+  printf "%s\n" '                           [Linux]'
+  printf "%s\n" '  --qemu-ga-manufacturer=VALUE'
+  printf "%s\n" '                           "manufacturer" name for qemu-ga registry entries'
+  printf "%s\n" '                           [QEMU]'
+  printf "%s\n" '  --qemu-ga-version=VALUE  version number for qemu-ga installer'
   printf "%s\n" '  --smbd=VALUE             Path to smbd for slirp networking'
   printf "%s\n" '  --sysconfdir=VALUE       Sysconf data directory [etc]'
   printf "%s\n" '  --tls-priority=VALUE     Default TLS protocol/cipher priority string'
@@ -422,6 +428,9 @@ _meson_option_parse() {
     --enable-qed) printf "%s" -Dqed=enabled ;;
     --disable-qed) printf "%s" -Dqed=disabled ;;
     --firmwarepath=*) quote_sh "-Dqemu_firmwarepath=$(meson_option_build_array $2)" ;;
+    --qemu-ga-distro=*) quote_sh "-Dqemu_ga_distro=$2" ;;
+    --qemu-ga-manufacturer=*) quote_sh "-Dqemu_ga_manufacturer=$2" ;;
+    --qemu-ga-version=*) quote_sh "-Dqemu_ga_version=$2" ;;
     --with-suffix=*) quote_sh "-Dqemu_suffix=$2" ;;
     --enable-qga-vss) printf "%s" -Dqga_vss=enabled ;;
     --disable-qga-vss) printf "%s" -Dqga_vss=disabled ;;
-- 
2.41.0



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

* [PULL 30/32] meson-buildoptions: document the data at the top
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (28 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 29/32] configure, meson: use command line options to configure qemu-ga Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 31/32] meson: add a note on why we use config_host for program paths Paolo Bonzini
                   ` (2 subsequent siblings)
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 scripts/meson-buildoptions.py | 8 ++++++++
 1 file changed, 8 insertions(+)

diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
index 2e88732a291..4814a8ff61f 100644
--- a/scripts/meson-buildoptions.py
+++ b/scripts/meson-buildoptions.py
@@ -25,11 +25,15 @@
 import shlex
 import sys
 
+# Options with nonstandard names (e.g. --with/--without) or OS-dependent
+# defaults.  Try not to add any.
 SKIP_OPTIONS = {
     "default_devices",
     "fuzzing_engine",
 }
 
+# Options whose name doesn't match the option for backwards compatibility
+# reasons, because Meson gives them a funny name, or both
 OPTION_NAMES = {
     "b_coverage": "gcov",
     "b_lto": "lto",
@@ -49,6 +53,10 @@
     "werror",
 }
 
+# Builtin options that should be definable via configure.  Some of the others
+# we really do not want (e.g. c_args is defined via the native file, not
+# via -D, because it's a mix of CFLAGS and --extra-cflags); for specific
+# cases "../configure -D" can be used as an escape hatch.
 BUILTIN_OPTIONS = {
     "b_coverage",
     "b_lto",
-- 
2.41.0



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

* [PULL 31/32] meson: add a note on why we use config_host for program paths
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (29 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 30/32] meson-buildoptions: document the data at the top Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18  8:27 ` [PULL 32/32] configure: define "pkg-config" in addition to "pkgconfig" Paolo Bonzini
  2023-10-18 22:32 ` [PULL 00/32] x86 and build system changes for 2023-10-18 Stefan Hajnoczi
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel

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

diff --git a/meson.build b/meson.build
index 2bda62a2b1b..0182622aede 100644
--- a/meson.build
+++ b/meson.build
@@ -4021,6 +4021,11 @@ summary(summary_info, bool_yn: true, section: 'Directories')
 summary_info = {}
 summary_info += {'python':            '@0@ (version: @1@)'.format(python.full_path(), python.language_version())}
 summary_info += {'sphinx-build':      sphinx_build}
+
+# FIXME: the [binaries] section of machine files, which can be probed
+# with find_program(), would be great for passing gdb and genisoimage
+# paths from configure to Meson.  However, there seems to be no way to
+# hide a program (for example if gdb is too old).
 if config_host.has_key('GDB')
   summary_info += {'gdb':             config_host['GDB']}
 endif
-- 
2.41.0



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

* [PULL 32/32] configure: define "pkg-config" in addition to "pkgconfig"
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (30 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 31/32] meson: add a note on why we use config_host for program paths Paolo Bonzini
@ 2023-10-18  8:27 ` Paolo Bonzini
  2023-10-18 22:32 ` [PULL 00/32] x86 and build system changes for 2023-10-18 Stefan Hajnoczi
  32 siblings, 0 replies; 35+ messages in thread
From: Paolo Bonzini @ 2023-10-18  8:27 UTC (permalink / raw)
  To: qemu-devel; +Cc: Thomas Huth

Meson used to allow both "pkgconfig" and "pkg-config" entries in machine
files; the former was used for dependency lookup and the latter
was used as return value for "find_program('pkg-config')", which is a less
common use-case and one that QEMU does not need.

This inconsistency is going to be fixed by Meson 1.3, which will deprecate
"pkgconfig" in favor of "pkg-config" (the less common one, but it makes
sense because it matches the name of the binary). For backward
compatibility it is still allowed to define both, so do that in the
configure-generated machine file.

Related: https://github.com/mesonbuild/meson/pull/12385
Reviewed-by: Thomas Huth <thuth@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure | 1 +
 1 file changed, 1 insertion(+)

diff --git a/configure b/configure
index 8827a29bf4c..b4ea78c77d8 100755
--- a/configure
+++ b/configure
@@ -1736,6 +1736,7 @@ if test "$skip_meson" = no; then
   echo "ar = [$(meson_quote $ar)]" >> $cross
   echo "nm = [$(meson_quote $nm)]" >> $cross
   echo "pkgconfig = [$(meson_quote $pkg_config)]" >> $cross
+  echo "pkg-config = [$(meson_quote $pkg_config)]" >> $cross
   echo "ranlib = [$(meson_quote $ranlib)]" >> $cross
   if has $sdl2_config; then
     echo "sdl2-config = [$(meson_quote $sdl2_config)]" >> $cross
-- 
2.41.0



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

* Re: [PULL 17/32] meson, cutils: allow non-relocatable installs
  2023-10-18  8:27 ` [PULL 17/32] meson, cutils: allow non-relocatable installs Paolo Bonzini
@ 2023-10-18 11:37   ` Michael Tokarev
  0 siblings, 0 replies; 35+ messages in thread
From: Michael Tokarev @ 2023-10-18 11:37 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: Emmanouil Pitsidianakis

18.10.2023 11:27, Paolo Bonzini wrote:
> Say QEMU is configured with bindir = "/usr/bin" and a firmware path
> that starts with "/usr/share/qemu".  Ever since QEMU 5.2, QEMU's
> install has been relocatable: if you move qemu-system-x86_64 from
> /usr/bin to /home/username/bin, it will start looking for firmware in
> /home/username/share/qemu.  Previously, you would get a non-relocatable
> install where the moved QEMU will keep looking for firmware in
> /usr/share/qemu.
> 
> Windows almost always wants relocatable installs, and in fact that
> is why QEMU 5.2 introduced relocatability in the first place.
> However, newfangled distribution mechanisms such as AppImage
> (https://docs.appimage.org/reference/best-practices.html), and
> possibly NixOS, also dislike using at runtime the absolute paths
> that were established at build time.
> 
> On POSIX systems you almost never care; if you do, your usecase
> dictates which one is desirable, so there's no single answer.
> Obviously relocatability works fine most of the time, because not many
> people have complained about QEMU's switch to relocatable install,
> and that's why until now there was no way to disable relocatability.
> 
> But a non-relocatable, non-modular binary can help if you want to do
> experiments with old firmware and new QEMU or vice versa (because you
> can just upgrade/downgrade the firmware package, and use rpm2cpio or
> similar to extract the QEMU binaries outside /usr), so allow both.
> This patch allows one to build a non-relocatable install using a new
> option to configure.  Why?  Because it's not too hard, and because
> it helps the user double check the relocatability of their install.
> 
> Note that the same code that handles relocation also lets you run QEMU
> from the build tree and pick e.g. firmware files from the source tree
> transparently.  Therefore that part remains active with this patch,
> even if you configure with --disable-relocatable.

Thank you very much for this Paolo.  It was on my todo list for quite
some time :)

/mjt


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

* Re: [PULL 00/32] x86 and build system changes for 2023-10-18
  2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
                   ` (31 preceding siblings ...)
  2023-10-18  8:27 ` [PULL 32/32] configure: define "pkg-config" in addition to "pkgconfig" Paolo Bonzini
@ 2023-10-18 22:32 ` Stefan Hajnoczi
  32 siblings, 0 replies; 35+ messages in thread
From: Stefan Hajnoczi @ 2023-10-18 22:32 UTC (permalink / raw)
  To: Paolo Bonzini; +Cc: qemu-devel

[-- Attachment #1: Type: text/plain, Size: 115 bytes --]

Applied, thanks.

Please update the changelog at https://wiki.qemu.org/ChangeLog/8.2 for any user-visible changes.

[-- Attachment #2: signature.asc --]
[-- Type: application/pgp-signature, Size: 488 bytes --]

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

end of thread, other threads:[~2023-10-18 22:33 UTC | newest]

Thread overview: 35+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
2023-10-18  8:27 [PULL 00/32] x86 and build system changes for 2023-10-18 Paolo Bonzini
2023-10-18  8:27 ` [PULL 01/32] iotests: get rid of '..' in path environment output Paolo Bonzini
2023-10-18  8:27 ` [PULL 02/32] iotests: use the correct python to run linters Paolo Bonzini
2023-10-18  8:27 ` [PULL 03/32] Revert "configure: Add workaround for ccache and clang" Paolo Bonzini
2023-10-18  8:27 ` [PULL 04/32] target/i386/cpu: Fix CPUID_HT exposure Paolo Bonzini
2023-10-18  8:27 ` [PULL 05/32] target/i386: check intercept for XSETBV Paolo Bonzini
2023-10-18  8:27 ` [PULL 06/32] tests/vm: netbsd: install dtc Paolo Bonzini
2023-10-18  8:27 ` [PULL 07/32] scripts: Mark feature_to_c.py as non-executable to fix a build issue Paolo Bonzini
2023-10-18  8:27 ` [PULL 08/32] scripts/get_maintainer.pl: don't print parentheses Paolo Bonzini
2023-10-18  8:27 ` [PULL 09/32] tests/docker: avoid invalid escape in Python string Paolo Bonzini
2023-10-18  8:27 ` [PULL 10/32] docs/sphinx: " Paolo Bonzini
2023-10-18  8:27 ` [PULL 11/32] target/hexagon: " Paolo Bonzini
2023-10-18  8:27 ` [PULL 12/32] tests/avocado: " Paolo Bonzini
2023-10-18  8:27 ` [PULL 13/32] tests/vm: " Paolo Bonzini
2023-10-18  8:27 ` [PULL 14/32] tracetool: " Paolo Bonzini
2023-10-18  8:27 ` [PULL 15/32] meson: do not build shaders by default Paolo Bonzini
2023-10-18  8:27 ` [PULL 16/32] meson: do not use set10 Paolo Bonzini
2023-10-18  8:27 ` [PULL 17/32] meson, cutils: allow non-relocatable installs Paolo Bonzini
2023-10-18 11:37   ` Michael Tokarev
2023-10-18  8:27 ` [PULL 18/32] configure: clean up handling of CFI option Paolo Bonzini
2023-10-18  8:27 ` [PULL 19/32] hw/xen: cleanup sourcesets Paolo Bonzini
2023-10-18  8:27 ` [PULL 20/32] hw/remote: move stub vfu_object_set_bus_irq out of stubs/ Paolo Bonzini
2023-10-18  8:27 ` [PULL 21/32] tests/tcg/arm: move non-SVE tests out of conditional Paolo Bonzini
2023-10-18  8:27 ` [PULL 22/32] configure, tests/tcg: simplify GDB conditionals Paolo Bonzini
2023-10-18  8:27 ` [PULL 23/32] configure: clean up plugin option handling Paolo Bonzini
2023-10-18  8:27 ` [PULL 24/32] configure: clean up PIE " Paolo Bonzini
2023-10-18  8:27 ` [PULL 25/32] configure: remove some dead cruft Paolo Bonzini
2023-10-18  8:27 ` [PULL 26/32] configure: move target-specific defaults to an external machine file Paolo Bonzini
2023-10-18  8:27 ` [PULL 27/32] configure: move environment-specific defaults to config-meson.cross Paolo Bonzini
2023-10-18  8:27 ` [PULL 28/32] configure: unify handling of several Debian cross containers Paolo Bonzini
2023-10-18  8:27 ` [PULL 29/32] configure, meson: use command line options to configure qemu-ga Paolo Bonzini
2023-10-18  8:27 ` [PULL 30/32] meson-buildoptions: document the data at the top Paolo Bonzini
2023-10-18  8:27 ` [PULL 31/32] meson: add a note on why we use config_host for program paths Paolo Bonzini
2023-10-18  8:27 ` [PULL 32/32] configure: define "pkg-config" in addition to "pkgconfig" Paolo Bonzini
2023-10-18 22:32 ` [PULL 00/32] x86 and build system changes for 2023-10-18 Stefan Hajnoczi

This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for NNTP newsgroup(s).