From b334f8dcdf3982f87dabdc47f4ca2b240167786a Mon Sep 17 00:00:00 2001
From: Mikolaj 'lich' Halber <lich@opmbx.org>
Date: Sun, 3 Jan 2016 21:31:07 +0000
Subject: Added Haiku support


diff --git a/cmake/modules/FindSDL2.cmake b/cmake/modules/FindSDL2.cmake
index b407bef..7764974 100644
--- a/cmake/modules/FindSDL2.cmake
+++ b/cmake/modules/FindSDL2.cmake
@@ -78,7 +78,7 @@
 FIND_PATH(SDL_INCLUDE_DIR SDL.h
   HINTS
   $ENV{SDLDIR}
-  PATH_SUFFIXES include/SDL include
+  PATH_SUFFIXES include/SDL include SDL
   PATHS
   ~/Library/Frameworks
   /Library/Frameworks
@@ -219,7 +219,7 @@ macro ( FindSDL_component _component )
     HINTS
     $ENV{SDL${UPPERCOMPONENT}DIR}
     $ENV{SDLDIR}
-    PATH_SUFFIXES include/SDL include
+    PATH_SUFFIXES include/SDL include SDL
     PATHS
     ~/Library/Frameworks
     /Library/Frameworks
diff --git a/cmake/modules/FindSDL_gfx.cmake b/cmake/modules/FindSDL_gfx.cmake
index 2e09b9b..3a5c89e 100644
--- a/cmake/modules/FindSDL_gfx.cmake
+++ b/cmake/modules/FindSDL_gfx.cmake
@@ -28,7 +28,7 @@ FIND_PATH(SDLGFX_INCLUDE_DIR SDL_gfx.h
   HINTS
   $ENV{SDLGFXDIR}
   $ENV{SDLDIR}
-  PATH_SUFFIXES include
+  PATH_SUFFIXES include SDL 
   PATHS
   ~/Library/Frameworks
   /Library/Frameworks
@@ -72,7 +72,7 @@ IF(NOT SDLGFX_INCLUDE_DIR)
     HINTS
     $ENV{SDLGFXDIR}
     $ENV{SDLDIR}
-    PATH_SUFFIXES include
+    PATH_SUFFIXES include SDL
     PATHS
     ~/Library/Frameworks
     /Library/Frameworks
diff --git a/src/Engine/CrossPlatform.cpp b/src/Engine/CrossPlatform.cpp
index a5704f4..d5768e9 100644
--- a/src/Engine/CrossPlatform.cpp
+++ b/src/Engine/CrossPlatform.cpp
@@ -59,6 +59,10 @@
 #include <SDL.h>
 #include <SDL_syswm.h>
 #include <SDL_image.h>
+#ifdef __HAIKU__
+#include <FindDirectory.h>
+#include <StorageDefs.h>
+#endif
 
 namespace OpenXcom
 {
@@ -144,7 +148,10 @@ std::vector<std::string> findDataFolders()
 #else
 	char const *home = getHome();
 #ifdef __HAIKU__
-	list.push_back("/boot/apps/OpenXcom/data/");
+	char data_path[B_PATH_NAME_LENGTH];
+	find_directory(B_SYSTEM_SETTINGS_DIRECTORY, 0, true, data_path, sizeof(data_path)-strlen("/OpenXcom/"));
+	strcat(data_path,"/OpenXcom/");
+	list.push_back(data_path);
 #endif
 	char path[MAXPATHLEN];
 
@@ -237,7 +244,10 @@ std::vector<std::string> findUserFolders()
 	}
 #else
 #ifdef __HAIKU__
-	list.push_back("/boot/apps/OpenXcom/");
+	char user_path[B_PATH_NAME_LENGTH];
+	find_directory(B_USER_SETTINGS_DIRECTORY, 0, true, user_path, sizeof(user_path)-strlen("/OpenXcom/"));
+	strcat(user_path,"/OpenXcom/");
+	list.push_back(user_path);
 #endif
 	char const *home = getHome();
 	char path[MAXPATHLEN];
@@ -281,7 +291,10 @@ std::string findConfigFolder()
 #if defined(_WIN32) || defined(__APPLE__)
 	return "";
 #elif defined (__HAIKU__)
-	return "/boot/home/config/settings/openxcom/";
+	char settings_path[B_PATH_NAME_LENGTH];
+	find_directory(B_USER_SETTINGS_DIRECTORY, 0, true, settings_path, sizeof(settings_path)-strlen("/OpenXcom/"));
+	strcat(settings_path,"/OpenXcom/");
+	return settings_path;
 #else
 	char const *home = getHome();
 	char path[MAXPATHLEN];
-- 
2.24.0


From 249301dc0c28cf27c37d56626e423ffcc0e33352 Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sat, 25 Jan 2020 21:46:40 +0100
Subject: fix build.


diff --git a/cmake/modules/FindYaml_cpp.cmake b/cmake/modules/FindYaml_cpp.cmake
index 64ccc2f..4f1d60f 100644
--- a/cmake/modules/FindYaml_cpp.cmake
+++ b/cmake/modules/FindYaml_cpp.cmake
@@ -24,7 +24,7 @@ FIND_PACKAGE(PkgConfig)
 PKG_CHECK_MODULES(PC_YAMLCPP QUIET yaml-cpp)
 
 
-FIND_PATH(YAMLCPP_INCLUDE_DIR yaml.h
+FIND_PATH(YAMLCPP_INCLUDE_DIR yaml-cpp/yaml.h
   HINTS
   ${PC_YAMLCPP_INCLUDEDIR}
   ${PC_YAMLCPP_INCLUDE_DIRS}
diff --git a/src/Engine/Language.cpp b/src/Engine/Language.cpp
index b14bca4..ca26e08 100644
--- a/src/Engine/Language.cpp
+++ b/src/Engine/Language.cpp
@@ -17,6 +17,7 @@
  * along with OpenXcom.  If not, see <http://www.gnu.org/licenses/>.
  */
 #include "Language.h"
+#include <algorithm>
 #include <assert.h>
 #include <locale>
 #include <fstream>
diff --git a/src/Engine/OptionInfo.cpp b/src/Engine/OptionInfo.cpp
index 31df3b5..57c229c 100644
--- a/src/Engine/OptionInfo.cpp
+++ b/src/Engine/OptionInfo.cpp
@@ -17,6 +17,7 @@
  * along with OpenXcom.  If not, see <http://www.gnu.org/licenses/>.
  */
 #include "OptionInfo.h"
+#include <algorithm>
 #include "Exception.h"
 
 namespace OpenXcom
diff --git a/src/Engine/Sound.cpp b/src/Engine/Sound.cpp
index f45f092..5d534d4 100644
--- a/src/Engine/Sound.cpp
+++ b/src/Engine/Sound.cpp
@@ -17,6 +17,7 @@
  * along with OpenXcom.  If not, see <http://www.gnu.org/licenses/>.
  */
 #include "Sound.h"
+#include <algorithm>
 #include <SDL.h>
 #include "Exception.h"
 #include "Options.h"
diff --git a/src/Menu/ListGamesState.cpp b/src/Menu/ListGamesState.cpp
index 9361da8..0f37915 100644
--- a/src/Menu/ListGamesState.cpp
+++ b/src/Menu/ListGamesState.cpp
@@ -17,6 +17,7 @@
  * along with OpenXcom.  If not, see <http://www.gnu.org/licenses/>.
  */
 #include "ListGamesState.h"
+#include <algorithm>
 #include <utility>
 #include "../Engine/Logger.h"
 #include "../Savegame/SavedGame.h"
diff --git a/src/Menu/ListLoadState.cpp b/src/Menu/ListLoadState.cpp
index f805c57..9b21523 100644
--- a/src/Menu/ListLoadState.cpp
+++ b/src/Menu/ListLoadState.cpp
@@ -17,6 +17,7 @@
  * along with OpenXcom.  If not, see <http://www.gnu.org/licenses/>.
  */
 #include "ListLoadState.h"
+#include <algorithm>
 #include "../Engine/Game.h"
 #include "../Engine/Language.h"
 #include "../Engine/Action.h"
diff --git a/src/Savegame/Craft.cpp b/src/Savegame/Craft.cpp
index f0c0ee8..ad99385 100644
--- a/src/Savegame/Craft.cpp
+++ b/src/Savegame/Craft.cpp
@@ -18,6 +18,7 @@
  */
 #define _USE_MATH_DEFINES
 #include "Craft.h"
+#include <algorithm>
 #include <cmath>
 #include <sstream>
 #include "../Engine/Language.h"
-- 
2.24.0

