diff --git a/CMakeLists.txt b/CMakeLists.txt index 312095f08..a5ab85d5f 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -84,6 +84,14 @@ ELSE(MSVC) ADD_DEFINITIONS(-DHAS_UNION_SEMUN) ENDIF(MSVC) +#FreeBSD support +IF(UNIX) + IF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") + ADD_DEFINITIONS(-DFREEBSD) + SET(FREEBSD TRUE) + ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD") +ENDIF(UNIX) + #use stdint.h types if they exist for this platform (we have to guess otherwise) CHECK_INCLUDE_FILES(stdint.h HAVE_STDINT_H) IF(HAVE_STDINT_H) diff --git a/common/Mutex.cpp b/common/Mutex.cpp index a866c5530..e556b05d3 100644 --- a/common/Mutex.cpp +++ b/common/Mutex.cpp @@ -74,7 +74,7 @@ Mutex::Mutex() { #else pthread_mutexattr_t attr; pthread_mutexattr_init(&attr); -#if defined(__CYGWIN__) || defined(__APPLE__) +#if defined(__CYGWIN__) || defined(__APPLE__) || defined(FREEBSD) pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE); #else pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP); diff --git a/common/memory_mapped_file.cpp b/common/memory_mapped_file.cpp index ca2ae0c6d..28455d0bd 100644 --- a/common/memory_mapped_file.cpp +++ b/common/memory_mapped_file.cpp @@ -29,6 +29,9 @@ #include #endif #include "eqemu_exception.h" +#ifdef FREEBSD +#include +#endif namespace EQEmu { diff --git a/eqlaunch/CMakeLists.txt b/eqlaunch/CMakeLists.txt index 14257fef9..66f68298f 100644 --- a/eqlaunch/CMakeLists.txt +++ b/eqlaunch/CMakeLists.txt @@ -26,7 +26,9 @@ IF(MINGW) ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(eqlaunch "dl") + IF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(eqlaunch "dl") + ENDIF(NOT FREEBSD) TARGET_LINK_LIBRARIES(eqlaunch "z") TARGET_LINK_LIBRARIES(eqlaunch "m") TARGET_LINK_LIBRARIES(eqlaunch "rt") diff --git a/loginserver/CMakeLists.txt b/loginserver/CMakeLists.txt index 5ded6a0c7..43b8b3076 100644 --- a/loginserver/CMakeLists.txt +++ b/loginserver/CMakeLists.txt @@ -53,7 +53,9 @@ IF(MINGW) ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(loginserver "dl") + IF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(loginserver "dl") + ENDIF(NOT FREEBSD) TARGET_LINK_LIBRARIES(loginserver "z") TARGET_LINK_LIBRARIES(loginserver "m") TARGET_LINK_LIBRARIES(loginserver "rt") diff --git a/queryserv/CMakeLists.txt b/queryserv/CMakeLists.txt index 4e319ddad..5108aa2f7 100644 --- a/queryserv/CMakeLists.txt +++ b/queryserv/CMakeLists.txt @@ -32,7 +32,9 @@ IF(MINGW) ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(queryserv "dl") + IF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(queryserv "dl") + ENDIF(NOT FREEBSD) TARGET_LINK_LIBRARIES(queryserv "z") TARGET_LINK_LIBRARIES(queryserv "m") TARGET_LINK_LIBRARIES(queryserv "rt") diff --git a/shared_memory/CMakeLists.txt b/shared_memory/CMakeLists.txt index 902ffb2ff..6003e61b3 100644 --- a/shared_memory/CMakeLists.txt +++ b/shared_memory/CMakeLists.txt @@ -31,7 +31,9 @@ IF(MINGW) ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(shared_memory "dl") + IF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(shared_memory "dl") + ENDIF(NOT FREEBSD) TARGET_LINK_LIBRARIES(shared_memory "z") TARGET_LINK_LIBRARIES(shared_memory "m") TARGET_LINK_LIBRARIES(shared_memory "rt") diff --git a/ucs/CMakeLists.txt b/ucs/CMakeLists.txt index 1218541a3..8649bcf10 100644 --- a/ucs/CMakeLists.txt +++ b/ucs/CMakeLists.txt @@ -34,7 +34,9 @@ IF(MINGW) ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(ucs "dl") + IF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(ucs "dl") + ENDIF(NOT FREEBSD) TARGET_LINK_LIBRARIES(ucs "z") TARGET_LINK_LIBRARIES(ucs "m") TARGET_LINK_LIBRARIES(ucs "rt") diff --git a/world/CMakeLists.txt b/world/CMakeLists.txt index 768072677..f974a671f 100644 --- a/world/CMakeLists.txt +++ b/world/CMakeLists.txt @@ -80,7 +80,9 @@ IF(MINGW) ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(world "dl") + IF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(world "dl") + ENDIF(NOT FREEBSD) TARGET_LINK_LIBRARIES(world "z") TARGET_LINK_LIBRARIES(world "m") TARGET_LINK_LIBRARIES(world "rt") diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt index 6f3ad68ee..4341b7435 100644 --- a/zone/CMakeLists.txt +++ b/zone/CMakeLists.txt @@ -168,7 +168,9 @@ IF(MINGW) ENDIF(MINGW) IF(UNIX) - TARGET_LINK_LIBRARIES(zone "dl") + IF(NOT FREEBSD) + TARGET_LINK_LIBRARIES(zone "dl") + ENDIF(NOT FREEBSD) TARGET_LINK_LIBRARIES(zone "z") TARGET_LINK_LIBRARIES(zone "m") TARGET_LINK_LIBRARIES(zone "rt") diff --git a/zone/client_packet.cpp b/zone/client_packet.cpp index 9724dec22..99582602b 100644 --- a/zone/client_packet.cpp +++ b/zone/client_packet.cpp @@ -12549,11 +12549,7 @@ void Client::Handle_OP_GuildCreate(const EQApplicationPacket *app) // char *GuildName = (char *)app->pBuffer; -#ifdef FREEBSD - if(strlen(GuildName) > 60) -#else if(strnlen(GuildName, 64) > 60) -#endif { Message(clientMessageError, "Guild name too long."); return;