Merge pull request #581 from devnexen/haiku_port

Haiku porting proposal.
This commit is contained in:
Yamagi 2020-06-26 16:12:34 +02:00 committed by GitHub
commit 7439bdd45c
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
5 changed files with 33 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

@ -277,6 +277,8 @@ else ifeq ($(YQ2_OSTYPE),Windows)
override LDFLAGS += -lws2_32 -lwinmm -static-libgcc
else ifeq ($(YQ2_OSTYPE), Darwin)
override LDFLAGS += -arch $(YQ2_ARCH)
else ifeq ($(YQ2_OSTYPE), Haiku)
override LDFLAGS += -lm -lnetwork
endif
# Keep symbols hidden.

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)
{
Q_strlcpy(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>