From d67cdbebce674f27a6db45356d1c25ee9534825f Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Fri, 1 Nov 2019 15:54:40 +1000 Subject: Fix for Haiku diff --git a/neo/CMakeLists.txt b/neo/CMakeLists.txt index 194f34d..ad4f50d 100644 --- a/neo/CMakeLists.txt +++ b/neo/CMakeLists.txt @@ -285,6 +285,12 @@ if(WIN32) ) endif() +if(HAIKU) + set(sys_libs ${sys_libs} + network + ) +endif() + # fallback for cmake versions without GNUInstallDirs if(GNUINSTALLDIRS MATCHES "NOTFOUND") set(CMAKE_INSTALL_BINDIR "bin" diff --git a/neo/framework/minizip/ioapi.c b/neo/framework/minizip/ioapi.c index f59b904..499e29a 100644 --- a/neo/framework/minizip/ioapi.c +++ b/neo/framework/minizip/ioapi.c @@ -17,7 +17,7 @@ #define _CRT_SECURE_NO_WARNINGS #endif -#if defined(__APPLE__) || defined(IOAPI_NO_64) || defined(__OpenBSD__) +#if defined(__APPLE__) || defined(IOAPI_NO_64) || defined(__OpenBSD__) || defined(__HAIKU__) // In darwin and perhaps other BSD variants off_t is a 64 bit value, hence no need for specific 64 bit functions #define FOPEN_FUNC(filename, mode) fopen(filename, mode) #define FTELLO_FUNC(stream) ftello(stream) diff --git a/neo/idlib/Str.cpp b/neo/idlib/Str.cpp index b37e1a9..db74996 100644 --- a/neo/idlib/Str.cpp +++ b/neo/idlib/Str.cpp @@ -224,7 +224,7 @@ int idStr::FindText( const char *str, const char *text, bool casesensitive, int } } else { for ( j = 0; text[j]; j++ ) { - if ( ::toupper( str[i+j] ) != ::toupper( text[j] ) ) { + if ( toupper( str[i+j] ) != toupper( text[j] ) ) { break; } } @@ -302,7 +302,7 @@ bool idStr::Filter( const char *filter, const char *name, bool casesensitive ) { } } else { - if ( ::toupper(*name) >= ::toupper(*filter) && ::toupper(*name) <= ::toupper(*(filter+2)) ) { + if ( toupper(*name) >= toupper(*filter) && toupper(*name) <= toupper(*(filter+2)) ) { found = true; } } @@ -315,7 +315,7 @@ bool idStr::Filter( const char *filter, const char *name, bool casesensitive ) { } } else { - if ( ::toupper(*filter) == ::toupper(*name) ) { + if ( toupper(*filter) == toupper(*name) ) { found = true; } } @@ -342,7 +342,7 @@ bool idStr::Filter( const char *filter, const char *name, bool casesensitive ) { } } else { - if ( ::toupper(*filter) != ::toupper(*name) ) { + if ( toupper(*filter) != toupper(*name) ) { return false; } } diff --git a/neo/sys/platform.h b/neo/sys/platform.h index 2c4ce98..ef8e8a3 100644 --- a/neo/sys/platform.h +++ b/neo/sys/platform.h @@ -134,7 +134,7 @@ If you have questions concerning this license or the applicable additional terms // Unix -#ifdef __unix__ +#if defined(__unix__) || defined(__HAIKU__) #define _alloca alloca #define _alloca16( x ) ((void *)((((uintptr_t)alloca( (x)+15 )) + 15) & ~15)) diff --git a/neo/sys/posix/posix_net.cpp b/neo/sys/posix/posix_net.cpp index db83fa9..ec240e9 100644 --- a/neo/sys/posix/posix_net.cpp +++ b/neo/sys/posix/posix_net.cpp @@ -273,6 +273,7 @@ NET_InitNetworking */ void Sys_InitNetworking(void) { +#ifndef __HAIKU__ unsigned int ip, mask; struct ifaddrs *ifap, *ifp; @@ -319,6 +320,7 @@ void Sys_InitNetworking(void) break; } freeifaddrs(ifap); +#endif } /* -- 2.23.0 From dbcdc3950ccc91134934009b18ff63dedf9fee68 Mon Sep 17 00:00:00 2001 From: Gerasim Troeglazov <3dEyes@gmail.com> Date: Sat, 2 Nov 2019 15:45:47 +1000 Subject: Add env for base dir diff --git a/neo/sys/linux/main.cpp b/neo/sys/linux/main.cpp index 5e08e2d..3efde5b 100644 --- a/neo/sys/linux/main.cpp +++ b/neo/sys/linux/main.cpp @@ -55,6 +55,14 @@ bool Sys_GetPath(sysPath_t type, idStr &path) { switch(type) { case PATH_BASE: +#ifdef __HAIKU__ + s = getenv("BASE_GAMEDIR"); + if (s) { + idStr::snPrintf(buf, sizeof(buf), "%s/", s); + path = buf; + return true; + } +#endif if (stat(BUILD_DATADIR, &st) != -1 && S_ISDIR(st.st_mode)) { path = BUILD_DATADIR; return true; -- 2.23.0