View Single Post
  #6  
Old 08-24-2010, 02:31 PM
Posix
Fire Beetle
 
Join Date: Aug 2010
Posts: 14
Default

Thanks, amraist!
No, my Google-Fu and Search-Fu were weak, as all I came across were people lamenting how EQEmu didn't work in FreeBSD from a few years ago. And that just wouldn't do!
I did not previously find erde's scripts or patches, I used gmake with the default makefiles, which seemed to work with some slight tweaking:
Code:
--- world/makefile   2010-08-13 10:39:18.000000000 -0700
+++ world/makefile   2010-08-13 13:39:56.000000000 -0700
@@ -1,7 +1,7 @@

-HCC=$(shell ccache -V 2>/dev/null)
+HCC=$(shell ccache-swig -V 2>/dev/null)
 ifneq (,$(findstring version,$(HCC)))
-       CC=ccache gcc
+       CC=ccache-swig gcc
 else
        CC=gcc
 endif
@@ -11,7 +11,7 @@
 OUT=-o
 LINKOUT=-o
 NOLINK=-c
-DFLAGS=-DDEBUG=5 -DEQDEBUG=5 -DSHAREMEM -DCATCH_CRASH -DNO_PIDLOG -DFIELD_ITEMS -DIRC -Di386 -DAPP_OPCODE_SIZE=2
+DFLAGS=-DDEBUG=5 -DEQDEBUG=5 -DSHAREMEM -DCATCH_CRASH -DNO_PIDLOG -DFIELD_ITEMS -DIRC -DAPP_OPCODE_SIZE=2 -DFREEBSD -D__x86_64__
 WFLAGS=-Wall -Wuninitialized -Wwrite-strings -Wcast-qual -Wcomment -Wcast-align -Wno-deprecated

 PERL_FLAGS=$(shell perl -MExtUtils::Embed -e ccopts)
@@ -21,9 +21,9 @@
 MYSQL_FLAGS=$(shell mysql_config --cflags)
 MYSQL_LIB=$(shell mysql_config --libs)

-COPTS=$(WFLAGS) -g -march=i686 -O -pthread -pipe -I../common/SocketLib \
+COPTS=$(WFLAGS) -ggdb -march=native -pthread -pipe -I../common/SocketLib \
   -DFX -D_GNU_SOURCE -DINVERSEXY -DWORLD $(DFLAGS) $(MYSQL_FLAGS) $(PERL_FLAGS)
-LINKOPTS=$(COPTS) -rdynamic -L. -lstdc++ -lm -lz -ldl \
+LINKOPTS=$(COPTS) -rdynamic -L. -lstdc++ -lm -lz \
   $(MYSQL_LIB) $(PERL_LIB)

 all: world
pretty much the same change to the zone and eqlauncher makefiles.
Then I made a couple changes to the code which seemed to get it to compile and run allright:
Code:
--- common/Mutex.cpp     2010-08-12 10:39:24.000000000 -0700
+++ common/Mutex.cpp   2010-08-12 17:35:08.000000000 -0700
@@ -77,7 +77,7 @@
 #if defined(__CYGWIN__) || defined(__APPLE__)
        pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
 #else
-       pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE_NP);
+       pthread_mutexattr_settype(&attr, PTHREAD_MUTEX_RECURSIVE);
 #endif
        pthread_mutex_init(&CSMutex, &attr);
        pthread_mutexattr_destroy(&attr);
and a curious case with how money is handled:
Code:
--- zone/client.cpp      2010-08-12 10:40:42.000000000 -0700
+++ zone/client.cpp      2010-08-12 17:50:28.000000000 -0700
@@ -40,7 +40,6 @@
 #include <sys/socket.h>
 #include <netinet/in.h>
 #include "../common/unix.h"
-#define abs64 abs
 #endif

 extern volatile bool RunLoops;
@@ -2017,7 +2016,7 @@
                copperpp -= copper;
                if(copperpp <= 0)
                {
-                       copper = abs64(copperpp);
+                       copper = copperpp * -1;
                        m_pp.copper = 0;
                }
                else
@@ -2029,7 +2028,7 @@
                silver -= copper;
                if(silver <= 0)
                {
-                       copper = abs64(silver);
+                       copper = silver * -1;
                        m_pp.silver = 0;
                }
                else
@@ -2044,7 +2043,7 @@

                if(gold <= 0)
                {
-                       copper = abs64(gold);
+                       copper = gold * -1;
                        m_pp.gold = 0;
                }
                else
since the value of the money variable is already known to be below 0 (negative), and I'm not seeing anywhere in there you could end up with an imaginary number, I just flip the sign instead of going through the trouble of getting an absolute value.

I'll be pouring over those patches, see how it stacks up to what I was muddling through
Reply With Quote