netbsd build fix

This commit is contained in:
scribam 2023-04-27 23:30:21 +02:00 committed by flyinghead
parent 79b9b49218
commit 4acb670b88
4 changed files with 11 additions and 12 deletions

View File

@ -573,6 +573,9 @@ if(NOT MINIUPNP_FOUND)
option(UPNPC_BUILD_SAMPLE "Build sample executables" OFF)
option(UPNPC_NO_INSTALL "Disable installation" ON)
add_subdirectory(core/deps/miniupnpc)
if(CMAKE_SYSTEM_NAME STREQUAL "NetBSD")
set_property(TARGET libminiupnpc-static APPEND_STRING PROPERTY COMPILE_FLAGS " -D_NETBSD_SOURCE")
endif()
if(WINDOWS_STORE)
get_target_property(miniupnpc-private-defs miniupnpc-private INTERFACE_COMPILE_DEFINITIONS)
list(REMOVE_ITEM miniupnpc-private-defs "_WIN32_WINNT=0x0501")

View File

@ -140,9 +140,7 @@ public:
{
pthread_mutexattr_t mattr;
pthread_mutexattr_init(&mattr);
#if !defined(__NetBSD__) && !defined(__OpenBSD__)
pthread_mutexattr_setpshared(&mattr, PTHREAD_PROCESS_SHARED);
#endif
pthread_mutex_init(&mutex, &mattr);
pthread_mutexattr_destroy(&mattr);
}
@ -176,9 +174,7 @@ public:
{
pthread_condattr_t cvattr;
pthread_condattr_init(&cvattr);
#if !defined(__NetBSD__) && !defined(__OpenBSD__)
pthread_condattr_setpshared(&cvattr, PTHREAD_PROCESS_SHARED);
#endif
pthread_cond_init(&cond, &cvattr);
pthread_condattr_destroy(&cvattr);
}

View File

@ -98,9 +98,9 @@ static void context_segfault(host_context_t* hostctx, void* segfault_ctx)
bicopy<ToSegfault>(hostctx->rdi, MCTX(->sc_rdi));
#elif defined(__NetBSD__)
bicopy<ToSegfault>(hostctx->pc, MCTX(.__gregs[_REG_RIP]));
bicopy<ToSegfault>(hostctx->rsp, MCTX(.__gregs[REG_RSP]));
bicopy<ToSegfault>(hostctx->r9, MCTX(.__gregs[REG_R9]));
bicopy<ToSegfault>(hostctx->rdi, MCTX(.__gregs[REG_RDI]));
bicopy<ToSegfault>(hostctx->rsp, MCTX(.__gregs[_REG_RSP]));
bicopy<ToSegfault>(hostctx->r9, MCTX(.__gregs[_REG_R9]));
bicopy<ToSegfault>(hostctx->rdi, MCTX(.__gregs[_REG_RDI]));
#elif defined(__unix__)
bicopy<ToSegfault>(hostctx->pc, MCTX(.gregs[REG_RIP]));
bicopy<ToSegfault>(hostctx->rsp, MCTX(.gregs[REG_RSP]));

View File

@ -24,7 +24,7 @@ int vasprintf(char **s, const char *fmt, va_list ap)
}
#endif
#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__SWITCH__)
#if !defined(_WIN32) && !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__SWITCH__)
static locale_t GetCLocale()
{
static locale_t c_locale = newlocale(LC_ALL_MASK, "C", nullptr);
@ -69,11 +69,11 @@ bool CharArrayFromFormatV(char* out, int outsize, const char* format, va_list ar
writtenCount = vsnprintf(out, outsize, format, args);
#endif
#else
#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__SWITCH__)
#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__SWITCH__)
locale_t previousLocale = uselocale(GetCLocale());
#endif
writtenCount = vsnprintf(out, outsize, format, args);
#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__SWITCH__)
#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__SWITCH__)
uselocale(previousLocale);
#endif
#endif
@ -101,7 +101,7 @@ std::string StringFromFormatV(const char* format, va_list args)
std::string temp = buf;
delete[] buf;
#else
#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__SWITCH__)
#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__SWITCH__)
locale_t previousLocale = uselocale(GetCLocale());
#endif
if (vasprintf(&buf, format, args) < 0)
@ -110,7 +110,7 @@ std::string StringFromFormatV(const char* format, va_list args)
buf = nullptr;
}
#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__SWITCH__)
#if !defined(__ANDROID__) && !defined(__HAIKU__) && !defined(__OpenBSD__) && !defined(__NetBSD__) && !defined(__SWITCH__)
uselocale(previousLocale);
#endif