2021-10-15 17:47:43 +03:00
|
|
|
if not have_ga
|
|
|
|
if get_option('guest_agent_msi').enabled()
|
|
|
|
error('Guest agent MSI requested, but the guest agent is not being built')
|
|
|
|
endif
|
2022-02-01 15:53:43 +03:00
|
|
|
have_qga_vss = false
|
2021-10-15 17:47:43 +03:00
|
|
|
subdir_done()
|
|
|
|
endif
|
|
|
|
|
2022-02-01 15:53:43 +03:00
|
|
|
have_qga_vss = get_option('qga_vss') \
|
|
|
|
.require(targetos == 'windows',
|
|
|
|
error_message: 'VSS support requires Windows') \
|
|
|
|
.require(link_language == 'cpp',
|
|
|
|
error_message: 'VSS support requires a C++ compiler') \
|
|
|
|
.require(have_vss, error_message: '''VSS support requires VSS headers.
|
|
|
|
If your Visual Studio installation doesn't have the VSS headers,
|
|
|
|
Please download and install Microsoft VSS SDK:
|
|
|
|
http://www.microsoft.com/en-us/download/details.aspx?id=23490
|
2022-02-22 22:40:03 +03:00
|
|
|
On POSIX-systems, MinGW should provide headers in >=10.0 releases.
|
2022-02-01 15:53:43 +03:00
|
|
|
you can extract the SDK headers by:
|
|
|
|
$ scripts/extract-vsssdk-headers setup.exe
|
|
|
|
The headers are extracted in the directory 'inc/win2003'.
|
|
|
|
Then run configure with: --extra-cxxflags="-isystem /path/to/vss/inc/win2003"''') \
|
2022-02-01 11:55:21 +03:00
|
|
|
.require(midl.found() or widl.found(),
|
|
|
|
error_message: 'VSS support requires midl or widl') \
|
2022-07-14 15:33:49 +03:00
|
|
|
.require(not get_option('prefer_static'),
|
2022-02-02 12:14:49 +03:00
|
|
|
error_message: 'VSS support requires dynamic linking with GLib') \
|
2022-02-01 15:53:43 +03:00
|
|
|
.allowed()
|
|
|
|
|
2021-10-15 17:28:29 +03:00
|
|
|
all_qga = []
|
|
|
|
|
2019-07-18 14:19:02 +03:00
|
|
|
qga_qapi_outputs = [
|
|
|
|
'qga-qapi-commands.c',
|
|
|
|
'qga-qapi-commands.h',
|
|
|
|
'qga-qapi-emit-events.c',
|
|
|
|
'qga-qapi-emit-events.h',
|
|
|
|
'qga-qapi-events.c',
|
|
|
|
'qga-qapi-events.h',
|
|
|
|
'qga-qapi-init-commands.c',
|
|
|
|
'qga-qapi-init-commands.h',
|
|
|
|
'qga-qapi-introspect.c',
|
|
|
|
'qga-qapi-introspect.h',
|
|
|
|
'qga-qapi-types.c',
|
|
|
|
'qga-qapi-types.h',
|
|
|
|
'qga-qapi-visit.c',
|
|
|
|
'qga-qapi-visit.h',
|
|
|
|
]
|
|
|
|
|
2022-01-26 19:11:29 +03:00
|
|
|
# Problem: to generate trace events, we'd have to add the .trace-events
|
|
|
|
# file to qapi_trace_events like we do in qapi/meson.build. Since
|
|
|
|
# qapi_trace_events is used by trace/meson.build, we'd have to move
|
|
|
|
# subdir('qga') above subdir('trace') in the top-level meson.build.
|
|
|
|
# Can't, because it would break the dependency of qga on qemuutil (which
|
|
|
|
# depends on trace_ss). Not worth solving now; simply suppress trace
|
|
|
|
# event generation instead.
|
2019-07-18 14:19:02 +03:00
|
|
|
qga_qapi_files = custom_target('QGA QAPI files',
|
2020-09-25 19:23:03 +03:00
|
|
|
output: qga_qapi_outputs,
|
2019-07-18 14:19:02 +03:00
|
|
|
input: 'qapi-schema.json',
|
2022-01-26 19:11:30 +03:00
|
|
|
command: [ qapi_gen, '-o', 'qga', '-p', 'qga-', '@INPUT0@',
|
|
|
|
'--suppress-tracing' ],
|
2019-07-18 14:19:02 +03:00
|
|
|
depend_files: qapi_gen_depends)
|
2020-08-05 14:07:48 +03:00
|
|
|
|
2019-07-18 14:19:02 +03:00
|
|
|
qga_ss = ss.source_set()
|
2020-10-20 11:12:56 +03:00
|
|
|
qga_ss.add(qga_qapi_files.to_list())
|
2019-07-18 14:19:02 +03:00
|
|
|
qga_ss.add(files(
|
|
|
|
'commands.c',
|
|
|
|
'guest-agent-command-state.c',
|
|
|
|
'main.c',
|
2022-05-25 17:41:30 +03:00
|
|
|
'cutils.c',
|
2019-07-18 14:19:02 +03:00
|
|
|
))
|
|
|
|
qga_ss.add(when: 'CONFIG_POSIX', if_true: files(
|
|
|
|
'channel-posix.c',
|
2020-10-20 11:12:52 +03:00
|
|
|
'commands-posix.c',
|
|
|
|
'commands-posix-ssh.c',
|
|
|
|
))
|
2022-10-17 10:28:20 +03:00
|
|
|
qga_ss.add(when: 'CONFIG_LINUX', if_true: files(
|
|
|
|
'commands-linux.c',
|
|
|
|
))
|
2022-10-17 10:28:21 +03:00
|
|
|
qga_ss.add(when: 'CONFIG_BSD', if_true: files(
|
|
|
|
'commands-bsd.c',
|
|
|
|
))
|
2019-07-18 14:19:02 +03:00
|
|
|
qga_ss.add(when: 'CONFIG_WIN32', if_true: files(
|
|
|
|
'channel-win32.c',
|
|
|
|
'commands-win32.c',
|
|
|
|
'service-win32.c',
|
|
|
|
'vss-win32.c'
|
|
|
|
))
|
|
|
|
|
|
|
|
qga_ss = qga_ss.apply(config_host, strict: false)
|
|
|
|
|
2021-10-15 17:28:29 +03:00
|
|
|
gen_tlb = []
|
|
|
|
qga_libs = []
|
2019-07-15 10:39:13 +03:00
|
|
|
if targetos == 'windows'
|
2022-04-01 11:51:06 +03:00
|
|
|
qga_libs += ['-lws2_32', '-lwinmm', '-lpowrprof', '-lwtsapi32', '-lwininet', '-liphlpapi', '-lnetapi32',
|
|
|
|
'-lsetupapi', '-lcfgmgr32']
|
2022-02-01 15:53:43 +03:00
|
|
|
if have_qga_vss
|
2021-10-15 17:28:29 +03:00
|
|
|
qga_libs += ['-lole32', '-loleaut32', '-lshlwapi', '-lstdc++', '-Wl,--enable-stdcall-fixup']
|
2019-07-15 10:39:13 +03:00
|
|
|
subdir('vss-win32')
|
2019-07-15 12:06:20 +03:00
|
|
|
endif
|
2021-10-15 17:28:29 +03:00
|
|
|
endif
|
2019-07-15 12:06:20 +03:00
|
|
|
|
2022-11-29 20:38:08 +03:00
|
|
|
qga_objs = []
|
|
|
|
if targetos == 'windows'
|
|
|
|
windmc = find_program('windmc', required: true)
|
|
|
|
windres = find_program('windres', required: true)
|
|
|
|
|
|
|
|
msgrc = custom_target('messages-win32.rc',
|
|
|
|
input: 'messages-win32.mc',
|
|
|
|
output: ['messages-win32.rc', 'MSG00409.bin', 'messages-win32.h'],
|
|
|
|
command: [windmc, '-h', '@OUTDIR@', '-r', '@OUTDIR@', '@INPUT@'])
|
|
|
|
msgobj = custom_target('messages-win32.o',
|
|
|
|
input: msgrc[0],
|
|
|
|
output: 'messages-win32.o',
|
|
|
|
command: [windres, '-I', '@OUTDIR@', '-o', '@OUTPUT@', '@INPUT@'])
|
|
|
|
|
|
|
|
qga_objs = [msgobj]
|
|
|
|
endif
|
|
|
|
|
|
|
|
qga = executable('qemu-ga', qga_ss.sources() + qga_objs,
|
2021-10-15 17:28:29 +03:00
|
|
|
link_args: qga_libs,
|
|
|
|
dependencies: [qemuutil, libudev],
|
|
|
|
install: true)
|
|
|
|
all_qga += qga
|
|
|
|
|
|
|
|
if targetos == 'windows'
|
2021-01-21 13:49:04 +03:00
|
|
|
qemu_ga_msi_arch = {
|
|
|
|
'x86': ['-D', 'Arch=32'],
|
|
|
|
'x86_64': ['-a', 'x64', '-D', 'Arch=64']
|
|
|
|
}
|
|
|
|
wixl = not_found
|
|
|
|
if cpu in qemu_ga_msi_arch
|
|
|
|
wixl = find_program('wixl', required: get_option('guest_agent_msi'))
|
|
|
|
elif get_option('guest_agent_msi').enabled()
|
|
|
|
error('CPU not supported for building guest agent installation package')
|
|
|
|
endif
|
|
|
|
|
2019-07-15 12:06:20 +03:00
|
|
|
if wixl.found()
|
|
|
|
deps = [gen_tlb, qga]
|
2021-01-21 13:49:04 +03:00
|
|
|
qemu_ga_msi_vss = []
|
2022-02-01 15:53:43 +03:00
|
|
|
if have_qga_vss
|
2021-01-21 13:49:04 +03:00
|
|
|
qemu_ga_msi_vss = ['-D', 'InstallVss']
|
2019-07-15 12:06:20 +03:00
|
|
|
deps += qga_vss
|
|
|
|
endif
|
2022-12-13 18:13:43 +03:00
|
|
|
if glib.version() < '2.73.2'
|
|
|
|
libpcre = 'libpcre1'
|
|
|
|
else
|
|
|
|
libpcre = 'libpcre2'
|
|
|
|
endif
|
2021-01-21 13:49:04 +03:00
|
|
|
qga_msi = custom_target('QGA MSI',
|
|
|
|
input: files('installer/qemu-ga.wxs'),
|
2022-01-14 11:43:11 +03:00
|
|
|
output: 'qemu-ga-@0@.msi'.format(host_arch),
|
2021-01-21 13:49:04 +03:00
|
|
|
depends: deps,
|
|
|
|
command: [
|
|
|
|
wixl, '-o', '@OUTPUT0@', '@INPUT0@',
|
|
|
|
qemu_ga_msi_arch[cpu],
|
|
|
|
qemu_ga_msi_vss,
|
2022-06-06 17:03:38 +03:00
|
|
|
'-D', 'BUILD_DIR=' + meson.project_build_root(),
|
2022-05-25 17:41:39 +03:00
|
|
|
'-D', 'BIN_DIR=' + glib.get_variable('bindir'),
|
2022-05-25 17:41:36 +03:00
|
|
|
'-D', 'QEMU_GA_VERSION=' + config_host['QEMU_GA_VERSION'],
|
|
|
|
'-D', 'QEMU_GA_MANUFACTURER=' + config_host['QEMU_GA_MANUFACTURER'],
|
|
|
|
'-D', 'QEMU_GA_DISTRO=' + config_host['QEMU_GA_DISTRO'],
|
2022-12-13 18:13:43 +03:00
|
|
|
'-D', 'LIBPCRE=' + libpcre,
|
2021-01-21 13:49:04 +03:00
|
|
|
])
|
|
|
|
all_qga += [qga_msi]
|
|
|
|
alias_target('msi', qga_msi)
|
2019-07-15 10:39:13 +03:00
|
|
|
endif
|
2020-08-26 16:06:21 +03:00
|
|
|
else
|
2021-01-21 13:49:04 +03:00
|
|
|
if get_option('guest_agent_msi').enabled()
|
|
|
|
error('MSI guest agent package is available only for MinGW Windows cross-compilation')
|
|
|
|
endif
|
2021-12-23 17:29:56 +03:00
|
|
|
install_emptydir(get_option('localstatedir') / 'run')
|
2019-07-15 10:39:13 +03:00
|
|
|
endif
|
2020-01-28 17:06:16 +03:00
|
|
|
|
|
|
|
alias_target('qemu-ga', all_qga)
|
2020-10-20 11:12:52 +03:00
|
|
|
|
|
|
|
test_env = environment()
|
|
|
|
test_env.set('G_TEST_SRCDIR', meson.current_source_dir())
|
|
|
|
test_env.set('G_TEST_BUILDDIR', meson.current_build_dir())
|
|
|
|
|
|
|
|
# disable qga-ssh-test for now. glib's G_TEST_OPTION_ISOLATE_DIRS triggers
|
|
|
|
# the leak detector in build-oss-fuzz Gitlab CI test. we should re-enable
|
|
|
|
# this when an alternative is implemented or when the underlying glib
|
|
|
|
# issue is identified/fix
|
|
|
|
#if 'CONFIG_POSIX' in config_host
|
|
|
|
if false
|
2020-10-20 11:12:57 +03:00
|
|
|
srcs = [files('commands-posix-ssh.c')]
|
|
|
|
i = 0
|
|
|
|
foreach output: qga_qapi_outputs
|
|
|
|
if output.startswith('qga-qapi-types') or output.startswith('qga-qapi-visit')
|
|
|
|
srcs += qga_qapi_files[i]
|
|
|
|
endif
|
|
|
|
i = i + 1
|
|
|
|
endforeach
|
|
|
|
qga_ssh_test = executable('qga-ssh-test', srcs,
|
2020-10-20 11:12:52 +03:00
|
|
|
dependencies: [qemuutil],
|
|
|
|
c_args: ['-DQGA_BUILD_UNIT_TEST'])
|
|
|
|
|
|
|
|
test('qga-ssh-test',
|
|
|
|
qga_ssh_test,
|
|
|
|
env: test_env,
|
|
|
|
suite: ['unit', 'qga'])
|
|
|
|
endif
|