Skip to contentSkip to conversation

First round of meson bugfixes and cleanups for 6.0

PATCH In review Paolo Bonzini 2 participants 14 messages Dec 16, 2020

Subsystems (3)
lore
Share & tools
lore
#0 lore raw

cover First round of meson bugfixes and cleanups for 6.0

Mostly switching to 0.56.0 in order to remove the b_staticpic version-dependent hack.

Paolo Bonzini (7):
Makefile: add dummy target for build.ninja dependencies
meson: update submodule to 0.56.0
meson: switch minimum meson version to 0.56.0
meson: fix detection of curses with pkgconfig
meson: use pkg-config method for libudev
meson: use dependency to gate block modules
meson: cleanup Kconfig.host handling

 Makefile                      |   1 +
 accel/Kconfig                 |   9 +++
 block/meson.build             |  20 +++----
 configure                     |   7 +--
 docs/devel/kconfig.rst        |  19 +++----
 docs/meson.build              |  12 ++--
 meson                         |   2 +-
 meson.build                   | 104 +++++++++++++++-------------------
 plugins/meson.build           |   4 +-
 tests/meson.build             |   2 +-
 tests/qapi-schema/meson.build |   4 +-
 tests/qtest/meson.build       |   2 +-
 trace/meson.build             |   4 +-
 13 files changed, 91 insertions(+), 99 deletions(-)
Signature · 1 line
2.29.2
#1 lore raw

PATCH 1/7 Makefile: add dummy target for build.ninja dependencies

The dummy targets ensure that incremental build can be done after deleting a meson.build file.

---
 Makefile | 1 +
 1 file changed, 1 insertion(+)
Makefile +1 -0
index 76dbb917f5..fb9923ff22 100644
@@ -133,6 +133,7 @@ Makefile.ninja: build.ninja
 
 # A separate rule is needed for Makefile dependencies to avoid -n
 build.ninja: build.ninja.stamp
+$(build-files):
 build.ninja.stamp: meson.stamp $(build-files)
 	$(NINJA) $(if $V,-v,) build.ninja && touch $@
 endif
Signature · 1 line
2.29.2
#2 lore raw

PATCH 2/7 meson: update submodule to 0.56.0

In reply to Paolo Bonzini
---
 configure | 2 +-
 meson     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
configure +1 -1
index 6317964997..8d12b715e3 100755
@@ -1938,7 +1938,7 @@ python_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0]
 python="$python -B"
 
 if test -z "$meson"; then
-    if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.55.3; then
+    if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.56.0; then
         meson=meson
     elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then
         meson=git
meson +1 -1
index 776acd2a80..f16d31607e 160000
@@ -1 +1 @@
-Subproject commit 776acd2a805c9b42b4f0375150977df42130317f
+Subproject commit f16d31607eb3cd0f281758bd0944e206ef6be387
Signature · 1 line
2.29.2
Reviewed-by on v1 2/7
#3 lore raw

Re: [PATCH 2/7] meson: update submodule to 0.56.0

Quoted 2 lines · Paolo Bonzini

---

Quoted 33 lines
 configure | 2 +-
 meson     | 2 +-
 2 files changed, 2 insertions(+), 2 deletions(-)
configure +0 -0
index 6317964997..8d12b715e3 100755
@@ -1938,7 +1938,7 @@ python_version=$($python -c 'import sys;

print("%d.%d.%d" % (sys.version_info[0]
python="$python -B"

if test -z "$meson"; then

configure +1 -3
-    if test "$explicit_python" = no && has meson && version_ge "$(meson
--version)" 0.55.3; then
+    if test "$explicit_python" = no && has meson && version_ge "$(meson
--version)" 0.56.0; then
         meson=meson
     elif test -e "${source_path}/.git" && test $git_update = 'yes' ; then
         meson=git
meson +1 -2
index 776acd2a80..f16d31607e 160000
@@ -1 +1 @@
-Subproject commit 776acd2a805c9b42b4f0375150977df42130317f
+Subproject commit f16d31607eb3cd0f281758bd0944e206ef6be387
--

2.29.2

Signature · 1 line
Marc-André Lureau
#4 lore raw

PATCH 3/7 meson: switch minimum meson version to 0.56.0

In reply to Paolo Bonzini

Meson 0.56.0 does not need b_staticpic=$pie anymore, and has stabilized the keyval module. Remove the workaround and use a few replacements for features deprecated in that release cycle.

---
 configure                     |  5 ----
 docs/meson.build              | 12 ++++----
 meson.build                   | 54 ++++++++++++++++-------------------
 plugins/meson.build           |  4 +--
 tests/meson.build             |  2 +-
 tests/qapi-schema/meson.build |  4 +--
 tests/qtest/meson.build       |  2 +-
 trace/meson.build             |  4 +--
 8 files changed, 39 insertions(+), 48 deletions(-)
configure +0 -5
index 8d12b715e3..708cf365f0 100755
@@ -6965,10 +6965,6 @@ fi
 mv $cross config-meson.cross
 
 rm -rf meson-private meson-info meson-logs
-unset staticpic
-if ! version_ge "$($meson --version)" 0.56.0; then
-  staticpic=$(if test "$pie" = yes; then echo true; else echo false; fi)
-fi
 NINJA=$ninja $meson setup \
         --prefix "$prefix" \
         --libdir "$libdir" \
@@ -6988,7 +6984,6 @@ NINJA=$ninja $meson setup \
         -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) \
-        ${staticpic:+-Db_staticpic=$staticpic} \
         -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
         -Db_lto=$lto -Dcfi=$cfi -Dcfi_debug=$cfi_debug \
         -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \
docs/meson.build +6 -6
index bb8fe4c9e4..4e88ed7516 100644
@@ -38,12 +38,12 @@ endif
 if build_docs
   SPHINX_ARGS += ['-Dversion=' + meson.project_version(), '-Drelease=' + config_host['PKGVERSION']]
 
-  sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
-                          meson.source_root() / 'docs/sphinx/hxtool.py',
-                          meson.source_root() / 'docs/sphinx/kerneldoc.py',
-                          meson.source_root() / 'docs/sphinx/kernellog.py',
-                          meson.source_root() / 'docs/sphinx/qapidoc.py',
-                          meson.source_root() / 'docs/sphinx/qmp_lexer.py',
+  sphinx_extn_depends = [ meson.current_source_dir() / 'sphinx/depfile.py',
+                          meson.current_source_dir() / 'sphinx/hxtool.py',
+                          meson.current_source_dir() / 'sphinx/kerneldoc.py',
+                          meson.current_source_dir() / 'sphinx/kernellog.py',
+                          meson.current_source_dir() / 'sphinx/qapidoc.py',
+                          meson.current_source_dir() / 'sphinx/qmp_lexer.py',
                           qapi_gen_depends ]
 
   configure_file(output: 'index.html',
meson.build +25 -29

95 lines not on this page · raw message

plugins/meson.build +2 -2
index e77723010e..d58efc980e 100644
@@ -1,7 +1,7 @@
 if 'CONFIG_HAS_LD_DYNAMIC_LIST' in config_host
-  plugin_ldflags = ['-Wl,--dynamic-list=' + (meson.build_root() / 'qemu-plugins-ld.symbols')]
+  plugin_ldflags = ['-Wl,--dynamic-list=' + (meson.project_build_root() / 'qemu-plugins-ld.symbols')]
 elif 'CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST' in config_host
-  plugin_ldflags = ['-Wl,-exported_symbols_list,' + (meson.build_root() / 'qemu-plugins-ld64.symbols')]
+  plugin_ldflags = ['-Wl,-exported_symbols_list,' + (meson.project_build_root() / 'qemu-plugins-ld64.symbols')]
 else
   plugin_ldflags = []
 endif
tests/meson.build +1 -1
index 1fa068f27b..0b8c3c6f32 100644
@@ -113,7 +113,7 @@ tests = {
   'test-keyval': [testqapi],
   'test-logging': [],
   'test-uuid': [],
-  'ptimer-test': ['ptimer-test-stubs.c', meson.source_root() / 'hw/core/ptimer.c'],
+  'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'],
   'test-qapi-util': [],
 }
 
tests/qapi-schema/meson.build +2 -2
index 304ef939bd..26588396d2 100644
@@ -1,5 +1,5 @@
 test_env = environment()
-test_env.set('PYTHONPATH', meson.source_root() / 'scripts')
+test_env.set('PYTHONPATH', meson.project_source_root() / 'scripts')
 test_env.set('PYTHONIOENCODING', 'utf-8')
 
 schemas = [
@@ -240,7 +240,7 @@ if build_docs
                                # clutter up the build dir with the cache.
                                command: [SPHINX_ARGS,
                                          '-b', 'text', '-E',
-                                         '-c', meson.source_root() / 'docs',
+                                         '-c', meson.project_source_root() / 'docs',
                                          '-D', 'master_doc=doc-good',
                                          meson.current_source_dir(),
                                          meson.current_build_dir()])
tests/qtest/meson.build +1 -1
index 6a67c538be..450af3e51c 100644
@@ -237,7 +237,7 @@ foreach dir : target_dirs
     qtest_env.set('QTEST_QEMU_IMG', './qemu-img')
     test_deps += [qemu_img]
   endif
-  qtest_env.set('G_TEST_DBUS_DAEMON', meson.source_root() / 'tests/dbus-vmstate-daemon.sh')
+  qtest_env.set('G_TEST_DBUS_DAEMON', meson.project_source_root() / 'tests/dbus-vmstate-daemon.sh')
   qtest_env.set('QTEST_QEMU_BINARY', './qemu-system-' + target_base)
   
   foreach test : target_qtests
trace/meson.build +2 -2
index b19309b327..012d0dbceb 100644
@@ -2,7 +2,7 @@ specific_ss.add(files('control-target.c'))
 
 trace_events_files = []
 foreach dir : [ '.' ] + trace_events_subdirs
-  trace_events_file = meson.source_root() / dir / 'trace-events'
+  trace_events_file = meson.project_source_root() / dir / 'trace-events'
   trace_events_files += [ trace_events_file ]
   group_name = dir == '.' ? 'root' : dir.underscorify()
   group = '--group=' + group_name
@@ -68,7 +68,7 @@ foreach d : [
 ]
   gen = custom_target(d[0],
                 output: d[0],
-                input: meson.source_root() / 'trace-events',
+                input: meson.project_source_root() / 'trace-events',
                 command: [ tracetool, '--group=root', '--format=@0@'.format(d[1]), '@INPUT@' ],
                 capture: true)
   specific_ss.add(when: 'CONFIG_TCG', if_true: gen)
Signature · 1 line
2.29.2
Reviewed-by on v1 3/7
#5 lore raw

Re: [PATCH 3/7] meson: switch minimum meson version to 0.56.0

Quoted 6 lines · Paolo Bonzini

Meson 0.56.0 does not need b_staticpic=$pie anymore, and has stabilized the keyval module. Remove the workaround and use a few replacements for features deprecated in that release cycle.

---

Quoted 289 lines
 configure                     |  5 ----
 docs/meson.build              | 12 ++++----
 meson.build                   | 54 ++++++++++++++++-------------------
 plugins/meson.build           |  4 +--
 tests/meson.build             |  2 +-
 tests/qapi-schema/meson.build |  4 +--
 tests/qtest/meson.build       |  2 +-
 trace/meson.build             |  4 +--
 8 files changed, 39 insertions(+), 48 deletions(-)
configure +0 -5
index 8d12b715e3..708cf365f0 100755
@@ -6965,10 +6965,6 @@ fi
 mv $cross config-meson.cross
 
 rm -rf meson-private meson-info meson-logs
-unset staticpic
-if ! version_ge "$($meson --version)" 0.56.0; then
-  staticpic=$(if test "$pie" = yes; then echo true; else echo false; fi)
-fi
 NINJA=$ninja $meson setup \
         --prefix "$prefix" \
         --libdir "$libdir" \
@@ -6988,7 +6984,6 @@ NINJA=$ninja $meson setup \
         -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) \
-        ${staticpic:+-Db_staticpic=$staticpic} \
         -Db_coverage=$(if test "$gcov" = yes; then echo true; else echo
false; fi) \
         -Db_lto=$lto -Dcfi=$cfi -Dcfi_debug=$cfi_debug \
         -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \
docs/meson.build +0 -0
index bb8fe4c9e4..4e88ed7516 100644
@@ -38,12 +38,12 @@ endif
 if build_docs
   SPHINX_ARGS += ['-Dversion=' + meson.project_version(), '-Drelease=' +

config_host['PKGVERSION']]

docs/meson.build +0 -3
-  sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
-                          meson.source_root() / 'docs/sphinx/hxtool.py',
-                          meson.source_root() /

'docs/sphinx/kerneldoc.py',
- meson.source_root() /
'docs/sphinx/kernellog.py',

docs/meson.build +0 -2
-                          meson.source_root() / 'docs/sphinx/qapidoc.py',
-                          meson.source_root() /

'docs/sphinx/qmp_lexer.py',
+ sphinx_extn_depends = [ meson.current_source_dir() / 'sphinx/depfile.py',

docs/meson.build +2 -0
+                          meson.current_source_dir() / 'sphinx/hxtool.py',
+                          meson.current_source_dir() /

'sphinx/kerneldoc.py',
+ meson.current_source_dir() /
'sphinx/kernellog.py',
+ meson.current_source_dir() /
'sphinx/qapidoc.py',
+ meson.current_source_dir() /
'sphinx/qmp_lexer.py',
qapi_gen_depends ]

configure_file(output: 'index.html',

meson.build +0 -2
index 77ac9ec01b..39fc9b7143 100644
@@ -1,14 +1,10 @@
-project('qemu', ['c'], meson_version: '>=0.55.0',
-        default_options: ['warning_level=1', 'c_std=gnu99',

'cpp_std=gnu++11', 'b_colorout=auto'] +
- (meson.version().version_compare('>=0.56.0') ? [
'b_staticpic=false' ] : []),
- version: run_command('head', meson.source_root() /
'VERSION').stdout().strip())

meson.build +2 -0
+project('qemu', ['c'], meson_version: '>=0.56.0',
+        default_options: ['warning_level=1', 'c_std=gnu99',

'cpp_std=gnu++11', 'b_colorout=auto',

meson.build +2 -0
+                          'b_staticpic=false'],
+        version: run_command('head', meson.project_source_root() /

'VERSION').stdout().strip())

not_found = dependency('', required: false)

meson.build +4 -20
-if meson.version().version_compare('>=0.56.0')
-  keyval = import('keyval')
-else
-  keyval = import('unstable-keyval')
-endif
+keyval = import('keyval')
 ss = import('sourceset')
 fs = import('fs')
@@ -1372,21 +1368,21 @@ genh += configure_file(output: 'config-host.h',
 configuration: config_host_data)
 hxtool = find_program('scripts/hxtool')
 shaderinclude = find_program('scripts/shaderinclude.pl')
 qapi_gen = find_program('scripts/qapi-gen.py')
-qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py',
-                     meson.source_root() / 'scripts/qapi/commands.py',
-                     meson.source_root() / 'scripts/qapi/common.py',
-                     meson.source_root() / 'scripts/qapi/error.py',
-                     meson.source_root() / 'scripts/qapi/events.py',
-                     meson.source_root() / 'scripts/qapi/expr.py',
-                     meson.source_root() / 'scripts/qapi/gen.py',
-                     meson.source_root() / 'scripts/qapi/introspect.py',
-                     meson.source_root() / 'scripts/qapi/parser.py',
-                     meson.source_root() / 'scripts/qapi/schema.py',
-                     meson.source_root() / 'scripts/qapi/source.py',
-                     meson.source_root() / 'scripts/qapi/types.py',
-                     meson.source_root() / 'scripts/qapi/visit.py',
-                     meson.source_root() / 'scripts/qapi/common.py',
-                     meson.source_root() / 'scripts/qapi-gen.py'
+qapi_gen_depends = [ meson.current_source_dir() /
 'scripts/qapi/__init__.py',
+                     meson.current_source_dir() /
 'scripts/qapi/commands.py',
+                     meson.current_source_dir() /

'scripts/qapi/common.py',

meson.build +2 -0
+                     meson.current_source_dir() / 'scripts/qapi/error.py',
+                     meson.current_source_dir() /

'scripts/qapi/events.py',

meson.build +3 -0
+                     meson.current_source_dir() / 'scripts/qapi/expr.py',
+                     meson.current_source_dir() / 'scripts/qapi/gen.py',
+                     meson.current_source_dir() /

'scripts/qapi/introspect.py',
+ meson.current_source_dir() /
'scripts/qapi/parser.py',
+ meson.current_source_dir() /
'scripts/qapi/schema.py',
+ meson.current_source_dir() /
'scripts/qapi/source.py',

meson.build +3 -0
+                     meson.current_source_dir() / 'scripts/qapi/types.py',
+                     meson.current_source_dir() / 'scripts/qapi/visit.py',
+                     meson.current_source_dir() /

'scripts/qapi/common.py',

meson.build +6 -5
+                     meson.current_source_dir() / 'scripts/qapi-gen.py'
 ]
 
 tracetool = [
@@ -1894,14 +1890,14 @@ foreach target : target_dirs
   if target.endswith('-softmmu')
     execs = [{
       'name': 'qemu-system-' + target_name,
-      'gui': false,
+      'win_subsystem': 'console',
       'sources': files('softmmu/main.c'),
       'dependencies': []
     }]
     if targetos == 'windows' and (sdl.found() or gtk.found())
       execs += [{
         'name': 'qemu-system-' + target_name + 'w',
-        'gui': true,
+        'win_subsystem': 'windows',
         'sources': files('softmmu/main.c'),
         'dependencies': []
       }]
@@ -1910,7 +1906,7 @@ foreach target : target_dirs
       specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false)
       execs += [{
         'name': 'qemu-fuzz-' + target_name,
-        'gui': false,
+        'win_subsystem': 'console',
         'sources': specific_fuzz.sources(),
         'dependencies': specific_fuzz.dependencies(),
       }]
@@ -1918,7 +1914,7 @@ foreach target : target_dirs
   else
     execs = [{
       'name': 'qemu-' + target_name,
-      'gui': false,
+      'win_subsystem': 'console',
       'sources': [],
       'dependencies': []
     }]
@@ -1933,7 +1929,7 @@ foreach target : target_dirs
                link_language: link_language,
                link_depends: [block_syms, qemu_syms] +
 exe.get('link_depends', []),
                link_args: link_args,
-               gui_app: exe['gui'])
+               win_subsystem: exe['win_subsystem'])
     }
 

if 'CONFIG_TRACE_SYSTEMTAP' in config_host

plugins/meson.build +0 -1
index e77723010e..d58efc980e 100644
@@ -1,7 +1,7 @@
 if 'CONFIG_HAS_LD_DYNAMIC_LIST' in config_host
-  plugin_ldflags = ['-Wl,--dynamic-list=' + (meson.build_root() /

'qemu-plugins-ld.symbols')]
+ plugin_ldflags = ['-Wl,--dynamic-list=' + (meson.project_build_root() / 'qemu-plugins-ld.symbols')]
elif 'CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST' in config_host
- plugin_ldflags = ['-Wl,-exported_symbols_list,' + (meson.build_root() / 'qemu-plugins-ld64.symbols')]
+ plugin_ldflags = ['-Wl,-exported_symbols_list,' + (meson.project_build_root() / 'qemu-plugins-ld64.symbols')] else
plugin_ldflags = []
endif

tests/meson.build +1 -1
index 1fa068f27b..0b8c3c6f32 100644
@@ -113,7 +113,7 @@ tests = {
   'test-keyval': [testqapi],
   'test-logging': [],
   'test-uuid': [],
-  'ptimer-test': ['ptimer-test-stubs.c', meson.source_root() /
 'hw/core/ptimer.c'],
+  'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() /
 'hw/core/ptimer.c'],
   'test-qapi-util': [],

}

tests/qapi-schema/meson.build +2 -2
index 304ef939bd..26588396d2 100644
@@ -1,5 +1,5 @@
 test_env = environment()
-test_env.set('PYTHONPATH', meson.source_root() / 'scripts')
+test_env.set('PYTHONPATH', meson.project_source_root() / 'scripts')
 test_env.set('PYTHONIOENCODING', 'utf-8')
 
 schemas = [
@@ -240,7 +240,7 @@ if build_docs
                                # clutter up the build dir with the cache.
                                command: [SPHINX_ARGS,
                                          '-b', 'text', '-E',
-                                         '-c', meson.source_root() /
 'docs',
+                                         '-c',
 meson.project_source_root() / 'docs',
                                          '-D', 'master_doc=doc-good',
                                          meson.current_source_dir(),
                                          meson.current_build_dir()])
tests/qtest/meson.build +1 -1
index 6a67c538be..450af3e51c 100644
@@ -237,7 +237,7 @@ foreach dir : target_dirs
     qtest_env.set('QTEST_QEMU_IMG', './qemu-img')
     test_deps += [qemu_img]
   endif
-  qtest_env.set('G_TEST_DBUS_DAEMON', meson.source_root() /
 'tests/dbus-vmstate-daemon.sh')
+  qtest_env.set('G_TEST_DBUS_DAEMON', meson.project_source_root() /
 'tests/dbus-vmstate-daemon.sh')
   qtest_env.set('QTEST_QEMU_BINARY', './qemu-system-' + target_base)

foreach test : target_qtests

trace/meson.build +2 -2
index b19309b327..012d0dbceb 100644
@@ -2,7 +2,7 @@ specific_ss.add(files('control-target.c'))
 
 trace_events_files = []
 foreach dir : [ '.' ] + trace_events_subdirs
-  trace_events_file = meson.source_root() / dir / 'trace-events'
+  trace_events_file = meson.project_source_root() / dir / 'trace-events'
   trace_events_files += [ trace_events_file ]
   group_name = dir == '.' ? 'root' : dir.underscorify()
   group = '--group=' + group_name
@@ -68,7 +68,7 @@ foreach d : [
 ]
   gen = custom_target(d[0],
                 output: d[0],
-                input: meson.source_root() / 'trace-events',
+                input: meson.project_source_root() / 'trace-events',
                 command: [ tracetool, '--group=root', '--format=@0@'.format(d[1]),
 '@INPUT@' ],
                 capture: true)

specific_ss.add(when: 'CONFIG_TCG', if_true: gen)
--
2.29.2

Signature · 1 line
Marc-André Lureau
#6 lore raw

PATCH 4/7 meson: fix detection of curses with pkgconfig

In reply to Paolo Bonzini
---
 meson.build | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meson.build +3 -3
index 39fc9b7143..ab622ae8bd 100644
@@ -500,16 +500,16 @@ if have_system and not get_option('curses').disabled()
     endif
   endforeach
   msg = get_option('curses').enabled() ? 'curses library not found' : ''
+  curses_compile_args = ['-DNCURSES_WIDECHAR']
   if curses.found()
-    if cc.links(curses_test, dependencies: [curses])
-      curses = declare_dependency(compile_args: '-DNCURSES_WIDECHAR', dependencies: [curses])
+    if cc.links(curses_test, args: curses_compile_args, dependencies: [curses])
+      curses = declare_dependency(compile_args: curses_compile_args, dependencies: [curses])
     else
       msg = 'curses package not usable'
       curses = not_found
     endif
   endif
   if not curses.found()
-    curses_compile_args = ['-DNCURSES_WIDECHAR']
     has_curses_h = cc.has_header('curses.h', args: curses_compile_args)
     if targetos != 'windows' and not has_curses_h
       message('Trying with /usr/include/ncursesw')
Signature · 1 line
2.29.2
Reviewed-by on v1 4/7
#7 lore raw

Re: [PATCH 4/7] meson: fix detection of curses with pkgconfig

Quoted 2 lines · Paolo Bonzini

---

Quoted 37 lines
 meson.build | 6 +++---
 1 file changed, 3 insertions(+), 3 deletions(-)
meson.build +3 -4
index 39fc9b7143..ab622ae8bd 100644
@@ -500,16 +500,16 @@ if have_system and not
 get_option('curses').disabled()
     endif
   endforeach
   msg = get_option('curses').enabled() ? 'curses library not found' : ''
+  curses_compile_args = ['-DNCURSES_WIDECHAR']
   if curses.found()
-    if cc.links(curses_test, dependencies: [curses])
-      curses = declare_dependency(compile_args: '-DNCURSES_WIDECHAR',
 dependencies: [curses])
+    if cc.links(curses_test, args: curses_compile_args, dependencies:
 [curses])
+      curses = declare_dependency(compile_args: curses_compile_args,
 dependencies: [curses])
     else
       msg = 'curses package not usable'
       curses = not_found
     endif
   endif
   if not curses.found()
-    curses_compile_args = ['-DNCURSES_WIDECHAR']
     has_curses_h = cc.has_header('curses.h', args: curses_compile_args)
     if targetos != 'windows' and not has_curses_h
       message('Trying with /usr/include/ncursesw')
--

2.29.2

Signature · 1 line
Marc-André Lureau
#8 lore raw

PATCH 5/7 meson: use pkg-config method for libudev

In reply to Paolo Bonzini

Do not bother asking CMake, this is a pkg-config dependency.

---
 meson.build | 1 +
 1 file changed, 1 insertion(+)
meson.build +1 -0
index ab622ae8bd..0b36fb38f1 100644
@@ -399,6 +399,7 @@ endif
 libudev = not_found
 if targetos == 'linux' and (have_system or have_tools)
   libudev = dependency('libudev',
+                       method: 'pkg-config',
                        required: get_option('libudev'),
                        static: enable_static)
 endif
Signature · 1 line
2.29.2
#9 lore raw

Re: [PATCH 5/7] meson: use pkg-config method for libudev

Quoted 4 lines · Paolo Bonzini

Do not bother asking CMake, this is a pkg-config dependency.

What was the problem with the default behaviour? Do we need to set pkg-config explicitly on all dependencies?

---

Quoted 21 lines
 meson.build | 1 +
 1 file changed, 1 insertion(+)
meson.build +1 -1
index ab622ae8bd..0b36fb38f1 100644
@@ -399,6 +399,7 @@ endif
 libudev = not_found
 if targetos == 'linux' and (have_system or have_tools)
   libudev = dependency('libudev',
+                       method: 'pkg-config',
                        required: get_option('libudev'),
                        static: enable_static)
 endif
--

2.29.2

Signature · 1 line
Marc-André Lureau
#10 lore raw

PATCH 6/7 meson: use dependency to gate block modules

In reply to Paolo Bonzini

This will allow converting the dependencies to meson options one by one, because moving the tests to meson.build will get rid of the symbols in config-host.mak.

---
 block/meson.build | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
block/meson.build +10 -10
index 5dcc1e5cce..b02cb14aad 100644
@@ -70,14 +70,14 @@ block_modules = {}
 
 modsrc = []
 foreach m : [
-  ['CONFIG_CURL', 'curl', [curl, glib], 'curl.c'],
-  ['CONFIG_GLUSTERFS', 'gluster', glusterfs, 'gluster.c'],
-  ['CONFIG_LIBISCSI', 'iscsi', libiscsi, 'iscsi.c'],
-  ['CONFIG_LIBNFS', 'nfs', libnfs, 'nfs.c'],
-  ['CONFIG_LIBSSH', 'ssh', libssh, 'ssh.c'],
-  ['CONFIG_RBD', 'rbd', rbd, 'rbd.c'],
+  [curl, 'curl', [curl, glib], 'curl.c'],
+  [glusterfs, 'gluster', glusterfs, 'gluster.c'],
+  [libiscsi, 'iscsi', libiscsi, 'iscsi.c'],
+  [libnfs, 'nfs', libnfs, 'nfs.c'],
+  [libssh, 'ssh', libssh, 'ssh.c'],
+  [rbd, 'rbd', rbd, 'rbd.c'],
 ]
-  if config_host.has_key(m[0])
+  if m[0].found()
     if enable_modules
       modsrc += files(m[3])
     endif
@@ -90,10 +90,10 @@ endforeach
 # those are not exactly regular block modules, so treat them apart
 if 'CONFIG_DMG' in config_host
   foreach m : [
-    ['CONFIG_LZFSE', 'dmg-lzfse', liblzfse, 'dmg-lzfse.c'],
-    ['CONFIG_BZIP2', 'dmg-bz2', [glib, libbzip2], 'dmg-bz2.c']
+    [liblzfse, 'dmg-lzfse', liblzfse, 'dmg-lzfse.c'],
+    [libbzip2, 'dmg-bz2', [glib, libbzip2], 'dmg-bz2.c']
   ]
-    if config_host.has_key(m[0])
+    if m[0].found()
       module_ss = ss.source_set()
       module_ss.add(when: m[2], if_true: files(m[3]))
       block_modules += {m[1] : module_ss}
Signature · 1 line
2.29.2
Reviewed-by on v1 6/7
#11 lore raw

Re: [PATCH 6/7] meson: use dependency to gate block modules

Quoted 6 lines · Paolo Bonzini

This will allow converting the dependencies to meson options one by one, because moving the tests to meson.build will get rid of the symbols in config-host.mak.

---

Quoted 49 lines
 block/meson.build | 20 ++++++++++----------
 1 file changed, 10 insertions(+), 10 deletions(-)
block/meson.build +10 -11
index 5dcc1e5cce..b02cb14aad 100644
@@ -70,14 +70,14 @@ block_modules = {}
 
 modsrc = []
 foreach m : [
-  ['CONFIG_CURL', 'curl', [curl, glib], 'curl.c'],
-  ['CONFIG_GLUSTERFS', 'gluster', glusterfs, 'gluster.c'],
-  ['CONFIG_LIBISCSI', 'iscsi', libiscsi, 'iscsi.c'],
-  ['CONFIG_LIBNFS', 'nfs', libnfs, 'nfs.c'],
-  ['CONFIG_LIBSSH', 'ssh', libssh, 'ssh.c'],
-  ['CONFIG_RBD', 'rbd', rbd, 'rbd.c'],
+  [curl, 'curl', [curl, glib], 'curl.c'],
+  [glusterfs, 'gluster', glusterfs, 'gluster.c'],
+  [libiscsi, 'iscsi', libiscsi, 'iscsi.c'],
+  [libnfs, 'nfs', libnfs, 'nfs.c'],
+  [libssh, 'ssh', libssh, 'ssh.c'],
+  [rbd, 'rbd', rbd, 'rbd.c'],
 ]
-  if config_host.has_key(m[0])
+  if m[0].found()
     if enable_modules
       modsrc += files(m[3])
     endif
@@ -90,10 +90,10 @@ endforeach
 # those are not exactly regular block modules, so treat them apart
 if 'CONFIG_DMG' in config_host
   foreach m : [
-    ['CONFIG_LZFSE', 'dmg-lzfse', liblzfse, 'dmg-lzfse.c'],
-    ['CONFIG_BZIP2', 'dmg-bz2', [glib, libbzip2], 'dmg-bz2.c']
+    [liblzfse, 'dmg-lzfse', liblzfse, 'dmg-lzfse.c'],
+    [libbzip2, 'dmg-bz2', [glib, libbzip2], 'dmg-bz2.c']
   ]
-    if config_host.has_key(m[0])
+    if m[0].found()
       module_ss = ss.source_set()
       module_ss.add(when: m[2], if_true: files(m[3]))
       block_modules += {m[1] : module_ss}
--

2.29.2

Signature · 1 line
Marc-André Lureau
#12 lore raw

PATCH 7/7 meson: cleanup Kconfig.host handling

In reply to Paolo Bonzini

Build the array of command line arguments coming from config_host once for all targets. Add all accelerators to accel/Kconfig so that the command line arguments for accelerators can be computed easily in the existing "foreach sym: accelerators" loop.

---
 accel/Kconfig          |  9 +++++++++
 docs/devel/kconfig.rst | 19 +++++++++----------
 meson.build            | 43 +++++++++++++++++-------------------------
 3 files changed, 35 insertions(+), 36 deletions(-)
accel/Kconfig +9 -0
index 2ad94a3839..461104c771 100644
@@ -1,3 +1,12 @@
+config WHPX
+    bool
+
+config HAX
+    bool
+
+config HVF
+    bool
+
 config TCG
     bool
 
docs/devel/kconfig.rst +9 -10
index 336ba0e8e5..cb2d7ffac0 100644
@@ -288,21 +288,20 @@ they will include all these symbols and some help text on what they do.
 ----------------
 
 In some special cases, a configurable element depends on host features
-that are detected by QEMU's configure script; for example some devices
-depend on the availability of KVM or on the presence of a library on
-the host.
+that are detected by QEMU's configure or ``meson.build`` scripts; for
+example some devices depend on the availability of KVM or on the presence
+of a library on the host.
 
 These symbols should be listed in ``Kconfig.host`` like this::
 
-    config KVM
+    config TPM
       bool
 
-and also listed as follows in the top-level Makefile's ``MINIKCONF_ARGS``
+and also listed as follows in the top-level meson.build's host_kconfig
 variable::
 
-    MINIKCONF_ARGS = \
-      $@ $*/config-devices.mak.d $< $(MINIKCONF_INPUTS) \
-      CONFIG_KVM=$(CONFIG_KVM) \
-      CONFIG_SPICE=$(CONFIG_SPICE) \
-      CONFIG_TPM=$(CONFIG_TPM) \
+    host_kconfig = \
+      ('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \
+      ('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \
+      ('CONFIG_IVSHMEM' in config_host ? ['CONFIG_IVSHMEM=y'] : []) + \
       ...
meson.build +17 -26

75 lines not on this page · raw message

Signature · 1 line
2.29.2
Reviewed-by on v1 7/7
#13 lore raw

Re: [PATCH 7/7] meson: cleanup Kconfig.host handling

Hi

Quoted 7 lines · Paolo Bonzini

Build the array of command line arguments coming from config_host once for all targets. Add all accelerators to accel/Kconfig so that the command line arguments for accelerators can be computed easily in the existing "foreach sym: accelerators" loop.

nice cleanup

---

Quoted 149 lines
 accel/Kconfig          |  9 +++++++++
 docs/devel/kconfig.rst | 19 +++++++++----------
 meson.build            | 43 +++++++++++++++++-------------------------
 3 files changed, 35 insertions(+), 36 deletions(-)
accel/Kconfig +9 -0
index 2ad94a3839..461104c771 100644
@@ -1,3 +1,12 @@
+config WHPX
+    bool
+
+config HAX
+    bool
+
+config HVF
+    bool
+
 config TCG
     bool
 
docs/devel/kconfig.rst +0 -0
index 336ba0e8e5..cb2d7ffac0 100644
@@ -288,21 +288,20 @@ they will include all these symbols and some help

text on what they do.
----------------

In some special cases, a configurable element depends on host features

docs/devel/kconfig.rst +9 -10
-that are detected by QEMU's configure script; for example some devices
-depend on the availability of KVM or on the presence of a library on
-the host.
+that are detected by QEMU's configure or ``meson.build`` scripts; for
+example some devices depend on the availability of KVM or on the presence
+of a library on the host.
 
 These symbols should be listed in ``Kconfig.host`` like this::
 
-    config KVM
+    config TPM
       bool
 
-and also listed as follows in the top-level Makefile's ``MINIKCONF_ARGS``
+and also listed as follows in the top-level meson.build's host_kconfig
 variable::
 
-    MINIKCONF_ARGS = \
-      $@ $*/config-devices.mak.d $< $(MINIKCONF_INPUTS) \
-      CONFIG_KVM=$(CONFIG_KVM) \
-      CONFIG_SPICE=$(CONFIG_SPICE) \
-      CONFIG_TPM=$(CONFIG_TPM) \
+    host_kconfig = \
+      ('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \
+      ('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \
+      ('CONFIG_IVSHMEM' in config_host ? ['CONFIG_IVSHMEM=y'] : []) + \
...
meson.build +17 -25
index 0b36fb38f1..bb198f792a 100644
@@ -954,21 +954,19 @@ if link_language == 'cpp'
   }
 endif
 
-kconfig_external_symbols = [
-  'CONFIG_KVM',
-  'CONFIG_XEN',
-  'CONFIG_TPM',
-  'CONFIG_SPICE',
-  'CONFIG_IVSHMEM',
-  'CONFIG_OPENGL',
-  'CONFIG_X11',
-  'CONFIG_VHOST_USER',
-  'CONFIG_VHOST_VDPA',
-  'CONFIG_VHOST_KERNEL',
-  'CONFIG_VIRTFS',
-  'CONFIG_LINUX',
-  'CONFIG_PVRDMA',
-]
+host_kconfig = \
+  ('CONFIG_TPM' in config_host ? ['CONFIG_TPM=y'] : []) + \
+  ('CONFIG_SPICE' in config_host ? ['CONFIG_SPICE=y'] : []) + \
+  ('CONFIG_IVSHMEM' in config_host ? ['CONFIG_IVSHMEM=y'] : []) + \
+  ('CONFIG_OPENGL' in config_host ? ['CONFIG_OPENGL=y'] : []) + \
+  ('CONFIG_X11' in config_host ? ['CONFIG_X11=y'] : []) + \
+  ('CONFIG_VHOST_USER' in config_host ? ['CONFIG_VHOST_USER=y'] : []) + \
+  ('CONFIG_VHOST_VDPA' in config_host ? ['CONFIG_VHOST_VDPA=y'] : []) + \
+  ('CONFIG_VHOST_KERNEL' in config_host ? ['CONFIG_VHOST_KERNEL=y'] : [])
+ \
+  ('CONFIG_VIRTFS' in config_host ? ['CONFIG_VIRTFS=y'] : []) + \
+  ('CONFIG_LINUX' in config_host ? ['CONFIG_LINUX=y'] : []) + \
+  ('CONFIG_PVRDMA' in config_host ? ['CONFIG_PVRDMA=y'] : [])
+
 ignored = [ 'TARGET_XML_FILES', 'TARGET_ABI_DIR', 'TARGET_ARCH' ]
 
 default_targets = 'CONFIG_DEFAULT_TARGETS' in config_host
@@ -1003,7 +1001,7 @@ foreach target : target_dirs
     }
   endif
 
-  have_accel = false
+  accel_kconfig = []
   foreach sym: accelerators
     if sym == 'CONFIG_TCG' or target in accelerator_targets.get(sym, [])
       config_target += { sym: 'y' }
@@ -1011,10 +1009,10 @@ foreach target : target_dirs
       if sym == 'CONFIG_XEN' and have_xen_pci_passthrough
         config_target += { 'CONFIG_XEN_PCI_PASSTHROUGH': 'y' }
       endif
-      have_accel = true
+      accel_kconfig += [ sym + '=y' ]
     endif
   endforeach
-  if not have_accel
+  if accel_kconfig.length() == 0
     if default_targets
       continue
     endif
@@ -1068,13 +1066,6 @@ foreach target : target_dirs
                                                configuration:
 config_target_data)}
 
   if target.endswith('-softmmu')
-    base_kconfig = []
-    foreach sym : kconfig_external_symbols
-      if sym in config_target or sym in config_host
-        base_kconfig += '@0@=y'.format(sym)
-      endif
-    endforeach
-
     config_devices_mak = target + '-config-devices.mak'
     config_devices_mak = configure_file(

input: ['default-configs/devices' / target + '.mak', 'Kconfig'],

meson.build +1 -2
@@ -1083,7 +1074,7 @@ foreach target : target_dirs
       capture: true,
       command: [minikconf, config_host['CONFIG_MINIKCONF_MODE'],
                 config_devices_mak, '@DEPFILE@', '@INPUT@',
-                base_kconfig])
+                host_kconfig, accel_kconfig])
 
     config_devices_data = configuration_data()
     config_devices = keyval.load(config_devices_mak)
--

2.29.2

Signature · 1 line
Marc-André Lureau