meson: switch minimum meson version to 0.58.2, minimum recommended to 0.59.2

Meson 0.58.2 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 the 0.57.0 release cycle.

One feature that we would like to use is passing dependencies to
summary.  However, that was broken in 0.59.0 and 0.59.1.  Therefore,
use the embedded Meson if the host has anything older than 0.59.2,
but allow --meson= to use 0.58.2.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
This commit is contained in:
Paolo Bonzini 2021-02-09 14:59:26 +01:00
parent 69c4c5c1c4
commit 654d6b0453
9 changed files with 44 additions and 55 deletions

8
configure vendored
View File

@ -1994,7 +1994,7 @@ python_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0]
python="$python -B" python="$python -B"
if test -z "$meson"; then 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.59.2; then
meson=meson meson=meson
elif test $git_submodules_action != 'ignore' ; then elif test $git_submodules_action != 'ignore' ; then
meson=git meson=git
@ -5163,10 +5163,6 @@ if test "$skip_meson" = no; then
mv $cross config-meson.cross mv $cross config-meson.cross
rm -rf meson-private meson-info meson-logs 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 \ NINJA=$ninja $meson setup \
--prefix "$prefix" \ --prefix "$prefix" \
--libdir "$libdir" \ --libdir "$libdir" \
@ -5186,7 +5182,6 @@ if test "$skip_meson" = no; then
-Dwerror=$(if test "$werror" = 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) \ -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_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_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
-Db_lto=$lto -Dcfi=$cfi -Dcfi_debug=$cfi_debug \ -Db_lto=$lto -Dcfi=$cfi -Dcfi_debug=$cfi_debug \
-Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \ -Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \
@ -5222,6 +5217,7 @@ else
perl -i -ne ' perl -i -ne '
s/^gettext = true$/gettext = auto/; s/^gettext = true$/gettext = auto/;
s/^gettext = false$/gettext = disabled/; s/^gettext = false$/gettext = disabled/;
/^b_staticpic/ && next;
print;' meson-private/cmd_line.txt print;' meson-private/cmd_line.txt
fi fi
fi fi

View File

@ -37,14 +37,14 @@ endif
if build_docs if build_docs
SPHINX_ARGS += ['-Dversion=' + meson.project_version(), '-Drelease=' + config_host['PKGVERSION']] SPHINX_ARGS += ['-Dversion=' + meson.project_version(), '-Drelease=' + config_host['PKGVERSION']]
sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py', sphinx_extn_depends = [ meson.current_source_dir() / 'sphinx/depfile.py',
meson.source_root() / 'docs/sphinx/hxtool.py', meson.current_source_dir() / 'sphinx/hxtool.py',
meson.source_root() / 'docs/sphinx/kerneldoc.py', meson.current_source_dir() / 'sphinx/kerneldoc.py',
meson.source_root() / 'docs/sphinx/kernellog.py', meson.current_source_dir() / 'sphinx/kernellog.py',
meson.source_root() / 'docs/sphinx/qapidoc.py', meson.current_source_dir() / 'sphinx/qapidoc.py',
meson.source_root() / 'docs/sphinx/qmp_lexer.py', meson.current_source_dir() / 'sphinx/qmp_lexer.py',
qapi_gen_depends ] qapi_gen_depends ]
sphinx_template_files = [ meson.source_root() / 'docs/_templates/footer.html' ] sphinx_template_files = [ meson.project_source_root() / 'docs/_templates/footer.html' ]
have_ga = have_tools and config_host.has_key('CONFIG_GUEST_AGENT') have_ga = have_tools and config_host.has_key('CONFIG_GUEST_AGENT')

View File

@ -1,14 +1,10 @@
project('qemu', ['c'], meson_version: '>=0.55.0', project('qemu', ['c'], meson_version: '>=0.58.2',
default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++11', 'b_colorout=auto'] + default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++11', 'b_colorout=auto',
(meson.version().version_compare('>=0.56.0') ? [ 'b_staticpic=false' ] : []), 'b_staticpic=false'],
version: run_command('head', meson.source_root() / 'VERSION').stdout().strip()) version: files('VERSION'))
not_found = dependency('', required: false) not_found = dependency('', required: false)
if meson.version().version_compare('>=0.56.0') keyval = import('keyval')
keyval = import('keyval')
else
keyval = import('unstable-keyval')
endif
ss = import('sourceset') ss = import('sourceset')
fs = import('fs') fs = import('fs')
@ -1972,21 +1968,21 @@ genh += configure_file(output: 'config-host.h', configuration: config_host_data)
hxtool = find_program('scripts/hxtool') hxtool = find_program('scripts/hxtool')
shaderinclude = find_program('scripts/shaderinclude.pl') shaderinclude = find_program('scripts/shaderinclude.pl')
qapi_gen = find_program('scripts/qapi-gen.py') qapi_gen = find_program('scripts/qapi-gen.py')
qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py', qapi_gen_depends = [ meson.current_source_dir() / 'scripts/qapi/__init__.py',
meson.source_root() / 'scripts/qapi/commands.py', meson.current_source_dir() / 'scripts/qapi/commands.py',
meson.source_root() / 'scripts/qapi/common.py', meson.current_source_dir() / 'scripts/qapi/common.py',
meson.source_root() / 'scripts/qapi/error.py', meson.current_source_dir() / 'scripts/qapi/error.py',
meson.source_root() / 'scripts/qapi/events.py', meson.current_source_dir() / 'scripts/qapi/events.py',
meson.source_root() / 'scripts/qapi/expr.py', meson.current_source_dir() / 'scripts/qapi/expr.py',
meson.source_root() / 'scripts/qapi/gen.py', meson.current_source_dir() / 'scripts/qapi/gen.py',
meson.source_root() / 'scripts/qapi/introspect.py', meson.current_source_dir() / 'scripts/qapi/introspect.py',
meson.source_root() / 'scripts/qapi/parser.py', meson.current_source_dir() / 'scripts/qapi/parser.py',
meson.source_root() / 'scripts/qapi/schema.py', meson.current_source_dir() / 'scripts/qapi/schema.py',
meson.source_root() / 'scripts/qapi/source.py', meson.current_source_dir() / 'scripts/qapi/source.py',
meson.source_root() / 'scripts/qapi/types.py', meson.current_source_dir() / 'scripts/qapi/types.py',
meson.source_root() / 'scripts/qapi/visit.py', meson.current_source_dir() / 'scripts/qapi/visit.py',
meson.source_root() / 'scripts/qapi/common.py', meson.current_source_dir() / 'scripts/qapi/common.py',
meson.source_root() / 'scripts/qapi-gen.py' meson.current_source_dir() / 'scripts/qapi-gen.py'
] ]
tracetool = [ tracetool = [
@ -2635,14 +2631,14 @@ foreach target : target_dirs
if target.endswith('-softmmu') if target.endswith('-softmmu')
execs = [{ execs = [{
'name': 'qemu-system-' + target_name, 'name': 'qemu-system-' + target_name,
'gui': false, 'win_subsystem': 'console',
'sources': files('softmmu/main.c'), 'sources': files('softmmu/main.c'),
'dependencies': [] 'dependencies': []
}] }]
if targetos == 'windows' and (sdl.found() or gtk.found()) if targetos == 'windows' and (sdl.found() or gtk.found())
execs += [{ execs += [{
'name': 'qemu-system-' + target_name + 'w', 'name': 'qemu-system-' + target_name + 'w',
'gui': true, 'win_subsystem': 'windows',
'sources': files('softmmu/main.c'), 'sources': files('softmmu/main.c'),
'dependencies': [] 'dependencies': []
}] }]
@ -2651,7 +2647,7 @@ foreach target : target_dirs
specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false) specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false)
execs += [{ execs += [{
'name': 'qemu-fuzz-' + target_name, 'name': 'qemu-fuzz-' + target_name,
'gui': false, 'win_subsystem': 'console',
'sources': specific_fuzz.sources(), 'sources': specific_fuzz.sources(),
'dependencies': specific_fuzz.dependencies(), 'dependencies': specific_fuzz.dependencies(),
}] }]
@ -2659,7 +2655,7 @@ foreach target : target_dirs
else else
execs = [{ execs = [{
'name': 'qemu-' + target_name, 'name': 'qemu-' + target_name,
'gui': false, 'win_subsystem': 'console',
'sources': [], 'sources': [],
'dependencies': [] 'dependencies': []
}] }]
@ -2678,7 +2674,7 @@ foreach target : target_dirs
link_language: link_language, link_language: link_language,
link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []), link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
link_args: link_args, link_args: link_args,
gui_app: exe['gui']) win_subsystem: exe['win_subsystem'])
if targetos == 'darwin' if targetos == 'darwin'
icon = 'pc-bios/qemu.rsrc' icon = 'pc-bios/qemu.rsrc'

View File

@ -2,9 +2,9 @@ plugin_ldflags = []
# Modules need more symbols than just those in plugins/qemu-plugins.symbols # Modules need more symbols than just those in plugins/qemu-plugins.symbols
if not enable_modules if not enable_modules
if 'CONFIG_HAS_LD_DYNAMIC_LIST' in config_host 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 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')]
endif endif
endif endif

View File

@ -60,11 +60,8 @@ def process_tests(test, targets, suites):
if test['workdir'] is not None: if test['workdir'] is not None:
print('.test.dir.%d := %s' % (i, shlex.quote(test['workdir']))) print('.test.dir.%d := %s' % (i, shlex.quote(test['workdir'])))
if 'depends' in test: deps = (targets.get(x, []) for x in test['depends'])
deps = (targets.get(x, []) for x in test['depends']) deps = itertools.chain.from_iterable(deps)
deps = itertools.chain.from_iterable(deps)
else:
deps = ['all']
print('.test.name.%d := %s' % (i, test['name'])) print('.test.name.%d := %s' % (i, test['name']))
print('.test.driver.%d := %s' % (i, driver)) print('.test.driver.%d := %s' % (i, driver))

View File

@ -1,5 +1,5 @@
test_env = environment() 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') test_env.set('PYTHONIOENCODING', 'utf-8')
schemas = [ schemas = [
@ -248,7 +248,7 @@ if build_docs
# clutter up the build dir with the cache. # clutter up the build dir with the cache.
command: [SPHINX_ARGS, command: [SPHINX_ARGS,
'-b', 'text', '-E', '-b', 'text', '-E',
'-c', meson.source_root() / 'docs', '-c', meson.project_source_root() / 'docs',
'-D', 'master_doc=doc-good', '-D', 'master_doc=doc-good',
meson.current_source_dir(), meson.current_source_dir(),
meson.current_build_dir()]) meson.current_build_dir()])

View File

@ -275,7 +275,7 @@ foreach dir : target_dirs
qtest_env.set('QTEST_QEMU_IMG', './qemu-img') qtest_env.set('QTEST_QEMU_IMG', './qemu-img')
test_deps += [qemu_img] test_deps += [qemu_img]
endif 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) qtest_env.set('QTEST_QEMU_BINARY', './qemu-system-' + target_base)
if have_tools and have_vhost_user_blk_server if have_tools and have_vhost_user_blk_server
qtest_env.set('QTEST_QEMU_STORAGE_DAEMON_BINARY', './storage-daemon/qemu-storage-daemon') qtest_env.set('QTEST_QEMU_STORAGE_DAEMON_BINARY', './storage-daemon/qemu-storage-daemon')

View File

@ -43,7 +43,7 @@ tests = {
'test-keyval': [testqapi], 'test-keyval': [testqapi],
'test-logging': [], 'test-logging': [],
'test-uuid': [], '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': [], 'test-qapi-util': [],
} }

View File

@ -4,7 +4,7 @@ specific_ss.add(files('control-target.c'))
trace_events_files = [] trace_events_files = []
dtrace = find_program('dtrace', required: 'CONFIG_TRACE_DTRACE' in config_host) dtrace = find_program('dtrace', required: 'CONFIG_TRACE_DTRACE' in config_host)
foreach dir : [ '.' ] + trace_events_subdirs 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 ] trace_events_files += [ trace_events_file ]
group_name = dir == '.' ? 'root' : dir.underscorify() group_name = dir == '.' ? 'root' : dir.underscorify()
group = '--group=' + group_name group = '--group=' + group_name
@ -70,7 +70,7 @@ foreach d : [
] ]
gen = custom_target(d[0], gen = custom_target(d[0],
output: 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@', '@OUTPUT@' ], command: [ tracetool, '--group=root', '--format=@0@'.format(d[1]), '@INPUT@', '@OUTPUT@' ],
depend_files: tracetool_depends) depend_files: tracetool_depends)
specific_ss.add(when: 'CONFIG_TCG', if_true: gen) specific_ss.add(when: 'CONFIG_TCG', if_true: gen)