All of lore.kernel.org
 help / color / mirror / Atom feed
* [PATCH 0/8] Next round of configure/meson cleanups
@ 2021-12-21 11:05 Paolo Bonzini
  2021-12-21 11:05 ` [PATCH 1/8] configure: simplify creation of plugin symbol list Paolo Bonzini
                   ` (7 more replies)
  0 siblings, 8 replies; 16+ messages in thread
From: Paolo Bonzini @ 2021-12-21 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: richard.henderson

Includes v2 of patches from the previous round, and new patches 3-8.

Paolo

Paolo Bonzini (8):
  configure: simplify creation of plugin symbol list
  configure: do not set bsd_user/linux_user early
  configure, makefile: remove traces of really old files
  configure: parse --enable/--disable-strip automatically, flip default
  configure: move non-command-line variables away from command-line
    parsing section
  meson: build contrib/ executables after generated headers
  configure, meson: move config-poison.h to meson
  meson: add comments in the target-specific flags section

 Makefile                           |  11 +--
 configure                          | 151 +++++------------------------
 contrib/elf2dmp/meson.build        |   2 +-
 contrib/ivshmem-client/meson.build |   2 +-
 contrib/ivshmem-server/meson.build |   2 +-
 contrib/rdmacm-mux/meson.build     |   2 +-
 meson.build                        |  17 ++++
 pc-bios/s390-ccw/Makefile          |   2 -
 plugins/meson.build                |  11 ++-
 scripts/make-config-poison.sh      |  16 +++
 scripts/meson-buildoptions.py      |  21 ++--
 scripts/meson-buildoptions.sh      |   3 +
 12 files changed, 90 insertions(+), 150 deletions(-)
 create mode 100755 scripts/make-config-poison.sh

-- 
2.33.1



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

* [PATCH 1/8] configure: simplify creation of plugin symbol list
  2021-12-21 11:05 [PATCH 0/8] Next round of configure/meson cleanups Paolo Bonzini
@ 2021-12-21 11:05 ` Paolo Bonzini
  2021-12-21 20:50   ` Richard Henderson
  2021-12-21 11:05 ` [PATCH 2/8] configure: do not set bsd_user/linux_user early Paolo Bonzini
                   ` (6 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Paolo Bonzini @ 2021-12-21 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: richard.henderson

--dynamic-list is present on all supported ELF (not Windows or Darwin)
platforms, since it dates back to 2006; -exported_symbols_list is
likewise present on all supported versions of macOS.  Do not bother
doing a functional test in configure.

Remove the file creation from configure as well: for Darwin, move the
the creation of the Darwin-formatted symbols to meson; for ELF, use the
file in the source path directly and switch from -Wl, to -Xlinker to
not break weird paths that include a comma.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure           | 80 ---------------------------------------------
 plugins/meson.build | 11 +++++--
 2 files changed, 8 insertions(+), 83 deletions(-)

diff --git a/configure b/configure
index 8ccfe51673..1bce9635d9 100755
--- a/configure
+++ b/configure
@@ -78,7 +78,6 @@ TMPC="${TMPDIR1}/${TMPB}.c"
 TMPO="${TMPDIR1}/${TMPB}.o"
 TMPCXX="${TMPDIR1}/${TMPB}.cxx"
 TMPE="${TMPDIR1}/${TMPB}.exe"
-TMPTXT="${TMPDIR1}/${TMPB}.txt"
 
 rm -f config.log
 
@@ -2343,69 +2342,6 @@ EOF
   fi
 fi
 
-##########################################
-# plugin linker support probe
-
-if test "$plugins" != "no"; then
-
-    #########################################
-    # See if --dynamic-list is supported by the linker
-
-    ld_dynamic_list="no"
-    cat > $TMPTXT <<EOF
-{
-  foo;
-};
-EOF
-
-        cat > $TMPC <<EOF
-#include <stdio.h>
-void foo(void);
-
-void foo(void)
-{
-  printf("foo\n");
-}
-
-int main(void)
-{
-  foo();
-  return 0;
-}
-EOF
-
-    if compile_prog "" "-Wl,--dynamic-list=$TMPTXT" ; then
-        ld_dynamic_list="yes"
-    fi
-
-    #########################################
-    # See if -exported_symbols_list is supported by the linker
-
-    ld_exported_symbols_list="no"
-    cat > $TMPTXT <<EOF
-  _foo
-EOF
-
-    if compile_prog "" "-Wl,-exported_symbols_list,$TMPTXT" ; then
-        ld_exported_symbols_list="yes"
-    fi
-
-    if test "$ld_dynamic_list" = "no" &&
-       test "$ld_exported_symbols_list" = "no" ; then
-        if test "$plugins" = "yes"; then
-            error_exit \
-                "Plugin support requires dynamic linking and specifying a set of symbols " \
-                "that are exported to plugins. Unfortunately your linker doesn't " \
-                "support the flag (--dynamic-list or -exported_symbols_list) used " \
-                "for this purpose."
-        else
-            plugins="no"
-        fi
-    else
-        plugins="yes"
-    fi
-fi
-
 ##########################################
 # glib support probe
 
@@ -3643,22 +3579,6 @@ fi
 
 if test "$plugins" = "yes" ; then
     echo "CONFIG_PLUGIN=y" >> $config_host_mak
-    # Copy the export object list to the build dir
-    if test "$ld_dynamic_list" = "yes" ; then
-	echo "CONFIG_HAS_LD_DYNAMIC_LIST=yes" >> $config_host_mak
-	ld_symbols=qemu-plugins-ld.symbols
-	cp "$source_path/plugins/qemu-plugins.symbols" $ld_symbols
-    elif test "$ld_exported_symbols_list" = "yes" ; then
-	echo "CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST=yes" >> $config_host_mak
-	ld64_symbols=qemu-plugins-ld64.symbols
-	echo "# Automatically generated by configure - do not modify" > $ld64_symbols
-	grep 'qemu_' "$source_path/plugins/qemu-plugins.symbols" | sed 's/;//g' | \
-	    sed -E 's/^[[:space:]]*(.*)/_\1/' >> $ld64_symbols
-    else
-	error_exit \
-	    "If \$plugins=yes, either \$ld_dynamic_list or " \
-	    "\$ld_exported_symbols_list should have been set to 'yes'."
-    fi
 fi
 
 if test -n "$gdb_bin"; then
diff --git a/plugins/meson.build b/plugins/meson.build
index b3de57853b..d0a2ee94cf 100644
--- a/plugins/meson.build
+++ b/plugins/meson.build
@@ -1,10 +1,15 @@
 plugin_ldflags = []
 # Modules need more symbols than just those in plugins/qemu-plugins.symbols
 if not enable_modules
-  if 'CONFIG_HAS_LD_DYNAMIC_LIST' in config_host
-    plugin_ldflags = ['-Wl,--dynamic-list=qemu-plugins-ld.symbols']
-  elif 'CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST' in config_host
+  if targetos == 'darwin'
+    qemu_plugins_symbols_list = configure_file(
+      input: files('qemu-plugins.symbols'),
+      output: 'qemu-plugins-ld64.symbols',
+      capture: true,
+      command: ['sed', '-ne', 's/^[[:space:]]*\\(qemu_.*\\);/_\\1/p', '@INPUT@'])
     plugin_ldflags = ['-Wl,-exported_symbols_list,qemu-plugins-ld64.symbols']
+  else
+    plugin_ldflags = ['-Xlinker', '--dynamic-list=' + (meson.project_source_root() / 'plugins/qemu-plugins.symbols')]
   endif
 endif
 
-- 
2.33.1




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

* [PATCH 2/8] configure: do not set bsd_user/linux_user early
  2021-12-21 11:05 [PATCH 0/8] Next round of configure/meson cleanups Paolo Bonzini
  2021-12-21 11:05 ` [PATCH 1/8] configure: simplify creation of plugin symbol list Paolo Bonzini
@ 2021-12-21 11:05 ` Paolo Bonzini
  2021-12-21 20:55   ` Richard Henderson
  2021-12-21 11:05 ` [PATCH 3/8] configure, makefile: remove traces of really old files Paolo Bonzini
                   ` (5 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Paolo Bonzini @ 2021-12-21 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: richard.henderson

Similar to other optional features, leave the variables empty and compute
the actual value later.  Use the existence of include or source directories
to detect whether an OS or CPU supports respectively bsd-user and linux-user.

For now, BSD user-mode emulation is buildable even on TCI-only
architectures.  This probably will change once safe signals are
brought over from linux-user.

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

diff --git a/configure b/configure
index 1bce9635d9..6dafbcd362 100755
--- a/configure
+++ b/configure
@@ -321,8 +321,8 @@ linux="no"
 solaris="no"
 profiler="no"
 softmmu="yes"
-linux_user="no"
-bsd_user="no"
+linux_user=""
+bsd_user=""
 pkgversion=""
 pie=""
 qom_cast_debug="yes"
@@ -539,7 +539,6 @@ gnu/kfreebsd)
 ;;
 freebsd)
   bsd="yes"
-  bsd_user="yes"
   make="${MAKE-gmake}"
   # needed for kinfo_getvmmap(3) in libutil.h
 ;;
@@ -584,7 +583,6 @@ haiku)
 ;;
 linux)
   linux="yes"
-  linux_user="yes"
   vhost_user=${default_feature:-yes}
 ;;
 esac
@@ -1262,18 +1260,26 @@ if eval test -z "\${cross_cc_$cpu}"; then
     cross_cc_vars="$cross_cc_vars cross_cc_${cpu}"
 fi
 
-# For user-mode emulation the host arch has to be one we explicitly
-# support, even if we're using TCI.
-if [ "$ARCH" = "unknown" ]; then
-  bsd_user="no"
-  linux_user="no"
-fi
-
 default_target_list=""
 deprecated_targets_list=ppc64abi32-linux-user
 deprecated_features=""
 mak_wilds=""
 
+if [ "$linux_user" != no ]; then
+    if [ "$targetos" = linux ] && [ -d $source_path/linux-user/host/$cpu ]; then
+        linux_user=yes
+    elif [ "$linux_user" = yes ]; then
+        error_exit "linux-user not supported on this architecture"
+    fi
+fi
+if [ "$bsd_user" != no ]; then
+    if [ "$bsd_user" = "" ]; then
+        test $targetos = freebsd && bsd_user=yes
+    fi
+    if [ "$bsd_user" = yes ] && ! [ -d $source_path/bsd-user/$targetos ]; then
+        error_exit "bsd-user not supported on this host OS"
+    fi
+fi
 if [ "$softmmu" = "yes" ]; then
     mak_wilds="${mak_wilds} $source_path/configs/targets/*-softmmu.mak"
 fi
-- 
2.33.1




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

* [PATCH 3/8] configure, makefile: remove traces of really old files
  2021-12-21 11:05 [PATCH 0/8] Next round of configure/meson cleanups Paolo Bonzini
  2021-12-21 11:05 ` [PATCH 1/8] configure: simplify creation of plugin symbol list Paolo Bonzini
  2021-12-21 11:05 ` [PATCH 2/8] configure: do not set bsd_user/linux_user early Paolo Bonzini
@ 2021-12-21 11:05 ` Paolo Bonzini
  2021-12-21 20:59   ` Richard Henderson
  2021-12-21 11:05 ` [PATCH 4/8] configure: parse --enable/--disable-strip automatically, flip default Paolo Bonzini
                   ` (4 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Paolo Bonzini @ 2021-12-21 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: richard.henderson

These files have been removed for more than year in the best
case, or for more than ten years for some really old TCG files.
Remove any traces of it.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Makefile  | 11 ++++-------
 configure |  9 ---------
 2 files changed, 4 insertions(+), 16 deletions(-)

diff --git a/Makefile b/Makefile
index 74c5b46d38..06ad8a61e1 100644
--- a/Makefile
+++ b/Makefile
@@ -205,14 +205,11 @@ recurse-clean: $(addsuffix /clean, $(ROM_DIRS))
 clean: recurse-clean
 	-$(quiet-@)test -f build.ninja && $(NINJA) $(NINJAFLAGS) -t clean || :
 	-$(quiet-@)test -f build.ninja && $(NINJA) $(NINJAFLAGS) clean-ctlist || :
-# avoid old build problems by removing potentially incorrect old files
-	rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
 	find . \( -name '*.so' -o -name '*.dll' -o -name '*.[oda]' \) -type f \
 		! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-aarch64.a \
 		! -path ./roms/edk2/ArmPkg/Library/GccLto/liblto-arm.a \
 		-exec rm {} +
-	rm -f TAGS cscope.* *.pod *~ */*~
-	rm -f fsdev/*.pod scsi/*.pod
+	rm -f TAGS cscope.* *~ */*~
 
 VERSION = $(shell cat $(SRC_PATH)/VERSION)
 
@@ -223,10 +220,10 @@ qemu-%.tar.bz2:
 
 distclean: clean
 	-$(quiet-@)test -f build.ninja && $(NINJA) $(NINJAFLAGS) -t clean -g || :
-	rm -f config-host.mak config-host.h* config-poison.h
+	rm -f config-host.mak config-poison.h
 	rm -f tests/tcg/config-*.mak
-	rm -f config-all-disas.mak config.status
-	rm -f roms/seabios/config.mak roms/vgabios/config.mak
+	rm -f config.status
+	rm -f roms/seabios/config.mak
 	rm -f qemu-plugins-ld.symbols qemu-plugins-ld64.symbols
 	rm -f *-config-target.h *-config-devices.mak *-config-devices.h
 	rm -rf meson-private meson-logs meson-info compile_commands.json
diff --git a/configure b/configure
index 6dafbcd362..e09e5bb58f 100755
--- a/configure
+++ b/configure
@@ -3696,9 +3696,6 @@ fi
 # so the build tree will be missing the link back to the new file, and
 # tests might fail. Prefer to keep the relevant files in their own
 # directory and symlink the directory instead.
-# UNLINK is used to remove symlinks from older development versions
-# that might get into the way when doing "git update" without doing
-# a "make distclean" in between.
 LINKS="Makefile"
 LINKS="$LINKS tests/tcg/Makefile.target"
 LINKS="$LINKS pc-bios/optionrom/Makefile"
@@ -3710,7 +3707,6 @@ LINKS="$LINKS tests/avocado tests/data"
 LINKS="$LINKS tests/qemu-iotests/check"
 LINKS="$LINKS python"
 LINKS="$LINKS contrib/plugins/Makefile "
-UNLINK="pc-bios/keymaps"
 for bios_file in \
     $source_path/pc-bios/*.bin \
     $source_path/pc-bios/*.elf \
@@ -3732,11 +3728,6 @@ for f in $LINKS ; do
         symlink "$source_path/$f" "$f"
     fi
 done
-for f in $UNLINK ; do
-    if [ -L "$f" ]; then
-        rm -f "$f"
-    fi
-done
 
 (for i in $cross_cc_vars; do
   export $i
-- 
2.33.1




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

* [PATCH 4/8] configure: parse --enable/--disable-strip automatically, flip default
  2021-12-21 11:05 [PATCH 0/8] Next round of configure/meson cleanups Paolo Bonzini
                   ` (2 preceding siblings ...)
  2021-12-21 11:05 ` [PATCH 3/8] configure, makefile: remove traces of really old files Paolo Bonzini
@ 2021-12-21 11:05 ` Paolo Bonzini
  2021-12-21 11:05 ` [PATCH 5/8] configure: move non-command-line variables away from command-line parsing section Paolo Bonzini
                   ` (3 subsequent siblings)
  7 siblings, 0 replies; 16+ messages in thread
From: Paolo Bonzini @ 2021-12-21 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: richard.henderson

Always include the STRIP variable in config-host.mak (it's only used
by the s390-ccw firmware build, and it adds a default if configure
omitted it), and use meson-buildoptions.sh to turn
--enable/--disable-strip into -Dstrip.

The default is now not to strip the binaries like for almost every other
package that has a configure script.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 configure                     | 10 +---------
 pc-bios/s390-ccw/Makefile     |  2 --
 scripts/meson-buildoptions.py | 21 ++++++++++++++-------
 scripts/meson-buildoptions.sh |  3 +++
 4 files changed, 18 insertions(+), 18 deletions(-)

diff --git a/configure b/configure
index e09e5bb58f..40dd6e8d1b 100755
--- a/configure
+++ b/configure
@@ -308,7 +308,6 @@ debug="no"
 sanitizers="no"
 tsan="no"
 fortify_source="$default_feature"
-strip_opt="yes"
 mingw32="no"
 gcov="no"
 EXESUF=""
@@ -891,7 +890,6 @@ for opt do
       debug_tcg="yes"
       debug_mutex="yes"
       debug="yes"
-      strip_opt="no"
       fortify_source="no"
   ;;
   --enable-sanitizers) sanitizers="yes"
@@ -902,8 +900,6 @@ for opt do
   ;;
   --disable-tsan) tsan="no"
   ;;
-  --disable-strip) strip_opt="no"
-  ;;
   --disable-slirp) slirp="disabled"
   ;;
   --enable-slirp) slirp="enabled"
@@ -1370,7 +1366,6 @@ Advanced options (experts only):
   --enable-debug           enable common debug build options
   --enable-sanitizers      enable default sanitizers
   --enable-tsan            enable thread sanitizer
-  --disable-strip          disable stripping binaries
   --disable-werror         disable compilation abort on warning
   --disable-stack-protector disable compiler-provided stack protection
   --audio-drv-list=LIST    set audio drivers to try if -audiodev is not used
@@ -3340,9 +3335,6 @@ echo "GIT_SUBMODULES_ACTION=$git_submodules_action" >> $config_host_mak
 if test "$debug_tcg" = "yes" ; then
   echo "CONFIG_DEBUG_TCG=y" >> $config_host_mak
 fi
-if test "$strip_opt" = "yes" ; then
-  echo "STRIP=${strip}" >> $config_host_mak
-fi
 if test "$mingw32" = "yes" ; then
   echo "CONFIG_WIN32=y" >> $config_host_mak
   if test "$guest_agent_with_vss" = "yes" ; then
@@ -3622,6 +3614,7 @@ echo "GLIB_CFLAGS=$glib_cflags" >> $config_host_mak
 echo "GLIB_LIBS=$glib_libs" >> $config_host_mak
 echo "QEMU_LDFLAGS=$QEMU_LDFLAGS" >> $config_host_mak
 echo "LD_I386_EMULATION=$ld_i386_emulation" >> $config_host_mak
+echo "STRIP=$strip" >> $config_host_mak
 echo "EXESUF=$EXESUF" >> $config_host_mak
 echo "LIBS_QGA=$libs_qga" >> $config_host_mak
 
@@ -3836,7 +3829,6 @@ if test "$skip_meson" = no; then
         -Doptimization=$(if test "$debug" = yes; then echo 0; else echo 2; fi) \
         -Ddebug=$(if test "$debug_info" = yes; then echo true; else echo false; fi) \
         -Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \
-        -Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \
         -Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
         -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
         -Db_lto=$lto -Dcfi=$cfi -Dtcg=$tcg -Dxen=$xen \
diff --git a/pc-bios/s390-ccw/Makefile b/pc-bios/s390-ccw/Makefile
index cee9d2c63b..0eb68efc7b 100644
--- a/pc-bios/s390-ccw/Makefile
+++ b/pc-bios/s390-ccw/Makefile
@@ -44,8 +44,6 @@ build-all: s390-ccw.img s390-netboot.img
 s390-ccw.elf: $(OBJECTS)
 	$(call quiet-command,$(CC) $(LDFLAGS) -o $@ $(OBJECTS),"BUILD","$(TARGET_DIR)$@")
 
-STRIP ?= strip
-
 s390-ccw.img: s390-ccw.elf
 	$(call quiet-command,$(STRIP) --strip-unneeded $< -o $@,"STRIP","$(TARGET_DIR)$@")
 
diff --git a/scripts/meson-buildoptions.py b/scripts/meson-buildoptions.py
index 96969d89ee..98ae944148 100755
--- a/scripts/meson-buildoptions.py
+++ b/scripts/meson-buildoptions.py
@@ -36,6 +36,10 @@
     "trace_file",
 }
 
+BUILTIN_OPTIONS = {
+    "strip",
+}
+
 LINE_WIDTH = 76
 
 
@@ -90,14 +94,17 @@ def allow_arg(opt):
     return not (set(opt["choices"]) <= {"auto", "disabled", "enabled"})
 
 
+def filter_options(json):
+    if ":" in json["name"]:
+        return False
+    if json["section"] == "user":
+        return json["name"] not in SKIP_OPTIONS
+    else:
+        return json["name"] in BUILTIN_OPTIONS
+
+
 def load_options(json):
-    json = [
-        x
-        for x in json
-        if x["section"] == "user"
-        and ":" not in x["name"]
-        and x["name"] not in SKIP_OPTIONS
-    ]
+    json = [x for x in json if filter_options(x)]
     return sorted(json, key=lambda x: x["name"])
 
 
diff --git a/scripts/meson-buildoptions.sh b/scripts/meson-buildoptions.sh
index ae8f18edc2..46360e541d 100644
--- a/scripts/meson-buildoptions.sh
+++ b/scripts/meson-buildoptions.sh
@@ -13,6 +13,7 @@ meson_options_help() {
   printf "%s\n" '                           jemalloc/system/tcmalloc)'
   printf "%s\n" '  --enable-slirp[=CHOICE]  Whether and how to find the slirp library'
   printf "%s\n" '                           (choices: auto/disabled/enabled/internal/system)'
+  printf "%s\n" '  --enable-strip           Strip targets on install'
   printf "%s\n" '  --enable-tcg-interpreter TCG with bytecode interpreter (slow)'
   printf "%s\n" '  --enable-trace-backends=CHOICE'
   printf "%s\n" '                           Set available tracing backends [log] (choices:'
@@ -234,6 +235,8 @@ _meson_option_parse() {
     --disable-spice) printf "%s" -Dspice=disabled ;;
     --enable-spice-protocol) printf "%s" -Dspice_protocol=enabled ;;
     --disable-spice-protocol) printf "%s" -Dspice_protocol=disabled ;;
+    --enable-strip) printf "%s" -Dstrip=true ;;
+    --disable-strip) printf "%s" -Dstrip=false ;;
     --enable-tcg) printf "%s" -Dtcg=enabled ;;
     --disable-tcg) printf "%s" -Dtcg=disabled ;;
     --enable-tcg-interpreter) printf "%s" -Dtcg_interpreter=true ;;
-- 
2.33.1




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

* [PATCH 5/8] configure: move non-command-line variables away from command-line parsing section
  2021-12-21 11:05 [PATCH 0/8] Next round of configure/meson cleanups Paolo Bonzini
                   ` (3 preceding siblings ...)
  2021-12-21 11:05 ` [PATCH 4/8] configure: parse --enable/--disable-strip automatically, flip default Paolo Bonzini
@ 2021-12-21 11:05 ` Paolo Bonzini
  2021-12-21 11:30   ` Philippe Mathieu-Daudé
  2021-12-21 11:05 ` [PATCH 6/8] meson: build contrib/ executables after generated headers Paolo Bonzini
                   ` (2 subsequent siblings)
  7 siblings, 1 reply; 16+ messages in thread
From: Paolo Bonzini @ 2021-12-21 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: richard.henderson

This makes it easier to identify candidates for moving to Meson.

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

diff --git a/configure b/configure
index 40dd6e8d1b..810bc36490 100755
--- a/configure
+++ b/configure
@@ -308,16 +308,12 @@ debug="no"
 sanitizers="no"
 tsan="no"
 fortify_source="$default_feature"
-mingw32="no"
 gcov="no"
 EXESUF=""
 modules="no"
 module_upgrades="no"
 prefix="/usr/local"
 qemu_suffix="qemu"
-bsd="no"
-linux="no"
-solaris="no"
 profiler="no"
 softmmu="yes"
 linux_user=""
@@ -331,8 +327,6 @@ opengl="$default_feature"
 cpuid_h="no"
 avx2_opt="$default_feature"
 guest_agent="$default_feature"
-guest_agent_with_vss="no"
-guest_agent_ntddscsi="no"
 vss_win32_sdk="$default_feature"
 win_sdk="no"
 want_tools="$default_feature"
@@ -527,6 +521,10 @@ fi
 
 # OS specific
 
+mingw32="no"
+bsd="no"
+linux="no"
+solaris="no"
 case $targetos in
 windows)
   mingw32="yes"
@@ -2574,6 +2572,7 @@ fi
 ##########################################
 # check if we have VSS SDK headers for win
 
+guest_agent_with_vss="no"
 if test "$mingw32" = "yes" && test "$guest_agent" != "no" && \
         test "$vss_win32_sdk" != "no" ; then
   case "$vss_win32_sdk" in
@@ -2604,7 +2603,6 @@ EOF
       echo "ERROR: The headers are extracted in the directory \`inc'."
       feature_not_found "VSS support"
     fi
-    guest_agent_with_vss="no"
   fi
 fi
 
@@ -2631,6 +2629,7 @@ fi
 
 ##########################################
 # check if mingw environment provides a recent ntddscsi.h
+guest_agent_ntddscsi="no"
 if test "$mingw32" = "yes" && test "$guest_agent" != "no"; then
   cat > $TMPC << EOF
 #include <windows.h>
-- 
2.33.1




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

* [PATCH 6/8] meson: build contrib/ executables after generated headers
  2021-12-21 11:05 [PATCH 0/8] Next round of configure/meson cleanups Paolo Bonzini
                   ` (4 preceding siblings ...)
  2021-12-21 11:05 ` [PATCH 5/8] configure: move non-command-line variables away from command-line parsing section Paolo Bonzini
@ 2021-12-21 11:05 ` Paolo Bonzini
  2021-12-21 11:32   ` Philippe Mathieu-Daudé
  2021-12-21 11:05 ` [PATCH 7/8] configure, meson: move config-poison.h to meson Paolo Bonzini
  2021-12-21 11:05 ` [PATCH 8/8] meson: add comments in the target-specific flags section Paolo Bonzini
  7 siblings, 1 reply; 16+ messages in thread
From: Paolo Bonzini @ 2021-12-21 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: richard.henderson

This will be needed as soon as config-poison.h moves from configure to
a meson custom_target (which is built at "ninja" time).

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 contrib/elf2dmp/meson.build        | 2 +-
 contrib/ivshmem-client/meson.build | 2 +-
 contrib/ivshmem-server/meson.build | 2 +-
 contrib/rdmacm-mux/meson.build     | 2 +-
 4 files changed, 4 insertions(+), 4 deletions(-)

diff --git a/contrib/elf2dmp/meson.build b/contrib/elf2dmp/meson.build
index 4d86cb390a..6707d43c4f 100644
--- a/contrib/elf2dmp/meson.build
+++ b/contrib/elf2dmp/meson.build
@@ -1,5 +1,5 @@
 if curl.found()
-  executable('elf2dmp', files('main.c', 'addrspace.c', 'download.c', 'pdb.c', 'qemu_elf.c'),
+  executable('elf2dmp', files('main.c', 'addrspace.c', 'download.c', 'pdb.c', 'qemu_elf.c'), genh,
              dependencies: [glib, curl],
              install: true)
 endif
diff --git a/contrib/ivshmem-client/meson.build b/contrib/ivshmem-client/meson.build
index 1b171efb4f..ce8dcca84d 100644
--- a/contrib/ivshmem-client/meson.build
+++ b/contrib/ivshmem-client/meson.build
@@ -1,4 +1,4 @@
-executable('ivshmem-client', files('ivshmem-client.c', 'main.c'),
+executable('ivshmem-client', files('ivshmem-client.c', 'main.c'), genh,
            dependencies: glib,
            build_by_default: targetos == 'linux',
            install: false)
diff --git a/contrib/ivshmem-server/meson.build b/contrib/ivshmem-server/meson.build
index 3a53942201..c6c3c82e89 100644
--- a/contrib/ivshmem-server/meson.build
+++ b/contrib/ivshmem-server/meson.build
@@ -1,4 +1,4 @@
-executable('ivshmem-server', files('ivshmem-server.c', 'main.c'),
+executable('ivshmem-server', files('ivshmem-server.c', 'main.c'), genh,
            dependencies: [qemuutil, rt],
            build_by_default: targetos == 'linux',
            install: false)
diff --git a/contrib/rdmacm-mux/meson.build b/contrib/rdmacm-mux/meson.build
index 6cc5016747..7674f54cc5 100644
--- a/contrib/rdmacm-mux/meson.build
+++ b/contrib/rdmacm-mux/meson.build
@@ -2,7 +2,7 @@ if 'CONFIG_PVRDMA' in config_host
   # if not found, CONFIG_PVRDMA should not be set
   # FIXME: broken on big endian architectures
   libumad = cc.find_library('ibumad', required: true)
-  executable('rdmacm-mux', files('main.c'),
+  executable('rdmacm-mux', files('main.c'), genh,
              dependencies: [glib, libumad],
              build_by_default: false,
              install: false)
-- 
2.33.1




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

* [PATCH 7/8] configure, meson: move config-poison.h to meson
  2021-12-21 11:05 [PATCH 0/8] Next round of configure/meson cleanups Paolo Bonzini
                   ` (5 preceding siblings ...)
  2021-12-21 11:05 ` [PATCH 6/8] meson: build contrib/ executables after generated headers Paolo Bonzini
@ 2021-12-21 11:05 ` Paolo Bonzini
  2021-12-21 21:54   ` Richard Henderson
  2021-12-21 11:05 ` [PATCH 8/8] meson: add comments in the target-specific flags section Paolo Bonzini
  7 siblings, 1 reply; 16+ messages in thread
From: Paolo Bonzini @ 2021-12-21 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: richard.henderson

This ensures that the file is regenerated properly whenever config-target.h
or config-devices.h files change.

Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
---
 Makefile                      |  2 +-
 configure                     | 11 -----------
 meson.build                   | 12 ++++++++++++
 scripts/make-config-poison.sh | 16 ++++++++++++++++
 4 files changed, 29 insertions(+), 12 deletions(-)
 create mode 100755 scripts/make-config-poison.sh

diff --git a/Makefile b/Makefile
index 06ad8a61e1..2f80f56a4a 100644
--- a/Makefile
+++ b/Makefile
@@ -220,7 +220,7 @@ qemu-%.tar.bz2:
 
 distclean: clean
 	-$(quiet-@)test -f build.ninja && $(NINJA) $(NINJAFLAGS) -t clean -g || :
-	rm -f config-host.mak config-poison.h
+	rm -f config-host.mak
 	rm -f tests/tcg/config-*.mak
 	rm -f config.status
 	rm -f roms/seabios/config.mak
diff --git a/configure b/configure
index 810bc36490..aff371ca81 100755
--- a/configure
+++ b/configure
@@ -3858,17 +3858,6 @@ if test -n "${deprecated_features}"; then
     echo "  features: ${deprecated_features}"
 fi
 
-# Create list of config switches that should be poisoned in common code...
-# but filter out CONFIG_TCG and CONFIG_USER_ONLY which are special.
-target_configs_h=$(ls *-config-devices.h *-config-target.h 2>/dev/null)
-if test -n "$target_configs_h" ; then
-    sed -n -e '/CONFIG_TCG/d' -e '/CONFIG_USER_ONLY/d' \
-        -e '/^#define / { s///; s/ .*//; s/^/#pragma GCC poison /p; }' \
-        $target_configs_h | sort -u > config-poison.h
-else
-    :> config-poison.h
-fi
-
 # Save the configure command line for later reuse.
 cat <<EOD >config.status
 #!/bin/sh
diff --git a/meson.build b/meson.build
index 2495360fd0..09ee427ca4 100644
--- a/meson.build
+++ b/meson.build
@@ -2006,6 +2006,18 @@ config_all += {
   'CONFIG_ALL': true,
 }
 
+target_configs_h = []
+foreach target: target_dirs
+  target_configs_h += config_target_h[target]
+  target_configs_h += config_devices_h.get(target, [])
+endforeach
+genh += custom_target('config-poison.h',
+                      input: [target_configs_h],
+                      output: 'config-poison.h',
+                      capture: true,
+                      command: [find_program('scripts/make-config-poison.sh')] +
+                               (target_configs_h.length() > 0 ? ['@INPUT@'] : []))
+
 ##############
 # Submodules #
 ##############
diff --git a/scripts/make-config-poison.sh b/scripts/make-config-poison.sh
new file mode 100755
index 0000000000..d222a04304
--- /dev/null
+++ b/scripts/make-config-poison.sh
@@ -0,0 +1,16 @@
+#! /bin/sh
+
+if test $# = 0; then
+  exit 0
+fi
+
+# Create list of config switches that should be poisoned in common code...
+# but filter out CONFIG_TCG and CONFIG_USER_ONLY which are special.
+exec sed -n \
+  -e' /CONFIG_TCG/d' \
+  -e '/CONFIG_USER_ONLY/d' \
+  -e '/^#define / {' \
+  -e    's///' \
+  -e    's/ .*//' \
+  -e    's/^/#pragma GCC poison /p' \
+  -e '}' "$@"
-- 
2.33.1




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

* [PATCH 8/8] meson: add comments in the target-specific flags section
  2021-12-21 11:05 [PATCH 0/8] Next round of configure/meson cleanups Paolo Bonzini
                   ` (6 preceding siblings ...)
  2021-12-21 11:05 ` [PATCH 7/8] configure, meson: move config-poison.h to meson Paolo Bonzini
@ 2021-12-21 11:05 ` Paolo Bonzini
  2021-12-21 11:32   ` Philippe Mathieu-Daudé
  7 siblings, 1 reply; 16+ messages in thread
From: Paolo Bonzini @ 2021-12-21 11:05 UTC (permalink / raw)
  To: qemu-devel; +Cc: richard.henderson

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 09ee427ca4..0a6d57125f 100644
--- a/meson.build
+++ b/meson.build
@@ -233,6 +233,7 @@ endif
 # Target-specific checks and dependencies #
 ###########################################
 
+# Fuzzing
 if get_option('fuzzing') and get_option('fuzzing_engine') == '' and \
     not cc.links('''
           #include <stdint.h>
@@ -244,6 +245,7 @@ if get_option('fuzzing') and get_option('fuzzing_engine') == '' and \
   error('Your compiler does not support -fsanitize=fuzzer')
 endif
 
+# Tracing backends
 if 'ftrace' in get_option('trace_backends') and targetos != 'linux'
   error('ftrace is supported only on Linux')
 endif
@@ -257,6 +259,7 @@ if 'syslog' in get_option('trace_backends') and not cc.compiles('''
   error('syslog is not supported on this system')
 endif
 
+# Miscellaneous Linux-only features
 if targetos != 'linux' and get_option('mpath').enabled()
   error('Multipath is supported only on Linux')
 endif
@@ -266,6 +269,7 @@ if targetos != 'linux' and get_option('multiprocess').enabled()
 endif
 multiprocess_allowed = targetos == 'linux' and not get_option('multiprocess').disabled()
 
+# Target-specific libraries and flags
 libm = cc.find_library('m', required: false)
 threads = dependency('threads')
 util = cc.find_library('util', required: false)
@@ -306,6 +310,7 @@ elif targetos == 'openbsd'
   endif
 endif
 
+# Target-specific configuration of accelerators
 accelerators = []
 if not get_option('kvm').disabled() and targetos == 'linux'
   accelerators += 'CONFIG_KVM'
-- 
2.33.1



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

* Re: [PATCH 5/8] configure: move non-command-line variables away from command-line parsing section
  2021-12-21 11:05 ` [PATCH 5/8] configure: move non-command-line variables away from command-line parsing section Paolo Bonzini
@ 2021-12-21 11:30   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-12-21 11:30 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: richard.henderson

On 12/21/21 12:05, Paolo Bonzini wrote:
> This makes it easier to identify candidates for moving to Meson.
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  configure | 13 ++++++-------
>  1 file changed, 6 insertions(+), 7 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



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

* Re: [PATCH 8/8] meson: add comments in the target-specific flags section
  2021-12-21 11:05 ` [PATCH 8/8] meson: add comments in the target-specific flags section Paolo Bonzini
@ 2021-12-21 11:32   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-12-21 11:32 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: richard.henderson

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

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



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

* Re: [PATCH 6/8] meson: build contrib/ executables after generated headers
  2021-12-21 11:05 ` [PATCH 6/8] meson: build contrib/ executables after generated headers Paolo Bonzini
@ 2021-12-21 11:32   ` Philippe Mathieu-Daudé
  0 siblings, 0 replies; 16+ messages in thread
From: Philippe Mathieu-Daudé @ 2021-12-21 11:32 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel; +Cc: richard.henderson

On 12/21/21 12:05, Paolo Bonzini wrote:
> This will be needed as soon as config-poison.h moves from configure to
> a meson custom_target (which is built at "ninja" time).
> 
> Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
> ---
>  contrib/elf2dmp/meson.build        | 2 +-
>  contrib/ivshmem-client/meson.build | 2 +-
>  contrib/ivshmem-server/meson.build | 2 +-
>  contrib/rdmacm-mux/meson.build     | 2 +-
>  4 files changed, 4 insertions(+), 4 deletions(-)

Reviewed-by: Philippe Mathieu-Daudé <philmd@redhat.com>



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

* Re: [PATCH 1/8] configure: simplify creation of plugin symbol list
  2021-12-21 11:05 ` [PATCH 1/8] configure: simplify creation of plugin symbol list Paolo Bonzini
@ 2021-12-21 20:50   ` Richard Henderson
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Henderson @ 2021-12-21 20:50 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 12/21/21 3:05 AM, Paolo Bonzini wrote:
> --dynamic-list is present on all supported ELF (not Windows or Darwin)
> platforms, since it dates back to 2006; -exported_symbols_list is
> likewise present on all supported versions of macOS.  Do not bother
> doing a functional test in configure.
> 
> Remove the file creation from configure as well: for Darwin, move the
> the creation of the Darwin-formatted symbols to meson; for ELF, use the
> file in the source path directly and switch from -Wl, to -Xlinker to
> not break weird paths that include a comma.
> 
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   configure           | 80 ---------------------------------------------
>   plugins/meson.build | 11 +++++--
>   2 files changed, 8 insertions(+), 83 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH 2/8] configure: do not set bsd_user/linux_user early
  2021-12-21 11:05 ` [PATCH 2/8] configure: do not set bsd_user/linux_user early Paolo Bonzini
@ 2021-12-21 20:55   ` Richard Henderson
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Henderson @ 2021-12-21 20:55 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 12/21/21 3:05 AM, Paolo Bonzini wrote:
> Similar to other optional features, leave the variables empty and compute
> the actual value later.  Use the existence of include or source directories
> to detect whether an OS or CPU supports respectively bsd-user and linux-user.
> 
> For now, BSD user-mode emulation is buildable even on TCI-only
> architectures.  This probably will change once safe signals are
> brought over from linux-user.
> 
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   configure | 28 +++++++++++++++++-----------
>   1 file changed, 17 insertions(+), 11 deletions(-)

Reviewed-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH 3/8] configure, makefile: remove traces of really old files
  2021-12-21 11:05 ` [PATCH 3/8] configure, makefile: remove traces of really old files Paolo Bonzini
@ 2021-12-21 20:59   ` Richard Henderson
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Henderson @ 2021-12-21 20:59 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 12/21/21 3:05 AM, Paolo Bonzini wrote:
> These files have been removed for more than year in the best
> case, or for more than ten years for some really old TCG files.
> Remove any traces of it.
> 
> Signed-off-by: Paolo Bonzini<pbonzini@redhat.com>
> ---
>   Makefile  | 11 ++++-------
>   configure |  9 ---------
>   2 files changed, 4 insertions(+), 16 deletions(-)

Acked-by: Richard Henderson <richard.henderson@linaro.org>

r~


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

* Re: [PATCH 7/8] configure, meson: move config-poison.h to meson
  2021-12-21 11:05 ` [PATCH 7/8] configure, meson: move config-poison.h to meson Paolo Bonzini
@ 2021-12-21 21:54   ` Richard Henderson
  0 siblings, 0 replies; 16+ messages in thread
From: Richard Henderson @ 2021-12-21 21:54 UTC (permalink / raw)
  To: Paolo Bonzini, qemu-devel

On 12/21/21 3:05 AM, Paolo Bonzini wrote:
> +genh += custom_target('config-poison.h',
> +                      input: [target_configs_h],
> +                      output: 'config-poison.h',
> +                      capture: true,
> +                      command: [find_program('scripts/make-config-poison.sh')] +
> +                               (target_configs_h.length() > 0 ? ['@INPUT@'] : []))

Using length + @INPUT@ seems needlessly around the bush.
Perhaps better as

   [find_program...] + target_configs_h

Otherwise it looks ok.


r~


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

end of thread, other threads:[~2021-12-21 21:56 UTC | newest]

Thread overview: 16+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2021-12-21 11:05 [PATCH 0/8] Next round of configure/meson cleanups Paolo Bonzini
2021-12-21 11:05 ` [PATCH 1/8] configure: simplify creation of plugin symbol list Paolo Bonzini
2021-12-21 20:50   ` Richard Henderson
2021-12-21 11:05 ` [PATCH 2/8] configure: do not set bsd_user/linux_user early Paolo Bonzini
2021-12-21 20:55   ` Richard Henderson
2021-12-21 11:05 ` [PATCH 3/8] configure, makefile: remove traces of really old files Paolo Bonzini
2021-12-21 20:59   ` Richard Henderson
2021-12-21 11:05 ` [PATCH 4/8] configure: parse --enable/--disable-strip automatically, flip default Paolo Bonzini
2021-12-21 11:05 ` [PATCH 5/8] configure: move non-command-line variables away from command-line parsing section Paolo Bonzini
2021-12-21 11:30   ` Philippe Mathieu-Daudé
2021-12-21 11:05 ` [PATCH 6/8] meson: build contrib/ executables after generated headers Paolo Bonzini
2021-12-21 11:32   ` Philippe Mathieu-Daudé
2021-12-21 11:05 ` [PATCH 7/8] configure, meson: move config-poison.h to meson Paolo Bonzini
2021-12-21 21:54   ` Richard Henderson
2021-12-21 11:05 ` [PATCH 8/8] meson: add comments in the target-specific flags section Paolo Bonzini
2021-12-21 11:32   ` Philippe Mathieu-Daudé

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