Thread: Mac Server
View Single Post
  #1  
Old 09-30-2013, 03:58 PM
Corysia
Fire Beetle
 
Join Date: Jul 2007
Location: Pacific Northwest
Posts: 22
Default Mac Server

I'm still working on this, so there may be updates/changes coming. But this is what I have today. Currently, I can't build the loginserver because I don't have a libEQEmuAuthCrypto.a for Mac. Also, luabind won't compile.

First, a super-short guide on prerequisites:

Code:
Assuming starting with a clean Mountain Lion installation.

1. Install Xcode

2. Install Mac Ports from http://www.macports.org/

3. install MySQL 5.1 from mac ports
	sudo port install mysql51 mysql51-server
	sudo port select --set mysql mysql51
	sudo -u _mysql /opt/local/lib/mysql51/bin/mysql_install_db
	sudo /opt/local/share/mysql51/mysql/mysql.server start
	sudo /opt/local/lib/mysql51/bin/mysql_secure_installation

4. install gcc 4.8
	sudo port install gcc48
	sudo port select --set gcc mp-gcc48

5. Install cmake
	sudo port install cmake

6. Install Perl
	sudo port install perl5.12 p5.12-dbi
	sudo ln -s /opt/local/bin/perl5.12 /opt/local/bin/perl

7. Install lua
	sudo port install lua
	sudo port install python27
	sudo port select --set python python27
	sudo port install boost
	
8. Update values with cmake . -i
	Say "yes" to the advanced options

	Set installation prefix to /opt/EQ/Server

	Do not enable loginserver
	Do not enable luaparser

	Set the compilers to
		/opt/local/bin/gcc
		/opt/local/bin/g++
	Set the SQL Libraries and paths
		MySQL_INCLUDE_DIR=/opt/local/include/mysql51/mysql
		MySQL_LIBRARY_RELEASE=/opt/local/lib/mysql51/mysql/libmysqlclient_r.dylib
		MySQL_LIBRARY_DEBUG=/opt/local/lib/mysql51/mysql/libmysqlclient_r.dylib

9. configure with: cmake -G "Unix Makefiles"

10. make
11. sudo make install
And the patch:

Code:
diff --git a/CMakeLists.txt b/CMakeLists.txt
index 215a356..61b8915 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -94,6 +94,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/common/TCPConnection.cpp b/common/TCPConnection.cpp
index 5fe7b7b..d1bfb5e 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 5c9ad6a..467c08e 100644
--- a/eqlaunch/CMakeLists.txt
+++ b/eqlaunch/CMakeLists.txt
@@ -32,7 +32,9 @@ IF(UNIX)
 	ENDIF(NOT FREEBSD)
 	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 7a4272a..4507c7a 100644
--- a/loginserver/CMakeLists.txt
+++ b/loginserver/CMakeLists.txt
@@ -60,7 +60,9 @@ IF(UNIX)
 	ENDIF(NOT FREEBSD)
 	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 8b8196b..460a422 100644
--- a/queryserv/CMakeLists.txt
+++ b/queryserv/CMakeLists.txt
@@ -38,7 +38,9 @@ IF(UNIX)
 	ENDIF(NOT FREEBSD)
 	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 76c8b75..ba188fc 100644
--- a/shared_memory/CMakeLists.txt
+++ b/shared_memory/CMakeLists.txt
@@ -38,7 +38,9 @@ IF(UNIX)
 	ENDIF(NOT FREEBSD)
 	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 649285b..eedf67e 100644
--- a/tests/CMakeLists.txt
+++ b/tests/CMakeLists.txt
@@ -30,7 +30,9 @@ IF(UNIX)
 	TARGET_LINK_LIBRARIES(tests "dl")
 	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 6603470..6d23812 100644
--- a/ucs/CMakeLists.txt
+++ b/ucs/CMakeLists.txt
@@ -41,7 +41,9 @@ IF(UNIX)
 	ENDIF(NOT FREEBSD)
 	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 a145054..d2c1704 100644
--- a/world/CMakeLists.txt
+++ b/world/CMakeLists.txt
@@ -87,7 +87,9 @@ IF(UNIX)
 	ENDIF(NOT FREEBSD)
 	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 3cf5b0c..7264b6c 100644
--- a/zone/CMakeLists.txt
+++ b/zone/CMakeLists.txt
@@ -228,7 +228,9 @@ IF(UNIX)
 	ENDIF(NOT FREEBSD)
 	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)
Reply With Quote