From 737f707b43575d9e06b90ea46cca0a0bb0a876b3 Mon Sep 17 00:00:00 2001
From: Edric Milaret <edric.ladent-milaret@savoirfairelinux.com>
Date: Tue, 16 Feb 2016 13:50:00 -0500
Subject: [PATCH] windows: support 64bit builds

- This patch allow us to build 64bits version of
the daemon (and thanks to that LRC and client too)
- We should essentially gain performance in CPU intensive task
like video processing

Depends on yaml-cpp bump that fix x64 mingw compilation

Change-Id: I32c7bafba0eddfa8a6779e1c13bde2ea56bf904b
Tuleap: #387
---
 contrib/src/pjproject/rules.mak      |  4 ++++
 contrib/src/upnp/rules.mak           |  3 +++
 contrib/src/upnp/win_inet_pton.patch | 25 +++++++++++++++++++++++++
 3 files changed, 32 insertions(+)
 create mode 100644 contrib/src/upnp/win_inet_pton.patch

diff --git a/contrib/src/pjproject/rules.mak b/contrib/src/pjproject/rules.mak
index 10c6a31151..efc7be5a78 100644
--- a/contrib/src/pjproject/rules.mak
+++ b/contrib/src/pjproject/rules.mak
@@ -29,6 +29,10 @@ endif
 
 PJPROJECT_EXTRA_CFLAGS = -DPJ_ICE_MAX_CAND=32 -DPJ_ICE_MAX_CHECKS=150 -DPJ_ICE_COMP_BITS=2
 
+ifdef HAVE_WIN64
+PJPROJECT_EXTRA_CFLAGS += -DPJ_WIN64=1
+endif
+
 PKGS += pjproject
 # FIXME: nominally 2.2.0 is enough, but it has to be patched for gnutls
 ifeq ($(call need_pkg,'libpjproject'),)
diff --git a/contrib/src/upnp/rules.mak b/contrib/src/upnp/rules.mak
index 378a4f975c..184569f9f0 100644
--- a/contrib/src/upnp/rules.mak
+++ b/contrib/src/upnp/rules.mak
@@ -18,6 +18,9 @@ ifdef HAVE_WIN32
 	$(APPLY) $(SRC)/upnp/libupnp-win32.patch
 	$(APPLY) $(SRC)/upnp/libupnp-win64.patch
 	$(APPLY) $(SRC)/upnp/threadpool.patch
+endif
+ifdef HAVE_WIN64
+	$(APPLY) $(SRC)/upnp/win_inet_pton.patch
 endif
 	$(APPLY) $(SRC)/upnp/libupnp-ipv6.patch
 	$(APPLY) $(SRC)/upnp/miniserver.patch
diff --git a/contrib/src/upnp/win_inet_pton.patch b/contrib/src/upnp/win_inet_pton.patch
new file mode 100644
index 0000000000..22e0f550da
--- /dev/null
+++ b/contrib/src/upnp/win_inet_pton.patch
@@ -0,0 +1,25 @@
+--- a/upnp/src/inet_pton.c	2013-11-15 11:10:05.000000000 -0500
++++ b/upnp/src/inet_pton.c	2016-02-16 13:21:03.963801774 -0500
+@@ -304,20 +304,7 @@
+ 	/* NOTREACHED */
+ }
+
+-int inet_pton(int af, const char *src, void *dst)
+-{
+-	switch (af) {
+-	case AF_INET:
+-		return inet_pton4(src, dst);
+-#ifdef INET_IPV6
+-	case AF_INET6:
+-		return inet_pton6(src, dst);
+-#endif
+-	default:
+-		/*__set_errno(EAFNOSUPPORT);*/
+-		return -1;
+-	}
+-	/* NOTREACHED */
+-}
++#define InetPtonA inet_pton
++WINSOCK_API_LINKAGE INT WSAAPI InetPtonA(INT Family, LPCSTR pStringBuf, PVOID pAddr);
+
+ #endif /* WIN32 */
-- 
GitLab