From c54427cc117d031d9eb3dbce07340de9229660ba Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Sat, 6 May 2017 11:09:02 +0200
Subject: Add Haiku to the known platforms


diff --git a/src/common/config.h b/src/common/config.h
index 8180f6a..72b2496 100644
--- a/src/common/config.h
+++ b/src/common/config.h
@@ -48,7 +48,7 @@
 #		define LOVE_MACOSX 1
 #	endif
 #endif
-#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
+#if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__) || defined(__HAIKU__)
 // I know it's not linux, but it seems most "linux-only" code is bsd-compatible
 #	define LOVE_LINUX 1
 #endif
-- 
2.30.0


From a975efb2a9af608abb8c0e9a213ff27fa04037e8 Mon Sep 17 00:00:00 2001
From: =?UTF-8?q?Zolt=C3=A1n=20Mizsei?= <zmizsei@extrowerk.com>
Date: Sat, 6 May 2017 11:18:30 +0200
Subject: Build fix for Haiku


diff --git a/src/modules/system/System.cpp b/src/modules/system/System.cpp
index d85a947..3a9d441 100644
--- a/src/modules/system/System.cpp
+++ b/src/modules/system/System.cpp
@@ -39,8 +39,10 @@
 #if defined(LOVE_ANDROID)
 #include "common/android.h"
 #elif defined(LOVE_LINUX)
+#ifndef __HAIKU__
 #include <spawn.h>
 #endif
+#endif
 
 namespace love
 {
@@ -106,8 +108,10 @@ bool System::openURL(const std::string &url) const
 
 	// Note: at the moment this process inherits our file descriptors.
 	// Note: the below const_cast is really ugly as well.
+	#ifndef __HAIKU__
 	if (posix_spawnp(&pid, "xdg-open", nullptr, nullptr, const_cast<char **>(argv), environ) != 0)
 		return false;
+	#endif
 
 	// Check if xdg-open already completed (or failed.)
 	int status = 0;
-- 
2.30.0


From fefdfa8ca95a20e939de01dcd9a1a729d93c9ce0 Mon Sep 17 00:00:00 2001
From: begasus <begasus@gmail.com>
Date: Fri, 26 Apr 2019 19:14:39 +0200
Subject: Build fix for Haiku #2


diff --git a/src/libraries/luasocket/libluasocket/compat.h b/src/libraries/luasocket/libluasocket/compat.h
index 7bf8010..9e3b43f 100644
--- a/src/libraries/luasocket/libluasocket/compat.h
+++ b/src/libraries/luasocket/libluasocket/compat.h
@@ -5,6 +5,8 @@
 #include "lauxlib.h"
 
 #if LUA_VERSION_NUM==501
+#define luaL_setfuncs socket_setfuncs
+#define luaL_testudata socket_testudata
 void luaL_setfuncs (lua_State *L, const luaL_Reg *l, int nup);
 #endif
 
-- 
2.30.0


From 823e7ebebfafc3b11e0d125671a8f00310a71e7f Mon Sep 17 00:00:00 2001
From: Jerome Duval <jerome.duval@gmail.com>
Date: Sun, 14 Feb 2021 11:49:17 +0100
Subject: links against libnetwork


diff --git a/configure.ac b/configure.ac
index 781680c..9fbaeb1 100644
--- a/configure.ac
+++ b/configure.ac
@@ -64,6 +64,7 @@ ACLOVE_DEP_SDL2
 ACLOVE_DEP_LIBM
 ACLOVE_DEP_ZLIB
 ACLOVE_DEP_PTHREAD
+ACLOVE_DEP_SOCKET
 
 # Conditional dependencies
 AS_VAR_IF([enable_module_audio], [yes], [ACLOVE_DEP_OPENAL], [])
diff --git a/platform/unix/deps.m4 b/platform/unix/deps.m4
index 42938d9..af4c10f 100644
--- a/platform/unix/deps.m4
+++ b/platform/unix/deps.m4
@@ -25,6 +25,16 @@ AC_DEFUN([ACLOVE_DEP_SDL2], [
 AC_DEFUN([ACLOVE_DEP_PTHREAD], [
 	AC_SEARCH_LIBS([pthread_create], [pthread], [], [LOVE_MSG_ERROR([the POSIX threads library])])])
 
+AC_DEFUN([ACLOVE_DEP_SOCKET], [
+  AC_CHECK_FUNCS(connect,,[
+    AC_CHECK_LIB(network,connect,[
+      LIBS_SOCKET="-lnetwork"
+      AC_SUBST([LIBS_SOCKET],[])
+    ])
+  ])
+])
+
+
 # does not use pkg-config because of the FILE_OFFSET_BITS.. bit
 AC_DEFUN([ACLOVE_DEP_MPG123], [
 	AC_SEARCH_LIBS([mpg123_open_feed], [mpg123], [],
diff --git a/src/Makefile.am b/src/Makefile.am
index 0d87ac4..df3e874 100644
--- a/src/Makefile.am
+++ b/src/Makefile.am
@@ -1023,6 +1023,7 @@ endif
 
 if LOVE_LIBRARY_LUASOCKET
 liblove_la_SOURCES += $(liblove_library_luasocket)
+liblove_la_LIBADD += $(LIBS_SOCKET)
 endif
 
 if LOVE_LIBRARY_LZ4
-- 
2.30.0

