From d1531a4d6125f9542d8729eb3712fd41cc88a565 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Tue, 7 Jan 2014 23:02:10 +0100
Subject: Link to libnetwork, since we use sockets.


diff --git a/server/CMakeLists.txt b/server/CMakeLists.txt
index 2110879..d1fed38 100644
--- a/server/CMakeLists.txt
+++ b/server/CMakeLists.txt
@@ -19,6 +19,10 @@ endif()
 
 target_link_libraries(vcmiserver vcmi ${Boost_LIBRARIES} ${RT_LIB} ${DL_LIB})
 
+if (HAIKU)
+	target_link_libraries(vcmiserver network)
+endif()
+
 if (NOT APPLE) # Already inside vcmiclient bundle
     install(TARGETS vcmiserver DESTINATION ${BIN_DIR})
 endif()
-- 
1.8.3.4


From 17615226b8b9b67a81330aade5609e7eb5a22024 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Wed, 8 Jan 2014 21:14:51 +0100
Subject: Support for renaming threads.


diff --git a/lib/CThreadHelper.cpp b/lib/CThreadHelper.cpp
index 6a4a89e..983ee5b 100644
--- a/lib/CThreadHelper.cpp
+++ b/lib/CThreadHelper.cpp
@@ -3,6 +3,8 @@
 
 #ifdef _WIN32
 	#include <windows.h>
+#elif defined(__HAIKU__)
+	#include <OS.h>
 #elif !defined(__APPLE__)
 	#include <sys/prctl.h>
 #endif
@@ -80,6 +82,8 @@ void setThreadName(const std::string &name)
 //not supported
 #endif
 
+#elif defined(__HAIKU__)
+	rename_thread(find_thread(NULL), name.c_str());
 #elif defined(__linux__)
 	prctl(PR_SET_NAME, name.c_str(), 0, 0, 0);
 #endif
-- 
1.8.3.4


From ea422b71bc3fa1af3f84ab5cd2da02649e42a227 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Mon, 27 Jan 2014 20:18:36 +0100
Subject: Fix settings dir path.


diff --git a/lib/VCMIDirs.cpp b/lib/VCMIDirs.cpp
index be00323..9fed4f8 100644
--- a/lib/VCMIDirs.cpp
+++ b/lib/VCMIDirs.cpp
@@ -123,12 +123,22 @@ std::string VCMIDirs::libraryName(std::string basename) const
 
 #else
 
+#if defined(__haiku__)
+std::string VCMIDirs::userDataPath() const
+{
+	BPath settingsDir;
+	if (find_directory(B_USER_SETTINGS_DIRECTORY, &path) == B_OK)
+		return std::string(path.Path()) + "vcmi";
+	return ".";
+}
+#else
 std::string VCMIDirs::userDataPath() const
 {
 	if (getenv("HOME") != nullptr )
 		return std::string(getenv("HOME")) + "/.vcmi";
 	return ".";
 }
+#endif
 
 std::string VCMIDirs::libraryPath() const
 {
diff --git a/vcmibuilder b/vcmibuilder
index 472a00d..1f60b12 100755
--- a/vcmibuilder
+++ b/vcmibuilder
@@ -64,7 +64,7 @@ then
 	echo " --download       " "Automatically download requied packages using wget"
 	echo "                  " "Requires wget and Internet connection"
 	echo
-	echo " --dest DIRECTORY " "Path where resulting data will be placed. Default is ~/.vcmi"
+	echo " --dest DIRECTORY " "Path where resulting data will be placed. Default is `finddir B_USER_SETTINGS_DIRECTORY`/vcmi"
 	echo
 	echo " --validate       " "Run basic validness checks"
 	exit 0
@@ -163,7 +163,7 @@ fi
 
 if [[ -z "$dest_dir" ]]
 then
-	dest_dir="$HOME/.vcmi"
+	dest_dir="`finddir B_USER_SETTINGS_DIRECTORY`/vcmi"
 fi
 
 temp_dir="$dest_dir"/buildertmp
-- 
1.8.3.4

