Bug 62793

Summary: Cygwin/mingw build fixes for trunk build
Product: Farstream Reporter: Conrad Poelman <cpfarstream>
Component: CoreAssignee: Olivier Crête <olivier.crete>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: medium Keywords: patch
Version: unspecified   
Hardware: x86 (IA32)   
OS: Cygwin   
Whiteboard:
i915 platform: i915 features:
Attachments: Patch for all files as described above

Description Conrad Poelman 2013-03-27 06:57:22 UTC
Created attachment 77085 [details] [review]
Patch for all files as described above

I checked out the latest version of farstream from http://cgit.collabora.com/git/farstream.git/ and built it under MinGW using gcc 4.7.2 and ran into a few minor problems. Most of them were fairly easy to fix. I'm attaching a patch file with the following changes:

- farstream/Makefile.am: referred to GLIB_FLAGS which doesn't appear elsewhere, I think that should be GLIB_CFLAGS.
 -- GLIB_CFLAGS and GLIB_LIBS appear to be used only by the top-level Makefile.am file. So to ./configure farstream I had to add my $GLIB_CFLAGS and $GLIB_LIBS to the tail end of my GST_CFLAGS and GST_LIBS environment variables.

- fs-msn-connection: Needed #ifdef G_OS_WIN32 to #include Winsock2.h, Ws2tcpip.h instead of arpa/inet.h, netinet/in.h, sys/socket.h, and use Windows ioctlsocket instead of fcntl.

- fs-msn-stream: #ifdef G_OS_WIN32 for #includes, cast 4th argument to setsockopt to (const void*).

- fs-raw-stream: #ifdef G_OS_WIN32 for #includes

- fs-rtp-codec-specific: Remove "hh" from "%02hhX%02hhX%02hhX" format string

- fs-rtp-tfrc: Use PRIu64 format string for guint64 arguments.

- test/rtp/Makefile.am: Reverse order of libraries to fix link errors.

- fs-multicase-transmitter: #define _WIN32_WINNT to indicate we only support Windows versions that have getaddrinfo/freeaddrinfo, cast 4th argument to setsockopt.

- fs-nice-transmitter: #include <nice/agent.h> rather than just <agent.h>; my version of libnice (latest built from their repo) doesn't put agent in a top-level "include" directory.

- fs-rawudp-component: #define _WIN32_WINNT to indicate we only support Windows versions that have getaddrinfo/freeaddrinfo

- fs-rawudp-transmitter: #define _WIN32_WINNT to indicate we only support Windows versions that have getaddrinfo/freeaddrinfo, cast 4th argument to setsockopt.

- fs-shm-stream-transmitter: Windows / MinGW has no mkdtemp() so the best I could come up with was finding an LGPL implementation of it on the internet, pasting it into a new mkdtemp.h file, and conditionally #including it. This feels ugly...

Two changes I didn't include in the patch because I'm not good with autoconf/automake/libtool and surely someone there is better suited to adding a bit of conditional logic to them:

- configure.ac: gio-unix should be made optional; it's only used for the commandline example.

- transmitters/multicast/Makefile.am needs libmulticast_transmitter_la_LIBADD += -lws2_32 on Windows or MinGW to pull in getaddrinfo/freeaddrinfo.

- transmitters/rawudp/Makefile.am needs librawudp_transmitter_la_LIBADD += -lws2_32 on Windows or MinGW to pull in getaddrinfo/freeaddrinfo.

A caveat is that I was doing all this to build the Pidgin IM client on Windows using MinGW; it builds and starts but currently won't load the fsrtpconference plugin so its hasn't been fully tested.
Comment 1 Olivier Crête 2013-03-27 17:37:11 UTC
%h is short int while %hh is a char, interestingly GLib has macros for gint16, gint32 and gint64, but not for gint8..

PRIu64 won't work, we have G_GINT64_FORMAT and G_GUINT64_FORMAT for that.

The shm transmitter won'T work on windows anyway, so don't bother, there is --with-transmitter-plugins=nice,rawudp,multicast for that

The addrinfo uses should be replaced with GResolver

I'm not sure either what needs testing for -lws2_32, that said, this can probalby be ignored if we use GResolver.
Comment 2 Olivier Crête 2013-03-27 17:41:06 UTC
arg, actually GResolver doesn'T have the equivalent of AI_NUMERICHOST, so we need to use g_inet_address_new_from_string() is which closer to what we want.
Comment 3 Olivier Crête 2013-04-04 18:33:37 UTC
I think I've fixed everything, please test! And please re-open if I missed something:

commit d5d734480e923156c8155cbc1d4f1faacd89c969
Author: Olivier Crête <olivier.crete@collabora.com>
Date:   Thu Apr 4 14:17:59 2013 -0400

    rawudp: Use GSocket abstraction for portability

commit 5caa188909453f8890a8af8b4b41fe3d287a7fec
Author: Olivier Crête <olivier.crete@collabora.com>
Date:   Thu Apr 4 14:17:15 2013 -0400

    multicast: Use gio instead of getaddrinfo for resolving

commit cdf4998b4ce7da59f15aa88b5f4629e5995cab94
Author: Olivier Crête <olivier.crete@collabora.com>
Date:   Thu Apr 4 14:04:03 2013 -0400

    tests: Use GSocket instead of getaddrinfo to parse IP addresses

commit 81351b580da0f8db520ca0ff5e5725c199a7a8b9
Author: Olivier Crête <olivier.crete@collabora.com>
Date:   Thu Apr 4 12:19:18 2013 -0400

    Misc win32 portability fixes
    
    Based on a patch by Conrad Poelman
Comment 4 Conrad Poelman 2013-04-04 18:53:32 UTC
Thanks! I'm literally at the airport heading out for a vacation but I'm
excited to check this out as soon as I get back on April 20th!
On Apr 4, 2013 12:33 PM, <bugzilla-daemon@freedesktop.org> wrote:

>  Olivier Crête <olivier.crete@ocrete.ca> changed bug 62793<https://bugs.freedesktop.org/show_bug.cgi?id=62793>
>  What Removed Added  Status NEW RESOLVED  Resolution --- FIXED
>
>  *Comment # 3 <https://bugs.freedesktop.org/show_bug.cgi?id=62793#c3> on bug
> 62793 <https://bugs.freedesktop.org/show_bug.cgi?id=62793> from Olivier
> Crête <olivier.crete@ocrete.ca> *
>
> I think I've fixed everything, please test! And please re-open if I missed
> something:
>
> commit d5d734480e923156c8155cbc1d4f1faacd89c969
> Author: Olivier Crête <olivier.crete@collabora.com>
> Date:   Thu Apr 4 14:17:59 2013 -0400
>
>     rawudp: Use GSocket abstraction for portability
>
> commit 5caa188909453f8890a8af8b4b41fe3d287a7fec
> Author: Olivier Crête <olivier.crete@collabora.com>
> Date:   Thu Apr 4 14:17:15 2013 -0400
>
>     multicast: Use gio instead of getaddrinfo for resolving
>
> commit cdf4998b4ce7da59f15aa88b5f4629e5995cab94
> Author: Olivier Crête <olivier.crete@collabora.com>
> Date:   Thu Apr 4 14:04:03 2013 -0400
>
>     tests: Use GSocket instead of getaddrinfo to parse IP addresses
>
> commit 81351b580da0f8db520ca0ff5e5725c199a7a8b9
> Author: Olivier Crête <olivier.crete@collabora.com>
> Date:   Thu Apr 4 12:19:18 2013 -0400
>
>     Misc win32 portability fixes
>
>     Based on a patch by Conrad Poelman
>
>  ------------------------------
> You are receiving this mail because:
>
>    - You reported the bug.
>
>
Comment 5 Olivier Crête 2013-04-04 20:01:03 UTC
Also, for pidgin you can skip the fsmsnconference and fsrawconference plugins. You only need to build fsrtpconference

Use of freedesktop.org services, including Bugzilla, is subject to our Code of Conduct. How we collect and use information is described in our Privacy Policy.