[libvirt] PATCH: Latest MinGW patches

I've got a MinGW build environment setup on Fedora 10 now, so just checked out what the latest state of libvirt CVS is. With the attached patch, I can run configure with: ./configure \ --build=i686-pc-linux-gnu \ --host=i686-pc-mingw32 \ --prefix=/usr/i686-pc-mingw32/sys-root/mingw \ --without-libvirtd \ --without-xen \ --without-qemu \ --without-sasl \ --without-lxc \ --without-openvz \ --without-python So, basically only the 'test' and 'remote' drivers are turned on. And do a build which produces a libvirt-0.dll and a virsh.exe which is I can run under Wine successfully. The changes: - The src/Makefile.am was conditionally turning off individual storage driver backends, based on the WITH_LIBVIRTD conditional. THis gave confusing diagnositics, since the configure summary said they were turned on. So, now configure itself turns off the storage drivers if libvirtd is disabled. - The storage_backend.c file is used by storage_Conf.c, so we need to compile this even if all storage backends are disabled. So we tweak src/Makefile.am to achieve this, and add a few more bits of conditional logic inside storage_backend.c to cope with the base directory pool driver not being available. - Mingw is missing regex.h and sys/wait.h, which are used in the generic storage_backend.c file. We check for those in configure and conditionalize their inclusion. Furthermore we disable the virStorageBackendRunProgRegex and virStorageBackendRunProgNul functions on Windows, since they're not required and not compilable without regex.h / sys/wait.h - Mingw is mising getuid() and getgid() which are used in the storage_conf XML parser. We check for and optionally disable them and initialize uid/gid to 0 if missing. - The virExec() stub routine for Mingw didn't have its signature updated when i did the recent virExe changes. THis fixes that. configure.in | 18 +++++++++++++--- qemud/remote_protocol.c | 1 qemud/remote_protocol.h | 1 qemud/remote_protocol.x | 1 src/Makefile.am | 6 ++--- src/storage_backend.c | 53 +++++++++++++++++++++++++++++++++++++++++++----- src/storage_conf.c | 22 +++++++++++++++++-- src/util.c | 17 +++------------ 8 files changed, 92 insertions(+), 27 deletions(-) Daniel diff -r 74dd97c354cc configure.in --- a/configure.in Tue Sep 02 10:49:53 2008 -0400 +++ b/configure.in Wed Sep 03 08:24:04 2008 -0400 @@ -65,10 +65,10 @@ AC_SYS_LARGEFILE dnl Availability of various common functions (non-fatal if missing). -AC_CHECK_FUNCS([cfmakeraw regexec uname sched_getaffinity]) +AC_CHECK_FUNCS([cfmakeraw regexec uname sched_getaffinity getuid getgid]) dnl Availability of various common headers (non-fatal if missing). -AC_CHECK_HEADERS([pwd.h paths.h sys/syslimits.h sys/utsname.h sys/wait.h winsock2.h sched.h termios.h]) +AC_CHECK_HEADERS([pwd.h paths.h regex.h sys/syslimits.h sys/utsname.h sys/wait.h winsock2.h sched.h termios.h]) dnl Where are the XDR functions? dnl If portablexdr is installed, prefer that. @@ -648,6 +648,18 @@ [ --with-storage-iscsi with iSCSI backend for the storage driver (on)],[],[with_storage_iscsi=check]) AC_ARG_WITH([storage-disk], [ --with-storage-disk with GPartd Disk backend for the storage driver (on)],[],[with_storage_disk=check]) + +with_storage_dir=yes +if test "$with_libvirtd" = "no"; then + with_storage_dir=no + with_storage_fs=no + with_storage_lvm=no + with_storage_iscsi=no + with_storage_disk=no +fi + +AM_CONDITIONAL([WITH_STORAGE_DIR], [test "$with_storage_dir" = "yes"]) + if test "$with_storage_fs" = "yes" -o "$with_storage_fs" = "check"; then AC_PATH_PROG([MOUNT], [mount], [], [$PATH:/sbin:/usr/sbin]) @@ -1053,7 +1065,7 @@ AC_MSG_NOTICE([]) AC_MSG_NOTICE([Storage Drivers]) AC_MSG_NOTICE([]) -AC_MSG_NOTICE([ Dir: yes]) +AC_MSG_NOTICE([ Dir: $with_storage_dir]) AC_MSG_NOTICE([ FS: $with_storage_fs]) AC_MSG_NOTICE([ NetFS: $with_storage_fs]) AC_MSG_NOTICE([ LVM: $with_storage_lvm]) diff -r 74dd97c354cc qemud/remote_protocol.c --- a/qemud/remote_protocol.c Tue Sep 02 10:49:53 2008 -0400 +++ b/qemud/remote_protocol.c Wed Sep 03 08:24:04 2008 -0400 @@ -6,6 +6,7 @@ #include "remote_protocol.h" #include <config.h> #include "internal.h" +#include "socketcompat.h" bool_t xdr_remote_nonnull_string (XDR *xdrs, remote_nonnull_string *objp) diff -r 74dd97c354cc qemud/remote_protocol.h --- a/qemud/remote_protocol.h Tue Sep 02 10:49:53 2008 -0400 +++ b/qemud/remote_protocol.h Wed Sep 03 08:24:04 2008 -0400 @@ -15,6 +15,7 @@ #include <config.h> #include "internal.h" +#include "socketcompat.h" #define REMOTE_MESSAGE_MAX 262144 #define REMOTE_STRING_MAX 65536 diff -r 74dd97c354cc qemud/remote_protocol.x --- a/qemud/remote_protocol.x Tue Sep 02 10:49:53 2008 -0400 +++ b/qemud/remote_protocol.x Wed Sep 03 08:24:04 2008 -0400 @@ -38,6 +38,7 @@ %#include <config.h> %#include "internal.h" +%#include "socketcompat.h" /*----- Data types. -----*/ diff -r 74dd97c354cc src/Makefile.am --- a/src/Makefile.am Tue Sep 02 10:49:53 2008 -0400 +++ b/src/Makefile.am Wed Sep 03 08:24:04 2008 -0400 @@ -58,7 +58,8 @@ # Storage driver generic impl APIs STORAGE_CONF_SOURCES = \ - storage_conf.h storage_conf.c + storage_conf.h storage_conf.c \ + storage_backend.h storage_backend.c # The remote RPC driver, covering domains, storage, networks, etc @@ -109,8 +110,7 @@ # And finally storage backend specific impls STORAGE_DRIVER_SOURCES = \ - storage_driver.h storage_driver.c \ - storage_backend.h storage_backend.c + storage_driver.h storage_driver.c STORAGE_DRIVER_FS_SOURCES = \ storage_backend_fs.h storage_backend_fs.c diff -r 74dd97c354cc src/storage_backend.c --- a/src/storage_backend.c Tue Sep 02 10:49:53 2008 -0400 +++ b/src/storage_backend.c Wed Sep 03 08:24:04 2008 -0400 @@ -24,9 +24,13 @@ #include <config.h> #include <string.h> +#if HAVE_REGEX_H #include <regex.h> +#endif #include <sys/types.h> +#if HAVE_SYS_WAIT_H #include <sys/wait.h> +#endif #include <unistd.h> #include <fcntl.h> #include <stdint.h> @@ -38,6 +42,10 @@ #endif #include "internal.h" +#include "util.h" +#include "memory.h" + +#include "storage_backend.h" #if WITH_STORAGE_LVM #include "storage_backend_logical.h" @@ -48,15 +56,14 @@ #if WITH_STORAGE_DISK #include "storage_backend_disk.h" #endif - -#include "util.h" -#include "memory.h" - -#include "storage_backend.h" +#if WITH_STORAGE_DIR #include "storage_backend_fs.h" +#endif static virStorageBackendPtr backends[] = { +#if WITH_STORAGE_DIR &virStorageBackendDirectory, +#endif #if WITH_STORAGE_FS &virStorageBackendFileSystem, &virStorageBackendNetFileSystem, @@ -209,8 +216,12 @@ return -2; if (S_ISREG(sb.st_mode)) { +#ifndef __MINGW32__ vol->allocation = (unsigned long long)sb.st_blocks * (unsigned long long)sb.st_blksize; +#else + vol->allocation = sb.st_size; +#endif /* Regular files may be sparse, so logical size (capacity) is not same * as actual allocation above */ @@ -337,6 +348,8 @@ return devpath; } + +#ifndef __MINGW32__ /* * Run an external program. * @@ -620,3 +633,33 @@ return 0; } + +#else + +int +virStorageBackendRunProgRegex(virConnectPtr conn, + virStoragePoolObjPtr pool ATTRIBUTE_UNUSED, + const char *const*prog ATTRIBUTE_UNUSED, + int nregex ATTRIBUTE_UNUSED, + const char **regex ATTRIBUTE_UNUSED, + int *nvars ATTRIBUTE_UNUSED, + virStorageBackendListVolRegexFunc func ATTRIBUTE_UNUSED, + void *data ATTRIBUTE_UNUSED, + int *outexit ATTRIBUTE_UNUSED) +{ + virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s no implemented on Win32", __FUNCTION__); + return -1; +} + +int +virStorageBackendRunProgNul(virConnectPtr conn, + virStoragePoolObjPtr pool ATTRIBUTE_UNUSED, + const char **prog ATTRIBUTE_UNUSED, + size_t n_columns ATTRIBUTE_UNUSED, + virStorageBackendListVolNulFunc func ATTRIBUTE_UNUSED, + void *data ATTRIBUTE_UNUSED) +{ + virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, "%s no implemented on Win32", __FUNCTION__); + return -1; +} +#endif diff -r 74dd97c354cc src/storage_conf.c --- a/src/storage_conf.c Tue Sep 02 10:49:53 2008 -0400 +++ b/src/storage_conf.c Wed Sep 03 08:24:04 2008 -0400 @@ -188,7 +188,11 @@ } if (virXPathNode(conn, "/pool/permissions/owner", ctxt) == NULL) { +#if HAVE_GETUID perms->uid = getuid(); +#else + perms->uid = 0; +#endif } else { if (virXPathLong(conn, "number(/pool/permissions/owner)", ctxt, &v) < 0) { virStorageReportError(conn, VIR_ERR_XML_ERROR, @@ -199,7 +203,11 @@ } if (virXPathNode(conn, "/pool/permissions/group", ctxt) == NULL) { - perms->uid = getgid(); +#if HAVE_GETGID + perms->gid = getgid(); +#else + perms->gid = 0; +#endif } else { if (virXPathLong(conn, "number(/pool/permissions/group)", ctxt, &v) < 0) { virStorageReportError(conn, VIR_ERR_XML_ERROR, @@ -407,7 +415,7 @@ if (!xml) { if (conn && conn->err.code == VIR_ERR_NONE) virStorageReportError(conn, VIR_ERR_XML_ERROR, - _("failed to parse xml document")); + "%s",_("failed to parse xml document")); goto cleanup; } @@ -569,7 +577,11 @@ } if (virXPathNode(conn, "/volume/permissions/owner", ctxt) == NULL) { +#if HAVE_GETUID perms->uid = getuid(); +#else + perms->uid = 0; +#endif } else { if (virXPathLong(conn, "number(/volume/permissions/owner)", ctxt, &v) < 0) { virStorageReportError(conn, VIR_ERR_XML_ERROR, @@ -579,7 +591,11 @@ perms->uid = (int)v; } if (virXPathNode(conn, "/volume/permissions/group", ctxt) == NULL) { +#if HAVE_GETGID perms->gid = getgid(); +#else + perms->gid = 0; +#endif } else { if (virXPathLong(conn, "number(/volume/permissions/group)", ctxt, &v) < 0) { virStorageReportError(conn, VIR_ERR_XML_ERROR, @@ -778,7 +794,7 @@ if (!xml) { if (conn && conn->err.code == VIR_ERR_NONE) virStorageReportError(conn, VIR_ERR_XML_ERROR, - _("failed to parse xml document")); + "%s", _("failed to parse xml document")); goto cleanup; } diff -r 74dd97c354cc src/util.c --- a/src/util.c Tue Sep 02 10:49:53 2008 -0400 +++ b/src/util.c Wed Sep 03 08:24:04 2008 -0400 @@ -440,22 +440,13 @@ int virExec(virConnectPtr conn, const char *const*argv ATTRIBUTE_UNUSED, + const char *const*envp ATTRIBUTE_UNUSED, + const fd_set *keepfd ATTRIBUTE_UNUSED, int *retpid ATTRIBUTE_UNUSED, int infd ATTRIBUTE_UNUSED, int *outfd ATTRIBUTE_UNUSED, - int *errfd ATTRIBUTE_UNUSED) -{ - ReportError (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__); - return -1; -} - -int -virExecNonBlock(virConnectPtr conn, - const char *const*argv ATTRIBUTE_UNUSED, - int *retpid ATTRIBUTE_UNUSED, - int infd ATTRIBUTE_UNUSED, - int *outfd ATTRIBUTE_UNUSED, - int *errfd ATTRIBUTE_UNUSED) + int *errfd ATTRIBUTE_UNUSED, + int flags ATTRIBUTE_UNUSED) { ReportError (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__); return -1; -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Wed, Sep 03, 2008 at 01:35:27PM +0100, Daniel P. Berrange wrote:
I've got a MinGW build environment setup on Fedora 10 now, so just checked out what the latest state of libvirt CVS is.
With the attached patch, I can run configure with:
./configure \ --build=i686-pc-linux-gnu \ --host=i686-pc-mingw32 \ --prefix=/usr/i686-pc-mingw32/sys-root/mingw \ --without-libvirtd \ --without-xen \ --without-qemu \ --without-sasl \ --without-lxc \ --without-openvz \ --without-python
Forgot to mention you need export PKG_CONFIG_PATH=/usr/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig to ensure it finds the mingw build of libxml2, gnutls, libgcrypt, etc instead of the one on your native host OS. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Wed, Sep 03, 2008 at 01:35:27PM +0100, Daniel P. Berrange wrote:
I've got a MinGW build environment setup on Fedora 10 now, so just checked out what the latest state of libvirt CVS is.
Big +1 Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones Read my OCaml programming blog: http://camltastic.blogspot.com/ Fedora now supports 64 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora

On Wed, Sep 03, 2008 at 01:35:27PM +0100, Daniel P. Berrange wrote:
I've got a MinGW build environment setup on Fedora 10 now, so just checked out what the latest state of libvirt CVS is.
With the attached patch, I can run configure with:
./configure \ --build=i686-pc-linux-gnu \ --host=i686-pc-mingw32 \ --prefix=/usr/i686-pc-mingw32/sys-root/mingw \ --without-libvirtd \ --without-xen \ --without-qemu \ --without-sasl \ --without-lxc \ --without-openvz \ --without-python
Aside from the PKG_CONFIG_PATH I already mentioned you need to set CC and also pass --without-avahi and --without-polkit, so complete invocation is actually PKG_CONFIG_PATH=/usr/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig \ CC="i686-pc-mingw32-gcc" \ ./configure \ --build=$(uname -m)-pc-linux \ --host=i686-pc-mingw32 \ --prefix=/usr/i686-pc-mingw32/sys-root/mingw \ --without-sasl \ --without-avahi \ --without-polkit \ --without-python \ --without-xen \ --without-qemu \ --without-lxc \ --without-openvz \ --without-libvirtd This new version of the patch fixes two small bugs in the original, and also adds the mingw-libvirt.spec.in and makes the autobuild.sh script build this RPM too, if mingw build chain is present. THis means we will get fully validation of the windows compatability for our nightly builds Daniel Index: .cvsignore =================================================================== RCS file: /data/cvs/libvirt/.cvsignore,v retrieving revision 1.10 diff -u -p -r1.10 .cvsignore --- .cvsignore 2 Jan 2008 16:31:21 -0000 1.10 +++ .cvsignore 3 Sep 2008 16:44:21 -0000 @@ -20,6 +20,7 @@ ltconfig update.log libvirt.pc libvirt.spec +mingw-libvirt.spec COPYING m4 ABOUT-NLS Index: Makefile.am =================================================================== RCS file: /data/cvs/libvirt/Makefile.am,v retrieving revision 1.27 diff -u -p -r1.27 Makefile.am --- Makefile.am 13 Jun 2008 09:08:44 -0000 1.27 +++ Makefile.am 3 Sep 2008 16:44:21 -0000 @@ -10,6 +10,7 @@ ACLOCAL_AMFLAGS = -I m4 -I gnulib/m4 EXTRA_DIST = \ libvirt.spec libvirt.spec.in \ + mingw-libvirt.spec mingw-libvirt.spec.in \ libvirt.pc libvirt.pc.in \ $(man_MANS) autobuild.sh \ .x-sc_avoid_if_before_free \ Index: autobuild.sh =================================================================== RCS file: /data/cvs/libvirt/autobuild.sh,v retrieving revision 1.10 diff -u -p -r1.10 autobuild.sh --- autobuild.sh 28 Aug 2008 09:08:44 -0000 1.10 +++ autobuild.sh 3 Sep 2008 16:44:21 -0000 @@ -17,8 +17,6 @@ rm -rf coverage ./autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" \ --enable-test-coverage \ --enable-compile-warnings=error \ - --with-openvz \ - --with-lxc \ --with-xen-proxy # If the MAKEFLAGS envvar does not yet include a -j option, @@ -44,6 +42,7 @@ test -x /usr/bin/lcov && make cov rm -f *.tar.gz make dist + if [ -f /usr/bin/rpmbuild ]; then if [ -n "$AUTOBUILD_COUNTER" ]; then EXTRA_RELEASE=".auto$AUTOBUILD_COUNTER" @@ -51,5 +50,40 @@ if [ -f /usr/bin/rpmbuild ]; then NOW=`date +"%s"` EXTRA_RELEASE=".$USER$NOW" fi - rpmbuild --nodeps --define "extra_release $EXTRA_RELEASE" -ta --clean *.tar.gz + + rpmbuild --nodeps \ + --define "extra_release $EXTRA_RELEASE" \ + --define "_sourcedir `pwd`" \ + -ba --clean libvirt.spec +fi + +if [ -x /usr/bin/i686-pc-mingw32-gcc ]; then + make distclean + + PKG_CONFIG_PATH=$AUTOBUILD_INSTALL_ROOT/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig \ + CC="i686-pc-mingw32-gcc" \ + ./configure \ + --build=$(uname -m)-pc-linux \ + --host=i686-pc-mingw32 \ + --prefix=$AUTOBUILD_INSTALL_ROOT/i686-pc-mingw32/sys-root/mingw \ + --without-sasl \ + --without-avahi \ + --without-polkit \ + --without-python \ + --without-xen \ + --without-qemu \ + --without-lxc \ + --without-openvz \ + --without-libvirtd + + make + make install + + #set -o pipefail + #make check 2>&1 | tee "$RESULTS" + + rpmbuild --nodeps \ + --define "extra_release $EXTRA_RELEASE" \ + --define "_sourcedir `pwd`" \ + -ba --clean mingw-libvirt.spec fi Index: configure.in =================================================================== RCS file: /data/cvs/libvirt/configure.in,v retrieving revision 1.163 diff -u -p -r1.163 configure.in --- configure.in 27 Aug 2008 20:05:58 -0000 1.163 +++ configure.in 3 Sep 2008 16:44:21 -0000 @@ -65,10 +65,10 @@ dnl Use --disable-largefile if you don't AC_SYS_LARGEFILE dnl Availability of various common functions (non-fatal if missing). -AC_CHECK_FUNCS([cfmakeraw regexec uname sched_getaffinity]) +AC_CHECK_FUNCS([cfmakeraw regexec uname sched_getaffinity getuid getgid]) dnl Availability of various common headers (non-fatal if missing). -AC_CHECK_HEADERS([pwd.h paths.h sys/syslimits.h sys/utsname.h sys/wait.h winsock2.h sched.h termios.h]) +AC_CHECK_HEADERS([pwd.h paths.h regex.h sys/syslimits.h sys/utsname.h sys/wait.h winsock2.h sched.h termios.h]) dnl Where are the XDR functions? dnl If portablexdr is installed, prefer that. @@ -649,6 +649,20 @@ AC_ARG_WITH([storage-iscsi], AC_ARG_WITH([storage-disk], [ --with-storage-disk with GPartd Disk backend for the storage driver (on)],[],[with_storage_disk=check]) +with_storage_dir=yes +if test "$with_libvirtd" = "no"; then + with_storage_dir=no + with_storage_fs=no + with_storage_lvm=no + with_storage_iscsi=no + with_storage_disk=no +fi +if test "$with_storage_dir" = "yes" ; then + AC_DEFINE_UNQUOTED([WITH_STORAGE_DIR], 1, [whether directory backend for storage driver is enabled]) +fi +AM_CONDITIONAL([WITH_STORAGE_DIR], [test "$with_storage_dir" = "yes"]) + + if test "$with_storage_fs" = "yes" -o "$with_storage_fs" = "check"; then AC_PATH_PROG([MOUNT], [mount], [], [$PATH:/sbin:/usr/sbin]) AC_PATH_PROG([UMOUNT], [umount], [], [$PATH:/sbin:/usr/sbin]) @@ -1024,7 +1038,7 @@ AC_OUTPUT(Makefile src/Makefile include/ docs/examples/python/Makefile \ gnulib/lib/Makefile \ gnulib/tests/Makefile \ - libvirt.pc libvirt.spec \ + libvirt.pc libvirt.spec mingw-libvirt.spec \ po/Makefile.in \ include/libvirt/Makefile include/libvirt/libvirt.h \ python/Makefile python/tests/Makefile \ @@ -1053,7 +1067,7 @@ AC_MSG_NOTICE([Libvirtd: $with_libvirtd] AC_MSG_NOTICE([]) AC_MSG_NOTICE([Storage Drivers]) AC_MSG_NOTICE([]) -AC_MSG_NOTICE([ Dir: yes]) +AC_MSG_NOTICE([ Dir: $with_storage_dir]) AC_MSG_NOTICE([ FS: $with_storage_fs]) AC_MSG_NOTICE([ NetFS: $with_storage_fs]) AC_MSG_NOTICE([ LVM: $with_storage_lvm]) Index: mingw-libvirt.spec.in =================================================================== RCS file: mingw-libvirt.spec.in diff -N mingw-libvirt.spec.in --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ mingw-libvirt.spec.in 3 Sep 2008 16:44:21 -0000 @@ -0,0 +1,89 @@ +%define __os_install_post /usr/lib/rpm/brp-compress %{nil} + +Name: mingw-libvirt +Version: @VERSION@ +Release: 1%{?dist}%{?extra_release} +Summary: MinGW Windows libvirt virtualization library + +License: LGPLv2+ +Group: Development/Libraries +URL: http://www.libvirt.org/ +Source0: ftp://libvirt.org/libvirt/libvirt-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: mingw-gcc +BuildRequires: mingw-binutils +BuildRequires: mingw-libgpg-error +BuildRequires: mingw-libgcrypt +BuildRequires: mingw-gnutls +BuildRequires: mingw-libxml2 +BuildRequires: mingw-portablexdr + +Requires: mingw-runtime +Requires: mingw-libgpg-error +Requires: mingw-libgcrypt +Requires: mingw-gnutls +Requires: mingw-libxml2 + +%description +MinGW Windows libvirt virtualization library. + + +%prep +%setup -q -n libvirt-%{version} + + +%build +# XXX enable SASL in future +PKG_CONFIG_PATH="%{_prefix}/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig" \ +CC="i686-pc-mingw32-gcc" \ +CFLAGS="-O2 -g -Wall -pipe" \ +./configure \ + --build=%_build \ + --host=i686-pc-mingw32 \ + --prefix=%{_prefix}/i686-pc-mingw32/sys-root/mingw \ + --without-sasl \ + --without-avahi \ + --without-polkit \ + --without-python \ + --without-xen \ + --without-qemu \ + --without-lxc \ + --without-openvz \ + --without-libvirtd +make + + +%install +rm -rf $RPM_BUILD_ROOT + +make DESTDIR=$RPM_BUILD_ROOT install + +rm -rf $RPM_BUILD_ROOT/%{_prefix}/i686-pc-mingw32/sys-root/mingw/etc/libvirt +rm -rf $RPM_BUILD_ROOT/%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/doc/* +rm -rf $RPM_BUILD_ROOT/%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/gtk-doc/* + +%clean +rm -rf $RPM_BUILD_ROOT + + +%files +%defattr(-,root,root) +%{_prefix}/i686-pc-mingw32/sys-root/mingw/bin/libvirt-0.dll +%{_prefix}/i686-pc-mingw32/sys-root/mingw/bin/virsh.exe + +%{_prefix}/i686-pc-mingw32/sys-root/mingw/lib/libvirt.a +%{_prefix}/i686-pc-mingw32/sys-root/mingw/lib/libvirt.dll.a +%{_prefix}/i686-pc-mingw32/sys-root/mingw/lib/libvirt.la +%{_prefix}/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig/libvirt.pc + +%dir %{_prefix}/i686-pc-mingw32/sys-root/mingw/include/libvirt +%{_prefix}/i686-pc-mingw32/sys-root/mingw/include/libvirt/libvirt.h +%{_prefix}/i686-pc-mingw32/sys-root/mingw/include/libvirt/virterror.h + +%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/man/man1/virsh.1* + + +%changelog +* Tue Sep 2 2008 Daniel P. Berrange <berrange@redhat.com> - 0.4.4-1 +- Initial RPM release, largely based on earlier work from several sources. Index: qemud/remote_protocol.c =================================================================== RCS file: /data/cvs/libvirt/qemud/remote_protocol.c,v retrieving revision 1.17 diff -u -p -r1.17 remote_protocol.c --- qemud/remote_protocol.c 27 Aug 2008 20:05:59 -0000 1.17 +++ qemud/remote_protocol.c 3 Sep 2008 16:44:22 -0000 @@ -6,6 +6,7 @@ #include "remote_protocol.h" #include <config.h> #include "internal.h" +#include "socketcompat.h" bool_t xdr_remote_nonnull_string (XDR *xdrs, remote_nonnull_string *objp) Index: qemud/remote_protocol.h =================================================================== RCS file: /data/cvs/libvirt/qemud/remote_protocol.h,v retrieving revision 1.17 diff -u -p -r1.17 remote_protocol.h --- qemud/remote_protocol.h 27 Aug 2008 20:05:59 -0000 1.17 +++ qemud/remote_protocol.h 3 Sep 2008 16:44:22 -0000 @@ -15,6 +15,7 @@ extern "C" { #include <config.h> #include "internal.h" +#include "socketcompat.h" #define REMOTE_MESSAGE_MAX 262144 #define REMOTE_STRING_MAX 65536 Index: qemud/remote_protocol.x =================================================================== RCS file: /data/cvs/libvirt/qemud/remote_protocol.x,v retrieving revision 1.17 diff -u -p -r1.17 remote_protocol.x --- qemud/remote_protocol.x 27 Aug 2008 20:05:59 -0000 1.17 +++ qemud/remote_protocol.x 3 Sep 2008 16:44:22 -0000 @@ -38,6 +38,7 @@ %#include <config.h> %#include "internal.h" +%#include "socketcompat.h" /*----- Data types. -----*/ Index: src/Makefile.am =================================================================== RCS file: /data/cvs/libvirt/src/Makefile.am,v retrieving revision 1.92 diff -u -p -r1.92 Makefile.am --- src/Makefile.am 27 Aug 2008 11:19:45 -0000 1.92 +++ src/Makefile.am 3 Sep 2008 16:44:22 -0000 @@ -58,7 +58,8 @@ NETWORK_CONF_SOURCES = \ # Storage driver generic impl APIs STORAGE_CONF_SOURCES = \ - storage_conf.h storage_conf.c + storage_conf.h storage_conf.c \ + storage_backend.h storage_backend.c # The remote RPC driver, covering domains, storage, networks, etc @@ -109,8 +110,7 @@ QEMU_DRIVER_SOURCES = \ # And finally storage backend specific impls STORAGE_DRIVER_SOURCES = \ - storage_driver.h storage_driver.c \ - storage_backend.h storage_backend.c + storage_driver.h storage_driver.c STORAGE_DRIVER_FS_SOURCES = \ storage_backend_fs.h storage_backend_fs.c Index: src/storage_backend.c =================================================================== RCS file: /data/cvs/libvirt/src/storage_backend.c,v retrieving revision 1.20 diff -u -p -r1.20 storage_backend.c --- src/storage_backend.c 27 Aug 2008 11:42:52 -0000 1.20 +++ src/storage_backend.c 3 Sep 2008 16:44:22 -0000 @@ -24,9 +24,13 @@ #include <config.h> #include <string.h> +#if HAVE_REGEX_H #include <regex.h> +#endif #include <sys/types.h> +#if HAVE_SYS_WAIT_H #include <sys/wait.h> +#endif #include <unistd.h> #include <fcntl.h> #include <stdint.h> @@ -38,6 +42,10 @@ #endif #include "internal.h" +#include "util.h" +#include "memory.h" + +#include "storage_backend.h" #if WITH_STORAGE_LVM #include "storage_backend_logical.h" @@ -48,15 +56,14 @@ #if WITH_STORAGE_DISK #include "storage_backend_disk.h" #endif - -#include "util.h" -#include "memory.h" - -#include "storage_backend.h" +#if WITH_STORAGE_DIR #include "storage_backend_fs.h" +#endif static virStorageBackendPtr backends[] = { +#if WITH_STORAGE_DIR &virStorageBackendDirectory, +#endif #if WITH_STORAGE_FS &virStorageBackendFileSystem, &virStorageBackendNetFileSystem, @@ -209,8 +216,12 @@ virStorageBackendUpdateVolInfoFD(virConn return -2; if (S_ISREG(sb.st_mode)) { +#ifndef __MINGW32__ vol->allocation = (unsigned long long)sb.st_blocks * (unsigned long long)sb.st_blksize; +#else + vol->allocation = sb.st_size; +#endif /* Regular files may be sparse, so logical size (capacity) is not same * as actual allocation above */ @@ -337,6 +348,8 @@ virStorageBackendStablePath(virConnectPt return devpath; } + +#ifndef __MINGW32__ /* * Run an external program. * @@ -620,3 +633,33 @@ virStorageBackendRunProgNul(virConnectPt return 0; } + +#else + +int +virStorageBackendRunProgRegex(virConnectPtr conn, + virStoragePoolObjPtr pool ATTRIBUTE_UNUSED, + const char *const*prog ATTRIBUTE_UNUSED, + int nregex ATTRIBUTE_UNUSED, + const char **regex ATTRIBUTE_UNUSED, + int *nvars ATTRIBUTE_UNUSED, + virStorageBackendListVolRegexFunc func ATTRIBUTE_UNUSED, + void *data ATTRIBUTE_UNUSED, + int *outexit ATTRIBUTE_UNUSED) +{ + virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, _("%s no implemented on Win32"), __FUNCTION__); + return -1; +} + +int +virStorageBackendRunProgNul(virConnectPtr conn, + virStoragePoolObjPtr pool ATTRIBUTE_UNUSED, + const char **prog ATTRIBUTE_UNUSED, + size_t n_columns ATTRIBUTE_UNUSED, + virStorageBackendListVolNulFunc func ATTRIBUTE_UNUSED, + void *data ATTRIBUTE_UNUSED) +{ + virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, _("%s no implemented on Win32"), __FUNCTION__); + return -1; +} +#endif Index: src/storage_conf.c =================================================================== RCS file: /data/cvs/libvirt/src/storage_conf.c,v retrieving revision 1.13 diff -u -p -r1.13 storage_conf.c --- src/storage_conf.c 3 Sep 2008 07:12:37 -0000 1.13 +++ src/storage_conf.c 3 Sep 2008 16:44:22 -0000 @@ -189,7 +189,11 @@ virStoragePoolDefParsePerms(virConnectPt } if (virXPathNode(conn, "/pool/permissions/owner", ctxt) == NULL) { +#if HAVE_GETUID perms->uid = getuid(); +#else + perms->uid = 0; +#endif } else { if (virXPathLong(conn, "number(/pool/permissions/owner)", ctxt, &v) < 0) { virStorageReportError(conn, VIR_ERR_XML_ERROR, @@ -200,7 +204,11 @@ virStoragePoolDefParsePerms(virConnectPt } if (virXPathNode(conn, "/pool/permissions/group", ctxt) == NULL) { - perms->uid = getgid(); +#if HAVE_GETGID + perms->gid = getgid(); +#else + perms->gid = 0; +#endif } else { if (virXPathLong(conn, "number(/pool/permissions/group)", ctxt, &v) < 0) { virStorageReportError(conn, VIR_ERR_XML_ERROR, @@ -425,7 +433,7 @@ virStoragePoolDefParse(virConnectPtr con if (!xml) { if (conn && conn->err.code == VIR_ERR_NONE) virStorageReportError(conn, VIR_ERR_XML_ERROR, - _("failed to parse xml document")); + "%s",_("failed to parse xml document")); goto cleanup; } @@ -590,7 +598,11 @@ virStorageVolDefParsePerms(virConnectPtr } if (virXPathNode(conn, "/volume/permissions/owner", ctxt) == NULL) { +#if HAVE_GETUID perms->uid = getuid(); +#else + perms->uid = 0; +#endif } else { if (virXPathLong(conn, "number(/volume/permissions/owner)", ctxt, &v) < 0) { virStorageReportError(conn, VIR_ERR_XML_ERROR, @@ -600,7 +612,11 @@ virStorageVolDefParsePerms(virConnectPtr perms->uid = (int)v; } if (virXPathNode(conn, "/volume/permissions/group", ctxt) == NULL) { +#if HAVE_GETGID perms->gid = getgid(); +#else + perms->gid = 0; +#endif } else { if (virXPathLong(conn, "number(/volume/permissions/group)", ctxt, &v) < 0) { virStorageReportError(conn, VIR_ERR_XML_ERROR, @@ -799,7 +815,7 @@ virStorageVolDefParse(virConnectPtr conn if (!xml) { if (conn && conn->err.code == VIR_ERR_NONE) virStorageReportError(conn, VIR_ERR_XML_ERROR, - _("failed to parse xml document")); + "%s", _("failed to parse xml document")); goto cleanup; } Index: src/util.c =================================================================== RCS file: /data/cvs/libvirt/src/util.c,v retrieving revision 1.56 diff -u -p -r1.56 util.c --- src/util.c 2 Sep 2008 10:29:51 -0000 1.56 +++ src/util.c 3 Sep 2008 16:44:22 -0000 @@ -440,22 +440,13 @@ virRun(virConnectPtr conn, int virExec(virConnectPtr conn, const char *const*argv ATTRIBUTE_UNUSED, + const char *const*envp ATTRIBUTE_UNUSED, + const fd_set *keepfd ATTRIBUTE_UNUSED, int *retpid ATTRIBUTE_UNUSED, int infd ATTRIBUTE_UNUSED, int *outfd ATTRIBUTE_UNUSED, - int *errfd ATTRIBUTE_UNUSED) -{ - ReportError (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__); - return -1; -} - -int -virExecNonBlock(virConnectPtr conn, - const char *const*argv ATTRIBUTE_UNUSED, - int *retpid ATTRIBUTE_UNUSED, - int infd ATTRIBUTE_UNUSED, - int *outfd ATTRIBUTE_UNUSED, - int *errfd ATTRIBUTE_UNUSED) + int *errfd ATTRIBUTE_UNUSED, + int flags ATTRIBUTE_UNUSED) { ReportError (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__); return -1; -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

"Daniel P. Berrange" <berrange@redhat.com> wrote:
On Wed, Sep 03, 2008 at 01:35:27PM +0100, Daniel P. Berrange wrote:
I've got a MinGW build environment setup on Fedora 10 now, so just checked out what the latest state of libvirt CVS is. ... This new version of the patch fixes two small bugs in the original, and also adds the mingw-libvirt.spec.in and makes the autobuild.sh script build this RPM too, if mingw build chain is present. THis means we will get fully validation of the windows compatability for our nightly builds
Looks fine.
Index: src/storage_backend.c =================================================================== RCS file: /data/cvs/libvirt/src/storage_backend.c,v retrieving revision 1.20 diff -u -p -r1.20 storage_backend.c --- src/storage_backend.c 27 Aug 2008 11:42:52 -0000 1.20 +++ src/storage_backend.c 3 Sep 2008 16:44:22 -0000 @@ -24,9 +24,13 @@ #include <config.h>
#include <string.h> +#if HAVE_REGEX_H #include <regex.h> +#endif #include <sys/types.h> ...
Another option (just to avoid this particular #if/#endif) would be to add "regexp" to the list of modules pulled in from gnulib. Probably not worth it right now, though, since the code that would use it has to remain #ifdef'd out. ...
Index: src/storage_conf.c =================================================================== RCS file: /data/cvs/libvirt/src/storage_conf.c,v retrieving revision 1.13 diff -u -p -r1.13 storage_conf.c --- src/storage_conf.c 3 Sep 2008 07:12:37 -0000 1.13 +++ src/storage_conf.c 3 Sep 2008 16:44:22 -0000 @@ -189,7 +189,11 @@ virStoragePoolDefParsePerms(virConnectPt }
if (virXPathNode(conn, "/pool/permissions/owner", ctxt) == NULL) { +#if HAVE_GETUID perms->uid = getuid(); +#else + perms->uid = 0; +#endif ... +#if HAVE_GETGID + perms->gid = getgid(); +#else + perms->gid = 0; +#endif ... +#if HAVE_GETUID perms->uid = getuid(); +#else + perms->uid = 0; +#endif ... +#if HAVE_GETGID perms->gid = getgid(); +#else + perms->gid = 0; +#endif ... Index: src/util.c =================================================================== RCS file: /data/cvs/libvirt/src/util.c,v retrieving revision 1.56
Instead of adding the #if/else blocks above, how about adding these in some header file? #ifndef HAVE_GETGID static inline gid_t getgid (void) { return 0; } #endif #ifndef HAVE_GETUID static inline uid_t getuid (void) { return 0; } #endif

On Thu, Sep 04, 2008 at 08:24:14AM +0200, Jim Meyering wrote:
Instead of adding the #if/else blocks above, how about adding these in some header file?
#ifndef HAVE_GETGID static inline gid_t getgid (void) { return 0; } #endif
#ifndef HAVE_GETUID static inline uid_t getuid (void) { return 0; } #endif
Hmmm ... It's a bit unexpected to have fundamental syscalls like getuid() implemented as macros which can return 0 ... Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-top is 'top' for virtual machines. Tiny program with many powerful monitoring features, net stats, disk stats, logging, etc. http://et.redhat.com/~rjones/virt-top

"Richard W.M. Jones" <rjones@redhat.com> wrote:
On Thu, Sep 04, 2008 at 08:24:14AM +0200, Jim Meyering wrote:
Instead of adding the #if/else blocks above, how about adding these in some header file?
#ifndef HAVE_GETGID static inline gid_t getgid (void) { return 0; } #endif
#ifndef HAVE_GETUID static inline uid_t getuid (void) { return 0; } #endif
Hmmm ...
It's a bit unexpected to have fundamental syscalls like getuid() implemented as macros which can return 0 ...
Why? If those functions don't exist, this supplies replacements (functions) that have the same semantics as the code in Dan's patch: i.e. pretend UID==0 and GID==0. but with far fewer cpp directives. Doesn't it do the right thing?

On Thu, Sep 04, 2008 at 11:56:44AM +0200, Jim Meyering wrote:
"Richard W.M. Jones" <rjones@redhat.com> wrote:
On Thu, Sep 04, 2008 at 08:24:14AM +0200, Jim Meyering wrote:
Instead of adding the #if/else blocks above, how about adding these in some header file?
#ifndef HAVE_GETGID static inline gid_t getgid (void) { return 0; } #endif
#ifndef HAVE_GETUID static inline uid_t getuid (void) { return 0; } #endif
Hmmm ...
It's a bit unexpected to have fundamental syscalls like getuid() implemented as macros which can return 0 ...
Why? If those functions don't exist, this supplies replacements (functions) that have the same semantics as the code in Dan's patch: i.e. pretend UID==0 and GID==0.
but with far fewer cpp directives.
Doesn't it do the right thing?
It's just a bit worrying that people might use getuid/getgid expecting them to return useful values under Windows, whereas in fact they would be 'silently' returning 0. In earlier versions of libvirt we made all sorts of assumptions about things like read-only connections based on UIDs. When I started the first port to MinGW I found it was useful to flag those and eventually completely remove them: http://www.redhat.com/archives/libvir-list/2007-December/msg00168.html http://www.redhat.com/archives/libvir-list/2008-April/msg00194.html I'm not convinced that we should always be removing #ifdefs at all costs, if in fact those serve to remind us of non-portable code or code which is making unwarranted assumptions. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/

On Thu, Sep 04, 2008 at 11:09:49AM +0100, Richard W.M. Jones wrote:
On Thu, Sep 04, 2008 at 11:56:44AM +0200, Jim Meyering wrote:
"Richard W.M. Jones" <rjones@redhat.com> wrote:
On Thu, Sep 04, 2008 at 08:24:14AM +0200, Jim Meyering wrote:
Instead of adding the #if/else blocks above, how about adding these in some header file?
#ifndef HAVE_GETGID static inline gid_t getgid (void) { return 0; } #endif
#ifndef HAVE_GETUID static inline uid_t getuid (void) { return 0; } #endif
Hmmm ...
It's a bit unexpected to have fundamental syscalls like getuid() implemented as macros which can return 0 ...
Why? If those functions don't exist, this supplies replacements (functions) that have the same semantics as the code in Dan's patch: i.e. pretend UID==0 and GID==0.
but with far fewer cpp directives.
Doesn't it do the right thing?
It's just a bit worrying that people might use getuid/getgid expecting them to return useful values under Windows, whereas in fact they would be 'silently' returning 0.
Yes this is a valid point - but not in the context of this code. This is in the XML parser code for storage APIs - this code couldn't care less whether getuid()/getgid() is returning 0 all the time or not - it is merely passing this data into the XML. The point where the uid/gid field in ths XML / struct is actually used is application code, external to libvirt & they're the ones who would need to know that MinGW has special semantics in this area. So whether we #ifdef inline to storage_conf or create dummy functions in util.h doesn't impact/help external apps. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Thu, Sep 04, 2008 at 08:24:14AM +0200, Jim Meyering wrote:
"Daniel P. Berrange" <berrange@redhat.com> wrote:
On Wed, Sep 03, 2008 at 01:35:27PM +0100, Daniel P. Berrange wrote:
I've got a MinGW build environment setup on Fedora 10 now, so just checked out what the latest state of libvirt CVS is. ... This new version of the patch fixes two small bugs in the original, and also adds the mingw-libvirt.spec.in and makes the autobuild.sh script build this RPM too, if mingw build chain is present. THis means we will get fully validation of the windows compatability for our nightly builds
Instead of adding the #if/else blocks above, how about adding these in some header file?
#ifndef HAVE_GETGID static inline gid_t getgid (void) { return 0; } #endif
#ifndef HAVE_GETUID static inline uid_t getuid (void) { return 0; } #endif
Attached is a version with that change - though I had to make it 'int' for the return type since uid_t/gid_t don't exist on mingw either. Not that it matters, since we store the result in an int anyway Daniel Index: .cvsignore =================================================================== RCS file: /data/cvs/libvirt/.cvsignore,v retrieving revision 1.10 diff -u -p -r1.10 .cvsignore --- .cvsignore 2 Jan 2008 16:31:21 -0000 1.10 +++ .cvsignore 4 Sep 2008 11:00:17 -0000 @@ -20,6 +20,7 @@ ltconfig update.log libvirt.pc libvirt.spec +mingw-libvirt.spec COPYING m4 ABOUT-NLS Index: Makefile.am =================================================================== RCS file: /data/cvs/libvirt/Makefile.am,v retrieving revision 1.27 diff -u -p -r1.27 Makefile.am --- Makefile.am 13 Jun 2008 09:08:44 -0000 1.27 +++ Makefile.am 4 Sep 2008 11:00:17 -0000 @@ -10,6 +10,7 @@ ACLOCAL_AMFLAGS = -I m4 -I gnulib/m4 EXTRA_DIST = \ libvirt.spec libvirt.spec.in \ + mingw-libvirt.spec mingw-libvirt.spec.in \ libvirt.pc libvirt.pc.in \ $(man_MANS) autobuild.sh \ .x-sc_avoid_if_before_free \ Index: autobuild.sh =================================================================== RCS file: /data/cvs/libvirt/autobuild.sh,v retrieving revision 1.10 diff -u -p -r1.10 autobuild.sh --- autobuild.sh 28 Aug 2008 09:08:44 -0000 1.10 +++ autobuild.sh 4 Sep 2008 11:00:17 -0000 @@ -17,8 +17,6 @@ rm -rf coverage ./autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" \ --enable-test-coverage \ --enable-compile-warnings=error \ - --with-openvz \ - --with-lxc \ --with-xen-proxy # If the MAKEFLAGS envvar does not yet include a -j option, @@ -44,6 +42,7 @@ test -x /usr/bin/lcov && make cov rm -f *.tar.gz make dist + if [ -f /usr/bin/rpmbuild ]; then if [ -n "$AUTOBUILD_COUNTER" ]; then EXTRA_RELEASE=".auto$AUTOBUILD_COUNTER" @@ -51,5 +50,40 @@ if [ -f /usr/bin/rpmbuild ]; then NOW=`date +"%s"` EXTRA_RELEASE=".$USER$NOW" fi - rpmbuild --nodeps --define "extra_release $EXTRA_RELEASE" -ta --clean *.tar.gz + + rpmbuild --nodeps \ + --define "extra_release $EXTRA_RELEASE" \ + --define "_sourcedir `pwd`" \ + -ba --clean libvirt.spec +fi + +if [ -x /usr/bin/i686-pc-mingw32-gcc ]; then + make distclean + + PKG_CONFIG_PATH=$AUTOBUILD_INSTALL_ROOT/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig \ + CC="i686-pc-mingw32-gcc" \ + ./configure \ + --build=$(uname -m)-pc-linux \ + --host=i686-pc-mingw32 \ + --prefix=$AUTOBUILD_INSTALL_ROOT/i686-pc-mingw32/sys-root/mingw \ + --without-sasl \ + --without-avahi \ + --without-polkit \ + --without-python \ + --without-xen \ + --without-qemu \ + --without-lxc \ + --without-openvz \ + --without-libvirtd + + make + make install + + #set -o pipefail + #make check 2>&1 | tee "$RESULTS" + + rpmbuild --nodeps \ + --define "extra_release $EXTRA_RELEASE" \ + --define "_sourcedir `pwd`" \ + -ba --clean mingw-libvirt.spec fi Index: configure.in =================================================================== RCS file: /data/cvs/libvirt/configure.in,v retrieving revision 1.164 diff -u -p -r1.164 configure.in --- configure.in 4 Sep 2008 10:44:23 -0000 1.164 +++ configure.in 4 Sep 2008 11:00:17 -0000 @@ -65,10 +65,10 @@ dnl Use --disable-largefile if you don't AC_SYS_LARGEFILE dnl Availability of various common functions (non-fatal if missing). -AC_CHECK_FUNCS([cfmakeraw regexec uname sched_getaffinity]) +AC_CHECK_FUNCS([cfmakeraw regexec uname sched_getaffinity getuid getgid]) dnl Availability of various common headers (non-fatal if missing). -AC_CHECK_HEADERS([pwd.h paths.h sys/syslimits.h sys/utsname.h sys/wait.h winsock2.h sched.h termios.h]) +AC_CHECK_HEADERS([pwd.h paths.h regex.h sys/syslimits.h sys/utsname.h sys/wait.h winsock2.h sched.h termios.h]) dnl Where are the XDR functions? dnl If portablexdr is installed, prefer that. @@ -649,6 +649,20 @@ AC_ARG_WITH([storage-iscsi], AC_ARG_WITH([storage-disk], [ --with-storage-disk with GPartd Disk backend for the storage driver (on)],[],[with_storage_disk=check]) +with_storage_dir=yes +if test "$with_libvirtd" = "no"; then + with_storage_dir=no + with_storage_fs=no + with_storage_lvm=no + with_storage_iscsi=no + with_storage_disk=no +fi +if test "$with_storage_dir" = "yes" ; then + AC_DEFINE_UNQUOTED([WITH_STORAGE_DIR], 1, [whether directory backend for storage driver is enabled]) +fi +AM_CONDITIONAL([WITH_STORAGE_DIR], [test "$with_storage_dir" = "yes"]) + + if test "$with_storage_fs" = "yes" -o "$with_storage_fs" = "check"; then AC_PATH_PROG([MOUNT], [mount], [], [$PATH:/sbin:/usr/sbin]) AC_PATH_PROG([UMOUNT], [umount], [], [$PATH:/sbin:/usr/sbin]) @@ -1024,7 +1038,7 @@ AC_OUTPUT(Makefile src/Makefile include/ docs/examples/python/Makefile \ gnulib/lib/Makefile \ gnulib/tests/Makefile \ - libvirt.pc libvirt.spec \ + libvirt.pc libvirt.spec mingw-libvirt.spec \ po/Makefile.in \ include/libvirt/Makefile include/libvirt/libvirt.h \ python/Makefile python/tests/Makefile \ @@ -1053,7 +1067,7 @@ AC_MSG_NOTICE([Libvirtd: $with_libvirtd] AC_MSG_NOTICE([]) AC_MSG_NOTICE([Storage Drivers]) AC_MSG_NOTICE([]) -AC_MSG_NOTICE([ Dir: yes]) +AC_MSG_NOTICE([ Dir: $with_storage_dir]) AC_MSG_NOTICE([ FS: $with_storage_fs]) AC_MSG_NOTICE([ NetFS: $with_storage_fs]) AC_MSG_NOTICE([ LVM: $with_storage_lvm]) Index: mingw-libvirt.spec.in =================================================================== RCS file: mingw-libvirt.spec.in diff -N mingw-libvirt.spec.in --- /dev/null 1 Jan 1970 00:00:00 -0000 +++ mingw-libvirt.spec.in 4 Sep 2008 11:00:17 -0000 @@ -0,0 +1,89 @@ +%define __os_install_post /usr/lib/rpm/brp-compress %{nil} + +Name: mingw-libvirt +Version: @VERSION@ +Release: 1%{?dist}%{?extra_release} +Summary: MinGW Windows libvirt virtualization library + +License: LGPLv2+ +Group: Development/Libraries +URL: http://www.libvirt.org/ +Source0: ftp://libvirt.org/libvirt/libvirt-%{version}.tar.gz +BuildRoot: %{_tmppath}/%{name}-%{version}-%{release}-root-%(%{__id_u} -n) + +BuildRequires: mingw-gcc +BuildRequires: mingw-binutils +BuildRequires: mingw-libgpg-error +BuildRequires: mingw-libgcrypt +BuildRequires: mingw-gnutls +BuildRequires: mingw-libxml2 +BuildRequires: mingw-portablexdr + +Requires: mingw-runtime +Requires: mingw-libgpg-error +Requires: mingw-libgcrypt +Requires: mingw-gnutls +Requires: mingw-libxml2 + +%description +MinGW Windows libvirt virtualization library. + + +%prep +%setup -q -n libvirt-%{version} + + +%build +# XXX enable SASL in future +PKG_CONFIG_PATH="%{_prefix}/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig" \ +CC="i686-pc-mingw32-gcc" \ +CFLAGS="-O2 -g -Wall -pipe" \ +./configure \ + --build=%_build \ + --host=i686-pc-mingw32 \ + --prefix=%{_prefix}/i686-pc-mingw32/sys-root/mingw \ + --without-sasl \ + --without-avahi \ + --without-polkit \ + --without-python \ + --without-xen \ + --without-qemu \ + --without-lxc \ + --without-openvz \ + --without-libvirtd +make + + +%install +rm -rf $RPM_BUILD_ROOT + +make DESTDIR=$RPM_BUILD_ROOT install + +rm -rf $RPM_BUILD_ROOT/%{_prefix}/i686-pc-mingw32/sys-root/mingw/etc/libvirt +rm -rf $RPM_BUILD_ROOT/%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/doc/* +rm -rf $RPM_BUILD_ROOT/%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/gtk-doc/* + +%clean +rm -rf $RPM_BUILD_ROOT + + +%files +%defattr(-,root,root) +%{_prefix}/i686-pc-mingw32/sys-root/mingw/bin/libvirt-0.dll +%{_prefix}/i686-pc-mingw32/sys-root/mingw/bin/virsh.exe + +%{_prefix}/i686-pc-mingw32/sys-root/mingw/lib/libvirt.a +%{_prefix}/i686-pc-mingw32/sys-root/mingw/lib/libvirt.dll.a +%{_prefix}/i686-pc-mingw32/sys-root/mingw/lib/libvirt.la +%{_prefix}/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig/libvirt.pc + +%dir %{_prefix}/i686-pc-mingw32/sys-root/mingw/include/libvirt +%{_prefix}/i686-pc-mingw32/sys-root/mingw/include/libvirt/libvirt.h +%{_prefix}/i686-pc-mingw32/sys-root/mingw/include/libvirt/virterror.h + +%{_prefix}/i686-pc-mingw32/sys-root/mingw/share/man/man1/virsh.1* + + +%changelog +* Tue Sep 2 2008 Daniel P. Berrange <berrange@redhat.com> - 0.4.4-1 +- Initial RPM release, largely based on earlier work from several sources. Index: qemud/remote_protocol.c =================================================================== RCS file: /data/cvs/libvirt/qemud/remote_protocol.c,v retrieving revision 1.17 diff -u -p -r1.17 remote_protocol.c --- qemud/remote_protocol.c 27 Aug 2008 20:05:59 -0000 1.17 +++ qemud/remote_protocol.c 4 Sep 2008 11:00:17 -0000 @@ -6,6 +6,7 @@ #include "remote_protocol.h" #include <config.h> #include "internal.h" +#include "socketcompat.h" bool_t xdr_remote_nonnull_string (XDR *xdrs, remote_nonnull_string *objp) Index: qemud/remote_protocol.h =================================================================== RCS file: /data/cvs/libvirt/qemud/remote_protocol.h,v retrieving revision 1.17 diff -u -p -r1.17 remote_protocol.h --- qemud/remote_protocol.h 27 Aug 2008 20:05:59 -0000 1.17 +++ qemud/remote_protocol.h 4 Sep 2008 11:00:17 -0000 @@ -15,6 +15,7 @@ extern "C" { #include <config.h> #include "internal.h" +#include "socketcompat.h" #define REMOTE_MESSAGE_MAX 262144 #define REMOTE_STRING_MAX 65536 Index: qemud/remote_protocol.x =================================================================== RCS file: /data/cvs/libvirt/qemud/remote_protocol.x,v retrieving revision 1.17 diff -u -p -r1.17 remote_protocol.x --- qemud/remote_protocol.x 27 Aug 2008 20:05:59 -0000 1.17 +++ qemud/remote_protocol.x 4 Sep 2008 11:00:17 -0000 @@ -38,6 +38,7 @@ %#include <config.h> %#include "internal.h" +%#include "socketcompat.h" /*----- Data types. -----*/ Index: src/Makefile.am =================================================================== RCS file: /data/cvs/libvirt/src/Makefile.am,v retrieving revision 1.92 diff -u -p -r1.92 Makefile.am --- src/Makefile.am 27 Aug 2008 11:19:45 -0000 1.92 +++ src/Makefile.am 4 Sep 2008 11:00:17 -0000 @@ -58,7 +58,8 @@ NETWORK_CONF_SOURCES = \ # Storage driver generic impl APIs STORAGE_CONF_SOURCES = \ - storage_conf.h storage_conf.c + storage_conf.h storage_conf.c \ + storage_backend.h storage_backend.c # The remote RPC driver, covering domains, storage, networks, etc @@ -109,8 +110,7 @@ QEMU_DRIVER_SOURCES = \ # And finally storage backend specific impls STORAGE_DRIVER_SOURCES = \ - storage_driver.h storage_driver.c \ - storage_backend.h storage_backend.c + storage_driver.h storage_driver.c STORAGE_DRIVER_FS_SOURCES = \ storage_backend_fs.h storage_backend_fs.c Index: src/storage_backend.c =================================================================== RCS file: /data/cvs/libvirt/src/storage_backend.c,v retrieving revision 1.20 diff -u -p -r1.20 storage_backend.c --- src/storage_backend.c 27 Aug 2008 11:42:52 -0000 1.20 +++ src/storage_backend.c 4 Sep 2008 11:00:17 -0000 @@ -24,9 +24,13 @@ #include <config.h> #include <string.h> +#if HAVE_REGEX_H #include <regex.h> +#endif #include <sys/types.h> +#if HAVE_SYS_WAIT_H #include <sys/wait.h> +#endif #include <unistd.h> #include <fcntl.h> #include <stdint.h> @@ -38,6 +42,10 @@ #endif #include "internal.h" +#include "util.h" +#include "memory.h" + +#include "storage_backend.h" #if WITH_STORAGE_LVM #include "storage_backend_logical.h" @@ -48,15 +56,14 @@ #if WITH_STORAGE_DISK #include "storage_backend_disk.h" #endif - -#include "util.h" -#include "memory.h" - -#include "storage_backend.h" +#if WITH_STORAGE_DIR #include "storage_backend_fs.h" +#endif static virStorageBackendPtr backends[] = { +#if WITH_STORAGE_DIR &virStorageBackendDirectory, +#endif #if WITH_STORAGE_FS &virStorageBackendFileSystem, &virStorageBackendNetFileSystem, @@ -209,8 +216,12 @@ virStorageBackendUpdateVolInfoFD(virConn return -2; if (S_ISREG(sb.st_mode)) { +#ifndef __MINGW32__ vol->allocation = (unsigned long long)sb.st_blocks * (unsigned long long)sb.st_blksize; +#else + vol->allocation = sb.st_size; +#endif /* Regular files may be sparse, so logical size (capacity) is not same * as actual allocation above */ @@ -337,6 +348,8 @@ virStorageBackendStablePath(virConnectPt return devpath; } + +#ifndef __MINGW32__ /* * Run an external program. * @@ -620,3 +633,33 @@ virStorageBackendRunProgNul(virConnectPt return 0; } + +#else + +int +virStorageBackendRunProgRegex(virConnectPtr conn, + virStoragePoolObjPtr pool ATTRIBUTE_UNUSED, + const char *const*prog ATTRIBUTE_UNUSED, + int nregex ATTRIBUTE_UNUSED, + const char **regex ATTRIBUTE_UNUSED, + int *nvars ATTRIBUTE_UNUSED, + virStorageBackendListVolRegexFunc func ATTRIBUTE_UNUSED, + void *data ATTRIBUTE_UNUSED, + int *outexit ATTRIBUTE_UNUSED) +{ + virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, _("%s not implemented on Win32"), __FUNCTION__); + return -1; +} + +int +virStorageBackendRunProgNul(virConnectPtr conn, + virStoragePoolObjPtr pool ATTRIBUTE_UNUSED, + const char **prog ATTRIBUTE_UNUSED, + size_t n_columns ATTRIBUTE_UNUSED, + virStorageBackendListVolNulFunc func ATTRIBUTE_UNUSED, + void *data ATTRIBUTE_UNUSED) +{ + virStorageReportError(conn, VIR_ERR_INTERNAL_ERROR, _("%s not implemented on Win32"), __FUNCTION__); + return -1; +} +#endif Index: src/storage_conf.c =================================================================== RCS file: /data/cvs/libvirt/src/storage_conf.c,v retrieving revision 1.13 diff -u -p -r1.13 storage_conf.c --- src/storage_conf.c 3 Sep 2008 07:12:37 -0000 1.13 +++ src/storage_conf.c 4 Sep 2008 11:00:17 -0000 @@ -200,7 +200,7 @@ virStoragePoolDefParsePerms(virConnectPt } if (virXPathNode(conn, "/pool/permissions/group", ctxt) == NULL) { - perms->uid = getgid(); + perms->gid = getgid(); } else { if (virXPathLong(conn, "number(/pool/permissions/group)", ctxt, &v) < 0) { virStorageReportError(conn, VIR_ERR_XML_ERROR, @@ -425,7 +425,7 @@ virStoragePoolDefParse(virConnectPtr con if (!xml) { if (conn && conn->err.code == VIR_ERR_NONE) virStorageReportError(conn, VIR_ERR_XML_ERROR, - _("failed to parse xml document")); + "%s",_("failed to parse xml document")); goto cleanup; } @@ -799,7 +799,7 @@ virStorageVolDefParse(virConnectPtr conn if (!xml) { if (conn && conn->err.code == VIR_ERR_NONE) virStorageReportError(conn, VIR_ERR_XML_ERROR, - _("failed to parse xml document")); + "%s", _("failed to parse xml document")); goto cleanup; } Index: src/util.c =================================================================== RCS file: /data/cvs/libvirt/src/util.c,v retrieving revision 1.56 diff -u -p -r1.56 util.c --- src/util.c 2 Sep 2008 10:29:51 -0000 1.56 +++ src/util.c 4 Sep 2008 11:00:17 -0000 @@ -440,22 +440,13 @@ virRun(virConnectPtr conn, int virExec(virConnectPtr conn, const char *const*argv ATTRIBUTE_UNUSED, + const char *const*envp ATTRIBUTE_UNUSED, + const fd_set *keepfd ATTRIBUTE_UNUSED, int *retpid ATTRIBUTE_UNUSED, int infd ATTRIBUTE_UNUSED, int *outfd ATTRIBUTE_UNUSED, - int *errfd ATTRIBUTE_UNUSED) -{ - ReportError (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__); - return -1; -} - -int -virExecNonBlock(virConnectPtr conn, - const char *const*argv ATTRIBUTE_UNUSED, - int *retpid ATTRIBUTE_UNUSED, - int infd ATTRIBUTE_UNUSED, - int *outfd ATTRIBUTE_UNUSED, - int *errfd ATTRIBUTE_UNUSED) + int *errfd ATTRIBUTE_UNUSED, + int flags ATTRIBUTE_UNUSED) { ReportError (conn, VIR_ERR_INTERNAL_ERROR, __FUNCTION__); return -1; Index: src/util.h =================================================================== RCS file: /data/cvs/libvirt/src/util.h,v retrieving revision 1.27 diff -u -p -r1.27 util.h --- src/util.h 2 Sep 2008 10:29:51 -0000 1.27 +++ src/util.h 4 Sep 2008 11:00:17 -0000 @@ -144,4 +144,12 @@ const char *virEnumToString(const char * const char *name ## TypeToString(int type); \ int name ## TypeFromString(const char*type); +#ifndef HAVE_GETUID +static inline int getuid (void) { return 0; } +#endif + +#ifndef HAVE_GETGID +static inline int getgid (void) { return 0; } +#endif + #endif /* __VIR_UTIL_H__ */ Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

"Daniel P. Berrange" <berrange@redhat.com> wrote: ...
Attached is a version with that change - though I had to make it 'int' for the return type since uid_t/gid_t don't exist on mingw either. Not that it matters, since we store the result in an int anyway ...
Thanks for reposting. By the light of day, I spotted a minor quoting problem:
Index: autobuild.sh =================================================================== RCS file: /data/cvs/libvirt/autobuild.sh,v retrieving revision 1.10 diff -u -p -r1.10 autobuild.sh --- autobuild.sh 28 Aug 2008 09:08:44 -0000 1.10 +++ autobuild.sh 4 Sep 2008 11:00:17 -0000 @@ -17,8 +17,6 @@ rm -rf coverage ./autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" \ --enable-test-coverage \ --enable-compile-warnings=error \ - --with-openvz \ - --with-lxc \ --with-xen-proxy
# If the MAKEFLAGS envvar does not yet include a -j option, @@ -44,6 +42,7 @@ test -x /usr/bin/lcov && make cov rm -f *.tar.gz make dist
+
accidentally added? no big deal, of course
if [ -f /usr/bin/rpmbuild ]; then if [ -n "$AUTOBUILD_COUNTER" ]; then EXTRA_RELEASE=".auto$AUTOBUILD_COUNTER" @@ -51,5 +50,40 @@ if [ -f /usr/bin/rpmbuild ]; then NOW=`date +"%s"` EXTRA_RELEASE=".$USER$NOW" fi - rpmbuild --nodeps --define "extra_release $EXTRA_RELEASE" -ta --clean *.tar.gz + + rpmbuild --nodeps \ + --define "extra_release $EXTRA_RELEASE" \ + --define "_sourcedir `pwd`" \ + -ba --clean libvirt.spec +fi + +if [ -x /usr/bin/i686-pc-mingw32-gcc ]; then + make distclean + + PKG_CONFIG_PATH=$AUTOBUILD_INSTALL_ROOT/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig \ + CC="i686-pc-mingw32-gcc" \
you might want to omit the unnecessary double quotes here, to be consistent e.g., with host=i686... below.
+ ./configure \ + --build=$(uname -m)-pc-linux \ + --host=i686-pc-mingw32 \ + --prefix=$AUTOBUILD_INSTALL_ROOT/i686-pc-mingw32/sys-root/mingw \
Here, however, you should add quotes around $AUTOBUILD_INSTALL_ROOT, since it's coming from the environment and may contain spaces or worse. --prefix="$AUTOBUILD_INSTALL_ROOT/i686-pc-mingw32/sys-root/mingw" \
+ --without-sasl \ ...

On Thu, Sep 04, 2008 at 01:32:57PM +0200, Jim Meyering wrote:
"Daniel P. Berrange" <berrange@redhat.com> wrote: ...
Attached is a version with that change - though I had to make it 'int' for the return type since uid_t/gid_t don't exist on mingw either. Not that it matters, since we store the result in an int anyway ...
if [ -f /usr/bin/rpmbuild ]; then if [ -n "$AUTOBUILD_COUNTER" ]; then EXTRA_RELEASE=".auto$AUTOBUILD_COUNTER" @@ -51,5 +50,40 @@ if [ -f /usr/bin/rpmbuild ]; then NOW=`date +"%s"` EXTRA_RELEASE=".$USER$NOW" fi - rpmbuild --nodeps --define "extra_release $EXTRA_RELEASE" -ta --clean *.tar.gz + + rpmbuild --nodeps \ + --define "extra_release $EXTRA_RELEASE" \ + --define "_sourcedir `pwd`" \ + -ba --clean libvirt.spec +fi + +if [ -x /usr/bin/i686-pc-mingw32-gcc ]; then + make distclean + + PKG_CONFIG_PATH=$AUTOBUILD_INSTALL_ROOT/i686-pc-mingw32/sys-root/mingw/lib/pkgconfig \ + CC="i686-pc-mingw32-gcc" \
you might want to omit the unnecessary double quotes here, to be consistent e.g., with host=i686... below.
+ ./configure \ + --build=$(uname -m)-pc-linux \ + --host=i686-pc-mingw32 \ + --prefix=$AUTOBUILD_INSTALL_ROOT/i686-pc-mingw32/sys-root/mingw \
Here, however, you should add quotes around $AUTOBUILD_INSTALL_ROOT, since it's coming from the environment and may contain spaces or worse.
--prefix="$AUTOBUILD_INSTALL_ROOT/i686-pc-mingw32/sys-root/mingw" \
I've made these two changes and committed the patch. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

Yes, this patch looks fine, and adding the MinGW build to the automatic build script is great. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones Read my OCaml programming blog: http://camltastic.blogspot.com/ Fedora now supports 67 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora

Just wondering, Will it help to solve issues with libvirt windows port or list of items mentioned at http://wiki.libvirt.org/page/TodoWindowsSupport. Regards, Atif On Thu, Sep 4, 2008 at 11:30 AM, Richard W.M. Jones <rjones@redhat.com>wrote:
Yes, this patch looks fine, and adding the MinGW build to the automatic build script is great.
Rich.
-- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones <http://et.redhat.com/%7Erjones> Read my OCaml programming blog: http://camltastic.blogspot.com/ Fedora now supports 67 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora
-- Libvir-list mailing list Libvir-list@redhat.com https://www.redhat.com/mailman/listinfo/libvir-list

On Thu, Sep 04, 2008 at 11:42:54AM +0200, atif bajwa wrote:
Just wondering, Will it help to solve issues with libvirt windows port or list of items mentioned at http://wiki.libvirt.org/page/TodoWindowsSupport.
So if you follow the mailing list, you will see that Dan Berrange has just spent a great deal of time fixing up the current Windows support for libvirt and also adding libvirt to our automated build process. This means that libvirt Windows support won't break so easily in future. It also means that shortly we can start offering libvirt binaries on the website. The next step is to get the required MinGW packages into Fedora, which is something I'm looking at right now. And the step after that will be to build more of our tools and supply those on the website (see the list at that link above). So this is broadly underway now. If you wish to help out, please grab the latest libvirt from CVS and try building it. Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones Read my OCaml programming blog: http://camltastic.blogspot.com/ Fedora now supports 67 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora

Hi, I have seen the fixes for MinGW have been included to 0.4.5 release. But I am unable to find the windows binaries on the site, which were to be generated using MinGW. If anyone of you already have client binaries for windows, please share them with me. SAKAI already shared me link to build virsh windows executable using a guide, but I am having some setup issues. It is missing some basic instruction such as MinGW setup. Where should I setup MinGW? a fedora or windows machine and where to get its distribution? The directory structure suggests that I should use fedora. Why is the MinGW guide is not published on your site as you are actively work on it? Regards, Atif On Thu, Sep 4, 2008 at 11:04 AM, Richard W.M. Jones <rjones@redhat.com>wrote:
On Thu, Sep 04, 2008 at 11:42:54AM +0200, atif bajwa wrote:
Just wondering, Will it help to solve issues with libvirt windows port or list of items mentioned at http://wiki.libvirt.org/page/TodoWindowsSupport.
So if you follow the mailing list, you will see that Dan Berrange has just spent a great deal of time fixing up the current Windows support for libvirt and also adding libvirt to our automated build process. This means that libvirt Windows support won't break so easily in future. It also means that shortly we can start offering libvirt binaries on the website.
The next step is to get the required MinGW packages into Fedora, which is something I'm looking at right now.
And the step after that will be to build more of our tools and supply those on the website (see the list at that link above).
So this is broadly underway now. If you wish to help out, please grab the latest libvirt from CVS and try building it.
Rich.
-- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones Read my OCaml programming blog: http://camltastic.blogspot.com/ Fedora now supports 67 OCaml packages (the OPEN alternative to F#) http://cocan.org/getting_started_with_ocaml_on_red_hat_and_fedora

On Fri, Sep 12, 2008 at 08:35:12AM +0100, atif bajwa wrote:
I have seen the fixes for MinGW have been included to 0.4.5 release. But I am unable to find the windows binaries on the site, which were to be generated using MinGW. If anyone of you already have client binaries for windows, please share them with me.
SAKAI already shared me link to build virsh windows executable using a guide, but I am having some setup issues. It is missing some basic instruction such as MinGW setup. Where should I setup MinGW? a fedora or windows machine and where to get its distribution? The directory structure suggests that I should use fedora.
Why is the MinGW guide is not published on your site as you are actively work on it?
The MinGW port is being actively discussed and worked on. However it is work in progress and at the moment we are not supplying binaries - you will have to build it yourself. This is not trivial - I suggest you find someone who knows how to compile software to help you. Here is the project SIG: http://fedoraproject.org/wiki/SIGs/MinGW This contains a working build chain for libvirt which builds the libvirt-0.dll and virsh.exe (make sure you read the README file first): http://hg.et.redhat.com/misc/fedora-mingw--devel Rich. -- Richard Jones, Emerging Technologies, Red Hat http://et.redhat.com/~rjones virt-df lists disk usage of guests without needing to install any software inside the virtual machine. Supports Linux and Windows. http://et.redhat.com/~rjones/virt-df/

On Wed, Sep 03, 2008 at 05:47:30PM +0100, Daniel P. Berrange wrote: > On Wed, Sep 03, 2008 at 01:35:27PM +0100, Daniel P. Berrange wrote: > > I've got a MinGW build environment setup on Fedora 10 now, so just checked > > out what the latest state of libvirt CVS is. > > > > With the attached patch, I can run configure with: > --- autobuild.sh 28 Aug 2008 09:08:44 -0000 1.10 > +++ autobuild.sh 3 Sep 2008 16:44:21 -0000 > @@ -17,8 +17,6 @@ rm -rf coverage > ./autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" \ > --enable-test-coverage \ > --enable-compile-warnings=error \ > - --with-openvz \ > - --with-lxc \ > --with-xen-proxy In general fine by me, but I'm a bit annoyed if we don't build OpenVZ and LXC by default in the build setup. Maybe one could differenciate the build for MingW or just sisable lxc and openvz from the C code if we are on the linux platform. Or some configure.in foo to override --with-openvz and --with-lxc if using a cross compiler. Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/

On Thu, Sep 04, 2008 at 03:58:19PM +0200, Daniel Veillard wrote: > On Wed, Sep 03, 2008 at 05:47:30PM +0100, Daniel P. Berrange wrote: > > On Wed, Sep 03, 2008 at 01:35:27PM +0100, Daniel P. Berrange wrote: > > > I've got a MinGW build environment setup on Fedora 10 now, so just checked > > > out what the latest state of libvirt CVS is. > > > > > > With the attached patch, I can run configure with: > > --- autobuild.sh 28 Aug 2008 09:08:44 -0000 1.10 > > +++ autobuild.sh 3 Sep 2008 16:44:21 -0000 > > @@ -17,8 +17,6 @@ rm -rf coverage > > ./autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" \ > > --enable-test-coverage \ > > --enable-compile-warnings=error \ > > - --with-openvz \ > > - --with-lxc \ > > --with-xen-proxy > > In general fine by me, but I'm a bit annoyed if we don't build OpenVZ > and LXC by default in the build setup. Maybe one could differenciate > the build for MingW or just sisable lxc and openvz from the C code > if we are on the linux platform. Or some configure.in foo to override > --with-openvz and --with-lxc if using a cross compiler. You turned on OpenVZ / LXC by default - hence I no longer need to have the explicit --with-lxc or --with-openvz for autobuild. Daniel -- |: Red Hat, Engineering, London -o- http://people.redhat.com/berrange/ :| |: http://libvirt.org -o- http://virt-manager.org -o- http://ovirt.org :| |: http://autobuild.org -o- http://search.cpan.org/~danberr/ :| |: GnuPG: 7D3B9505 -o- F3C9 553F A1DA 4AC2 5648 23C1 B3DF F742 7D3B 9505 :|

On Thu, Sep 04, 2008 at 03:50:17PM +0100, Daniel P. Berrange wrote: > On Thu, Sep 04, 2008 at 03:58:19PM +0200, Daniel Veillard wrote: > > On Wed, Sep 03, 2008 at 05:47:30PM +0100, Daniel P. Berrange wrote: > > > On Wed, Sep 03, 2008 at 01:35:27PM +0100, Daniel P. Berrange wrote: > > > > I've got a MinGW build environment setup on Fedora 10 now, so just checked > > > > out what the latest state of libvirt CVS is. > > > > > > > > With the attached patch, I can run configure with: > > > --- autobuild.sh 28 Aug 2008 09:08:44 -0000 1.10 > > > +++ autobuild.sh 3 Sep 2008 16:44:21 -0000 > > > @@ -17,8 +17,6 @@ rm -rf coverage > > > ./autogen.sh --prefix="$AUTOBUILD_INSTALL_ROOT" \ > > > --enable-test-coverage \ > > > --enable-compile-warnings=error \ > > > - --with-openvz \ > > > - --with-lxc \ > > > --with-xen-proxy > > > > In general fine by me, but I'm a bit annoyed if we don't build OpenVZ > > and LXC by default in the build setup. Maybe one could differenciate > > the build for MingW or just sisable lxc and openvz from the C code > > if we are on the linux platform. Or some configure.in foo to override > > --with-openvz and --with-lxc if using a cross compiler. > > You turned on OpenVZ / LXC by default - hence I no longer need to have > the explicit --with-lxc or --with-openvz for autobuild. Dohh :-) I read that as --without-openvz and --without-lxc ! Daniel -- Daniel Veillard | libxml Gnome XML XSLT toolkit http://xmlsoft.org/ daniel@veillard.com | Rpmfind RPM search engine http://rpmfind.net/ http://veillard.com/ | virtualization library http://libvirt.org/
participants (5)
-
atif bajwa
-
Daniel P. Berrange
-
Daniel Veillard
-
Jim Meyering
-
Richard W.M. Jones