Fixes for BSD build

- patch fixes for BSD handling
- OpenBSD/aarch64 has elf_aux_info()
- unrar build fix for FreeBSD/NetBSD/OpenBSD
- OpenBSD does not have librt

Signed-off-by: Rafael Kitover <rkitover@gmail.com>
This commit is contained in:
Brad Smith
2025-09-18 21:43:51 -04:00
committed by Rafael Kitover
parent 5bd8904746
commit ede668b712
4 changed files with 10 additions and 6 deletions

View File

@@ -10,7 +10,7 @@
#endif #endif
#if defined(__FreeBSD__) || defined(__NetBSD__) #if defined(__FreeBSD__) || defined(__NetBSD__) || defined(__OpenBSD__)
#include <sys/param.h> #include <sys/param.h>
#define fopen64 fopen #define fopen64 fopen
#define fseeko64 fseeko #define fseeko64 fseeko
@@ -34,7 +34,7 @@
#include "core/base/file_util.h" #include "core/base/file_util.h"
#ifdef __GNUC__ #ifdef __GNUC__
#if defined(__MUSL__) || defined(__APPLE__) || defined(BSD) || defined(__NetBSD__) #if defined(__MUSL__) || defined(__APPLE__) || defined(BSD)
typedef off_t __off64_t; /* off_t is 64 bits on BSD. */ typedef off_t __off64_t; /* off_t is 64 bits on BSD. */
#define fseeko64 fseeko #define fseeko64 fseeko
#define ftello64 ftello #define ftello64 ftello

View File

@@ -877,7 +877,7 @@ BoolInt CPU_IsSupported_AES (void) { return APPLE_CRYPTO_SUPPORT_VAL; }
#ifdef USE_HWCAP #ifdef USE_HWCAP
#if defined(__FreeBSD__) #if defined(__FreeBSD__) || defined(__OpenBSD__)
static unsigned long MY_getauxval(int aux) static unsigned long MY_getauxval(int aux)
{ {
unsigned long val; unsigned long val;

View File

@@ -129,7 +129,9 @@ wchar etoupperw(wchar ch)
{ {
if (ch=='i') if (ch=='i')
return('I'); return('I');
#if defined(__APPLE__) || defined(_MSC_VER) || defined(__MINGW32__) || defined(__linux__) #if defined(__APPLE__) || defined(_MSC_VER) || defined(__MINGW32__) || \
defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
defined(__OpenBSD__)
return(toupper(ch)); return(toupper(ch));
#else #else
return(toupperw(ch)); return(toupperw(ch));
@@ -234,7 +236,9 @@ bool LowAscii(const wchar *Str)
int wcsicompc(const wchar *Str1,const wchar *Str2) int wcsicompc(const wchar *Str1,const wchar *Str2)
{ {
#if defined(_UNIX) || defined(_MSC_VER) || defined(__APPLE__) || defined(__linux__) #if defined(_UNIX) || defined(_MSC_VER) || defined(__APPLE__) || \
defined(__linux__) || defined(__FreeBSD__) || defined(__NetBSD__) || \
defined(__OpenBSD__)
return my_wcscmp(Str1,Str2); return my_wcscmp(Str1,Str2);
#elif defined(__MINGW32__) #elif defined(__MINGW32__)
return _wcsicmp(Str1,Str2); return _wcsicmp(Str1,Str2);

View File

@@ -88,7 +88,7 @@ endif()
if(UNIX OR APPLE) if(UNIX OR APPLE)
target_link_libraries(sfml-system PRIVATE pthread) target_link_libraries(sfml-system PRIVATE pthread)
endif() endif()
if(UNIX AND NOT APPLE) if(UNIX AND NOT APPLE AND NOT CMAKE_SYSTEM_NAME STREQUAL "OpenBSD")
target_link_libraries(sfml-system PRIVATE rt) target_link_libraries(sfml-system PRIVATE rt)
elseif(WIN32) elseif(WIN32)
target_link_libraries(sfml-system PRIVATE winmm) target_link_libraries(sfml-system PRIVATE winmm)