diff --git a/CMakeLists.txt b/CMakeLists.txt index 2b12e2ee1..c164cfba4 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -328,7 +328,10 @@ IF(UNIX) IF(NOT DARWIN) SET(SERVER_LIBS ${SERVER_LIBS} "rt") ENDIF() - SET(SERVER_LIBS ${SERVER_LIBS} "uuid") + # Freebsd provides uuids in the C library + IF(NOT ${CMAKE_SYSTEM_NAME} STREQUAL "FreeBSD") + SET(SERVER_LIBS ${SERVER_LIBS} "uuid") + ENDIF() ENDIF() IF(EQEMU_BUILD_LOGIN AND NOT TLS_LIBRARY_ENABLED) diff --git a/common/crash.cpp b/common/crash.cpp index 155bfcf2a..cecb52f02 100644 --- a/common/crash.cpp +++ b/common/crash.cpp @@ -118,6 +118,11 @@ void set_exception_handler() { #include #include +#ifdef __FreeBSD__ +#include +#include +#endif + void print_trace() { auto uid = geteuid(); diff --git a/common/proc_launcher.h b/common/proc_launcher.h index 6289579cd..23b7e523c 100644 --- a/common/proc_launcher.h +++ b/common/proc_launcher.h @@ -24,6 +24,10 @@ #include #include +#ifdef __FreeBSD__ +#include +#endif + //I forced this object to become a singleton because it registers its //signal handler for UNIX class ProcLauncher { diff --git a/common/util/uuid.cpp b/common/util/uuid.cpp index c5b6b9a4d..633ffebaf 100644 --- a/common/util/uuid.cpp +++ b/common/util/uuid.cpp @@ -14,6 +14,10 @@ #include #endif +#ifdef __FreeBSD__ +#include +#endif + unsigned char hexDigitToChar(char ch) { if (ch > 47 && ch < 58) @@ -126,6 +130,15 @@ EQ::Util::UUID EQ::Util::UUID::Generate() return buffer; #endif + +#ifdef __FreeBSD__ + uuid_t l_id; + char l_uuid[37]; + uint32_t l_ignored; + uuid_create(&l_id, &l_ignored); + uuid_to_string(&l_id, (char**) &l_uuid, &l_ignored); + return FromString(l_uuid); +#endif } EQ::Util::UUID EQ::Util::UUID::FromString(const std::string &str) diff --git a/zone/main.cpp b/zone/main.cpp index 0445534d4..364df32b9 100644 --- a/zone/main.cpp +++ b/zone/main.cpp @@ -92,6 +92,10 @@ Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA #include "../common/unix.h" #endif +#ifdef __FreeBSD__ +#include +#endif + extern volatile bool is_zone_loaded; EntityList entity_list; @@ -431,8 +435,10 @@ int main(int argc, char** argv) { EQStreamIdentifier stream_identifier; RegisterAllPatches(stream_identifier); -#ifndef WIN32 +#ifdef __linux__ LogDebug("Main thread running with thread id [{}]", pthread_self()); +#elif defined(__FreeBSD__) + LogDebug("Main thread running with thread id [{}]", pthread_getthreadid_np()); #endif bool worldwasconnected = worldserver.Connected();