commit c3cc709b98612b32c44b1c73eb10c1f2ebae259d
parent 1a35979fc768eff6b6fca56a6d40f4354658cf11
Author: Marco Simonelli <msimonelli@protonmail.com>
Date: Fri, 10 Mar 2023 11:59:37 +0000
BB 41459: WebRTC fails to build under mingw (Part 4)
- fixes requried to build netwerk/sctp
Diffstat:
9 files changed, 36 insertions(+), 1 deletion(-)
diff --git a/netwerk/sctp/src/moz.build b/netwerk/sctp/src/moz.build
@@ -62,3 +62,5 @@ if CONFIG['OS_TARGET'] in ('Linux', 'Android'):
DEFINES['_GNU_SOURCE'] = 1
elif CONFIG['OS_TARGET'] == 'Darwin':
DEFINES['__APPLE_USE_RFC_2292'] = 1
+elif CONFIG['OS_TARGET'] == 'WINNT':
+ DEFINES['_CRT_RAND_S'] = True
diff --git a/netwerk/sctp/src/netinet/sctp_cc_functions.c b/netwerk/sctp/src/netinet/sctp_cc_functions.c
@@ -49,6 +49,10 @@
#include <netinet/sctp_kdtrace.h>
#endif
+#if defined(_WIN32) && defined(__MINGW32__)
+#include <minmax.h>
+#endif
+
#define SHIFT_MPTCP_MULTI_N 40
#define SHIFT_MPTCP_MULTI_Z 16
#define SHIFT_MPTCP_MULTI 8
diff --git a/netwerk/sctp/src/netinet/sctp_indata.c b/netwerk/sctp/src/netinet/sctp_indata.c
@@ -53,6 +53,11 @@
#if defined(__FreeBSD__) && !defined(__Userspace__)
#include <netinet/sctp_lock_bsd.h>
#endif
+
+#if defined(_WIN32) && !defined(_MSC_VER)
+#include <minmax.h>
+#endif
+
/*
* NOTES: On the outbound side of things I need to check the sack timer to
* see if I should generate a sack into the chunk queue (if I have data to
diff --git a/netwerk/sctp/src/netinet/sctp_input.c b/netwerk/sctp/src/netinet/sctp_input.c
@@ -58,6 +58,10 @@
#include <sys/smp.h>
#endif
+#if defined(_WIN32) && !defined(_MSC_VER)
+#include <minmax.h>
+#endif
+
static void
sctp_stop_all_cookie_timers(struct sctp_tcb *stcb)
{
diff --git a/netwerk/sctp/src/netinet/sctp_output.c b/netwerk/sctp/src/netinet/sctp_output.c
@@ -74,6 +74,11 @@
#if defined(__Userspace__) && defined(INET6)
#include <netinet6/sctp6_var.h>
#endif
+
+#if defined(_WIN32) && !defined(_MSC_VER)
+#include <minmax.h>
+#endif
+
#if defined(__APPLE__) && !defined(__Userspace__)
#if !(defined(APPLE_LEOPARD) || defined(APPLE_SNOWLEOPARD))
#define SCTP_MAX_LINKHDR 16
diff --git a/netwerk/sctp/src/netinet/sctp_usrreq.c b/netwerk/sctp/src/netinet/sctp_usrreq.c
@@ -63,6 +63,10 @@
#include <netinet/sctp_peeloff.h>
#endif /* HAVE_SCTP_PEELOFF_SOCKOPT */
+#if defined(_WIN32) && !defined(_MSC_VER)
+#include <minmax.h>
+#endif
+
extern const struct sctp_cc_functions sctp_cc_functions[];
extern const struct sctp_ss_functions sctp_ss_functions[];
diff --git a/netwerk/sctp/src/netinet/sctputil.c b/netwerk/sctp/src/netinet/sctputil.c
@@ -77,6 +77,10 @@
#endif
#endif
+#if defined(_WIN32) && !defined(_MSC_VER)
+#include <minmax.h>
+#endif
+
extern const struct sctp_cc_functions sctp_cc_functions[];
extern const struct sctp_ss_functions sctp_ss_functions[];
diff --git a/netwerk/sctp/src/user_mbuf.c b/netwerk/sctp/src/user_mbuf.c
@@ -35,6 +35,10 @@
*
*/
+#if defined(_WIN32) && !defined(_MSC_VER)
+#include <minmax.h>
+#endif
+
#include <stdio.h>
#include <string.h>
/* #include <sys/param.h> This defines MSIZE 256 */
diff --git a/netwerk/sctp/src/user_socket.c b/netwerk/sctp/src/user_socket.c
@@ -60,9 +60,12 @@
#endif
userland_mutex_t accept_mtx;
userland_cond_t accept_cond;
-#ifdef _WIN32
+#if defined(_WIN32)
#include <time.h>
#include <sys/timeb.h>
+#if !defined(_MSC_VER)
+#include <minmax.h>
+#endif
#endif
MALLOC_DEFINE(M_PCB, "sctp_pcb", "sctp pcb");