From 66474e6f9da7d2bcc0b00093c7ff0e6fa80d55e9 Mon Sep 17 00:00:00 2001 From: Vinnie Falco Date: Thu, 20 Jun 2013 13:38:44 -0700 Subject: [PATCH] Beast fixes for FreeBSD --- .../beast/modules/beast_core/beast_core.cpp | 7 +++++-- .../native/beast_BasicNativeHeaders.h | 21 ++++++++++++------- .../native/beast_posix_SharedCode.h | 7 ++++++- .../beast_core/system/beast_SystemStats.cpp | 2 +- .../beast_core/system/beast_TargetPlatform.h | 4 +++- 5 files changed, 29 insertions(+), 12 deletions(-) diff --git a/Subtrees/beast/modules/beast_core/beast_core.cpp b/Subtrees/beast/modules/beast_core/beast_core.cpp index d6eca8536..0514b14c5 100644 --- a/Subtrees/beast/modules/beast_core/beast_core.cpp +++ b/Subtrees/beast/modules/beast_core/beast_core.cpp @@ -40,7 +40,10 @@ #include #include -#include + +#if ! BEAST_BSD + #include +#endif #if ! BEAST_ANDROID #include @@ -85,7 +88,7 @@ #include #include - #if ! BEAST_ANDROID + #if ! BEAST_ANDROID && ! BEAST_BSD #include #endif #endif diff --git a/Subtrees/beast/modules/beast_core/native/beast_BasicNativeHeaders.h b/Subtrees/beast/modules/beast_core/native/beast_BasicNativeHeaders.h index 649280f1e..5af5a11d7 100644 --- a/Subtrees/beast/modules/beast_core/native/beast_BasicNativeHeaders.h +++ b/Subtrees/beast/modules/beast_core/native/beast_BasicNativeHeaders.h @@ -68,11 +68,11 @@ #elif BEAST_WINDOWS #if BEAST_MSVC #ifndef _CPPRTTI - #error "You're compiling without RTTI enabled! This is needed for a lot of BEAST classes, please update your compiler settings!" + #error "Beast requires RTTI!" #endif #ifndef _CPPUNWIND - #error "You're compiling without exceptions enabled! This is needed for a lot of BEAST classes, please update your compiler settings!" + #error "Beast requires RTTI!" #endif #pragma warning (push) @@ -161,15 +161,13 @@ type##localFunctionName localFunctionName = (type##localFunctionName) dll.getFunction (#functionName); //============================================================================== -#elif BEAST_LINUX +#elif BEAST_LINUX || BEAST_BSD #include #include #include #include #include - #include #include - #include #include #include #include @@ -184,12 +182,21 @@ #include #include #include - #include #include - #include #include #include + #if BEAST_BSD + #include + #include + #include + #else + #include + #include + #include + #include + #endif + //============================================================================== #elif BEAST_ANDROID #include diff --git a/Subtrees/beast/modules/beast_core/native/beast_posix_SharedCode.h b/Subtrees/beast/modules/beast_core/native/beast_posix_SharedCode.h index a91ad4ecd..1903180f7 100644 --- a/Subtrees/beast/modules/beast_core/native/beast_posix_SharedCode.h +++ b/Subtrees/beast/modules/beast_core/native/beast_posix_SharedCode.h @@ -177,7 +177,8 @@ bool File::setAsCurrentWorkingDirectory() const //============================================================================== namespace { - #if BEAST_LINUX || (BEAST_IOS && ! __DARWIN_ONLY_64_BIT_INO_T) // (this iOS stuff is to avoid a simulator bug) + #if BEAST_LINUX || \ + (BEAST_IOS && ! __DARWIN_ONLY_64_BIT_INO_T) // (this iOS stuff is to avoid a simulator bug) typedef struct stat64 beast_statStruct; #define BEAST_STAT stat64 #else @@ -1217,7 +1218,11 @@ private: t.tv_sec = (time_t) (time / 1000000000); t.tv_nsec = (long) (time % 1000000000); +#if BEAST_BSD + bassertfalse; // unimplemented +#else clock_nanosleep (CLOCK_MONOTONIC, TIMER_ABSTIME, &t, nullptr); +#endif } uint64 time, delta; diff --git a/Subtrees/beast/modules/beast_core/system/beast_SystemStats.cpp b/Subtrees/beast/modules/beast_core/system/beast_SystemStats.cpp index d49d5bdc5..07a8b43c8 100644 --- a/Subtrees/beast/modules/beast_core/system/beast_SystemStats.cpp +++ b/Subtrees/beast/modules/beast_core/system/beast_SystemStats.cpp @@ -68,7 +68,7 @@ String SystemStats::getStackBacktrace() { String result; - #if BEAST_ANDROID || BEAST_MINGW + #if BEAST_ANDROID || BEAST_MINGW || BEAST_BSD bassertfalse; // sorry, not implemented yet! #elif BEAST_WINDOWS diff --git a/Subtrees/beast/modules/beast_core/system/beast_TargetPlatform.h b/Subtrees/beast/modules/beast_core/system/beast_TargetPlatform.h index 91b5df6cc..9a11d1e3a 100644 --- a/Subtrees/beast/modules/beast_core/system/beast_TargetPlatform.h +++ b/Subtrees/beast/modules/beast_core/system/beast_TargetPlatform.h @@ -59,6 +59,8 @@ #else #define BEAST_MAC 1 #endif +#elif defined (__FreeBSD__) + #define BEAST_BSD 1 #else #error "Unknown platform!" #endif @@ -135,7 +137,7 @@ #endif //============================================================================== -#if BEAST_LINUX || BEAST_ANDROID +#if BEAST_LINUX || BEAST_ANDROID || BEAST_BSD #ifdef _DEBUG #define BEAST_DEBUG 1