From 77fc282d827c9dcc5c4860ef8a5aa43470f69b7e Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Wed, 15 Jan 2014 23:08:55 +0100
Subject: Make buildsystem aware of Haiku.


diff --git a/build/unix/config_functions b/build/unix/config_functions
index 4f017f1..7c4aa5a 100644
--- a/build/unix/config_functions
+++ b/build/unix/config_functions
@@ -1060,6 +1060,8 @@ set_host_system() {
 				HOST_SYSTEM="ARMV5" ;;
 			[Gg][Cc][Cc][Ee])
 				HOST_SYSTEM="GCCE" ;;				
+			[Hh][Aa][Ii][Kk][Uu])
+				HOST_SYSTEM="Haiku" ;;
 			*)
 				build_message "Warning: host type '$BUILD_HOST' unknown. Using defaults."
 				;;
diff --git a/build/unix/config_proginfo_host b/build/unix/config_proginfo_host
index 6e0466c..d95c6c9 100644
--- a/build/unix/config_proginfo_host
+++ b/build/unix/config_proginfo_host
@@ -299,7 +299,7 @@ case "$HOST_SYSTEM" in
 		LIB_pthread_LDFLAGS="$(pthread-config --ldflags)"
 		LIB_pthread_VERSION="$(pthread-config --version)"
 		;;
-	WINSCW|ARMV5|GCCE)
+	WINSCW|ARMV5|GCCE|Haiku)
 		LIB_pthread_DETECT="true"
 		;;					
 	*)
@@ -321,6 +321,11 @@ case "$HOST_SYSTEM" in
 	ARMV5|WINSCW|GCCE)
 		LIB_netlibs_DETECT="false"
 		;;
+	Haiku)
+		LIB_netlibs_CFLAGS=""
+		LIB_netlibs_LDFLAGS="-lnetwork"
+		LIB_netlibs_VERSION=""
+		;;
 esac
 
 
-- 
2.23.0


From be8543f8eb6681c8b03d974271d369c2ed518864 Mon Sep 17 00:00:00 2001
From: Adrien Destugues <pulkomandy@pulkomandy.tk>
Date: Wed, 15 Jan 2014 23:09:08 +0100
Subject: Add missing include for use of select().


diff --git a/src/libs/network/netmanager/netmanager_bsd.c b/src/libs/network/netmanager/netmanager_bsd.c
index 29159f8..4390eb8 100644
--- a/src/libs/network/netmanager/netmanager_bsd.c
+++ b/src/libs/network/netmanager/netmanager_bsd.c
@@ -30,6 +30,7 @@
 #include <errno.h>
 #include <stdlib.h>
 #include <string.h>
+#include <sys/select.h>
 
 #include "netmanager_common.ci"
 #include "ndindex.ci"
-- 
2.23.0


From c92675ee804117a509cc9964f5f14eb423944929 Mon Sep 17 00:00:00 2001
From: Gerasim Troeglazov <3dEyes@gmail.com>
Date: Sat, 21 Sep 2019 13:37:15 +1000
Subject: Change current dir to application dir


diff --git a/src/uqm.c b/src/uqm.c
index a96f97a..b07ab7e 100644
--- a/src/uqm.c
+++ b/src/uqm.c
@@ -61,6 +61,10 @@
 			// Including this is actually necessary on OSX.
 #endif
 
+#ifdef __HAIKU__
+#   include<libgen.h> 
+#endif
+
 struct bool_option
 {
 	bool value;
@@ -267,6 +271,14 @@ main (int argc, char *argv[])
 	int gfxFlags;
 	int i;
 
+#ifdef __HAIKU__
+	char *binpath = realpath(argv[0], NULL);
+	if (binpath != NULL) {
+		chdir(dirname(binpath));
+		free(binpath);
+	}
+#endif
+
 	// NOTE: we cannot use the logging facility yet because we may have to
 	//   log to a file, and we'll only get the log file name after parsing
 	//   the options.
-- 
2.23.0

