Here's the latest version of my patch. With the updates to LUA, everything now builds and installs except the loginserver. I haven't any hope of that working until I can work with CaveDude.
This patch is much the same as the previous one. Just two more CMakeList.txt files needed a test to avoid linking in librt on OSX.
Code:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index e390336..e567b1d 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -99,6 +99,10 @@ IF(UNIX)
ADD_DEFINITIONS(-DFREEBSD)
SET(FREEBSD TRUE)
ENDIF(CMAKE_SYSTEM_NAME MATCHES "FreeBSD")
+ IF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
+ ADD_DEFINITIONS(-DDARWIN)
+ SET(DARWIN TRUE)
+ ENDIF(CMAKE_SYSTEM_NAME MATCHES "Darwin")
ENDIF(UNIX)
#use stdint.h types if they exist for this platform (we have to guess otherwise)
diff --git a/client_files/export/CMakeLists.txt b/client_files/export/CMakeLists.txt
index 1911840..851aa05 100644
--- a/client_files/export/CMakeLists.txt
+++ b/client_files/export/CMakeLists.txt
@@ -26,7 +26,9 @@ IF(UNIX)
TARGET_LINK_LIBRARIES(export_client_files "${CMAKE_DL_LIBS}")
TARGET_LINK_LIBRARIES(export_client_files "z")
TARGET_LINK_LIBRARIES(export_client_files "m")
- TARGET_LINK_LIBRARIES(export_client_files "rt")
+ IF(NOT DARWIN)
+ TARGET_LINK_LIBRARIES(export_client_files "rt")
+ ENDIF(NOT DARWIN)
TARGET_LINK_LIBRARIES(export_client_files "pthread")
ADD_DEFINITIONS(-fPIC)
ENDIF(UNIX)
diff --git a/client_files/import/CMakeLists.txt b/client_files/import/CMakeLists.txt
index 9487530..0b6c45b 100644
--- a/client_files/import/CMakeLists.txt
+++ b/client_files/import/CMakeLists.txt
@@ -26,7 +26,9 @@ IF(UNIX)
TARGET_LINK_LIBRARIES(import_client_files "${CMAKE_DL_LIBS}")
TARGET_LINK_LIBRARIES(import_client_files "z")
TARGET_LINK_LIBRARIES(import_client_files "m")
- TARGET_LINK_LIBRARIES(import_client_files "rt")
+ IF(NOT DARWIN)
+ TARGET_LINK_LIBRARIES(import_client_files "rt")
+ ENDIF(NOT DARWIN)
TARGET_LINK_LIBRARIES(import_client_files "pthread")
ADD_DEFINITIONS(-fPIC)
ENDIF(UNIX)
diff --git a/common/TCPConnection.cpp b/common/TCPConnection.cpp
index e576f95..1e5f496 100644
--- a/common/TCPConnection.cpp
+++ b/common/TCPConnection.cpp
@@ -30,6 +30,10 @@
#ifdef FREEBSD //Timothy Whitman - January 7, 2003
#define MSG_NOSIGNAL 0
#endif
+#ifdef DARWIN
+ #define MSG_NOSIGNAL SO_NOSIGPIPE // Corysia Taware - Sept. 27, 2013
+ // See http://lists.apple.com/archives/macnetworkprog/2002/Dec/msg00091.html
+#endif // DARWIN
#ifdef _WINDOWS
InitWinsock winsock;
diff --git a/eqlaunch/CMakeLists.txt b/eqlaunch/CMakeLists.txt
index 0f0114c..b636a18 100644
--- a/eqlaunch/CMakeLists.txt
+++ b/eqlaunch/CMakeLists.txt
@@ -30,7 +30,9 @@ IF(UNIX)
TARGET_LINK_LIBRARIES(eqlaunch "${CMAKE_DL_LIBS}")
TARGET_LINK_LIBRARIES(eqlaunch "z")
TARGET_LINK_LIBRARIES(eqlaunch "m")
- TARGET_LINK_LIBRARIES(eqlaunch "rt")
+ IF(NOT DARWIN)
+ TARGET_LINK_LIBRARIES(eqlaunch "rt")
+ ENDIF(NOT DARWIN)
TARGET_LINK_LIBRARIES(eqlaunch "pthread")
ADD_DEFINITIONS(-fPIC)
ENDIF(UNIX)
diff --git a/loginserver/CMakeLists.txt b/loginserver/CMakeLists.txt
index ba96b1f..9ded859 100644
--- a/loginserver/CMakeLists.txt
+++ b/loginserver/CMakeLists.txt
@@ -58,7 +58,9 @@ IF(UNIX)
TARGET_LINK_LIBRARIES(loginserver "${CMAKE_DL_LIBS}")
TARGET_LINK_LIBRARIES(loginserver "z")
TARGET_LINK_LIBRARIES(loginserver "m")
- TARGET_LINK_LIBRARIES(loginserver "rt")
+ IF(NOT DARWIN)
+ TARGET_LINK_LIBRARIES(loginserver "rt")
+ ENDIF(NOT DARWIN)
TARGET_LINK_LIBRARIES(loginserver "pthread")
TARGET_LINK_LIBRARIES(loginserver "EQEmuAuthCrypto")
TARGET_LINK_LIBRARIES(loginserver "cryptopp")
diff --git a/queryserv/CMakeLists.txt b/queryserv/CMakeLists.txt
index a8480ca..33be865 100644
--- a/queryserv/CMakeLists.txt
+++ b/queryserv/CMakeLists.txt
@@ -36,7 +36,9 @@ IF(UNIX)
TARGET_LINK_LIBRARIES(queryserv "${CMAKE_DL_LIBS}")
TARGET_LINK_LIBRARIES(queryserv "z")
TARGET_LINK_LIBRARIES(queryserv "m")
- TARGET_LINK_LIBRARIES(queryserv "rt")
+ IF(NOT DARWIN)
+ TARGET_LINK_LIBRARIES(queryserv "rt")
+ ENDIF(NOT DARWIN)
TARGET_LINK_LIBRARIES(queryserv "pthread")
ADD_DEFINITIONS(-fPIC)
ENDIF(UNIX)
diff --git a/shared_memory/CMakeLists.txt b/shared_memory/CMakeLists.txt
index 863b563..3d23a1b 100644
--- a/shared_memory/CMakeLists.txt
+++ b/shared_memory/CMakeLists.txt
@@ -38,7 +38,9 @@ IF(UNIX)
TARGET_LINK_LIBRARIES(shared_memory "${CMAKE_DL_LIBS}")
TARGET_LINK_LIBRARIES(shared_memory "z")
TARGET_LINK_LIBRARIES(shared_memory "m")
- TARGET_LINK_LIBRARIES(shared_memory "rt")
+ IF(NOT DARWIN)
+ TARGET_LINK_LIBRARIES(shared_memory "rt")
+ ENDIF(NOT DARWIN)
TARGET_LINK_LIBRARIES(shared_memory "pthread")
ADD_DEFINITIONS(-fPIC)
ENDIF(UNIX)
diff --git a/tests/CMakeLists.txt b/tests/CMakeLists.txt
index 80f6a2f..aef5124 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -32,7 +32,9 @@ IF(UNIX)
TARGET_LINK_LIBRARIES(tests "${CMAKE_DL_LIBS}")
TARGET_LINK_LIBRARIES(tests "z")
TARGET_LINK_LIBRARIES(tests "m")
- TARGET_LINK_LIBRARIES(tests "rt")
+ IF(NOT DARWIN)
+ TARGET_LINK_LIBRARIES(loginserver "rt")
+ ENDIF(NOT DARWIN)
TARGET_LINK_LIBRARIES(tests "pthread")
ADD_DEFINITIONS(-fPIC)
ENDIF(UNIX)
diff --git a/ucs/CMakeLists.txt b/ucs/CMakeLists.txt
index 27a8a07..4468183 100644
--- a/ucs/CMakeLists.txt
+++ b/ucs/CMakeLists.txt
@@ -38,7 +38,9 @@ IF(UNIX)
TARGET_LINK_LIBRARIES(ucs "${CMAKE_DL_LIBS}")
TARGET_LINK_LIBRARIES(ucs "z")
TARGET_LINK_LIBRARIES(ucs "m")
- TARGET_LINK_LIBRARIES(ucs "rt")
+ IF(NOT DARWIN)
+ TARGET_LINK_LIBRARIES(ucs "rt")
+ ENDIF(NOT DARWIN)
TARGET_LINK_LIBRARIES(ucs "pthread")
ADD_DEFINITIONS(-fPIC)
ENDIF(UNIX)
diff --git a/world/CMakeLists.txt b/world/CMakeLists.txt
index 2decbf4..3ac0082 100644
--- a/world/CMakeLists.txt
+++ b/world/CMakeLists.txt
@@ -84,7 +84,9 @@ IF(UNIX)
TARGET_LINK_LIBRARIES(world "${CMAKE_DL_LIBS}")
TARGET_LINK_LIBRARIES(world "z")
TARGET_LINK_LIBRARIES(world "m")
- TARGET_LINK_LIBRARIES(world "rt")
+ IF(NOT DARWIN)
+ TARGET_LINK_LIBRARIES(world "rt")
+ ENDIF(NOT DARWIN)
TARGET_LINK_LIBRARIES(world "pthread")
ADD_DEFINITIONS(-fPIC)
ENDIF(UNIX)
diff --git a/world/net.cpp b/world/net.cpp
index 057367b..8be3283 100644
--- a/world/net.cpp
+++ b/world/net.cpp
@@ -56,7 +56,7 @@
#include <sys/ipc.h>
#include <sys/sem.h>
#include <sys/shm.h>
- #ifndef FREEBSD
+ #if not defined (FREEBSD) && not defined (DARWIN)
union semun {
int val;
struct semid_ds *buf;
diff --git a/zone/CMakeLists.txt b/zone/CMakeLists.txt
index 49410f0..e582e0c 100644
--- a/zone/CMakeLists.txt
+++ b/zone/CMakeLists.txt
@@ -230,7 +230,9 @@ IF(UNIX)
TARGET_LINK_LIBRARIES(zone "${CMAKE_DL_LIBS}")
TARGET_LINK_LIBRARIES(zone "z")
TARGET_LINK_LIBRARIES(zone "m")
- TARGET_LINK_LIBRARIES(zone "rt")
+ IF(NOT DARWIN)
+ TARGET_LINK_LIBRARIES(zone "rt")
+ ENDIF(NOT DARWIN)
TARGET_LINK_LIBRARIES(zone "pthread")
ADD_DEFINITIONS(-fPIC)
ENDIF(UNIX)