Skip to content

Commit 654d6b0

Browse files
committed
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 <[email protected]> Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 69c4c5c commit 654d6b0

File tree

9 files changed

+44
-55
lines changed

9 files changed

+44
-55
lines changed

configure

+2-6
Original file line numberDiff line numberDiff line change
@@ -1994,7 +1994,7 @@ python_version=$($python -c 'import sys; print("%d.%d.%d" % (sys.version_info[0]
19941994
python="$python -B"
19951995

19961996
if test -z "$meson"; then
1997-
if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.55.3; then
1997+
if test "$explicit_python" = no && has meson && version_ge "$(meson --version)" 0.59.2; then
19981998
meson=meson
19991999
elif test $git_submodules_action != 'ignore' ; then
20002000
meson=git
@@ -5163,10 +5163,6 @@ if test "$skip_meson" = no; then
51635163
mv $cross config-meson.cross
51645164

51655165
rm -rf meson-private meson-info meson-logs
5166-
unset staticpic
5167-
if ! version_ge "$($meson --version)" 0.56.0; then
5168-
staticpic=$(if test "$pie" = yes; then echo true; else echo false; fi)
5169-
fi
51705166
NINJA=$ninja $meson setup \
51715167
--prefix "$prefix" \
51725168
--libdir "$libdir" \
@@ -5186,7 +5182,6 @@ if test "$skip_meson" = no; then
51865182
-Dwerror=$(if test "$werror" = yes; then echo true; else echo false; fi) \
51875183
-Dstrip=$(if test "$strip_opt" = yes; then echo true; else echo false; fi) \
51885184
-Db_pie=$(if test "$pie" = yes; then echo true; else echo false; fi) \
5189-
${staticpic:+-Db_staticpic=$staticpic} \
51905185
-Db_coverage=$(if test "$gcov" = yes; then echo true; else echo false; fi) \
51915186
-Db_lto=$lto -Dcfi=$cfi -Dcfi_debug=$cfi_debug \
51925187
-Dmalloc=$malloc -Dmalloc_trim=$malloc_trim -Dsparse=$sparse \
@@ -5222,6 +5217,7 @@ else
52225217
perl -i -ne '
52235218
s/^gettext = true$/gettext = auto/;
52245219
s/^gettext = false$/gettext = disabled/;
5220+
/^b_staticpic/ && next;
52255221
print;' meson-private/cmd_line.txt
52265222
fi
52275223
fi

docs/meson.build

+7-7
Original file line numberDiff line numberDiff line change
@@ -37,14 +37,14 @@ endif
3737
if build_docs
3838
SPHINX_ARGS += ['-Dversion=' + meson.project_version(), '-Drelease=' + config_host['PKGVERSION']]
3939

40-
sphinx_extn_depends = [ meson.source_root() / 'docs/sphinx/depfile.py',
41-
meson.source_root() / 'docs/sphinx/hxtool.py',
42-
meson.source_root() / 'docs/sphinx/kerneldoc.py',
43-
meson.source_root() / 'docs/sphinx/kernellog.py',
44-
meson.source_root() / 'docs/sphinx/qapidoc.py',
45-
meson.source_root() / 'docs/sphinx/qmp_lexer.py',
40+
sphinx_extn_depends = [ meson.current_source_dir() / 'sphinx/depfile.py',
41+
meson.current_source_dir() / 'sphinx/hxtool.py',
42+
meson.current_source_dir() / 'sphinx/kerneldoc.py',
43+
meson.current_source_dir() / 'sphinx/kernellog.py',
44+
meson.current_source_dir() / 'sphinx/qapidoc.py',
45+
meson.current_source_dir() / 'sphinx/qmp_lexer.py',
4646
qapi_gen_depends ]
47-
sphinx_template_files = [ meson.source_root() / 'docs/_templates/footer.html' ]
47+
sphinx_template_files = [ meson.project_source_root() / 'docs/_templates/footer.html' ]
4848

4949
have_ga = have_tools and config_host.has_key('CONFIG_GUEST_AGENT')
5050

meson.build

+25-29
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,10 @@
1-
project('qemu', ['c'], meson_version: '>=0.55.0',
2-
default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++11', 'b_colorout=auto'] +
3-
(meson.version().version_compare('>=0.56.0') ? [ 'b_staticpic=false' ] : []),
4-
version: run_command('head', meson.source_root() / 'VERSION').stdout().strip())
1+
project('qemu', ['c'], meson_version: '>=0.58.2',
2+
default_options: ['warning_level=1', 'c_std=gnu11', 'cpp_std=gnu++11', 'b_colorout=auto',
3+
'b_staticpic=false'],
4+
version: files('VERSION'))
55

66
not_found = dependency('', required: false)
7-
if meson.version().version_compare('>=0.56.0')
8-
keyval = import('keyval')
9-
else
10-
keyval = import('unstable-keyval')
11-
endif
7+
keyval = import('keyval')
128
ss = import('sourceset')
139
fs = import('fs')
1410

@@ -1972,21 +1968,21 @@ genh += configure_file(output: 'config-host.h', configuration: config_host_data)
19721968
hxtool = find_program('scripts/hxtool')
19731969
shaderinclude = find_program('scripts/shaderinclude.pl')
19741970
qapi_gen = find_program('scripts/qapi-gen.py')
1975-
qapi_gen_depends = [ meson.source_root() / 'scripts/qapi/__init__.py',
1976-
meson.source_root() / 'scripts/qapi/commands.py',
1977-
meson.source_root() / 'scripts/qapi/common.py',
1978-
meson.source_root() / 'scripts/qapi/error.py',
1979-
meson.source_root() / 'scripts/qapi/events.py',
1980-
meson.source_root() / 'scripts/qapi/expr.py',
1981-
meson.source_root() / 'scripts/qapi/gen.py',
1982-
meson.source_root() / 'scripts/qapi/introspect.py',
1983-
meson.source_root() / 'scripts/qapi/parser.py',
1984-
meson.source_root() / 'scripts/qapi/schema.py',
1985-
meson.source_root() / 'scripts/qapi/source.py',
1986-
meson.source_root() / 'scripts/qapi/types.py',
1987-
meson.source_root() / 'scripts/qapi/visit.py',
1988-
meson.source_root() / 'scripts/qapi/common.py',
1989-
meson.source_root() / 'scripts/qapi-gen.py'
1971+
qapi_gen_depends = [ meson.current_source_dir() / 'scripts/qapi/__init__.py',
1972+
meson.current_source_dir() / 'scripts/qapi/commands.py',
1973+
meson.current_source_dir() / 'scripts/qapi/common.py',
1974+
meson.current_source_dir() / 'scripts/qapi/error.py',
1975+
meson.current_source_dir() / 'scripts/qapi/events.py',
1976+
meson.current_source_dir() / 'scripts/qapi/expr.py',
1977+
meson.current_source_dir() / 'scripts/qapi/gen.py',
1978+
meson.current_source_dir() / 'scripts/qapi/introspect.py',
1979+
meson.current_source_dir() / 'scripts/qapi/parser.py',
1980+
meson.current_source_dir() / 'scripts/qapi/schema.py',
1981+
meson.current_source_dir() / 'scripts/qapi/source.py',
1982+
meson.current_source_dir() / 'scripts/qapi/types.py',
1983+
meson.current_source_dir() / 'scripts/qapi/visit.py',
1984+
meson.current_source_dir() / 'scripts/qapi/common.py',
1985+
meson.current_source_dir() / 'scripts/qapi-gen.py'
19901986
]
19911987

19921988
tracetool = [
@@ -2635,14 +2631,14 @@ foreach target : target_dirs
26352631
if target.endswith('-softmmu')
26362632
execs = [{
26372633
'name': 'qemu-system-' + target_name,
2638-
'gui': false,
2634+
'win_subsystem': 'console',
26392635
'sources': files('softmmu/main.c'),
26402636
'dependencies': []
26412637
}]
26422638
if targetos == 'windows' and (sdl.found() or gtk.found())
26432639
execs += [{
26442640
'name': 'qemu-system-' + target_name + 'w',
2645-
'gui': true,
2641+
'win_subsystem': 'windows',
26462642
'sources': files('softmmu/main.c'),
26472643
'dependencies': []
26482644
}]
@@ -2651,15 +2647,15 @@ foreach target : target_dirs
26512647
specific_fuzz = specific_fuzz_ss.apply(config_target, strict: false)
26522648
execs += [{
26532649
'name': 'qemu-fuzz-' + target_name,
2654-
'gui': false,
2650+
'win_subsystem': 'console',
26552651
'sources': specific_fuzz.sources(),
26562652
'dependencies': specific_fuzz.dependencies(),
26572653
}]
26582654
endif
26592655
else
26602656
execs = [{
26612657
'name': 'qemu-' + target_name,
2662-
'gui': false,
2658+
'win_subsystem': 'console',
26632659
'sources': [],
26642660
'dependencies': []
26652661
}]
@@ -2678,7 +2674,7 @@ foreach target : target_dirs
26782674
link_language: link_language,
26792675
link_depends: [block_syms, qemu_syms] + exe.get('link_depends', []),
26802676
link_args: link_args,
2681-
gui_app: exe['gui'])
2677+
win_subsystem: exe['win_subsystem'])
26822678

26832679
if targetos == 'darwin'
26842680
icon = 'pc-bios/qemu.rsrc'

plugins/meson.build

+2-2
Original file line numberDiff line numberDiff line change
@@ -2,9 +2,9 @@ plugin_ldflags = []
22
# Modules need more symbols than just those in plugins/qemu-plugins.symbols
33
if not enable_modules
44
if 'CONFIG_HAS_LD_DYNAMIC_LIST' in config_host
5-
plugin_ldflags = ['-Wl,--dynamic-list=' + (meson.build_root() / 'qemu-plugins-ld.symbols')]
5+
plugin_ldflags = ['-Wl,--dynamic-list=' + (meson.project_build_root() / 'qemu-plugins-ld.symbols')]
66
elif 'CONFIG_HAS_LD_EXPORTED_SYMBOLS_LIST' in config_host
7-
plugin_ldflags = ['-Wl,-exported_symbols_list,' + (meson.build_root() / 'qemu-plugins-ld64.symbols')]
7+
plugin_ldflags = ['-Wl,-exported_symbols_list,' + (meson.project_build_root() / 'qemu-plugins-ld64.symbols')]
88
endif
99
endif
1010

scripts/mtest2make.py

+2-5
Original file line numberDiff line numberDiff line change
@@ -60,11 +60,8 @@ def process_tests(test, targets, suites):
6060
if test['workdir'] is not None:
6161
print('.test.dir.%d := %s' % (i, shlex.quote(test['workdir'])))
6262

63-
if 'depends' in test:
64-
deps = (targets.get(x, []) for x in test['depends'])
65-
deps = itertools.chain.from_iterable(deps)
66-
else:
67-
deps = ['all']
63+
deps = (targets.get(x, []) for x in test['depends'])
64+
deps = itertools.chain.from_iterable(deps)
6865

6966
print('.test.name.%d := %s' % (i, test['name']))
7067
print('.test.driver.%d := %s' % (i, driver))

tests/qapi-schema/meson.build

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
test_env = environment()
2-
test_env.set('PYTHONPATH', meson.source_root() / 'scripts')
2+
test_env.set('PYTHONPATH', meson.project_source_root() / 'scripts')
33
test_env.set('PYTHONIOENCODING', 'utf-8')
44

55
schemas = [
@@ -248,7 +248,7 @@ if build_docs
248248
# clutter up the build dir with the cache.
249249
command: [SPHINX_ARGS,
250250
'-b', 'text', '-E',
251-
'-c', meson.source_root() / 'docs',
251+
'-c', meson.project_source_root() / 'docs',
252252
'-D', 'master_doc=doc-good',
253253
meson.current_source_dir(),
254254
meson.current_build_dir()])

tests/qtest/meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -275,7 +275,7 @@ foreach dir : target_dirs
275275
qtest_env.set('QTEST_QEMU_IMG', './qemu-img')
276276
test_deps += [qemu_img]
277277
endif
278-
qtest_env.set('G_TEST_DBUS_DAEMON', meson.source_root() / 'tests/dbus-vmstate-daemon.sh')
278+
qtest_env.set('G_TEST_DBUS_DAEMON', meson.project_source_root() / 'tests/dbus-vmstate-daemon.sh')
279279
qtest_env.set('QTEST_QEMU_BINARY', './qemu-system-' + target_base)
280280
if have_tools and have_vhost_user_blk_server
281281
qtest_env.set('QTEST_QEMU_STORAGE_DAEMON_BINARY', './storage-daemon/qemu-storage-daemon')

tests/unit/meson.build

+1-1
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ tests = {
4343
'test-keyval': [testqapi],
4444
'test-logging': [],
4545
'test-uuid': [],
46-
'ptimer-test': ['ptimer-test-stubs.c', meson.source_root() / 'hw/core/ptimer.c'],
46+
'ptimer-test': ['ptimer-test-stubs.c', meson.project_source_root() / 'hw/core/ptimer.c'],
4747
'test-qapi-util': [],
4848
}
4949

trace/meson.build

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@ specific_ss.add(files('control-target.c'))
44
trace_events_files = []
55
dtrace = find_program('dtrace', required: 'CONFIG_TRACE_DTRACE' in config_host)
66
foreach dir : [ '.' ] + trace_events_subdirs
7-
trace_events_file = meson.source_root() / dir / 'trace-events'
7+
trace_events_file = meson.project_source_root() / dir / 'trace-events'
88
trace_events_files += [ trace_events_file ]
99
group_name = dir == '.' ? 'root' : dir.underscorify()
1010
group = '--group=' + group_name
@@ -70,7 +70,7 @@ foreach d : [
7070
]
7171
gen = custom_target(d[0],
7272
output: d[0],
73-
input: meson.source_root() / 'trace-events',
73+
input: meson.project_source_root() / 'trace-events',
7474
command: [ tracetool, '--group=root', '--format=@0@'.format(d[1]), '@INPUT@', '@OUTPUT@' ],
7575
depend_files: tracetool_depends)
7676
specific_ss.add(when: 'CONFIG_TCG', if_true: gen)

0 commit comments

Comments
 (0)