Re: [gtk-vnc-devel] PATCH: Portability to compile under MinGW for Windows



On Wed, Sep 10, 2008 at 02:51:07PM +0100, Daniel P. Berrange wrote:
> This patch addresses the (surprisingly few) portability problems which
> prevent compilation of gtk-vnc with MinGW. We had already addressed
> the major problem with the  pthreads based coroutine in the past, and
> this ties up loose ends. The two issues addressed are a drop in impl
> of getaddrinfo from GNULIB, and errno / WSAGetLastError() changes.
> 
> For those not aware of what gnulib is / does, here's a little background.
> GNULIB provides implementations of many POSIX apis to replace/augment/fix
> broken/missing impls from various OS. GNULIB is not a library in the normal
> sense - you don't link to it, nor is it installed in /usr/lib. GNULIB
> is distributed in source form only. As a developer you declare which APIs
> you want help from gnulib on, and it has a bootstrap script which pulls 
> the source for these APIs into your source directory.  By convention we
> place this in gnulib/lib and gnulib/tests. It also provides some autoconf
> macros in gnulib/m4 which you call from configure.ac  When configure runs
> gnulib probes for the APIs provided by the OS, and if it finds problems
> automatically turns on use of the gnulib replacements.
> 
> In this case we merely need the getaddrinfo() replacement, so we add a call
> to #include "getaddrinfo.h" in src/gvnc.c, and add ../gnulib/lib/gnulib.la
> to the LDADD, and -I../gnulib/lib to the CFLAGS. gnulib.la is a static only
> library, so it gets linked straight into libgtkvnc.so 
> 
> We have used GNULIB very successfully in libvirt to provide portability
> to Windows, MacOS and Solaris, so I don't anticipate any problems with 
> GTK-VNC.
> 
> For the sake of brevity, the patch I'm attaching does /not/ include all 
> the files that GNULIB itself will add. I'm just showing the diffs to
> existing files. If you want to see what gnulib adds, then just invoke
> the 'bootstrap' script after applying this patch. When I actually commit
> this to HG, i'll checkin all the stuff GNULIB adds.

I forgot to mention, each GNULIB function has a explicitly declared
license. The bootstrap script I provided explicitly only pulls in
modules which are compatible with the LGPLv2+, so we're not placing
any additional license constraints on GTK-VNC:

> +# Tell gnulib to:
> +#   require LGPLv2+
> +#   put *.m4 files in new gnulib/m4/ dir
> +#   put *.[ch] files in new gnulib/lib/ dir.
> +
> +$gnulib_tool			\
> +  --lgpl=2			\
> +  --with-tests			\
> +  --m4-base=gnulib/m4		\
> +  --source-base=gnulib/lib	\
> +  --tests-base=gnulib/tests	\
> +  --import $modules
> +


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 :|




[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]