From b075822dac169dcccb7b1450a75883043210077f Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sun, 11 Apr 2021 21:38:33 +1000
Subject: Fix haiku build


diff --git a/CMakeLists.txt b/CMakeLists.txt
index 8091a17..b9799c0 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -122,11 +122,7 @@ if (OPTION_BUILD_WINSTATIC)
 endif()
 set (Boost_USE_MULTITHREADED ON)
 set (Boost_DETAILED_FAILURE_MSG ON)
-find_package(Boost 1.48
-  COMPONENTS
-    unit_test_framework
-  REQUIRED
-    system)
+find_package(Boost 1.48 REQUIRED)
 
 find_package (PythonInterp REQUIRED)
 
diff --git a/src/logic/map_objects/backtrace.cc b/src/logic/map_objects/backtrace.cc
index 71e1f4e..16794e8 100644
--- a/src/logic/map_objects/backtrace.cc
+++ b/src/logic/map_objects/backtrace.cc
@@ -21,15 +21,18 @@
 
 #ifndef _WIN32
 #ifndef __APPLE__
+#ifndef __HAIKU__
 
 #include <execinfo.h>
 #endif
 #endif
+#endif
 
 std::string get_backtrace() {
 	std::string result("Backtrace:\n");
 #ifndef _WIN32
 #ifndef __APPLE__
+#ifndef __HAIKU__
 #define BACKTRACE_STACKSIZE 24
 
 	void* stack[BACKTRACE_STACKSIZE];
@@ -41,6 +44,7 @@ std::string get_backtrace() {
 	}
 	free(list);
 #endif
+#endif
 #endif
 	return result;
 }
diff --git a/src/network/network.h b/src/network/network.h
index 7b61b01..b634a3c 100644
--- a/src/network/network.h
+++ b/src/network/network.h
@@ -22,7 +22,15 @@
 
 #include <functional>
 
+#ifdef __HAIKU__
+#undef _BSD_SOURCE
+#undef _DEFAULT_SOURCE
 #include <boost/asio.hpp>
+#define _DEFAULT_SOURCE
+#define _BSD_SOURCE
+#else
+#include <boost/asio.hpp>
+#endif
 #include <boost/lexical_cast.hpp>
 
 #include "base/wexception.h"
-- 
2.30.2

