Haiku porting proposal.

This commit is contained in:
David Carlier 2020-06-20 15:37:21 +00:00
parent ea0c0c04a2
commit a2b274d1a5
4 changed files with 31 additions and 1 deletions

View file

@ -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})

View file

@ -45,6 +45,10 @@
#include <mach-o/dyld.h> // _NSGetExecutablePath
#endif
#ifdef __HAIKU__
#include <kernel/image.h>
#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

View file

@ -30,6 +30,9 @@
#include <libgen.h>
#include <unistd.h>
#include <sys/stat.h>
#ifndef FNDELAY
#define FNDELAY O_NDELAY
#endif
#include "../../common/header/common.h"

View file

@ -35,6 +35,9 @@
#include <unistd.h>
#include <sys/stat.h>
#include <sys/select.h> /* for fd_set */
#ifndef FNDELAY
#define FNDELAY O_NDELAY
#endif
#ifdef __APPLE__
#include <mach/clock.h>