qemu-ga: various w32 build fix-ups for MSI/VSS support
cover qemu-ga: various w32 build fix-ups for MSI/VSS support
These patches are based on the qga-dev tree:
https://github.com/mdroth/qemu/commits/qga-dev
and are also available from:
https://github.com/mdroth/qemu/commits/qga-dev-build-fixes
These are minor fixes/refactorings to improve the build process for qemu-ga.
Makefile | 10 ++---- configure | 119 +++++++++++++++++++++++++++++++++++++--------------------------------- 2 files changed, 66 insertions(+), 63 deletions(-)
PATCH 1/4 configure: qemu-ga: move MSI installer probe after qga probe
MSI probe assumes that qemu-ga support has been probed already, but in cases where --enable-guest-agent/--disable-guest-agent have not been passed to configure, qemu-ga support may end up getting enabled later, as is the case with w32 builds. This leads to MSI probe prematurely reporting error due to lack of qemu-ga support.
Fix this by moving MSI installer probe after the final qga probes.
--- configure | 106 ++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 54 insertions(+), 52 deletions(-)
configure +54 -52
@@ -3905,58 +3905,6 @@ EOF fi ########################################## -# Guest agent Window MSI package - -if test "$guest_agent" != yes; then - if test "$guest_agent_msi" = yes; then - error_exit "MSI guest agent package requires guest agent enabled" - fi - guest_agent_msi=no -elif test "$mingw32" != "yes"; then - if test "$guest_agent_msi" = "yes"; then - error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation" - fi - guest_agent_msi=no -elif ! has wixl; then - if test "$guest_agent_msi" = "yes"; then - error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )" - fi - guest_agent_msi=no -fi - -if test "$guest_agent_msi" != "no"; then - if test "$guest_agent_with_vss" = "yes"; then - QEMU_GA_MSI_WITH_VSS="-D InstallVss" - fi - - if test "$QEMU_GA_MANUFACTURER" = ""; then - QEMU_GA_MANUFACTURER=QEMU - fi - - if test "$QEMU_GA_DISTRO" = ""; then - QEMU_GA_DISTRO=Linux - fi - - if test "$QEMU_GA_VERSION" = ""; then - QEMU_GA_VERSION=`cat $source_path/VERSION` - fi - - QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=`$pkg_config --variable=prefix glib-2.0`/bin" - - case "$cpu" in - x86_64) - QEMU_GA_MSI_ARCH="-a x64 -D Arch=64" - ;; - i386) - QEMU_GA_MSI_ARCH="-D Arch=32" - ;; - *) - error_exit "CPU $cpu not supported for building installation package" - ;; - esac -fi - -########################################## # check if we have fdatasync fdatasync=no
@@ -4396,6 +4344,9 @@ if test "$softmmu" = yes ; then fi fi fi + +# Probe for guest agent support/options + if [ "$guest_agent" != "no" ]; then if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then tools="qemu-ga\$(EXESUF) $tools"
@@ -4410,6 +4361,57 @@ if [ "$guest_agent" != "no" ]; then fi fi +# Guest agent Window MSI package + +if test "$guest_agent" != yes; then + if test "$guest_agent_msi" = yes; then + error_exit "MSI guest agent package requires guest agent enabled" + fi + guest_agent_msi=no +elif test "$mingw32" != "yes"; then + if test "$guest_agent_msi" = "yes"; then + error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation" + fi + guest_agent_msi=no +elif ! has wixl; then + if test "$guest_agent_msi" = "yes"; then + error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )" + fi + guest_agent_msi=no +fi + +if test "$guest_agent_msi" != "no"; then + if test "$guest_agent_with_vss" = "yes"; then + QEMU_GA_MSI_WITH_VSS="-D InstallVss" + fi + + if test "$QEMU_GA_MANUFACTURER" = ""; then + QEMU_GA_MANUFACTURER=QEMU + fi + + if test "$QEMU_GA_DISTRO" = ""; then + QEMU_GA_DISTRO=Linux + fi + + if test "$QEMU_GA_VERSION" = ""; then + QEMU_GA_VERSION=`cat $source_path/VERSION` + fi + + QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=`$pkg_config --variable=prefix glib-2.0`/bin" + + case "$cpu" in + x86_64) + QEMU_GA_MSI_ARCH="-a x64 -D Arch=64" + ;; + i386) + QEMU_GA_MSI_ARCH="-D Arch=32" + ;; + *) + error_exit "CPU $cpu not supported for building installation package" + ;; + esac +fi + # Mac OS X ships with a broken assembler roms= if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \
Signature · 1 line
1.9.1
Re: [Qemu-devel] [PATCH 1/4] configure: qemu-ga: move MSI installer probe after qga probe
Quoted 10 lines · Michael Roth
MSI probe assumes that qemu-ga support has been probed already, but in cases where --enable-guest-agent/--disable-guest-agent have not been passed to configure, qemu-ga support may end up getting enabled later, as is the case with w32 builds. This leads to MSI probe prematurely reporting error due to lack of qemu-ga support.
Fix this by moving MSI installer probe after the final qga probes.
Signed-off-by Michael Roth <[email protected]>---
Quoted 138 lines
configure | 106 ++++++++++++++++++++++++++++++++------------------------------ 1 file changed, 54 insertions(+), 52 deletions(-)configure +54
-53@@ -3905,58 +3905,6 @@ EOF fi ########################################## -# Guest agent Window MSI package - -if test "$guest_agent" != yes; then - if test "$guest_agent_msi" = yes; then - error_exit "MSI guest agent package requires guest agent enabled" - fi - guest_agent_msi=no -elif test "$mingw32" != "yes"; then - if test "$guest_agent_msi" = "yes"; then - error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation" - fi - guest_agent_msi=no -elif ! has wixl; then - if test "$guest_agent_msi" = "yes"; then - error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )" - fi - guest_agent_msi=no -fi - -if test "$guest_agent_msi" != "no"; then - if test "$guest_agent_with_vss" = "yes"; then - QEMU_GA_MSI_WITH_VSS="-D InstallVss" - fi - - if test "$QEMU_GA_MANUFACTURER" = ""; then - QEMU_GA_MANUFACTURER=QEMU - fi - - if test "$QEMU_GA_DISTRO" = ""; then - QEMU_GA_DISTRO=Linux - fi - - if test "$QEMU_GA_VERSION" = ""; then - QEMU_GA_VERSION=`cat $source_path/VERSION` - fi - - QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=`$pkg_config --variable=prefix glib-2.0`/bin" - - case "$cpu" in - x86_64) - QEMU_GA_MSI_ARCH="-a x64 -D Arch=64" - ;; - i386) - QEMU_GA_MSI_ARCH="-D Arch=32" - ;; - *) - error_exit "CPU $cpu not supported for building installation package" - ;; - esac -fi - -########################################## # check if we have fdatasync fdatasync=no@@ -4396,6 +4344,9 @@ if test "$softmmu" = yes ; then fi fi fi + +# Probe for guest agent support/options + if [ "$guest_agent" != "no" ]; then if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then tools="qemu-ga\$(EXESUF) $tools"@@ -4410,6 +4361,57 @@ if [ "$guest_agent" != "no" ]; then fi fi +# Guest agent Window MSI package + +if test "$guest_agent" != yes; then + if test "$guest_agent_msi" = yes; then + error_exit "MSI guest agent package requires guest agent enabled" + fi + guest_agent_msi=no +elif test "$mingw32" != "yes"; then + if test "$guest_agent_msi" = "yes"; then + error_exit "MSI guest agent package is available only for MinGW Windows cross-compilation" + fi + guest_agent_msi=no +elif ! has wixl; then + if test "$guest_agent_msi" = "yes"; then + error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )" + fi + guest_agent_msi=no +fi + +if test "$guest_agent_msi" != "no"; then + if test "$guest_agent_with_vss" = "yes"; then + QEMU_GA_MSI_WITH_VSS="-D InstallVss" + fi + + if test "$QEMU_GA_MANUFACTURER" = ""; then + QEMU_GA_MANUFACTURER=QEMU + fi + + if test "$QEMU_GA_DISTRO" = ""; then + QEMU_GA_DISTRO=Linux + fi + + if test "$QEMU_GA_VERSION" = ""; then + QEMU_GA_VERSION=`cat $source_path/VERSION` + fi + + QEMU_GA_MSI_MINGW_DLL_PATH="-D Mingw_dlls=`$pkg_config --variable=prefix glib-2.0`/bin" + + case "$cpu" in + x86_64) + QEMU_GA_MSI_ARCH="-a x64 -D Arch=64" + ;; + i386) + QEMU_GA_MSI_ARCH="-D Arch=32" + ;; + *) + error_exit "CPU $cpu not supported for building installation package" + ;; + esac +fi + # Mac OS X ships with a broken assembler roms= if test \( "$cpu" = "i386" -o "$cpu" = "x86_64" \) -a \ --1.9.1
Signature · 1 line
Marc-André Lureau
PATCH 2/4 configure: qemu-ga: explicitly enable qemu-ga MSI support when probed
In reply to Michael RothCurrently, if we don't explicitly disable support for MSI installer via --disable-guest-agent-msi, the configure variable that tracks the flag, 'guest_agent_msi', never gets set unless one of the probes fails. Subsequent code then treats this unset value the same as if it were a "yes" value (via != "no" style checks).
Instead, set the default "yes" value explicitly after the probes, then make subsequent code expect the values to be set.
This makes it easier to report on whether or not MSI support was enabled via probe by looking at the ./configure summary.
--- configure | 10 ++++++++-- 1 file changed, 8 insertions(+), 2 deletions(-)
configure +8 -2
@@ -4378,9 +4378,15 @@ elif ! has wixl; then error_exit "MSI guest agent package requires wixl tool installed ( usually from msitools package )" fi guest_agent_msi=no +else + # we support qemu-ga, mingw32, and wixl: default to MSI enabled if it wasn't + # disabled explicitly + if test "$guest_agent_msi" != "no"; then + guest_agent_msi=yes + fi fi -if test "$guest_agent_msi" != "no"; then +if test "$guest_agent_msi" = "yes"; then if test "$guest_agent_with_vss" = "yes"; then QEMU_GA_MSI_WITH_VSS="-D InstallVss" fi
@@ -4659,7 +4665,7 @@ if test "$mingw32" = "yes" ; then if test "$guest_agent_ntddscsi" = "yes" ; then echo "CONFIG_QGA_NTDDDISK=y" >> $config_host_mak fi - if test "$guest_agent_msi" != "no"; then + if test "$guest_agent_msi" = "yes"; then echo "QEMU_GA_MSI_ENABLED=yes" >> $config_host_mak echo "QEMU_GA_MSI_MINGW_DLL_PATH=${QEMU_GA_MSI_MINGW_DLL_PATH}" >> $config_host_mak echo "QEMU_GA_MSI_WITH_VSS=${QEMU_GA_MSI_WITH_VSS}" >> $config_host_mak
Signature · 1 line
1.9.1
Re: [Qemu-devel] [PATCH 2/4] configure: qemu-ga: explicitly enable qemu-ga MSI support when probed
Hi
Quoted 2 lines · Michael Roth
This makes it easier to report on whether or not MSI support was enabled via probe by looking at the ./configure summary.
Sorry I don't get what that really changes. Otherwise the patch looks fine.
Signature · 1 line
Marc-André Lureau
Re: [Qemu-devel] [PATCH 2/4] configure: qemu-ga: explicitly enable qemu-ga MSI support when probed
Quoting Marc-André Lureau (2015-08-27 07:41:17)
Quoted 8 lines
Hi
Quoted 2 lines · Michael Roth
This makes it easier to report on whether or not MSI support was enabled via probe by looking at the ./configure summary.
Sorry I don't get what that really changes. Otherwise the patch looks fine.
If we keep the $enabled != "no" logic all the way through, $enabled, unless explicitly turned off or missing dependencies, will be undefined when the configure options are summarized via:
configure: qemu-ga: report MSI install support in summary
requiring the user to infer whether we'll default to "yes" or "no". The current logic in fact defaults to "yes" in function, so with this patch we're simply setting that flag early on so we can report "yes" rather than undefined.
Quoted 5 lines
Signature · 2 lines
-- Marc-André Lureau
Re: [Qemu-devel] [PATCH 2/4] configure: qemu-ga: explicitly enable qemu-ga MSI support when probed
Hi
Quoted 10 lines · Michael Roth
If we keep the $enabled != "no" logic all the way through, $enabled, unless explicitly turned off or missing dependencies, will be undefined when the configure options are summarized via:
configure: qemu-ga: report MSI install support in summary
requiring the user to infer whether we'll default to "yes" or "no". The current logic in fact defaults to "yes" in function, so with this patch we're simply setting that flag early on so we can report "yes" rather than undefined.
Where is it reported? I don't see that in the configure summary, did you add it in another patch?
Signature · 1 line
Marc-André Lureau
Re: [Qemu-devel] [PATCH 2/4] configure: qemu-ga: explicitly enable qemu-ga MSI support when probed
Quoting Marc-André Lureau (2015-08-27 09:05:40)
Quoted 9 lines
Hi
Quoted 6 lines · Michael Roth
If we keep the $enabled != "no" logic all the way through, $enabled, unless explicitly turned off or missing dependencies, will be undefined when the configure options are summarized via:
configure: qemu-ga: report MSI install support in summary
Quoted 7 lines
Quoted 4 lines
requiring the user to infer whether we'll default to "yes" or "no". The current logic in fact defaults to "yes" in function, so with this patch we're simply setting that flag early on so we can report "yes" rather than undefined.
Where is it reported? I don't see that in the configure summary, did you add it in another patch?
Yes, recently patch, only applied to qga-dev currently:
https://lists.gnu.org/archive/html/qemu-devel/2015-08/msg03170.html
Quoted 5 lines
Signature · 2 lines
-- Marc-André Lureau
PATCH 3/4 build: qemu-ga: fix VSS dependencies
In reply to Michael RothCurrently VSS dll/tlb files for use in w32 builds are only built as a result of having been added to the general 'tools' target alongside qemu-ga. This is fine for default make target, but if we build qemu-ga directly via make qemu-ga.exe, the VSS files are not created.
Fix this by moving the VSS dependencies to qemu-ga.exe directly. With this move we can move the VSS files back out of 'tools', and drop the extra handling from MSI target in Makefile.
Now we can build qemu-ga MSI package with:
./configure ...
make qemu-ga.exe
make msi
or simply:
./configure ...
make msi
and no longer need to do a full build beforehand.
--- Makefile | 8 ++------ configure | 5 ++--- 2 files changed, 4 insertions(+), 9 deletions(-)
Makefile +2 -6
@@ -290,8 +290,8 @@ $(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py) QGALIB_GEN=$(addprefix qga/qapi-generated/, qga-qapi-types.h qga-qapi-visit.h qga-qmp-commands.h) $(qga-obj-y) qemu-ga.o: $(QGALIB_GEN) -qemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a - $(call LINK, $^) +qemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a $(QGA_VSS_PROVIDER) + $(call LINK, $(filter-out %.tlb %.dll, $^)) ifdef QEMU_GA_MSI_ENABLED QEMU_GA_MSI=qemu-ga-$(ARCH).msi
@@ -300,10 +300,6 @@ msi: $(QEMU_GA_MSI) $(QEMU_GA_MSI): qemu-ga.exe -ifdef QEMU_GA_MSI_WITH_VSS -$(QEMU_GA_MSI): qga/vss-win32/qga-vss.dll -endif - $(QEMU_GA_MSI): config-host.mak $(QEMU_GA_MSI): $(SRC_PATH)/qga/installer/qemu-ga.wxs
configure +2 -3
@@ -3851,6 +3851,7 @@ EOF guest_agent_with_vss="yes" QEMU_CFLAGS="$QEMU_CFLAGS $vss_win32_include" libs_qga="-lole32 -loleaut32 -lshlwapi -luuid -lstdc++ -Wl,--enable-stdcall-fixup $libs_qga" + qga_vss_provider="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb" else if test "$vss_win32_sdk" != "" ; then echo "ERROR: Please download and install Microsoft VSS SDK:"
@@ -4350,9 +4351,6 @@ fi if [ "$guest_agent" != "no" ]; then if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then tools="qemu-ga\$(EXESUF) $tools" - if [ "$mingw32" = "yes" -a "$guest_agent_with_vss" = "yes" ]; then - tools="qga/vss-win32/qga-vss.dll qga/vss-win32/qga-vss.tlb $tools" - fi guest_agent=yes elif [ "$guest_agent" != yes ]; then guest_agent=no
@@ -4660,6 +4658,7 @@ if test "$mingw32" = "yes" ; then echo "CONFIG_PRODUCTVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak if test "$guest_agent_with_vss" = "yes" ; then echo "CONFIG_QGA_VSS=y" >> $config_host_mak + echo "QGA_VSS_PROVIDER=$qga_vss_provider" >> $config_host_mak echo "WIN_SDK=\"$win_sdk\"" >> $config_host_mak fi if test "$guest_agent_ntddscsi" = "yes" ; then
Signature · 1 line
1.9.1
Re: [Qemu-devel] [PATCH 3/4] build: qemu-ga: fix VSS dependencies
Hi
Makefile $(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py) · line 294
Quoted 2 lines · Michael Roth
Makefile +2
-0+qemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a $(QGA_VSS_PROVIDER) + $(call LINK, $(filter-out %.tlb %.dll, $^))
Strictly this is not so great, but that makes sense: so perhaps a small comment above to explain it would be good.
Signature · 1 line
Marc-André Lureau
Re: [Qemu-devel] [PATCH 3/4] build: qemu-ga: fix VSS dependencies
Quoting Marc-André Lureau (2015-08-27 07:49:19)
Quoted 9 lines
Hi
Makefile $(qapi-modules) $(SRC_PATH)/scripts/qapi-commands.py $(qapi-py) · line 294
Quoted 2 lines · Michael Roth
Makefile +2
-0+qemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a $(QGA_VSS_PROVIDER) + $(call LINK, $(filter-out %.tlb %.dll, $^))Strictly this is not so great, but that makes sense: so perhaps a small comment above to explain it would be good.
Will add a comment either way, but perhaps something like:
qemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a $(QGA_VSS_PROVIDER)
$(call LINK, $(filter-out $(QGA_VSS_PROVIDER), $^))
would be clearer? I suppose it's a bit more future-proof as well, if we added more dependencies to QGA_VSS_PROVIDER for some reason.
Quoted 8 lines
Reviewed-by Marc-André Lureau <[email protected]>Signature · 1 line
Marc-André Lureau
Re: [Qemu-devel] [PATCH 3/4] build: qemu-ga: fix VSS dependencies
Quoted 2 lines · Michael Roth
Will add a comment either way, but perhaps something like:
thanks
Quoted 5 lines
qemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a $(QGA_VSS_PROVIDER)
$(call LINK, $(filter-out $(QGA_VSS_PROVIDER), $^))would be clearer? I suppose it's a bit more future-proof as well, if we added more dependencies to
QGA_VSS_PROVIDERfor some reason.
agree, it's better.
Signature · 1 line
Marc-André Lureau
PATCH 4/4 Makefile: qemu-ga: fix msi target error message
In reply to Michael Roth'msi' target reports error if we attempt to use it when QEMU hasn't been ./configure'd to enable it. The parenthesis cause an interpreter error if we don't enclose the error in quotes.
--- Makefile | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-)
Makefile +1 -1
@@ -307,7 +307,7 @@ $(QEMU_GA_MSI): $(SRC_PATH)/qga/installer/qemu-ga.wxs wixl -o $@ $(QEMU_GA_MSI_ARCH) $(QEMU_GA_MSI_WITH_VSS) $(QEMU_GA_MSI_MINGW_DLL_PATH) $<, " WIXL $@") else msi: - @echo MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option) + @echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)" endif clean:
Signature · 1 line
1.9.1
Re: [Qemu-devel] [PATCH 4/4] Makefile: qemu-ga: fix msi target error message
Quoted 1 line · Michael Roth
+ @echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
Signature · 1 line
Marc-André Lureau