From 9765982fde68b8ad42e532f2a486dbe5b6634b2d Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Thu, 8 Jun 2017 00:17:54 +0200
Subject: fix build


diff --git a/deps/hiredis/net.c b/deps/hiredis/net.c
index 7d41209..9df8bc8 100644
--- a/deps/hiredis/net.c
+++ b/deps/hiredis/net.c
@@ -141,7 +141,7 @@ int redisKeepAlive(redisContext *c, int interval) {
         return REDIS_ERR;
     }
 #else
-#if defined(__GLIBC__) && !defined(__FreeBSD_kernel__)
+#if defined(__GLIBC__) && !defined(__FreeBSD_kernel__) && !defined(__HAIKU__)
     val = interval;
     if (setsockopt(fd, IPPROTO_TCP, TCP_KEEPIDLE, &val, sizeof(val)) < 0) {
         __redisSetError(c,REDIS_ERR_OTHER,strerror(errno));
diff --git a/src/Makefile b/src/Makefile
index 2a68649..ce8946d 100644
--- a/src/Makefile
+++ b/src/Makefile
@@ -90,6 +90,11 @@ ifeq ($(uname_S),SunOS)
 	FINAL_CFLAGS+= -D__EXTENSIONS__ -D_XPG6
 	FINAL_LIBS+= -ldl -lnsl -lsocket -lresolv -lpthread -lrt
 else
+ifeq ($(uname_S),Haiku)
+  CFLAGS?=-std=c99 -pedantic $(OPTIMIZATION) -Wall -W $(ARCH) $(PROF)
+  CCLINK?=-lroot -lnetwork
+  DEBUG?=-g -ggdb
+else
 ifeq ($(uname_S),Darwin)
 	# Darwin
 	FINAL_LIBS+= -ldl
@@ -126,6 +131,7 @@ endif
 endif
 endif
 endif
+endif
 # Include paths to dependencies
 FINAL_CFLAGS+= -I../deps/hiredis -I../deps/linenoise -I../deps/lua/src
 
-- 
2.24.0


From ae32c278250eb551a7acce111569002406bf1687 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Thu, 14 Nov 2019 19:38:32 +0100
Subject: ESOCKTNOSUPPORT isn't available on Haiku.


diff --git a/src/server.c b/src/server.c
index 828be2e..69a288e 100644
--- a/src/server.c
+++ b/src/server.c
@@ -1964,7 +1964,10 @@ int listenToPort(int port, int *fds, int *count) {
                 server.bindaddr[j] ? server.bindaddr[j] : "*",
                 port, server.neterr);
                 if (errno == ENOPROTOOPT     || errno == EPROTONOSUPPORT ||
-                    errno == ESOCKTNOSUPPORT || errno == EPFNOSUPPORT ||
+#ifndef __HAIKU__
+                    errno == ESOCKTNOSUPPORT ||
+#endif
+                    errno == EPFNOSUPPORT ||
                     errno == EAFNOSUPPORT    || errno == EADDRNOTAVAIL)
                     continue;
             return C_ERR;
-- 
2.24.0

