]>
Commit | Line | Data |
---|---|---|
20cf5cb4 PB |
1 | if not have_ga |
2 | if get_option('guest_agent_msi').enabled() | |
3 | error('Guest agent MSI requested, but the guest agent is not being built') | |
4 | endif | |
8821a389 | 5 | have_qga_vss = false |
20cf5cb4 PB |
6 | subdir_done() |
7 | endif | |
8 | ||
8821a389 | 9 | have_qga_vss = get_option('qga_vss') \ |
d0cda6f4 | 10 | .require(host_os == 'windows', |
8821a389 | 11 | error_message: 'VSS support requires Windows') \ |
785abf0d | 12 | .require('cpp' in all_languages, |
8821a389 MAL |
13 | error_message: 'VSS support requires a C++ compiler') \ |
14 | .require(have_vss, error_message: '''VSS support requires VSS headers. | |
15 | If your Visual Studio installation doesn't have the VSS headers, | |
16 | Please download and install Microsoft VSS SDK: | |
17 | http://www.microsoft.com/en-us/download/details.aspx?id=23490 | |
b770f6ce | 18 | On POSIX-systems, MinGW should provide headers in >=10.0 releases. |
8821a389 MAL |
19 | you can extract the SDK headers by: |
20 | $ scripts/extract-vsssdk-headers setup.exe | |
21 | The headers are extracted in the directory 'inc/win2003'. | |
22 | Then run configure with: --extra-cxxflags="-isystem /path/to/vss/inc/win2003"''') \ | |
23011f44 MAL |
23 | .require(midl.found() or widl.found(), |
24 | error_message: 'VSS support requires midl or widl') \ | |
a0cbd2e8 | 25 | .require(not get_option('prefer_static'), |
e23460ce | 26 | error_message: 'VSS support requires dynamic linking with GLib') \ |
8821a389 MAL |
27 | .allowed() |
28 | ||
87263685 PB |
29 | all_qga = [] |
30 | ||
f15bff25 PB |
31 | qga_qapi_outputs = [ |
32 | 'qga-qapi-commands.c', | |
33 | 'qga-qapi-commands.h', | |
f15bff25 PB |
34 | 'qga-qapi-emit-events.c', |
35 | 'qga-qapi-emit-events.h', | |
36 | 'qga-qapi-events.c', | |
37 | 'qga-qapi-events.h', | |
38 | 'qga-qapi-init-commands.c', | |
39 | 'qga-qapi-init-commands.h', | |
40 | 'qga-qapi-introspect.c', | |
41 | 'qga-qapi-introspect.h', | |
42 | 'qga-qapi-types.c', | |
43 | 'qga-qapi-types.h', | |
44 | 'qga-qapi-visit.c', | |
45 | 'qga-qapi-visit.h', | |
46 | ] | |
47 | ||
378dfa48 VSO |
48 | # Problem: to generate trace events, we'd have to add the .trace-events |
49 | # file to qapi_trace_events like we do in qapi/meson.build. Since | |
50 | # qapi_trace_events is used by trace/meson.build, we'd have to move | |
51 | # subdir('qga') above subdir('trace') in the top-level meson.build. | |
52 | # Can't, because it would break the dependency of qga on qemuutil (which | |
53 | # depends on trace_ss). Not worth solving now; simply suppress trace | |
54 | # event generation instead. | |
f15bff25 | 55 | qga_qapi_files = custom_target('QGA QAPI files', |
db16115f | 56 | output: qga_qapi_outputs, |
f15bff25 | 57 | input: 'qapi-schema.json', |
761a1a48 VSO |
58 | command: [ qapi_gen, '-o', 'qga', '-p', 'qga-', '@INPUT0@', |
59 | '--suppress-tracing' ], | |
f15bff25 | 60 | depend_files: qapi_gen_depends) |
acfdaac5 | 61 | |
f15bff25 | 62 | qga_ss = ss.source_set() |
2a127f96 | 63 | qga_ss.add(qga_qapi_files.to_list()) |
f15bff25 PB |
64 | qga_ss.add(files( |
65 | 'commands.c', | |
66 | 'guest-agent-command-state.c', | |
67 | 'main.c', | |
0edbfbe3 | 68 | 'cutils.c', |
1cc99327 | 69 | 'commands-common-ssh.c' |
f15bff25 | 70 | )) |
d0cda6f4 | 71 | if host_os == 'windows' |
dc495494 PB |
72 | qga_ss.add(files( |
73 | 'channel-win32.c', | |
74 | 'commands-win32.c', | |
75 | 'service-win32.c', | |
6b9296ba | 76 | 'vss-win32.c', |
77 | 'commands-windows-ssh.c' | |
dc495494 PB |
78 | )) |
79 | else | |
80 | qga_ss.add(files( | |
81 | 'channel-posix.c', | |
82 | 'commands-posix.c', | |
83 | 'commands-posix-ssh.c', | |
84 | )) | |
d0cda6f4 | 85 | if host_os == 'linux' |
dc495494 | 86 | qga_ss.add(files('commands-linux.c')) |
d0cda6f4 | 87 | elif host_os in bsd_oses |
dc495494 PB |
88 | qga_ss.add(files('commands-bsd.c')) |
89 | endif | |
53e8868d | 90 | endif |
f15bff25 | 91 | |
1220f581 | 92 | qga_ss = qga_ss.apply({}) |
f15bff25 | 93 | |
87263685 PB |
94 | gen_tlb = [] |
95 | qga_libs = [] | |
d0cda6f4 | 96 | if host_os == 'windows' |
3015321d | 97 | qga_libs += ['-lws2_32', '-lwinmm', '-lpowrprof', '-lwtsapi32', '-lwininet', '-liphlpapi', '-lnetapi32', |
6b9296ba | 98 | '-lsetupapi', '-lcfgmgr32', '-luserenv'] |
8821a389 | 99 | if have_qga_vss |
87263685 | 100 | qga_libs += ['-lole32', '-loleaut32', '-lshlwapi', '-lstdc++', '-Wl,--enable-stdcall-fixup'] |
7272fc72 | 101 | subdir('vss-win32') |
328ec32d | 102 | endif |
87263685 | 103 | endif |
328ec32d | 104 | |
f9f0e617 | 105 | qga_objs = [] |
d0cda6f4 | 106 | if host_os == 'windows' |
f9f0e617 AD |
107 | windmc = find_program('windmc', required: true) |
108 | windres = find_program('windres', required: true) | |
109 | ||
110 | msgrc = custom_target('messages-win32.rc', | |
111 | input: 'messages-win32.mc', | |
112 | output: ['messages-win32.rc', 'MSG00409.bin', 'messages-win32.h'], | |
113 | command: [windmc, '-h', '@OUTDIR@', '-r', '@OUTDIR@', '@INPUT@']) | |
114 | msgobj = custom_target('messages-win32.o', | |
115 | input: msgrc[0], | |
116 | output: 'messages-win32.o', | |
117 | command: [windres, '-I', '@OUTDIR@', '-o', '@OUTPUT@', '@INPUT@']) | |
118 | ||
119 | qga_objs = [msgobj] | |
120 | endif | |
121 | ||
122 | qga = executable('qemu-ga', qga_ss.sources() + qga_objs, | |
87263685 PB |
123 | link_args: qga_libs, |
124 | dependencies: [qemuutil, libudev], | |
125 | install: true) | |
126 | all_qga += qga | |
127 | ||
d0cda6f4 | 128 | if host_os == 'windows' |
b846ab7c PB |
129 | qemu_ga_msi_arch = { |
130 | 'x86': ['-D', 'Arch=32'], | |
131 | 'x86_64': ['-a', 'x64', '-D', 'Arch=64'] | |
132 | } | |
133 | wixl = not_found | |
134 | if cpu in qemu_ga_msi_arch | |
135 | wixl = find_program('wixl', required: get_option('guest_agent_msi')) | |
136 | elif get_option('guest_agent_msi').enabled() | |
137 | error('CPU not supported for building guest agent installation package') | |
138 | endif | |
139 | ||
328ec32d MAL |
140 | if wixl.found() |
141 | deps = [gen_tlb, qga] | |
b846ab7c | 142 | qemu_ga_msi_vss = [] |
8821a389 | 143 | if have_qga_vss |
b846ab7c | 144 | qemu_ga_msi_vss = ['-D', 'InstallVss'] |
328ec32d MAL |
145 | deps += qga_vss |
146 | endif | |
7b47b13e | 147 | if glib.version().version_compare('<2.73.2') |
9ca180bc AD |
148 | libpcre = 'libpcre1' |
149 | else | |
150 | libpcre = 'libpcre2' | |
151 | endif | |
e20d68aa | 152 | qga_msi_version = get_option('qemu_ga_version') == '' \ |
7e5b1979 | 153 | ? meson.project_version() \ |
e20d68aa | 154 | : get_option('qemu_ga_version') |
b846ab7c PB |
155 | qga_msi = custom_target('QGA MSI', |
156 | input: files('installer/qemu-ga.wxs'), | |
6bee0960 | 157 | output: 'qemu-ga-@0@.msi'.format(host_arch), |
b846ab7c PB |
158 | depends: deps, |
159 | command: [ | |
b846ab7c PB |
160 | wixl, '-o', '@OUTPUT0@', '@INPUT0@', |
161 | qemu_ga_msi_arch[cpu], | |
162 | qemu_ga_msi_vss, | |
ca5765c8 | 163 | '-D', 'BUILD_DIR=' + meson.project_build_root(), |
91a2e688 | 164 | '-D', 'BIN_DIR=' + glib_pc.get_variable('bindir'), |
e20d68aa PB |
165 | '-D', 'QEMU_GA_VERSION=' + qga_msi_version, |
166 | '-D', 'QEMU_GA_MANUFACTURER=' + get_option('qemu_ga_manufacturer'), | |
167 | '-D', 'QEMU_GA_DISTRO=' + get_option('qemu_ga_distro'), | |
9ca180bc | 168 | '-D', 'LIBPCRE=' + libpcre, |
b846ab7c PB |
169 | ]) |
170 | all_qga += [qga_msi] | |
171 | alias_target('msi', qga_msi) | |
7272fc72 | 172 | endif |
8ab1aabc | 173 | else |
b846ab7c PB |
174 | if get_option('guest_agent_msi').enabled() |
175 | error('MSI guest agent package is available only for MinGW Windows cross-compilation') | |
176 | endif | |
8a29c205 | 177 | install_emptydir(get_option('localstatedir') / 'run') |
7272fc72 | 178 | endif |
588a19fa PB |
179 | |
180 | alias_target('qemu-ga', all_qga) | |
8d769ec7 MAL |
181 | |
182 | test_env = environment() | |
183 | test_env.set('G_TEST_SRCDIR', meson.current_source_dir()) | |
184 | test_env.set('G_TEST_BUILDDIR', meson.current_build_dir()) | |
185 | ||
26813f7f | 186 | # disable qga-ssh-test with fuzzing: glib's G_TEST_OPTION_ISOLATE_DIRS triggers |
8d769ec7 MAL |
187 | # the leak detector in build-oss-fuzz Gitlab CI test. we should re-enable |
188 | # this when an alternative is implemented or when the underlying glib | |
189 | # issue is identified/fix | |
26813f7f | 190 | if host_os != 'windows' and not get_option('fuzzing') |
1cc99327 | 191 | srcs = [files('commands-common-ssh.c', 'commands-posix-ssh.c')] |
cad97c08 MAL |
192 | i = 0 |
193 | foreach output: qga_qapi_outputs | |
194 | if output.startswith('qga-qapi-types') or output.startswith('qga-qapi-visit') | |
195 | srcs += qga_qapi_files[i] | |
196 | endif | |
197 | i = i + 1 | |
198 | endforeach | |
199 | qga_ssh_test = executable('qga-ssh-test', srcs, | |
8d769ec7 MAL |
200 | dependencies: [qemuutil], |
201 | c_args: ['-DQGA_BUILD_UNIT_TEST']) | |
202 | ||
203 | test('qga-ssh-test', | |
204 | qga_ssh_test, | |
205 | env: test_env, | |
206 | suite: ['unit', 'qga']) | |
207 | endif |