Skip to content

Commit

Permalink
meson, configure: move bdrv whitelists to meson
Browse files Browse the repository at this point in the history
Use the new support for string option parsing.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Paolo Bonzini <pbonzini@redhat.com>
  • Loading branch information
bonzini committed May 1, 2022
1 parent 062fae0 commit 172fd9d
Show file tree
Hide file tree
Showing 4 changed files with 28 additions and 25 deletions.
14 changes: 0 additions & 14 deletions configure
Expand Up @@ -235,8 +235,6 @@ interp_prefix="/usr/gnemul/qemu-%M"
static="no"
cross_compile="no"
cross_prefix=""
block_drv_rw_whitelist=""
block_drv_ro_whitelist=""
host_cc="cc"
lto="false"
stack_protector=""
Expand Down Expand Up @@ -816,10 +814,6 @@ for opt do
# configure to be used by RPM and similar macros that set
# lots of directory switches by default.
;;
--block-drv-rw-whitelist=*|--block-drv-whitelist=*) block_drv_rw_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
;;
--block-drv-ro-whitelist=*) block_drv_ro_whitelist=$(echo "$optarg" | sed -e 's/,/ /g')
;;
--enable-debug-tcg) debug_tcg="yes"
;;
--disable-debug-tcg) debug_tcg="no"
Expand Down Expand Up @@ -1155,12 +1149,6 @@ Advanced options (experts only):
--disable-stack-protector disable compiler-provided stack protection
--audio-drv-list=LIST set audio drivers to try if -audiodev is not used
--block-drv-whitelist=L Same as --block-drv-rw-whitelist=L
--block-drv-rw-whitelist=L
set block driver read-write whitelist
(by default affects only QEMU, not tools like qemu-img)
--block-drv-ro-whitelist=L
set block driver read-only whitelist
(by default affects only QEMU, not tools like qemu-img)
--with-trace-file=NAME Full PATH,NAME of file to store traces
Default:trace-<pid>
--cpu=CPU Build for host CPU [$cpu]
Expand Down Expand Up @@ -2185,8 +2173,6 @@ fi
if test "$static" = "yes" ; then
echo "CONFIG_STATIC=y" >> $config_host_mak
fi
echo "CONFIG_BDRV_RW_WHITELIST=$block_drv_rw_whitelist" >> $config_host_mak
echo "CONFIG_BDRV_RO_WHITELIST=$block_drv_ro_whitelist" >> $config_host_mak
qemu_version=$(head $source_path/VERSION)
echo "PKGVERSION=$pkgversion" >>$config_host_mak
echo "SRC_PATH=$source_path" >> $config_host_mak
Expand Down
27 changes: 16 additions & 11 deletions meson.build
Expand Up @@ -1594,6 +1594,19 @@ have_virtfs = get_option('virtfs') \

have_virtfs_proxy_helper = targetos != 'darwin' and have_virtfs and have_tools

if get_option('block_drv_ro_whitelist') == ''
config_host_data.set('CONFIG_BDRV_RO_WHITELIST', '')
else
config_host_data.set('CONFIG_BDRV_RO_WHITELIST',
'"' + get_option('block_drv_ro_whitelist').replace(',', '", "') + '"')
endif
if get_option('block_drv_rw_whitelist') == ''
config_host_data.set('CONFIG_BDRV_RW_WHITELIST', '')
else
config_host_data.set('CONFIG_BDRV_RW_WHITELIST',
'"' + get_option('block_drv_rw_whitelist').replace(',', '", "') + '"')
endif

foreach k : get_option('trace_backends')
config_host_data.set('CONFIG_TRACE_' + k.to_upper(), true)
endforeach
Expand Down Expand Up @@ -2208,16 +2221,8 @@ config_host_data.set('HAVE_VSS_SDK', have_vss_sdk)

ignored = ['CONFIG_QEMU_INTERP_PREFIX', # actually per-target
'HAVE_GDB_BIN']
arrays = ['CONFIG_BDRV_RW_WHITELIST', 'CONFIG_BDRV_RO_WHITELIST']
foreach k, v: config_host
if ignored.contains(k)
# do nothing
elif arrays.contains(k)
if v != ''
v = '"' + '", "'.join(v.split()) + '", '
endif
config_host_data.set(k, v)
elif k.startswith('CONFIG_')
if k.startswith('CONFIG_') and not ignored.contains(k)
config_host_data.set(k, v == 'y' ? 1 : v)
endif
endforeach
Expand Down Expand Up @@ -3799,8 +3804,8 @@ summary_info = {}
summary_info += {'coroutine backend': config_host['CONFIG_COROUTINE_BACKEND']}
summary_info += {'coroutine pool': have_coroutine_pool}
if have_block
summary_info += {'Block whitelist (rw)': config_host['CONFIG_BDRV_RW_WHITELIST']}
summary_info += {'Block whitelist (ro)': config_host['CONFIG_BDRV_RO_WHITELIST']}
summary_info += {'Block whitelist (rw)': get_option('block_drv_rw_whitelist')}
summary_info += {'Block whitelist (ro)': get_option('block_drv_ro_whitelist')}
summary_info += {'Use block whitelist in tools': get_option('block_drv_whitelist_in_tools')}
summary_info += {'VirtFS support': have_virtfs}
summary_info += {'build virtiofs daemon': have_virtiofsd}
Expand Down
4 changes: 4 additions & 0 deletions meson_options.txt
Expand Up @@ -21,6 +21,10 @@ option('default_devices', type : 'boolean', value : true,
option('audio_drv_list', type: 'array', value: ['default'],
choices: ['alsa', 'coreaudio', 'default', 'dsound', 'jack', 'oss', 'pa', 'sdl'],
description: 'Set audio driver list')
option('block_drv_rw_whitelist', type : 'string', value : '',
description: 'set block driver read-write whitelist (by default affects only QEMU, not tools like qemu-img)')
option('block_drv_ro_whitelist', type : 'string', value : '',
description: 'set block driver read-only whitelist (by default affects only QEMU, not tools like qemu-img)')
option('fuzzing_engine', type : 'string', value : '',
description: 'fuzzing engine library for OSS-Fuzz')
option('trace_file', type: 'string', value: 'trace',
Expand Down
8 changes: 8 additions & 0 deletions scripts/meson-buildoptions.sh
Expand Up @@ -2,6 +2,12 @@
meson_options_help() {
printf "%s\n" ' --audio-drv-list=CHOICES Set audio driver list [default] (choices:'
printf "%s\n" ' alsa/coreaudio/default/dsound/jack/oss/pa/sdl)'
printf "%s\n" ' --block-drv-ro-whitelist=VALUE'
printf "%s\n" ' set block driver read-only whitelist (by default'
printf "%s\n" ' affects only QEMU, not tools like qemu-img)'
printf "%s\n" ' --block-drv-rw-whitelist=VALUE'
printf "%s\n" ' set block driver read-write whitelist (by default'
printf "%s\n" ' affects only QEMU, not tools like qemu-img)'
printf "%s\n" ' --disable-coroutine-pool coroutine freelist (better performance)'
printf "%s\n" ' --disable-install-blobs install provided firmware blobs'
printf "%s\n" ' --enable-block-drv-whitelist-in-tools'
Expand Down Expand Up @@ -161,6 +167,8 @@ _meson_option_parse() {
--disable-avx2) printf "%s" -Davx2=disabled ;;
--enable-avx512f) printf "%s" -Davx512f=enabled ;;
--disable-avx512f) printf "%s" -Davx512f=disabled ;;
--block-drv-ro-whitelist=*) quote_sh "-Dblock_drv_ro_whitelist=$2" ;;
--block-drv-rw-whitelist=*) quote_sh "-Dblock_drv_rw_whitelist=$2" ;;
--enable-block-drv-whitelist-in-tools) printf "%s" -Dblock_drv_whitelist_in_tools=true ;;
--disable-block-drv-whitelist-in-tools) printf "%s" -Dblock_drv_whitelist_in_tools=false ;;
--enable-bochs) printf "%s" -Dbochs=enabled ;;
Expand Down

0 comments on commit 172fd9d

Please sign in to comment.