diff mbox

[v4,05/10] qemu-ga: Add configure options to specify path to Windows/VSS SDK

Message ID 20130606150641.10486.35710.stgit@hds.com
State New
Headers show

Commit Message

Tomoki Sekiyama June 6, 2013, 3:06 p.m. UTC
To enable VSS support in qemu-ga for Windows, header files included in
VSS SDK are required.
The VSS support is enabled by the configure option like below:
  ./configure --with-vss-sdk="/path/to/VSS SDK"

If the path is omitted, it tries to search the headers from default paths
and VSS support is enabled only if the SDK is found.
VSS support is disabled if --without-vss-sdk or --with-vss-sdk=no is
specified.

VSS SDK is available from:
  http://www.microsoft.com/en-us/download/details.aspx?id=23490

To cross-compile using mingw, you need to setup the SDK on Windows
environments to extract headers. You can also extract the SDK headers on
POSIX environments using scripts/extract-vss-headers and msitools.

In addition, --with-win-sdk="/path/to/Windows SDK" option is also added to
specify path to Windows SDK, which may be used for native-compile of .tlb
file of qemu-ga VSS provider. However, this is usually unnecessary because
pre-compiled .tlb file is included.

Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
---
 .gitignore |    1 +
 Makefile   |    1 +
 configure  |   69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
 3 files changed, 71 insertions(+)

Comments

Laszlo Ersek June 25, 2013, 11:16 a.m. UTC | #1
On 06/06/13 17:06, Tomoki Sekiyama wrote:
> To enable VSS support in qemu-ga for Windows, header files included in
> VSS SDK are required.
> The VSS support is enabled by the configure option like below:
>   ./configure --with-vss-sdk="/path/to/VSS SDK"
> 
> If the path is omitted, it tries to search the headers from default paths
> and VSS support is enabled only if the SDK is found.
> VSS support is disabled if --without-vss-sdk or --with-vss-sdk=no is
> specified.
> 
> VSS SDK is available from:
>   http://www.microsoft.com/en-us/download/details.aspx?id=23490
> 
> To cross-compile using mingw, you need to setup the SDK on Windows
> environments to extract headers. You can also extract the SDK headers on
> POSIX environments using scripts/extract-vss-headers and msitools.
> 
> In addition, --with-win-sdk="/path/to/Windows SDK" option is also added to
> specify path to Windows SDK, which may be used for native-compile of .tlb
> file of qemu-ga VSS provider. However, this is usually unnecessary because
> pre-compiled .tlb file is included.
> 
> Signed-off-by: Tomoki Sekiyama <tomoki.sekiyama@hds.com>
> ---
>  .gitignore |    1 +
>  Makefile   |    1 +
>  configure  |   69 ++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++
>  3 files changed, 71 insertions(+)

Reviewed-by: Laszlo Ersek <lersek@redhat.com>
Daniel P. Berrangé June 28, 2013, 10:43 a.m. UTC | #2
On Tue, Jun 25, 2013 at 01:16:38PM +0200, Laszlo Ersek wrote:
> On 06/06/13 17:06, Tomoki Sekiyama wrote:
> > To enable VSS support in qemu-ga for Windows, header files included in
> > VSS SDK are required.
> > The VSS support is enabled by the configure option like below:
> >   ./configure --with-vss-sdk="/path/to/VSS SDK"
> > 
> > If the path is omitted, it tries to search the headers from default paths
> > and VSS support is enabled only if the SDK is found.
> > VSS support is disabled if --without-vss-sdk or --with-vss-sdk=no is
> > specified.
> > 
> > VSS SDK is available from:
> >   http://www.microsoft.com/en-us/download/details.aspx?id=23490
> > 
> > To cross-compile using mingw, you need to setup the SDK on Windows
> > environments to extract headers. You can also extract the SDK headers on
> > POSIX environments using scripts/extract-vss-headers and msitools.

What is the license of the VSS SDK ?  In particular is the license
compatible with QEMU to allow us to link to it from GPL code ?

Daniel
Paolo Bonzini June 28, 2013, 10:54 a.m. UTC | #3
Il 28/06/2013 12:43, Daniel P. Berrange ha scritto:
> On Tue, Jun 25, 2013 at 01:16:38PM +0200, Laszlo Ersek wrote:
>> On 06/06/13 17:06, Tomoki Sekiyama wrote:
>>> To enable VSS support in qemu-ga for Windows, header files included in
>>> VSS SDK are required.
>>> The VSS support is enabled by the configure option like below:
>>>   ./configure --with-vss-sdk="/path/to/VSS SDK"
>>>
>>> If the path is omitted, it tries to search the headers from default paths
>>> and VSS support is enabled only if the SDK is found.
>>> VSS support is disabled if --without-vss-sdk or --with-vss-sdk=no is
>>> specified.
>>>
>>> VSS SDK is available from:
>>>   http://www.microsoft.com/en-us/download/details.aspx?id=23490
>>>
>>> To cross-compile using mingw, you need to setup the SDK on Windows
>>> environments to extract headers. You can also extract the SDK headers on
>>> POSIX environments using scripts/extract-vss-headers and msitools.
> 
> What is the license of the VSS SDK ?  In particular is the license
> compatible with QEMU to allow us to link to it from GPL code ?

Doesn't it fall under the "operating system component" exception?

Paolo
Daniel P. Berrangé June 28, 2013, 11:01 a.m. UTC | #4
On Fri, Jun 28, 2013 at 12:54:04PM +0200, Paolo Bonzini wrote:
> Il 28/06/2013 12:43, Daniel P. Berrange ha scritto:
> > On Tue, Jun 25, 2013 at 01:16:38PM +0200, Laszlo Ersek wrote:
> >> On 06/06/13 17:06, Tomoki Sekiyama wrote:
> >>> To enable VSS support in qemu-ga for Windows, header files included in
> >>> VSS SDK are required.
> >>> The VSS support is enabled by the configure option like below:
> >>>   ./configure --with-vss-sdk="/path/to/VSS SDK"
> >>>
> >>> If the path is omitted, it tries to search the headers from default paths
> >>> and VSS support is enabled only if the SDK is found.
> >>> VSS support is disabled if --without-vss-sdk or --with-vss-sdk=no is
> >>> specified.
> >>>
> >>> VSS SDK is available from:
> >>>   http://www.microsoft.com/en-us/download/details.aspx?id=23490
> >>>
> >>> To cross-compile using mingw, you need to setup the SDK on Windows
> >>> environments to extract headers. You can also extract the SDK headers on
> >>> POSIX environments using scripts/extract-vss-headers and msitools.
> > 
> > What is the license of the VSS SDK ?  In particular is the license
> > compatible with QEMU to allow us to link to it from GPL code ?
> 
> Doesn't it fall under the "operating system component" exception?

Maybe, maybe no. I think it depends what the VSS SDK actually includes.

IANAL, but my interpretation is that the exception would only apply
to stuff that is distributed as part of the base Windows install. Since
this is a separate download from Microsoft, it isn't clear to me that
the exception would apply in this case.

Does the VSS SDK actually include the .dll library that qemu-ga would
be linking aginst, or is the .dll part of base windows install, and
VSS SDK merely includes the header files needed for compilation ?

If in doubt, I always tend to err on the side of caution when dealing
with licensing for any microsoft provided software.

Daniel
Laszlo Ersek June 28, 2013, 11:05 a.m. UTC | #5
On 06/28/13 12:43, Daniel P. Berrange wrote:
> On Tue, Jun 25, 2013 at 01:16:38PM +0200, Laszlo Ersek wrote:
>> On 06/06/13 17:06, Tomoki Sekiyama wrote:
>>> To enable VSS support in qemu-ga for Windows, header files included in
>>> VSS SDK are required.
>>> The VSS support is enabled by the configure option like below:
>>>   ./configure --with-vss-sdk="/path/to/VSS SDK"
>>>
>>> If the path is omitted, it tries to search the headers from default paths
>>> and VSS support is enabled only if the SDK is found.
>>> VSS support is disabled if --without-vss-sdk or --with-vss-sdk=no is
>>> specified.
>>>
>>> VSS SDK is available from:
>>>   http://www.microsoft.com/en-us/download/details.aspx?id=23490
>>>
>>> To cross-compile using mingw, you need to setup the SDK on Windows
>>> environments to extract headers. You can also extract the SDK headers on
>>> POSIX environments using scripts/extract-vss-headers and msitools.
> 
> What is the license of the VSS SDK ?  In particular is the license
> compatible with QEMU to allow us to link to it from GPL code ?

Thanks for raising this -- I think we should first figure out what
constitutes derivative work of what in this case (according to the FSF's
interpretation). I'd like to take a passive (r/o) role in that
discussion. I'm adding Anthony to the To: list.

Thanks,
Laszlo
Paolo Bonzini June 28, 2013, 11:18 a.m. UTC | #6
Il 28/06/2013 13:01, Daniel P. Berrange ha scritto:
>>> What is the license of the VSS SDK ?  In particular is the license
>>> compatible with QEMU to allow us to link to it from GPL code ?
>>
>> Doesn't it fall under the "operating system component" exception?
> 
> Maybe, maybe no. I think it depends what the VSS SDK actually includes.
> 
> IANAL, but my interpretation is that the exception would only apply
> to stuff that is distributed as part of the base Windows install. Since
> this is a separate download from Microsoft, it isn't clear to me that
> the exception would apply in this case.
> 
> Does the VSS SDK actually include the .dll library that qemu-ga would
> be linking aginst, or is the .dll part of base windows install, and
> VSS SDK merely includes the header files needed for compilation ?

Only the headers, the IDL files, and the "import libraries":

Program Files/Microsoft/VSSSDK72/lib/winxp/obj/i386/vss_uuid.lib
Program Files/Microsoft/VSSSDK72/lib/winxp/obj/i386/vssapi.lib
Program Files/Microsoft/VSSSDK72/lib/win2003/obj/ia64/vss_uuid.lib
Program Files/Microsoft/VSSSDK72/lib/win2003/obj/ia64/vssapi.lib
Program Files/Microsoft/VSSSDK72/lib/win2003/obj/i386/vssapi.lib
Program Files/Microsoft/VSSSDK72/lib/win2003/obj/i386/vss_uuid.lib
Program Files/Microsoft/VSSSDK72/lib/win2003/obj/amd64/vss_uuid.lib
Program Files/Microsoft/VSSSDK72/lib/win2003/obj/amd64/vssapi.lib
Program Files/Microsoft/VSSSDK72/inc/winxp/vss.h
Program Files/Microsoft/VSSSDK72/inc/winxp/vswriter.h
Program Files/Microsoft/VSSSDK72/inc/winxp/vsbackup.h
Program Files/Microsoft/VSSSDK72/inc/win2003/vdslun.h
Program Files/Microsoft/VSSSDK72/inc/win2003/vswriter.h
Program Files/Microsoft/VSSSDK72/inc/win2003/vsmgmt.h
Program Files/Microsoft/VSSSDK72/inc/win2003/vscoordint.h
Program Files/Microsoft/VSSSDK72/inc/win2003/vscoordint.idl
Program Files/Microsoft/VSSSDK72/inc/win2003/vsswprv.idl
Program Files/Microsoft/VSSSDK72/inc/win2003/vsswprv.h
Program Files/Microsoft/VSSSDK72/inc/win2003/vss.idl
Program Files/Microsoft/VSSSDK72/inc/win2003/vss.h
Program Files/Microsoft/VSSSDK72/inc/win2003/vdslun.idl
Program Files/Microsoft/VSSSDK72/inc/win2003/vsbackup.h
Program Files/Microsoft/VSSSDK72/inc/win2003/vsprov.idl
Program Files/Microsoft/VSSSDK72/inc/win2003/vsprov.h
Program Files/Microsoft/VSSSDK72/inc/win2003/vsmgmt.idl

Paolo
Daniel P. Berrangé June 28, 2013, 11:30 a.m. UTC | #7
On Fri, Jun 28, 2013 at 01:18:10PM +0200, Paolo Bonzini wrote:
> Il 28/06/2013 13:01, Daniel P. Berrange ha scritto:
> >>> What is the license of the VSS SDK ?  In particular is the license
> >>> compatible with QEMU to allow us to link to it from GPL code ?
> >>
> >> Doesn't it fall under the "operating system component" exception?
> > 
> > Maybe, maybe no. I think it depends what the VSS SDK actually includes.
> > 
> > IANAL, but my interpretation is that the exception would only apply
> > to stuff that is distributed as part of the base Windows install. Since
> > this is a separate download from Microsoft, it isn't clear to me that
> > the exception would apply in this case.
> > 
> > Does the VSS SDK actually include the .dll library that qemu-ga would
> > be linking aginst, or is the .dll part of base windows install, and
> > VSS SDK merely includes the header files needed for compilation ?
> 
> Only the headers, the IDL files, and the "import libraries":
> 
> Program Files/Microsoft/VSSSDK72/lib/winxp/obj/i386/vss_uuid.lib
> Program Files/Microsoft/VSSSDK72/lib/winxp/obj/i386/vssapi.lib
> Program Files/Microsoft/VSSSDK72/lib/win2003/obj/ia64/vss_uuid.lib
> Program Files/Microsoft/VSSSDK72/lib/win2003/obj/ia64/vssapi.lib
> Program Files/Microsoft/VSSSDK72/lib/win2003/obj/i386/vssapi.lib
> Program Files/Microsoft/VSSSDK72/lib/win2003/obj/i386/vss_uuid.lib
> Program Files/Microsoft/VSSSDK72/lib/win2003/obj/amd64/vss_uuid.lib
> Program Files/Microsoft/VSSSDK72/lib/win2003/obj/amd64/vssapi.lib
> Program Files/Microsoft/VSSSDK72/inc/winxp/vss.h
> Program Files/Microsoft/VSSSDK72/inc/winxp/vswriter.h
> Program Files/Microsoft/VSSSDK72/inc/winxp/vsbackup.h
> Program Files/Microsoft/VSSSDK72/inc/win2003/vdslun.h
> Program Files/Microsoft/VSSSDK72/inc/win2003/vswriter.h
> Program Files/Microsoft/VSSSDK72/inc/win2003/vsmgmt.h
> Program Files/Microsoft/VSSSDK72/inc/win2003/vscoordint.h
> Program Files/Microsoft/VSSSDK72/inc/win2003/vscoordint.idl
> Program Files/Microsoft/VSSSDK72/inc/win2003/vsswprv.idl
> Program Files/Microsoft/VSSSDK72/inc/win2003/vsswprv.h
> Program Files/Microsoft/VSSSDK72/inc/win2003/vss.idl
> Program Files/Microsoft/VSSSDK72/inc/win2003/vss.h
> Program Files/Microsoft/VSSSDK72/inc/win2003/vdslun.idl
> Program Files/Microsoft/VSSSDK72/inc/win2003/vsbackup.h
> Program Files/Microsoft/VSSSDK72/inc/win2003/vsprov.idl
> Program Files/Microsoft/VSSSDK72/inc/win2003/vsprov.h
> Program Files/Microsoft/VSSSDK72/inc/win2003/vsmgmt.idl

That sounds more reasonable then from the POV of the gpl system
components exception.

BTW, I notice that mingw64 includes the vss.h header and vssapi.a library,
so I wonder if that's sufficient to compile this code, without needing
to use the VSS SDK download at all.

Daniel
Paolo Bonzini June 28, 2013, 12:18 p.m. UTC | #8
Il 28/06/2013 13:30, Daniel P. Berrange ha scritto:
> > > > Does the VSS SDK actually include the .dll library that qemu-ga would
> > > > be linking aginst, or is the .dll part of base windows install, and
> > > > VSS SDK merely includes the header files needed for compilation ?
> > 
> > Only the headers, the IDL files, and the "import libraries":
> 
> That sounds more reasonable then from the POV of the gpl system
> components exception.
> 
> BTW, I notice that mingw64 includes the vss.h header and vssapi.a library,
> so I wonder if that's sufficient to compile this code, without needing
> to use the VSS SDK download at all.

No, it is not unfortunately.  It only defines a small subset of the API
(IVssAsync and IVssEnumObject).

Paolo
diff mbox

Patch

diff --git a/.gitignore b/.gitignore
index 64e9466..67facd3 100644
--- a/.gitignore
+++ b/.gitignore
@@ -79,6 +79,7 @@  fsdev/virtfs-proxy-helper.pod
 *.la
 *.pc
 .libs
+.sdk
 *.swp
 *.orig
 .pc
diff --git a/Makefile b/Makefile
index a96736b..4851ba0 100644
--- a/Makefile
+++ b/Makefile
@@ -272,6 +272,7 @@  distclean: clean
 	for d in $(TARGET_DIRS); do \
 	rm -rf $$d || exit 1 ; \
         done
+	rm -Rf .sdk
 	if test -f pixman/config.log; then make -C pixman distclean; fi
 	if test -f dtc/version_gen.h; then make $(DTC_MAKE_ARGS) clean; fi
 
diff --git a/configure b/configure
index a2fc3f3..cafe830 100755
--- a/configure
+++ b/configure
@@ -232,6 +232,8 @@  usb_redir=""
 glx=""
 zlib="yes"
 guest_agent="yes"
+guest_agent_with_vss="no"
+vss_win32_sdk=""
 want_tools="yes"
 libiscsi=""
 coroutine=""
@@ -919,6 +921,14 @@  for opt do
   ;;
   --disable-guest-agent) guest_agent="no"
   ;;
+  --with-vss-sdk) vss_win32_sdk=""
+  ;;
+  --with-vss-sdk=*) vss_win32_sdk="$optarg"
+  ;;
+  --without-vss-sdk) vss_win32_sdk="no"
+  ;;
+  --with-win-sdk=*) win_sdk="$optarg"
+  ;;
   --enable-tools) want_tools="yes"
   ;;
   --disable-tools) want_tools="no"
@@ -1151,6 +1161,8 @@  echo "  --disable-usb-redir      disable usb network redirection support"
 echo "  --enable-usb-redir       enable usb network redirection support"
 echo "  --disable-guest-agent    disable building of the QEMU Guest Agent"
 echo "  --enable-guest-agent     enable building of the QEMU Guest Agent"
+echo "  --with-vss-sdk=SDK-path  enable Windows VSS support in QEMU Guest Agent"
+echo "  --with-win-sdk=SDK-path  path to Windows Platform SDK (to build VSS .tlb)"
 echo "  --disable-seccomp        disable seccomp support"
 echo "  --enable-seccomp         enables seccomp support"
 echo "  --with-coroutine=BACKEND coroutine backend. Supported options:"
@@ -3066,6 +3078,57 @@  if test "$usb_redir" != "no" ; then
 fi
 
 ##########################################
+# check if we have VSS SDK headers for win
+
+if test "$mingw32" = "yes" -a "$guest_agent" = "yes" -a "$vss_win32_sdk" != "no" ; then
+  case "$vss_win32_sdk" in
+    "")   vss_win32_include="-I$source_path" ;;
+    *\ *) # The SDK is installed in "Program Files" by default, but we cannot
+          # handle path with spaces. So we symlink the headers into ".sdk/vss".
+          vss_win32_include="-I$source_path/.sdk/vss"
+	  symlink "$vss_win32_sdk/inc" "$source_path/.sdk/vss/inc"
+	  ;;
+    *)    vss_win32_include="-I$vss_win32_sdk"
+  esac
+  cat > $TMPC << EOF
+#define __MIDL_user_allocate_free_DEFINED__
+#include <inc/win2003/vss.h>
+int main(void) { return VSS_CTX_BACKUP; }
+EOF
+  if compile_prog "$vss_win32_include" "" ; then
+    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"
+  else
+    if test "$vss_win32_sdk" != "" ; then
+      echo "ERROR: Please download and install Microsoft VSS SDK:"
+      echo "ERROR:   http://www.microsoft.com/en-us/download/details.aspx?id=23490"
+      echo "ERROR: On POSIX-systems, you can extract the SDK headers by:"
+      echo "ERROR:   scripts/extract-vsssdk-headers setup.exe"
+      echo "ERROR: The headers are extracted in the directory \`inc'."
+      feature_not_found "VSS support"
+    fi
+    guest_agent_with_vss="no"
+  fi
+fi
+
+##########################################
+# lookup Windows platform SDK (if not specified)
+# The SDK is needed only to build .tlb (type library) file of guest agent
+# VSS provider from the source. It is usually unnecessary because the
+# pre-compiled .tlb file is included.
+
+if test "$mingw32" = "yes" -a "$guest_agent" = "yes" -a "$guest_agent_with_vss" = "yes" ; then
+  if test -z "$win_sdk"; then
+    programfiles="$PROGRAMFILES"
+    test -n "$PROGRAMW6432" && programfiles="$PROGRAMW6432"
+    if test -n "$programfiles"; then
+      win_sdk=$(ls -d "$programfiles/Microsoft SDKs/Windows/v"* | tail -1) 2>/dev/null
+    fi
+  fi
+fi
+
+##########################################
 
 ##########################################
 # check if we have fdatasync
@@ -3466,6 +3529,7 @@  echo "Manual directory  `eval echo $mandir`"
 echo "ELF interp prefix $interp_prefix"
 else
 echo "local state directory   queried at runtime"
+echo "Windows SDK       $win_sdk"
 fi
 echo "Source path       $source_path"
 echo "C compiler        $cc"
@@ -3552,6 +3616,7 @@  echo "usb net redir     $usb_redir"
 echo "GLX support       $glx"
 echo "libiscsi support  $libiscsi"
 echo "build guest agent $guest_agent"
+echo "QGA VSS support   $guest_agent_with_vss"
 echo "seccomp support   $seccomp"
 echo "coroutine backend $coroutine"
 echo "GlusterFS support $glusterfs"
@@ -3627,6 +3692,10 @@  if test "$mingw32" = "yes" ; then
   version_micro=0
   echo "CONFIG_FILEVERSION=$version_major,$version_minor,$version_subminor,$version_micro" >> $config_host_mak
   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 "WIN_SDK=\"$win_sdk\"" >> $config_host_mak
+  fi
 else
   echo "CONFIG_POSIX=y" >> $config_host_mak
 fi