Skip to content

Commit b846ab7

Browse files
committed
meson: convert wixl detection to Meson
Signed-off-by: Paolo Bonzini <[email protected]>
1 parent 70903cc commit b846ab7

File tree

5 files changed

+61
-92
lines changed

5 files changed

+61
-92
lines changed

Makefile

-2
Original file line numberDiff line numberDiff line change
@@ -335,9 +335,7 @@ endif
335335
ifdef CONFIG_WIN32
336336
@echo 'Windows targets:'
337337
$(call print-help,installer,Build NSIS-based installer for QEMU)
338-
ifdef CONFIG_QGA_MSI
339338
$(call print-help,msi,Build MSI-based installer for qemu-ga)
340-
endif
341339
@echo ''
342340
endif
343341
$(call print-help,$(MAKE) [targets],(quiet build, default))

configure

+18-66
Original file line numberDiff line numberDiff line change
@@ -404,7 +404,7 @@ zstd="auto"
404404
guest_agent="$default_feature"
405405
guest_agent_with_vss="no"
406406
guest_agent_ntddscsi="no"
407-
guest_agent_msi="$default_feature"
407+
guest_agent_msi="auto"
408408
vss_win32_sdk="$default_feature"
409409
win_sdk="no"
410410
want_tools="$default_feature"
@@ -1334,9 +1334,9 @@ for opt do
13341334
;;
13351335
--disable-guest-agent) guest_agent="no"
13361336
;;
1337-
--enable-guest-agent-msi) guest_agent_msi="yes"
1337+
--enable-guest-agent-msi) guest_agent_msi="enabled"
13381338
;;
1339-
--disable-guest-agent-msi) guest_agent_msi="no"
1339+
--disable-guest-agent-msi) guest_agent_msi="disabled"
13401340
;;
13411341
--with-vss-sdk) vss_win32_sdk=""
13421342
;;
@@ -5341,62 +5341,19 @@ if [ "$guest_agent" != "no" ]; then
53415341
fi
53425342
fi
53435343

5344-
# Guest agent Window MSI package
5344+
# Guest agent Windows MSI package
53455345

5346-
if test "$guest_agent" != yes; then
5347-
if test "$guest_agent_msi" = yes; then
5348-
error_exit "MSI guest agent package requires guest agent enabled"
5349-
fi
5350-
guest_agent_msi=no
5351-
elif test "$mingw32" != "yes"; then
5352-
if test "$guest_agent_msi" = "yes"; then
5353-
error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation"
5354-
fi
5355-
guest_agent_msi=no
5356-
elif ! has wixl; then
5357-
if test "$guest_agent_msi" = "yes"; then
5358-
error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )"
5359-
fi
5360-
guest_agent_msi=no
5361-
else
5362-
# we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't
5363-
# disabled explicitly
5364-
if test "$guest_agent_msi" != "no"; then
5365-
guest_agent_msi=yes
5366-
fi
5346+
if test "$QEMU_GA_MANUFACTURER" = ""; then
5347+
QEMU_GA_MANUFACTURER=QEMU
53675348
fi
5368-
5369-
if test "$guest_agent_msi" = "yes"; then
5370-
if test "$guest_agent_with_vss" = "yes"; then
5371-
QEMU_GA_MSI_WITH_VSS="-D InstallVss"
5372-
fi
5373-
5374-
if test "$QEMU_GA_MANUFACTURER" = ""; then
5375-
QEMU_GA_MANUFACTURER=QEMU
5376-
fi
5377-
5378-
if test "$QEMU_GA_DISTRO" = ""; then
5379-
QEMU_GA_DISTRO=Linux
5380-
fi
5381-
5382-
if test "$QEMU_GA_VERSION" = ""; then
5383-
QEMU_GA_VERSION=$(cat $source_path/VERSION)
5384-
fi
5385-
5386-
QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=$($pkg_config --variable=prefix glib-2.0)/bin"
5387-
5388-
case "$cpu" in
5389-
x86_64)
5390-
QEMU_GA_MSI_ARCH="-a x64 -D Arch=64"
5391-
;;
5392-
i386)
5393-
QEMU_GA_MSI_ARCH="-D Arch=32"
5394-
;;
5395-
*)
5396-
error_exit "CPU $cpu not supported for building installation package"
5397-
;;
5398-
esac
5349+
if test "$QEMU_GA_DISTRO" = ""; then
5350+
QEMU_GA_DISTRO=Linux
53995351
fi
5352+
if test "$QEMU_GA_VERSION" = ""; then
5353+
QEMU_GA_VERSION=$(cat $source_path/VERSION)
5354+
fi
5355+
5356+
QEMU_GA_MSI_MINGW_DLL_PATH="$($pkg_config --variable=prefix glib-2.0)/bin"
54005357

54015358
# Mac OS X ships with a broken assembler
54025359
roms=
@@ -5495,15 +5452,10 @@ if test "$mingw32" = "yes" ; then
54955452
if test "$guest_agent_ntddscsi" = "yes" ; then
54965453
echo "CONFIG_QGA_NTDDSCSI=y" >> $config_host_mak
54975454
fi
5498-
if test "$guest_agent_msi" = "yes"; then
5499-
echo "CONFIG_QGA_MSI=y" >> $config_host_mak
5500-
echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak
5501-
echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak
5502-
echo "QEMU_GA_MSI_ARCH=${QEMU_GA_MSI_ARCH}" >> $config_host_mak
5503-
echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
5504-
echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
5505-
echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak
5506-
fi
5455+
echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak
5456+
echo "QEMU_GA_MANUFACTURER=${QEMU_GA_MANUFACTURER}" >> $config_host_mak
5457+
echo "QEMU_GA_DISTRO=${QEMU_GA_DISTRO}" >> $config_host_mak
5458+
echo "QEMU_GA_VERSION=${QEMU_GA_VERSION}" >> $config_host_mak
55075459
else
55085460
echo "CONFIG_POSIX=y" >> $config_host_mak
55095461
fi
@@ -6420,7 +6372,7 @@ NINJA=$ninja $meson setup \
64206372
-Dattr=$attr -Ddefault_devices=$default_devices \
64216373
-Ddocs=$docs -Dsphinx_build=$sphinx_build -Dinstall_blobs=$blobs \
64226374
-Dvhost_user_blk_server=$vhost_user_blk_server \
6423-
-Dfuse=$fuse -Dfuse_lseek=$fuse_lseek \
6375+
-Dfuse=$fuse -Dfuse_lseek=$fuse_lseek -Dguest_agent_msi=$guest_agent_msi \
64246376
$(if test "$default_features" = no; then echo "-Dauto_features=disabled"; fi) \
64256377
$cross_arg \
64266378
"$PWD" "$source_path"

meson.build

+7-3
Original file line numberDiff line numberDiff line change
@@ -2196,6 +2196,8 @@ endif
21962196

21972197
if 'CONFIG_GUEST_AGENT' in config_host
21982198
subdir('qga')
2199+
elif get_option('guest_agent_msi').enabled()
2200+
error('Guest agent MSI requested, but the guest agent is not being built')
21992201
endif
22002202

22012203
# Don't build qemu-keymap if xkbcommon is not explicitly enabled
@@ -2460,9 +2462,11 @@ if targetos == 'windows'
24602462
if 'WIN_SDK' in config_host
24612463
summary_info += {'Windows SDK': config_host['WIN_SDK']}
24622464
endif
2463-
summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')}
2464-
summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
2465-
summary_info += {'QGA MSI support': config_host.has_key('CONFIG_QGA_MSI')}
2465+
if config_host.has_key('CONFIG_GUEST_AGENT')
2466+
summary_info += {'QGA VSS support': config_host.has_key('CONFIG_QGA_VSS')}
2467+
summary_info += {'QGA w32 disk info': config_host.has_key('CONFIG_QGA_NTDDSCSI')}
2468+
summary_info += {'QGA MSI support': wixl.found()}
2469+
endif
24662470
endif
24672471
summary_info += {'seccomp support': seccomp.found()}
24682472
summary_info += {'CFI support': get_option('cfi')}

meson_options.txt

+2
Original file line numberDiff line numberDiff line change
@@ -17,6 +17,8 @@ option('install_blobs', type : 'boolean', value : true,
1717
description: 'install provided firmware blobs')
1818
option('sparse', type : 'feature', value : 'auto',
1919
description: 'sparse checker')
20+
option('guest_agent_msi', type : 'feature', value : 'auto',
21+
description: 'Build MSI package for the QEMU Guest Agent')
2022

2123
option('malloc_trim', type : 'feature', value : 'auto',
2224
description: 'enable libc malloc_trim() for memory optimization')

qga/meson.build

+34-21
Original file line numberDiff line numberDiff line change
@@ -55,33 +55,46 @@ if targetos == 'windows'
5555
gen_tlb = []
5656
endif
5757

58-
wixl = find_program('wixl', required: false)
58+
qemu_ga_msi_arch = {
59+
'x86': ['-D', 'Arch=32'],
60+
'x86_64': ['-a', 'x64', '-D', 'Arch=64']
61+
}
62+
wixl = not_found
63+
if cpu in qemu_ga_msi_arch
64+
wixl = find_program('wixl', required: get_option('guest_agent_msi'))
65+
elif get_option('guest_agent_msi').enabled()
66+
error('CPU not supported for building guest agent installation package')
67+
endif
68+
5969
if wixl.found()
6070
deps = [gen_tlb, qga]
61-
if 'CONFIG_QGA_VSS' in config_host and 'QEMU_GA_MSI_WITH_VSS' in config_host
71+
qemu_ga_msi_vss = []
72+
if 'CONFIG_QGA_VSS' in config_host
73+
qemu_ga_msi_vss = ['-D', 'InstallVss']
6274
deps += qga_vss
6375
endif
64-
if 'CONFIG_QGA_MSI' in config_host
65-
qga_msi = custom_target('QGA MSI',
66-
input: files('installer/qemu-ga.wxs'),
67-
output: 'qemu-ga-@[email protected]'.format(config_host['ARCH']),
68-
depends: deps,
69-
command: [
70-
find_program('env'),
71-
'QEMU_GA_VERSION=' + config_host['QEMU_GA_VERSION'],
72-
'QEMU_GA_MANUFACTURER=' + config_host['QEMU_GA_MANUFACTURER'],
73-
'QEMU_GA_DISTRO=' + config_host['QEMU_GA_DISTRO'],
74-
'BUILD_DIR=' + meson.build_root(),
75-
wixl, '-o', '@OUTPUT0@', '@INPUT0@',
76-
config_host['QEMU_GA_MSI_ARCH'].split(),
77-
config_host['QEMU_GA_MSI_WITH_VSS'].split(),
78-
config_host['QEMU_GA_MSI_MINGW_DLL_PATH'].split(),
79-
])
80-
all_qga += [qga_msi]
81-
alias_target('msi', qga_msi)
82-
endif
76+
qga_msi = custom_target('QGA MSI',
77+
input: files('installer/qemu-ga.wxs'),
78+
output: 'qemu-ga-@[email protected]'.format(config_host['ARCH']),
79+
depends: deps,
80+
command: [
81+
find_program('env'),
82+
'QEMU_GA_VERSION=' + config_host['QEMU_GA_VERSION'],
83+
'QEMU_GA_MANUFACTURER=' + config_host['QEMU_GA_MANUFACTURER'],
84+
'QEMU_GA_DISTRO=' + config_host['QEMU_GA_DISTRO'],
85+
'BUILD_DIR=' + meson.build_root(),
86+
wixl, '-o', '@OUTPUT0@', '@INPUT0@',
87+
qemu_ga_msi_arch[cpu],
88+
qemu_ga_msi_vss,
89+
'-D', 'Mingw_dlls=' + config_host['QEMU_GA_MSI_MINGW_DLL_PATH'],
90+
])
91+
all_qga += [qga_msi]
92+
alias_target('msi', qga_msi)
8393
endif
8494
else
95+
if get_option('guest_agent_msi').enabled()
96+
error('MSI guest agent package is available only for MinGW Windows cross-compilation')
97+
endif
8598
install_subdir('run', install_dir: get_option('localstatedir'))
8699
endif
87100

0 commit comments

Comments
 (0)