diff mbox

[3/4] build: qemu-ga: fix VSS dependencies

Message ID 1440719744-24755-4-git-send-email-mdroth@linux.vnet.ibm.com
State New
Headers show

Commit Message

Michael Roth Aug. 27, 2015, 11:55 p.m. UTC
Currently 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.

Reviewed-by: Marc-André Lureau <marcandre.lureau@redhat.com>
Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
---
 Makefile  | 11 +++++------
 configure |  5 ++---
 2 files changed, 7 insertions(+), 9 deletions(-)

Comments

Paolo Bonzini Sept. 7, 2015, 10:48 a.m. UTC | #1
On 28/08/2015 01:55, Michael Roth wrote:
> Now we can build qemu-ga MSI package with:
>   ./configure ...
>   make qemu-ga.exe
>   make msi
> 
> or simply:
>   ./configure ...
>   make msi

Shouldn't the latter have always worked?

I think that if someone does "make qemu-ga.exe" they should *not* get
the VSS files.  Perhaps we can add a Win32-specific phony qemu-ga target
to build both qemu-ga.exe and the VSS files, but this patch's use of
filter-out is a bit ugly.

Paolo
Michael Roth Sept. 7, 2015, 7:55 p.m. UTC | #2
Quoting Paolo Bonzini (2015-09-07 05:48:27)
> 
> 
> On 28/08/2015 01:55, Michael Roth wrote:
> > Now we can build qemu-ga MSI package with:
> >   ./configure ...
> >   make qemu-ga.exe
> >   make msi
> > 
> > or simply:
> >   ./configure ...
> >   make msi
> 
> Shouldn't the latter have always worked?

Hmm, at the time of the patch I'm not sure, since out-of-tree builds
were broken with `make msi` until the recent:

  decdfbd qemu-ga: Fixed paths issue with MSI build

With that patch in place I noticed out-of-tree builds were still
broken:

  [mdroth@vm4 qemu-build-w64]$ ../w/qemu4.git/configure --enable-guest-agent --target-list=x86_64-softmmu --extra-cflags=-Wall --enable-guest-agent-msi --cross-prefix=x86_64-w64-mingw32- --with-vss-sdk=/home/mdroth/w/vss-win32/ && make msi
  ...
    AR    libqemustub.a
    LINK  qemu-ga.exe
    CXX   qga/vss-win32/requester.o
  ...
    CXX   qga/vss-win32/provider.o
    CXX   qga/vss-win32/install.o
    LINK  qga/vss-win32/qga-vss.dll
    WIXL  qemu-ga-x86_64.msi
  Couldn't find file /home/mdroth/qemu-build-w64/qga/vss-win32/qga-vss.tlb
  make: *** [qemu-ga-x86_64.msi] Error 1

For out-of-tree, qga-vss.tlb dependency gets met by QEMU tools target, which
is what motivated this patch.

But for in-tree builds, qga-vss.tlb is already present in working directory,
so it might have actually worked for that case.

So I may have misdiagnosed the root issue here: that *.tlb (not just
*.dll) needed to be added to MSI dependency list instead of being
assumed (via in-tree build or full qemu build with tools).

> 
> I think that if someone does "make qemu-ga.exe" they should *not* get
> the VSS files.  Perhaps we can add a Win32-specific phony qemu-ga target
> to build both qemu-ga.exe and the VSS files, but this patch's use of
> filter-out is a bit ugly.

I think it might make sense to re-de-couple VSS from qemu-ga.exe, but
I'm not sure I like the idea of making MSI target responsible for
VSS files. MSI is relatively new, but VSS support has been around for a
while when documentated install procedure for qemu-ga.exe was manually
copying files. MSI isn't the source of the issue, presumably everybody
distributing qemu-ga.exe in this manner was relying on the full build
to get the VSS files. But moving VSS completely to MSI means that use
case would break (whereas moving them to qemu-ga.exe would still work,
since qemu-ga.exe is build as part of default/full build)

I think the ideal solution is too keep things as they are with this
patch (previous working methods supported), but move to a new 'qemu-ga'
build target that just does the right thing on each platform:

  on posix:
    1) build 'qemu-ga' executable
  
  on mingw:
    1) build 'qemu-ga.exe' executable (no need to build .exe directly)
    2) build VSS if VSS supported/requested
    3) build MSI package if supported/requested (and include VSS files
       if VSS supported)

That would let us drop the wierd filtering, and bring the w32 build
process more inline with posix.

I'm not even sure if that's possible atm, but if that's reasonable I can
look into it as a follow-up (this series is merged already).

> 
> Paolo
>
diff mbox

Patch

diff --git a/Makefile b/Makefile
index c13a83d..dbdeb47 100644
--- a/Makefile
+++ b/Makefile
@@ -290,8 +290,11 @@  $(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, $^)
+# we require QGA_VSS_PROVIDER files to be built alongside qemu-ga
+# executable since they are shipped together, but we don't want to actually
+# link against them
+qemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a $(QGA_VSS_PROVIDER)
+	$(call LINK, $(filter-out $(QGA_VSS_PROVIDER), $^))
 
 ifdef QEMU_GA_MSI_ENABLED
 QEMU_GA_MSI=qemu-ga-$(ARCH).msi
@@ -300,10 +303,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
diff --git a/configure b/configure
index a52ef50..21c4089 100755
--- a/configure
+++ b/configure
@@ -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