From 7c7827b8c58760d24973bfc9782d6cf58f0c792d Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Wed, 22 Nov 2017 11:02:24 +0100
Subject: [PATCH 1/3] Haiku: CMake: fix search paths

---
 cmake/FindSDL2.cmake | 7 ++++---
 1 file changed, 4 insertions(+), 3 deletions(-)

diff --git a/cmake/FindSDL2.cmake b/cmake/FindSDL2.cmake
index fc2ee31..d32bed1 100644
--- a/cmake/FindSDL2.cmake
+++ b/cmake/FindSDL2.cmake
@@ -74,12 +74,13 @@ SET(SDL2_SEARCH_PATHS
   /opt/local # DarwinPorts
   /opt/csw # Blastwave
   /opt
+  /system/develop # Haiku
 )
 
 FIND_PATH(SDL2_INCLUDE_DIR SDL_scancode.h
   HINTS
   $ENV{SDL2DIR}
-  PATH_SUFFIXES include/SDL2 include
+  PATH_SUFFIXES include/SDL2 include headers/x86/SDL2 headers/SDL2 headers
   PATHS ${SDL2_SEARCH_PATHS}
 )
 
@@ -87,7 +88,7 @@ FIND_LIBRARY(SDL2_LIBRARY_TEMP
   NAMES SDL2
   HINTS
   $ENV{SDL2DIR}
-  PATH_SUFFIXES lib64 lib
+  PATH_SUFFIXES lib64 lib/x86 lib
   PATHS ${SDL2_SEARCH_PATHS}
 )
 
@@ -101,7 +102,7 @@ IF(NOT SDL2_BUILDING_LIBRARY)
       NAMES SDL2main
       HINTS
       $ENV{SDL2DIR}
-      PATH_SUFFIXES lib64 lib
+      PATH_SUFFIXES lib64 lib/x86 lib
       PATHS ${SDL2_SEARCH_PATHS}
     )
   ENDIF(NOT ${SDL2_INCLUDE_DIR} MATCHES ".framework")
-- 
2.15.0


From 0e3c6924d5b225393a70ccde7ce59d9446d2f135 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Wed, 22 Nov 2017 11:02:50 +0100
Subject: [PATCH 2/3] Haiku: CMake: link with libnetwork

---
 src/CMakeLists.txt | 5 +++++
 1 file changed, 5 insertions(+)

diff --git a/src/CMakeLists.txt b/src/CMakeLists.txt
index 2401099..0f6ccf2 100644
--- a/src/CMakeLists.txt
+++ b/src/CMakeLists.txt
@@ -124,6 +124,11 @@ if(WIN32)
 	target_link_libraries(Previous ws2_32 Iphlpapi)
 endif(WIN32)
 
+if(HAIKU)
+	# Needed for socket() on Haiku
+	target_link_libraries(Previous network)
+endif(HAIKU)
+
 if(ENABLE_OSX_BUNDLE)
 	install(TARGETS Previous BUNDLE DESTINATION /Applications)
 else()
-- 
2.15.0


From ea28cdb3f93736d1408d46aea8dba7a844dc3f9b Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Fran=C3=A7ois=20Revol?= <revol@free.fr>
Date: Wed, 22 Nov 2017 11:03:18 +0100
Subject: [PATCH 3/3] Haiku: use existing uint* types from SupportDefs.h or
 things break

---
 src/slirp/slirp.h | 4 ++++
 1 file changed, 4 insertions(+)

diff --git a/src/slirp/slirp.h b/src/slirp/slirp.h
index 8496ce6..22da7a2 100755
--- a/src/slirp/slirp.h
+++ b/src/slirp/slirp.h
@@ -92,10 +92,14 @@ typedef unsigned char u_int8_t;
 # endif
 #endif /* NEED_TYPEDEFS */
 
+#ifdef __HAIKU__
+#include <SupportDefs.h>
+#else
 /* Basilisk II types glue */
 typedef u_int8_t uint8;
 typedef u_int16_t uint16;
 typedef u_int32_t uint32;
+#endif
 
 #ifdef HAVE_UNISTD_H
 # include <unistd.h>
-- 
2.15.0

