diff mbox

build: qemu-ga: add 'qemu-ga' build target for w32

Message ID 1441727278-18450-1-git-send-email-mdroth@linux.vnet.ibm.com
State New
Headers show

Commit Message

Michael Roth Sept. 8, 2015, 3:47 p.m. UTC
Currently POSIX builds rely on 'qemu-ga' target to do qga-only
distributable build. On w32, as with most standalone binary targets,
we rely on 'qemu-ga.exe' target.

Unlike with POSIX, qemu-ga for w32 has a number of related targets
such as VSS DLL and MSI package. We can do the full distributable
qga-only build on w32 with:

  make qemu-ga.exe

or:

  make msi

To make that work, we tie VSS dependencies onto qemu-ga.exe.
However, in reality the DLL isn't part of the binary, so we use a
filter to pull them out of the LINK recipe, which attempts to link
against prereqs for binary targets. Additionally, it could be argued
that VSS is a separate distributable, and shouldn't be implied by
qemu-ga.exe binary target.

To avoid this, we can tie the VSS dependencies only to the 'msi'
target, but that would make it impossible to do a qga-only build of
the w32 distributable without building the 'msi' package, which was
supported in the past.

An alternative approach is to add a new target to build the whole
distributable. w32 allows us to use the same build target we use
on POSIX, 'qemu-ga', since the current binary-only target on w32
is 'qemu-ga.exe'.

To further simplify the build, we also make 'qemu-ga' build the MSI
package if the appropriate ./configure options are set, making the
full qga-only build the same on both POSIX and w32: `make qemu-ga`

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

Comments

Paolo Bonzini Sept. 9, 2015, 9:42 a.m. UTC | #1
On 08/09/2015 17:47, Michael Roth wrote:
> Currently POSIX builds rely on 'qemu-ga' target to do qga-only
> distributable build. On w32, as with most standalone binary targets,
> we rely on 'qemu-ga.exe' target.
> 
> Unlike with POSIX, qemu-ga for w32 has a number of related targets
> such as VSS DLL and MSI package. We can do the full distributable
> qga-only build on w32 with:
> 
>   make qemu-ga.exe
> 
> or:
> 
>   make msi
> 
> To make that work, we tie VSS dependencies onto qemu-ga.exe.
> However, in reality the DLL isn't part of the binary, so we use a
> filter to pull them out of the LINK recipe, which attempts to link
> against prereqs for binary targets. Additionally, it could be argued
> that VSS is a separate distributable, and shouldn't be implied by
> qemu-ga.exe binary target.
> 
> To avoid this, we can tie the VSS dependencies only to the 'msi'
> target, but that would make it impossible to do a qga-only build of
> the w32 distributable without building the 'msi' package, which was
> supported in the past.
> 
> An alternative approach is to add a new target to build the whole
> distributable. w32 allows us to use the same build target we use
> on POSIX, 'qemu-ga', since the current binary-only target on w32
> is 'qemu-ga.exe'.
> 
> To further simplify the build, we also make 'qemu-ga' build the MSI
> package if the appropriate ./configure options are set, making the
> full qga-only build the same on both POSIX and w32: `make qemu-ga`
> 
> Cc: Paolo Bonzini <pbonzini@redhat.com>
> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> ---
>  Makefile  | 14 ++++++++------
>  configure |  2 +-
>  2 files changed, 9 insertions(+), 7 deletions(-)
> 
> diff --git a/Makefile b/Makefile
> index 9ce3972..7efca5e 100644
> --- a/Makefile
> +++ b/Makefile
> @@ -290,18 +290,15 @@ $(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)
>  
> -# 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), $^))
> +qemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a
> +	$(call LINK, $^)
>  
>  ifdef QEMU_GA_MSI_ENABLED
>  QEMU_GA_MSI=qemu-ga-$(ARCH).msi
>  
>  msi: $(QEMU_GA_MSI)
>  
> -$(QEMU_GA_MSI): qemu-ga.exe
> +$(QEMU_GA_MSI): qemu-ga.exe $(QGA_VSS_PROVIDER)
>  
>  $(QEMU_GA_MSI): config-host.mak
>  
> @@ -313,6 +310,11 @@ msi:
>  	@echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
>  endif
>  
> +ifneq ($(EXESUF),)
> +.PHONY: qemu-ga
> +qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
> +endif
> +
>  clean:
>  # avoid old build problems by removing potentially incorrect old files
>  	rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
> diff --git a/configure b/configure
> index d854936..fc34443 100755
> --- a/configure
> +++ b/configure
> @@ -4350,7 +4350,7 @@ fi
>  
>  if [ "$guest_agent" != "no" ]; then
>    if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
> -      tools="qemu-ga\$(EXESUF) $tools"
> +      tools="qemu-ga $tools"
>        guest_agent=yes
>    elif [ "$guest_agent" != yes ]; then
>        guest_agent=no
> 

Looks good, thanks!

Paolo
Stefan Weil Nov. 15, 2015, 8:13 a.m. UTC | #2
Am 09.09.2015 um 11:42 schrieb Paolo Bonzini:
>
> On 08/09/2015 17:47, Michael Roth wrote:
>> Currently POSIX builds rely on 'qemu-ga' target to do qga-only
>> distributable build. On w32, as with most standalone binary targets,
>> we rely on 'qemu-ga.exe' target.
>>
>> Unlike with POSIX, qemu-ga for w32 has a number of related targets
>> such as VSS DLL and MSI package. We can do the full distributable
>> qga-only build on w32 with:
>>
>>   make qemu-ga.exe
>>
>> or:
>>
>>   make msi
>>
>> To make that work, we tie VSS dependencies onto qemu-ga.exe.
>> However, in reality the DLL isn't part of the binary, so we use a
>> filter to pull them out of the LINK recipe, which attempts to link
>> against prereqs for binary targets. Additionally, it could be argued
>> that VSS is a separate distributable, and shouldn't be implied by
>> qemu-ga.exe binary target.
>>
>> To avoid this, we can tie the VSS dependencies only to the 'msi'
>> target, but that would make it impossible to do a qga-only build of
>> the w32 distributable without building the 'msi' package, which was
>> supported in the past.
>>
>> An alternative approach is to add a new target to build the whole
>> distributable. w32 allows us to use the same build target we use
>> on POSIX, 'qemu-ga', since the current binary-only target on w32
>> is 'qemu-ga.exe'.
>>
>> To further simplify the build, we also make 'qemu-ga' build the MSI
>> package if the appropriate ./configure options are set, making the
>> full qga-only build the same on both POSIX and w32: `make qemu-ga`
>>
>> Cc: Paolo Bonzini <pbonzini@redhat.com>
>> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
>> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
>> ---
>>  Makefile  | 14 ++++++++------
>>  configure |  2 +-
>>  2 files changed, 9 insertions(+), 7 deletions(-)
>>
>> diff --git a/Makefile b/Makefile
>> index 9ce3972..7efca5e 100644
>> --- a/Makefile
>> +++ b/Makefile
>> @@ -290,18 +290,15 @@ $(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)
>>  
>> -# 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), $^))
>> +qemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a
>> +	$(call LINK, $^)
>>  
>>  ifdef QEMU_GA_MSI_ENABLED
>>  QEMU_GA_MSI=qemu-ga-$(ARCH).msi
>>  
>>  msi: $(QEMU_GA_MSI)
>>  
>> -$(QEMU_GA_MSI): qemu-ga.exe
>> +$(QEMU_GA_MSI): qemu-ga.exe $(QGA_VSS_PROVIDER)
>>  
>>  $(QEMU_GA_MSI): config-host.mak
>>  
>> @@ -313,6 +310,11 @@ msi:
>>  	@echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
>>  endif
>>  
>> +ifneq ($(EXESUF),)
>> +.PHONY: qemu-ga
>> +qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
>> +endif
>> +
>>  clean:
>>  # avoid old build problems by removing potentially incorrect old files
>>  	rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
>> diff --git a/configure b/configure
>> index d854936..fc34443 100755
>> --- a/configure
>> +++ b/configure
>> @@ -4350,7 +4350,7 @@ fi
>>  
>>  if [ "$guest_agent" != "no" ]; then
>>    if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
>> -      tools="qemu-ga\$(EXESUF) $tools"
>> +      tools="qemu-ga $tools"
>>        guest_agent=yes
>>    elif [ "$guest_agent" != yes ]; then
>>        guest_agent=no
>>
> Looks good, thanks!
>
> Paolo

Looks good, but introduced a regression for cross builds:
'make install' now fails with an error:

install: cannot stat 'qemu-ga': No such file or directory

Reverting the change in configure fixes this.

Stefan
Michael Roth Nov. 15, 2015, 4:14 p.m. UTC | #3
Quoting Stefan Weil (2015-11-15 02:13:36)
> Am 09.09.2015 um 11:42 schrieb Paolo Bonzini:
> >
> > On 08/09/2015 17:47, Michael Roth wrote:
> >> Currently POSIX builds rely on 'qemu-ga' target to do qga-only
> >> distributable build. On w32, as with most standalone binary targets,
> >> we rely on 'qemu-ga.exe' target.
> >>
> >> Unlike with POSIX, qemu-ga for w32 has a number of related targets
> >> such as VSS DLL and MSI package. We can do the full distributable
> >> qga-only build on w32 with:
> >>
> >>   make qemu-ga.exe
> >>
> >> or:
> >>
> >>   make msi
> >>
> >> To make that work, we tie VSS dependencies onto qemu-ga.exe.
> >> However, in reality the DLL isn't part of the binary, so we use a
> >> filter to pull them out of the LINK recipe, which attempts to link
> >> against prereqs for binary targets. Additionally, it could be argued
> >> that VSS is a separate distributable, and shouldn't be implied by
> >> qemu-ga.exe binary target.
> >>
> >> To avoid this, we can tie the VSS dependencies only to the 'msi'
> >> target, but that would make it impossible to do a qga-only build of
> >> the w32 distributable without building the 'msi' package, which was
> >> supported in the past.
> >>
> >> An alternative approach is to add a new target to build the whole
> >> distributable. w32 allows us to use the same build target we use
> >> on POSIX, 'qemu-ga', since the current binary-only target on w32
> >> is 'qemu-ga.exe'.
> >>
> >> To further simplify the build, we also make 'qemu-ga' build the MSI
> >> package if the appropriate ./configure options are set, making the
> >> full qga-only build the same on both POSIX and w32: `make qemu-ga`
> >>
> >> Cc: Paolo Bonzini <pbonzini@redhat.com>
> >> Cc: Marc-André Lureau <marcandre.lureau@redhat.com>
> >> Signed-off-by: Michael Roth <mdroth@linux.vnet.ibm.com>
> >> ---
> >>  Makefile  | 14 ++++++++------
> >>  configure |  2 +-
> >>  2 files changed, 9 insertions(+), 7 deletions(-)
> >>
> >> diff --git a/Makefile b/Makefile
> >> index 9ce3972..7efca5e 100644
> >> --- a/Makefile
> >> +++ b/Makefile
> >> @@ -290,18 +290,15 @@ $(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)
> >>  
> >> -# 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), $^))
> >> +qemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a
> >> +    $(call LINK, $^)
> >>  
> >>  ifdef QEMU_GA_MSI_ENABLED
> >>  QEMU_GA_MSI=qemu-ga-$(ARCH).msi
> >>  
> >>  msi: $(QEMU_GA_MSI)
> >>  
> >> -$(QEMU_GA_MSI): qemu-ga.exe
> >> +$(QEMU_GA_MSI): qemu-ga.exe $(QGA_VSS_PROVIDER)
> >>  
> >>  $(QEMU_GA_MSI): config-host.mak
> >>  
> >> @@ -313,6 +310,11 @@ msi:
> >>      @echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
> >>  endif
> >>  
> >> +ifneq ($(EXESUF),)
> >> +.PHONY: qemu-ga
> >> +qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
> >> +endif
> >> +
> >>  clean:
> >>  # avoid old build problems by removing potentially incorrect old files
> >>      rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
> >> diff --git a/configure b/configure
> >> index d854936..fc34443 100755
> >> --- a/configure
> >> +++ b/configure
> >> @@ -4350,7 +4350,7 @@ fi
> >>  
> >>  if [ "$guest_agent" != "no" ]; then
> >>    if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
> >> -      tools="qemu-ga\$(EXESUF) $tools"
> >> +      tools="qemu-ga $tools"
> >>        guest_agent=yes
> >>    elif [ "$guest_agent" != yes ]; then
> >>        guest_agent=no
> >>
> > Looks good, thanks!
> >
> > Paolo
> 
> Looks good, but introduced a regression for cross builds:
> 'make install' now fails with an error:
> 
> install: cannot stat 'qemu-ga': No such file or directory
> 
> Reverting the change in configure fixes this.

Thanks for the catch. Just sent a proposed fix:

"[PATCH for-2.5] makefile: fix w32 install target for qemu-ga"

> 
> Stefan
>
diff mbox

Patch

diff --git a/Makefile b/Makefile
index 9ce3972..7efca5e 100644
--- a/Makefile
+++ b/Makefile
@@ -290,18 +290,15 @@  $(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)
 
-# 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), $^))
+qemu-ga$(EXESUF): $(qga-obj-y) libqemuutil.a libqemustub.a
+	$(call LINK, $^)
 
 ifdef QEMU_GA_MSI_ENABLED
 QEMU_GA_MSI=qemu-ga-$(ARCH).msi
 
 msi: $(QEMU_GA_MSI)
 
-$(QEMU_GA_MSI): qemu-ga.exe
+$(QEMU_GA_MSI): qemu-ga.exe $(QGA_VSS_PROVIDER)
 
 $(QEMU_GA_MSI): config-host.mak
 
@@ -313,6 +310,11 @@  msi:
 	@echo "MSI build not configured or dependency resolution failed (reconfigure with --enable-guest-agent-msi option)"
 endif
 
+ifneq ($(EXESUF),)
+.PHONY: qemu-ga
+qemu-ga: qemu-ga$(EXESUF) $(QGA_VSS_PROVIDER) $(QEMU_GA_MSI)
+endif
+
 clean:
 # avoid old build problems by removing potentially incorrect old files
 	rm -f config.mak op-i386.h opc-i386.h gen-op-i386.h op-arm.h opc-arm.h gen-op-arm.h
diff --git a/configure b/configure
index d854936..fc34443 100755
--- a/configure
+++ b/configure
@@ -4350,7 +4350,7 @@  fi
 
 if [ "$guest_agent" != "no" ]; then
   if [ "$linux" = "yes" -o "$bsd" = "yes" -o "$solaris" = "yes" -o "$mingw32" = "yes" ] ; then
-      tools="qemu-ga\$(EXESUF) $tools"
+      tools="qemu-ga $tools"
       guest_agent=yes
   elif [ "$guest_agent" != yes ]; then
       guest_agent=no