From 0a59009a58f6391b1e54a49a93f163bce0acab9c Mon Sep 17 00:00:00 2001
From: James M Snell <jasnell@gmail.com>
Date: Wed, 12 Aug 2020 11:48:07 -0700
Subject: [PATCH] Fixup building on windows and freebsd

Without these changes, library was failing to build on both Windows and
FreeBSD.
---
 lib/includes/ngtcp2/ngtcp2.h |  7 ++++++-
 lib/ngtcp2_addr.c            | 13 ++++++++++++-
 2 files changed, 18 insertions(+), 2 deletions(-)

diff --git a/lib/includes/ngtcp2/ngtcp2.h b/lib/includes/ngtcp2/ngtcp2.h
index abef3855..3373adb9 100644
--- a/lib/includes/ngtcp2/ngtcp2.h
+++ b/lib/includes/ngtcp2/ngtcp2.h
@@ -46,10 +46,15 @@ extern "C" {
 #  include <inttypes.h>
 #endif /* !defined(_MSC_VER) || (_MSC_VER >= 1800) */
 #include <sys/types.h>
-#include <sys/socket.h>
 #include <stdarg.h>
 #include <stddef.h>
 
+#ifdef WIN32
+#  include <winsock2.h>
+#else
+#  include <sys/socket.h>
+#endif
+
 #include <ngtcp2/version.h>
 
 #ifdef NGTCP2_STATICLIB
diff --git a/lib/ngtcp2_addr.c b/lib/ngtcp2_addr.c
index cf7a4f31..cfc91c41 100644
--- a/lib/ngtcp2_addr.c
+++ b/lib/ngtcp2_addr.c
@@ -26,7 +26,18 @@
 
 #include <string.h>
 #include <assert.h>
-#include <netinet/ip.h>
+
+#ifdef WIN32
+#  include <winsock2.h>
+#  include <ws2tcpip.h>
+#else
+#  include <sys/types.h>
+#  include <sys/socket.h>
+#  include <netinet/in.h>
+#  include <netinet/ip.h>
+#  include <netinet/tcp.h>
+#  include <arpa/inet.h>
+#endif
 
 ngtcp2_addr *ngtcp2_addr_init(ngtcp2_addr *dest, const struct sockaddr *addr,
                               size_t addrlen, void *user_data) {
-- 
GitLab