From 4a9dcbc50d09bf6d186f28e1b0cb2febd8d60491 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Thu, 5 Apr 2018 17:55:26 +0200
Subject: Haiku patches


diff --git a/cli/cppcheckexecutor.cpp b/cli/cppcheckexecutor.cpp
index 82cc960..ded5fe0 100644
--- a/cli/cppcheckexecutor.cpp
+++ b/cli/cppcheckexecutor.cpp
@@ -52,7 +52,7 @@
 #   include <ucontext.h>
 
 #   undef _XOPEN_SOURCE
-#elif !defined(__OpenBSD__)
+#elif !defined(__OpenBSD__) && !defined(__HAIKU__)
 #   include <ucontext.h>
 #endif
 #ifdef __linux__
diff --git a/cli/threadexecutor.cpp b/cli/threadexecutor.cpp
index f0534d5..028a28f 100644
--- a/cli/threadexecutor.cpp
+++ b/cli/threadexecutor.cpp
@@ -143,7 +143,7 @@ int ThreadExecutor::handleRead(int rpipe, unsigned int &result)
 
 bool ThreadExecutor::checkLoadAverage(size_t nchildren)
 {
-#if defined(__CYGWIN__) || defined(__QNX__)  // getloadavg() is unsupported on Cygwin, Qnx.
+#if defined(__CYGWIN__) || defined(__QNX__) || defined(__HAIKU__)  // getloadavg() is unsupported on Cygwin, Qnx, Haiku.
     return true;
 #else
     if (!nchildren || !_settings.loadAverage) {
diff --git a/cmake/compileroptions.cmake b/cmake/compileroptions.cmake
index 545e6be..695853d 100644
--- a/cmake/compileroptions.cmake
+++ b/cmake/compileroptions.cmake
@@ -5,9 +5,13 @@ set(EXTRA_C_FLAGS_DEBUG "-DDEBUG")
 if (USE_CLANG)
     set (CMAKE_C_COMPILER_ID            "Clang")
     set (CMAKE_CXX_COMPILER_ID          "Clang")
-    set (CMAKE_C_COMPILER               "/usr/bin/clang")
-    set (CMAKE_CXX_COMPILER             "/usr/bin/clang++")
-
+    if (NOT HAIKU)
+        set (CMAKE_C_COMPILER               "/usr/bin/clang")
+        set (CMAKE_CXX_COMPILER             "/usr/bin/clang++")
+    else (NOT HAIKU)
+        set (CMAKE_C_COMPILER               "/bin/clang")
+        set (CMAKE_CXX_COMPILER             "/bin/clang++")
+    endif (NOT HAIKU)
     set (CMAKE_C_FLAGS                  "-std=c99")
     set (CMAKE_C_FLAGS_DEBUG            "-g")
     set (CMAKE_C_FLAGS_RELEASE          "-O2")
-- 
2.19.1


From df6b2a1c46a76891bffbcbe3f0721e60fc811334 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Fri, 22 Mar 2019 21:30:17 +0100
Subject: Use data instead of shared on haiku.


diff --git a/cmake/options.cmake b/cmake/options.cmake
index 3c96ca8..803cd07 100644
--- a/cmake/options.cmake
+++ b/cmake/options.cmake
@@ -47,5 +47,8 @@ set(CMAKE_RUNTIME_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/bin)
 set(CMAKE_ARCHIVE_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
 set(CMAKE_LIBRARY_OUTPUT_DIRECTORY ${PROJECT_BINARY_DIR}/lib)
 
-set(CFGDIR                         ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME} CACHE STRING "CFG files directory")
-
+if (NOT HAIKU)
+    set(CFGDIR                         ${CMAKE_INSTALL_PREFIX}/share/${PROJECT_NAME} CACHE STRING "CFG files directory")
+else()
+    set(CFGDIR                         ${CMAKE_INSTALL_PREFIX}/data/${PROJECT_NAME} CACHE STRING "CFG files directory")
+endif()
-- 
2.19.1

