From b7922368bd367a8c9f5dd5dff0068662be18ef0a Mon Sep 17 00:00:00 2001 From: exstrim401 Date: Sat, 5 Jun 2021 12:54:37 +0500 Subject: [PATCH] engine: Haiku OS support (#478) --- engine/common/build.c | 2 ++ engine/wscript | 6 ++++++ game_launch/game.cpp | 2 +- public/build.h | 4 ++++ 4 files changed, 13 insertions(+), 1 deletion(-) diff --git a/engine/common/build.c b/engine/common/build.c index 78f9c8f9..eef0454a 100644 --- a/engine/common/build.c +++ b/engine/common/build.c @@ -93,6 +93,8 @@ const char *Q_buildos( void ) osname = "emscripten"; #elif XASH_DOS4GW osname = "DOS4GW"; +#elif XASH_HAIKU + osname = "haiku"; #else #error "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug" #endif diff --git a/engine/wscript b/engine/wscript index f57c09f6..38022b5a 100644 --- a/engine/wscript +++ b/engine/wscript @@ -62,6 +62,10 @@ def configure(conf): conf.fatal('SDL2 not availiable! If you want to build dedicated server, specify --dedicated') conf.define('XASH_SDL', 2) + if conf.env.DEST_OS == 'haiku': + conf.env.LIB_HAIKU = ['network'] + conf.env.LIBPATH_HAIKU = ['/boot/system/lib'] + if conf.options.USE_SELECT == None: conf.options.USE_SELECT = conf.options.DEDICATED @@ -112,6 +116,8 @@ def build(bld): source += bld.path.ant_glob(['platform/dos/*.c']) source += bld.path.ant_glob(['platform/stub/s_stub.c']) + if bld.env.DEST_OS == 'haiku': + libs.append('HAIKU') if bld.get_define('XASH_CUSTOM_SWAP'): source += bld.path.ant_glob(['platform/misc/kmalloc.c', 'platform/misc/sbrk.c']) diff --git a/game_launch/game.cpp b/game_launch/game.cpp index 9ce8c262..0ab28635 100644 --- a/game_launch/game.cpp +++ b/game_launch/game.cpp @@ -20,7 +20,7 @@ GNU General Public License for more details. #include #include -#if defined(__APPLE__) || defined(__unix__) +#if defined(__APPLE__) || defined(__unix__) || defined(__HAIKU__) #define XASHLIB "libxash." OS_LIB_EXT #elif _WIN32 #if !__MINGW32__ && _MSC_VER >= 1200 diff --git a/public/build.h b/public/build.h index f94ffce9..4edb351b 100644 --- a/public/build.h +++ b/public/build.h @@ -67,6 +67,7 @@ For more information, please refer to #undef XASH_MSVC #undef XASH_NETBSD #undef XASH_OPENBSD +#undef XASH_HAIKU #undef XASH_WIN32 #undef XASH_WIN64 #undef XASH_X86 @@ -115,6 +116,9 @@ For more information, please refer to #elif defined __WATCOMC__ && defined __DOS__ #define XASH_DOS4GW 1 #define XASH_LITTLE_ENDIAN +#elif defined __HAIKU__ + #define XASH_HAIKU 1 + #define XASH_POSIX 1 #else #error "Place your operating system name here! If this is a mistake, try to fix conditions above and report a bug" #endif