diff --git a/CMakeLists.txt b/CMakeLists.txt index a600c4ca..008f97df 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -140,7 +140,11 @@ endif() if(${CMAKE_SYSTEM_NAME} MATCHES "Windows") list(APPEND yquake2LinkerFlags "-lm -static-libgcc") else() - list(APPEND yquake2LinkerFlags "-lm -rdynamic") + if (NOT ${CMAKE_SYSTEM_NAME} MATCHES "Haiku") + list(APPEND yquake2LinkerFlags "-lm -rdynamic") + else() + list(APPEND yquake2LinkerFlags "-lm -lnetwork") + endif() endif() list(APPEND yquake2LinkerFlags ${CMAKE_DL_LIBS}) diff --git a/src/backends/generic/misc.c b/src/backends/generic/misc.c index 973a2cba..aef164ee 100644 --- a/src/backends/generic/misc.c +++ b/src/backends/generic/misc.c @@ -45,6 +45,10 @@ #include // _NSGetExecutablePath #endif +#ifdef __HAIKU__ +#include +#endif + #ifndef PATH_MAX // this is mostly for windows. windows has a MAX_PATH = 260 #define, but allows // longer paths anyway.. this might not be the maximum allowed length, but is @@ -118,6 +122,22 @@ static void SetExecutablePath(char* exePath) // TODO: realpath() ? // TODO: no idea what this is if the executable is in an app bundle +#elif defined(__HAIKU__) + image_info ii; + int32_t id = 0; + + exePath[0] = '\0'; + + for (; get_next_image_info(0, &id, &ii) == B_OK;) + { + if (ii.type == B_APP_IMAGE) + break; + } + + if (ii.type == B_APP_IMAGE) + { + memcpy(exePath, ii.name, PATH_MAX); + } #else diff --git a/src/backends/unix/main.c b/src/backends/unix/main.c index a5e5702c..06bc2ea7 100644 --- a/src/backends/unix/main.c +++ b/src/backends/unix/main.c @@ -30,6 +30,9 @@ #include #include #include +#ifndef FNDELAY +#define FNDELAY O_NDELAY +#endif #include "../../common/header/common.h" diff --git a/src/backends/unix/system.c b/src/backends/unix/system.c index 784362ae..b2d7c992 100644 --- a/src/backends/unix/system.c +++ b/src/backends/unix/system.c @@ -35,6 +35,9 @@ #include #include #include /* for fd_set */ +#ifndef FNDELAY +#define FNDELAY O_NDELAY +#endif #ifdef __APPLE__ #include