Skip to content

Instantly share code, notes, and snippets.

@gmanley
Created February 25, 2010 05:00
Show Gist options
  • Save gmanley/314255 to your computer and use it in GitHub Desktop.
Save gmanley/314255 to your computer and use it in GitHub Desktop.
- mac-extractor.patch
If cmake is available, simply follow instructions in README.linux file instead of using the Xcode project file.
- old-configure.patch
Patch was created by the command: git diff f3a5a93e{,^} configure.ac
for a in local $(ls /usr/local/ | grep -v -); do
FULLPATH=/usr/local/$a
if [ -x $FULLPATH ]; then
if [ -x $FULLPATH/bin ]; then
export PATH="$FULLPATH/bin:$PATH"
fi
if [ -x $FULLPATH/sbin ]; then
export PATH="$FULLPATH/sbin:$PATH"
fi
if [ -x $FULLPATH/share/aclocal ]; then
export ACLOCAL_FLAGS="-I $FULLPATH/share/aclocal $ACLOCAL_FLAGS"
fi
if [ -x $FULLPATH/man ]; then
export MANPATH="$FULLPATH/man:$MANPATH"
fi
if [ -x $FULLPATH/share/man ]; then
export MANPATH="$FULLPATH/share/man:$MANPATH"
fi
if [ -x $FULLPATH/lib/pkgconfig ]; then
export PKG_CONFIG_PATH="$FULLPATH/lib/pkgconfig/:$PKG_CONFIG_PATH"
fi
fi
done
diff --git a/src/framework/Platform/CompilerDefs.h b/src/framework/Platform/CompilerDefs.h
index e835491..011035f 100644
--- a/src/framework/Platform/CompilerDefs.h
+++ b/src/framework/Platform/CompilerDefs.h
@@ -29,7 +29,9 @@
# define PLATFORM PLATFORM_WINDOWS
#elif defined( __WIN32__ ) || defined( WIN32 ) || defined( _WIN32 )
# define PLATFORM PLATFORM_WINDOWS
-#elif defined( __APPLE_CC__ )
+// Use appropriate macros as suggested by Apple.
+// http://developer.apple.com/technotes/tn2002/tn2071.html#Section10
+#elif defined( __APPLE__ ) && defined( __MACH__ )
# define PLATFORM PLATFORM_APPLE
#elif defined( __INTEL_COMPILER )
# define PLATFORM PLATFORM_INTEL
diff --git a/src/framework/Platform/Define.h b/src/framework/Platform/Define.h
index 8318493..7263beb 100644
--- a/src/framework/Platform/Define.h
+++ b/src/framework/Platform/Define.h
@@ -53,14 +53,21 @@
# define MANGOS_LOAD_LIBRARY(a) dlopen(a,RTLD_NOW)
# define MANGOS_CLOSE_LIBRARY dlclose
# define MANGOS_GET_PROC_ADDR dlsym
-# if defined(__APPLE_CC__) && defined(BIG_ENDIAN)
+// longcall calling convention is only supported on Big Endian (non-intel) compilers
+// BIG_ENDIAN can be defined on some Macs, but set to 0!
+# if MANGOS_ENDIAN == MANGOS_BIGENDIAN
# define MANGOS_IMPORT __attribute__ ((longcall))
# elif defined(__x86_64__)
# define MANGOS_IMPORT
# else
# define MANGOS_IMPORT __attribute__ ((cdecl))
-# endif //__APPLE_CC__ && BIG_ENDIAN
-# define MANGOS_SCRIPT_EXT ".so"
+# endif //MANGOS_IMPORT
+// OS X uses .dylib as the dynamic library file name suffix
+# if PLATFORM == PLATFORM_APPLE
+# define MANGOS_SCRIPT_EXT ".dylib"
+# else //PLATFORM != PLATFORM_APPLE
+# define MANGOS_SCRIPT_EXT ".so"
+# endif //MANGOS_SCRIPT_EXT
# define MANGOS_SCRIPT_NAME "libmangosscript"
# define MANGOS_PATH_MAX PATH_MAX
#endif //PLATFORM
diff --git a/src/game/ScriptCalls.cpp b/src/game/ScriptCalls.cpp
index adbdcb1..4a3f146 100644
--- a/src/game/ScriptCalls.cpp
+++ b/src/game/ScriptCalls.cpp
@@ -47,6 +47,19 @@ bool LoadScriptingModule(char const* libName)
testScript->hScriptsLib=MANGOS_LOAD_LIBRARY(name.c_str());
+// OSX: Hack for people who install into /opt but don't add it to their paths
+#if PLATFORM == PLATFORM_APPLE
+ if(!testScript->hScriptsLib )
+ {
+ // Library was not found within standard dynamic loader search paths
+ // $HOME/lib; /usr/local/lib; /usr/lib
+ // Try relative path instead for those who install into non-standard directory
+ std::string fullPath = "@executable_path/../lib/";
+ fullPath += name;
+ testScript->hScriptsLib=MANGOS_LOAD_LIBRARY(fullPath.c_str());
+ }
+#endif
+
if(!testScript->hScriptsLib )
{
printf("Error loading Scripts Library %s !\n",name.c_str());
diff --git a/src/mangosd/CliRunnable.cpp b/src/mangosd/CliRunnable.cpp
index cd730e3..30e872a 100644
--- a/src/mangosd/CliRunnable.cpp
+++ b/src/mangosd/CliRunnable.cpp
@@ -266,7 +266,7 @@ bool ChatHandler::HandleServerSetLogLevelCommand(const char *args)
/// @}
-#ifdef linux
+#if defined( linux ) || PLATFORM == PLATFORM_APPLE
// Non-blocking keypress detector, when return pressed, return 1, else always return 0
int kb_hit_return()
{
@@ -303,7 +303,7 @@ void CliRunnable::run()
while (!World::IsStopped())
{
fflush(stdout);
- #ifdef linux
+ #if defined( linux ) || PLATFORM == PLATFORM_APPLE
while (!kb_hit_return() && !World::IsStopped())
// With this, we limit CLI to 10commands/second
usleep(100);
diff --git a/contrib/extractor/.gitignore b/contrib/extractor/.gitignore
index 908bb67..2fc9309 100644
--- a/contrib/extractor/.gitignore
+++ b/contrib/extractor/.gitignore
@@ -18,3 +18,7 @@ debug
release
*.user
*.ilk
+
+# Extractor generated files at Apple Xcode build
+#
+build
diff --git a/contrib/extractor/System.cpp b/contrib/extractor/System.cpp
index a851412..031c6b0 100644
--- a/contrib/extractor/System.cpp
+++ b/contrib/extractor/System.cpp
@@ -872,7 +872,12 @@ void ExtractMapsFromMpq()
}
// draw progress bar
printf("Processing........................%d%%\r", (100 * (y+1)) / WDT_MAP_SIZE);
+#if defined( __APPLE__ ) && defined( __MACH__ )
+ // OS X: Using \r does not automatically redraw the line
+ fflush(stdout);
+#endif
}
+ printf("\n");
}
delete [] areas;
delete [] map_ids;
@@ -966,6 +971,19 @@ inline void CloseMPQFiles()
int main(int argc, char * arg[])
{
+
+#if defined( __APPLE__ ) && defined( __MACH__ )
+// OS X: Set the working directory to the executable path
+// Allows double-click in Finder, similar to Windows port
+if (strrchr(arg[0],'/'))
+{
+ char execPath[128];
+ strcpy(execPath,arg[0]);
+ *(strrchr(execPath,'/'))=0;
+ chdir(execPath);
+}
+#endif
+
printf("Map & DBC Extractor\n");
printf("===================\n\n");
diff --git a/contrib/extractor/ad.xcodeproj/.gitignore b/contrib/extractor/ad.xcodeproj/.gitignore
new file mode 100644
index 0000000..2041872
--- /dev/null
+++ b/contrib/extractor/ad.xcodeproj/.gitignore
@@ -0,0 +1,5 @@
+
+# Apple Xcode generated files
+*.mode1v3
+*.mode2v3
+*.pbxuser
diff --git a/contrib/extractor/ad.xcodeproj/project.pbxproj b/contrib/extractor/ad.xcodeproj/project.pbxproj
new file mode 100644
index 0000000..011d5ed
--- /dev/null
+++ b/contrib/extractor/ad.xcodeproj/project.pbxproj
@@ -0,0 +1,424 @@
+// !$*UTF8*$!
+{
+ archiveVersion = 1;
+ classes = {
+ };
+ objectVersion = 45;
+ objects = {
+
+/* Begin PBXBuildFile section */
+ 7DC888F2105EE89A002D73C0 /* libz.dylib in Frameworks */ = {isa = PBXBuildFile; fileRef = 7DC888F1105EE89A002D73C0 /* libz.dylib */; };
+ 7DD3A17C0E980CE50023CB74 /* huffman.h in Headers */ = {isa = PBXBuildFile; fileRef = 7DD3A16E0E980CE50023CB74 /* huffman.h */; };
+ 7DD3A17D0E980CE50023CB74 /* explode.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7DD3A16F0E980CE50023CB74 /* explode.cpp */; };
+ 7DD3A17E0E980CE50023CB74 /* extract.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7DD3A1700E980CE50023CB74 /* extract.cpp */; };
+ 7DD3A17F0E980CE50023CB74 /* wave.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7DD3A1710E980CE50023CB74 /* wave.cpp */; };
+ 7DD3A1800E980CE50023CB74 /* parser.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7DD3A1720E980CE50023CB74 /* parser.cpp */; };
+ 7DD3A1810E980CE50023CB74 /* mpq.h in Headers */ = {isa = PBXBuildFile; fileRef = 7DD3A1730E980CE50023CB74 /* mpq.h */; };
+ 7DD3A1820E980CE50023CB74 /* mpq.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7DD3A1740E980CE50023CB74 /* mpq.cpp */; };
+ 7DD3A1830E980CE50023CB74 /* zlib.h in Headers */ = {isa = PBXBuildFile; fileRef = 7DD3A1750E980CE50023CB74 /* zlib.h */; };
+ 7DD3A1840E980CE50023CB74 /* zconf.h in Headers */ = {isa = PBXBuildFile; fileRef = 7DD3A1760E980CE50023CB74 /* zconf.h */; };
+ 7DD3A1850E980CE50023CB74 /* wave.h in Headers */ = {isa = PBXBuildFile; fileRef = 7DD3A1770E980CE50023CB74 /* wave.h */; };
+ 7DD3A1860E980CE50023CB74 /* common.h in Headers */ = {isa = PBXBuildFile; fileRef = 7DD3A1780E980CE50023CB74 /* common.h */; };
+ 7DD3A1870E980CE50023CB74 /* explode.h in Headers */ = {isa = PBXBuildFile; fileRef = 7DD3A1790E980CE50023CB74 /* explode.h */; };
+ 7DD3A1880E980CE50023CB74 /* common.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7DD3A17A0E980CE50023CB74 /* common.cpp */; };
+ 7DD3A1890E980CE50023CB74 /* huffman.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7DD3A17B0E980CE50023CB74 /* huffman.cpp */; };
+ 7DD3A1920E980D2D0023CB74 /* System.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7DD3A18C0E980D2D0023CB74 /* System.cpp */; };
+ 7DD3A1930E980D2D0023CB74 /* mpq_libmpq.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7DD3A18D0E980D2D0023CB74 /* mpq_libmpq.cpp */; };
+ 7DD3A1940E980D2D0023CB74 /* dbcfile.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7DD3A1900E980D2D0023CB74 /* dbcfile.cpp */; };
+ 7DD3A1A60E9811FA0023CB74 /* libmpq.a in Frameworks */ = {isa = PBXBuildFile; fileRef = 7DA32C690E980BC50060F599 /* libmpq.a */; };
+ 7DD9CC190F6614B4004DCDA1 /* adt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7DD9CC120F6614B4004DCDA1 /* adt.cpp */; };
+ 7DD9CC1A0F6614B4004DCDA1 /* loadlib.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7DD9CC150F6614B4004DCDA1 /* loadlib.cpp */; };
+ 7DD9CC1B0F6614B4004DCDA1 /* wdt.cpp in Sources */ = {isa = PBXBuildFile; fileRef = 7DD9CC170F6614B4004DCDA1 /* wdt.cpp */; };
+/* End PBXBuildFile section */
+
+/* Begin PBXContainerItemProxy section */
+ 7DD3A19D0E9810B70023CB74 /* PBXContainerItemProxy */ = {
+ isa = PBXContainerItemProxy;
+ containerPortal = 08FB7793FE84155DC02AAC07 /* Project object */;
+ proxyType = 1;
+ remoteGlobalIDString = 7DA32C680E980BC50060F599;
+ remoteInfo = libmpq;
+ };
+/* End PBXContainerItemProxy section */
+
+/* Begin PBXCopyFilesBuildPhase section */
+ 8DD76F690486A84900D96B5E /* CopyFiles */ = {
+ isa = PBXCopyFilesBuildPhase;
+ buildActionMask = 8;
+ dstPath = /usr/share/man/man1/;
+ dstSubfolderSpec = 0;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 1;
+ };
+/* End PBXCopyFilesBuildPhase section */
+
+/* Begin PBXFileReference section */
+ 7DA32C690E980BC50060F599 /* libmpq.a */ = {isa = PBXFileReference; explicitFileType = archive.ar; includeInIndex = 0; path = libmpq.a; sourceTree = BUILT_PRODUCTS_DIR; };
+ 7DC888F1105EE89A002D73C0 /* libz.dylib */ = {isa = PBXFileReference; lastKnownFileType = "compiled.mach-o.dylib"; name = libz.dylib; path = /usr/lib/libz.dylib; sourceTree = "<absolute>"; };
+ 7DD3A16E0E980CE50023CB74 /* huffman.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = huffman.h; path = libmpq/huffman.h; sourceTree = "<group>"; };
+ 7DD3A16F0E980CE50023CB74 /* explode.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = explode.cpp; path = libmpq/explode.cpp; sourceTree = "<group>"; };
+ 7DD3A1700E980CE50023CB74 /* extract.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = extract.cpp; path = libmpq/extract.cpp; sourceTree = "<group>"; };
+ 7DD3A1710E980CE50023CB74 /* wave.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = wave.cpp; path = libmpq/wave.cpp; sourceTree = "<group>"; };
+ 7DD3A1720E980CE50023CB74 /* parser.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = parser.cpp; path = libmpq/parser.cpp; sourceTree = "<group>"; };
+ 7DD3A1730E980CE50023CB74 /* mpq.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = mpq.h; path = libmpq/mpq.h; sourceTree = "<group>"; };
+ 7DD3A1740E980CE50023CB74 /* mpq.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = mpq.cpp; path = libmpq/mpq.cpp; sourceTree = "<group>"; };
+ 7DD3A1750E980CE50023CB74 /* zlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zlib.h; path = libmpq/zlib.h; sourceTree = "<group>"; };
+ 7DD3A1760E980CE50023CB74 /* zconf.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = zconf.h; path = libmpq/zconf.h; sourceTree = "<group>"; };
+ 7DD3A1770E980CE50023CB74 /* wave.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = wave.h; path = libmpq/wave.h; sourceTree = "<group>"; };
+ 7DD3A1780E980CE50023CB74 /* common.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = common.h; path = libmpq/common.h; sourceTree = "<group>"; };
+ 7DD3A1790E980CE50023CB74 /* explode.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; name = explode.h; path = libmpq/explode.h; sourceTree = "<group>"; };
+ 7DD3A17A0E980CE50023CB74 /* common.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = common.cpp; path = libmpq/common.cpp; sourceTree = "<group>"; };
+ 7DD3A17B0E980CE50023CB74 /* huffman.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; name = huffman.cpp; path = libmpq/huffman.cpp; sourceTree = "<group>"; };
+ 7DD3A18C0E980D2D0023CB74 /* System.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = System.cpp; sourceTree = "<group>"; };
+ 7DD3A18D0E980D2D0023CB74 /* mpq_libmpq.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = mpq_libmpq.cpp; sourceTree = "<group>"; };
+ 7DD3A18E0E980D2D0023CB74 /* mpq_libmpq.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = mpq_libmpq.h; sourceTree = "<group>"; };
+ 7DD3A18F0E980D2D0023CB74 /* dbcfile.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = dbcfile.h; sourceTree = "<group>"; };
+ 7DD3A1900E980D2D0023CB74 /* dbcfile.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = dbcfile.cpp; sourceTree = "<group>"; };
+ 7DD9CC120F6614B4004DCDA1 /* adt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = adt.cpp; sourceTree = "<group>"; };
+ 7DD9CC130F6614B4004DCDA1 /* adt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = adt.h; sourceTree = "<group>"; };
+ 7DD9CC150F6614B4004DCDA1 /* loadlib.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = loadlib.cpp; sourceTree = "<group>"; };
+ 7DD9CC160F6614B4004DCDA1 /* loadlib.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = loadlib.h; sourceTree = "<group>"; };
+ 7DD9CC170F6614B4004DCDA1 /* wdt.cpp */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.cpp.cpp; path = wdt.cpp; sourceTree = "<group>"; };
+ 7DD9CC180F6614B4004DCDA1 /* wdt.h */ = {isa = PBXFileReference; fileEncoding = 4; lastKnownFileType = sourcecode.c.h; path = wdt.h; sourceTree = "<group>"; };
+ 8DD76F6C0486A84900D96B5E /* ad */ = {isa = PBXFileReference; explicitFileType = "compiled.mach-o.executable"; includeInIndex = 0; path = ad; sourceTree = BUILT_PRODUCTS_DIR; };
+/* End PBXFileReference section */
+
+/* Begin PBXFrameworksBuildPhase section */
+ 7DA32C670E980BC50060F599 /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 8DD76F660486A84900D96B5E /* Frameworks */ = {
+ isa = PBXFrameworksBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7DD3A1A60E9811FA0023CB74 /* libmpq.a in Frameworks */,
+ 7DC888F2105EE89A002D73C0 /* libz.dylib in Frameworks */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXFrameworksBuildPhase section */
+
+/* Begin PBXGroup section */
+ 08FB7794FE84155DC02AAC07 /* mangos_extractor */ = {
+ isa = PBXGroup;
+ children = (
+ 08FB7795FE84155DC02AAC07 /* extractor */,
+ 7DD3A16D0E980C960023CB74 /* libmpq */,
+ 7DD9CC110F6614B4004DCDA1 /* loadlib */,
+ 7DD3A19B0E9810470023CB74 /* Libraries */,
+ C6859E8C029090F304C91782 /* Documentation */,
+ 1AB674ADFE9D54B511CA2CBB /* Products */,
+ );
+ name = mangos_extractor;
+ sourceTree = "<group>";
+ };
+ 08FB7795FE84155DC02AAC07 /* extractor */ = {
+ isa = PBXGroup;
+ children = (
+ 7DD3A18C0E980D2D0023CB74 /* System.cpp */,
+ 7DD3A18D0E980D2D0023CB74 /* mpq_libmpq.cpp */,
+ 7DD3A18E0E980D2D0023CB74 /* mpq_libmpq.h */,
+ 7DD3A18F0E980D2D0023CB74 /* dbcfile.h */,
+ 7DD3A1900E980D2D0023CB74 /* dbcfile.cpp */,
+ );
+ name = extractor;
+ sourceTree = "<group>";
+ };
+ 1AB674ADFE9D54B511CA2CBB /* Products */ = {
+ isa = PBXGroup;
+ children = (
+ 8DD76F6C0486A84900D96B5E /* ad */,
+ 7DA32C690E980BC50060F599 /* libmpq.a */,
+ );
+ name = Products;
+ sourceTree = "<group>";
+ };
+ 7DD3A16D0E980C960023CB74 /* libmpq */ = {
+ isa = PBXGroup;
+ children = (
+ 7DD3A16E0E980CE50023CB74 /* huffman.h */,
+ 7DD3A16F0E980CE50023CB74 /* explode.cpp */,
+ 7DD3A1700E980CE50023CB74 /* extract.cpp */,
+ 7DD3A1710E980CE50023CB74 /* wave.cpp */,
+ 7DD3A1720E980CE50023CB74 /* parser.cpp */,
+ 7DD3A1730E980CE50023CB74 /* mpq.h */,
+ 7DD3A1740E980CE50023CB74 /* mpq.cpp */,
+ 7DD3A1750E980CE50023CB74 /* zlib.h */,
+ 7DD3A1760E980CE50023CB74 /* zconf.h */,
+ 7DD3A1770E980CE50023CB74 /* wave.h */,
+ 7DD3A1780E980CE50023CB74 /* common.h */,
+ 7DD3A1790E980CE50023CB74 /* explode.h */,
+ 7DD3A17A0E980CE50023CB74 /* common.cpp */,
+ 7DD3A17B0E980CE50023CB74 /* huffman.cpp */,
+ );
+ name = libmpq;
+ sourceTree = "<group>";
+ };
+ 7DD3A19B0E9810470023CB74 /* Libraries */ = {
+ isa = PBXGroup;
+ children = (
+ 7DC888F1105EE89A002D73C0 /* libz.dylib */,
+ );
+ name = Libraries;
+ sourceTree = "<group>";
+ };
+ 7DD9CC110F6614B4004DCDA1 /* loadlib */ = {
+ isa = PBXGroup;
+ children = (
+ 7DD9CC120F6614B4004DCDA1 /* adt.cpp */,
+ 7DD9CC130F6614B4004DCDA1 /* adt.h */,
+ 7DD9CC150F6614B4004DCDA1 /* loadlib.cpp */,
+ 7DD9CC160F6614B4004DCDA1 /* loadlib.h */,
+ 7DD9CC170F6614B4004DCDA1 /* wdt.cpp */,
+ 7DD9CC180F6614B4004DCDA1 /* wdt.h */,
+ );
+ path = loadlib;
+ sourceTree = "<group>";
+ };
+ C6859E8C029090F304C91782 /* Documentation */ = {
+ isa = PBXGroup;
+ children = (
+ );
+ name = Documentation;
+ sourceTree = "<group>";
+ };
+/* End PBXGroup section */
+
+/* Begin PBXHeadersBuildPhase section */
+ 7DA32C650E980BC50060F599 /* Headers */ = {
+ isa = PBXHeadersBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7DD3A17C0E980CE50023CB74 /* huffman.h in Headers */,
+ 7DD3A1810E980CE50023CB74 /* mpq.h in Headers */,
+ 7DD3A1830E980CE50023CB74 /* zlib.h in Headers */,
+ 7DD3A1840E980CE50023CB74 /* zconf.h in Headers */,
+ 7DD3A1850E980CE50023CB74 /* wave.h in Headers */,
+ 7DD3A1860E980CE50023CB74 /* common.h in Headers */,
+ 7DD3A1870E980CE50023CB74 /* explode.h in Headers */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXHeadersBuildPhase section */
+
+/* Begin PBXNativeTarget section */
+ 7DA32C680E980BC50060F599 /* libmpq */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 7DA32C6D0E980BF00060F599 /* Build configuration list for PBXNativeTarget "libmpq" */;
+ buildPhases = (
+ 7DA32C650E980BC50060F599 /* Headers */,
+ 7DA32C660E980BC50060F599 /* Sources */,
+ 7DA32C670E980BC50060F599 /* Frameworks */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ );
+ name = libmpq;
+ productName = mpq;
+ productReference = 7DA32C690E980BC50060F599 /* libmpq.a */;
+ productType = "com.apple.product-type.library.static";
+ };
+ 8DD76F620486A84900D96B5E /* ad */ = {
+ isa = PBXNativeTarget;
+ buildConfigurationList = 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "ad" */;
+ buildPhases = (
+ 8DD76F640486A84900D96B5E /* Sources */,
+ 8DD76F660486A84900D96B5E /* Frameworks */,
+ 8DD76F690486A84900D96B5E /* CopyFiles */,
+ );
+ buildRules = (
+ );
+ dependencies = (
+ 7DD3A19E0E9810B70023CB74 /* PBXTargetDependency */,
+ );
+ name = ad;
+ productInstallPath = "$(HOME)/bin";
+ productName = mangos_extractor;
+ productReference = 8DD76F6C0486A84900D96B5E /* ad */;
+ productType = "com.apple.product-type.tool";
+ };
+/* End PBXNativeTarget section */
+
+/* Begin PBXProject section */
+ 08FB7793FE84155DC02AAC07 /* Project object */ = {
+ isa = PBXProject;
+ buildConfigurationList = 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "ad" */;
+ compatibilityVersion = "Xcode 3.1";
+ hasScannedForEncodings = 1;
+ mainGroup = 08FB7794FE84155DC02AAC07 /* mangos_extractor */;
+ projectDirPath = "";
+ projectRoot = "";
+ targets = (
+ 8DD76F620486A84900D96B5E /* ad */,
+ 7DA32C680E980BC50060F599 /* libmpq */,
+ );
+ };
+/* End PBXProject section */
+
+/* Begin PBXSourcesBuildPhase section */
+ 7DA32C660E980BC50060F599 /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7DD3A17D0E980CE50023CB74 /* explode.cpp in Sources */,
+ 7DD3A17E0E980CE50023CB74 /* extract.cpp in Sources */,
+ 7DD3A17F0E980CE50023CB74 /* wave.cpp in Sources */,
+ 7DD3A1800E980CE50023CB74 /* parser.cpp in Sources */,
+ 7DD3A1820E980CE50023CB74 /* mpq.cpp in Sources */,
+ 7DD3A1880E980CE50023CB74 /* common.cpp in Sources */,
+ 7DD3A1890E980CE50023CB74 /* huffman.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+ 8DD76F640486A84900D96B5E /* Sources */ = {
+ isa = PBXSourcesBuildPhase;
+ buildActionMask = 2147483647;
+ files = (
+ 7DD3A1920E980D2D0023CB74 /* System.cpp in Sources */,
+ 7DD3A1930E980D2D0023CB74 /* mpq_libmpq.cpp in Sources */,
+ 7DD3A1940E980D2D0023CB74 /* dbcfile.cpp in Sources */,
+ 7DD9CC190F6614B4004DCDA1 /* adt.cpp in Sources */,
+ 7DD9CC1A0F6614B4004DCDA1 /* loadlib.cpp in Sources */,
+ 7DD9CC1B0F6614B4004DCDA1 /* wdt.cpp in Sources */,
+ );
+ runOnlyForDeploymentPostprocessing = 0;
+ };
+/* End PBXSourcesBuildPhase section */
+
+/* Begin PBXTargetDependency section */
+ 7DD3A19E0E9810B70023CB74 /* PBXTargetDependency */ = {
+ isa = PBXTargetDependency;
+ target = 7DA32C680E980BC50060F599 /* libmpq */;
+ targetProxy = 7DD3A19D0E9810B70023CB74 /* PBXContainerItemProxy */;
+ };
+/* End PBXTargetDependency section */
+
+/* Begin XCBuildConfiguration section */
+ 1DEB923208733DC60010E9CD /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_PREPROCESSOR_DEFINITIONS = (
+ "_GLIBCXX_DEBUG=1",
+ "_GLIBCXX_DEBUG_PEDANTIC=1",
+ );
+ INSTALL_PATH = /usr/local/bin;
+ PRODUCT_NAME = ad;
+ };
+ name = Debug;
+ };
+ 1DEB923308733DC60010E9CD /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = /usr/local/bin;
+ PRODUCT_NAME = ad;
+ };
+ name = Release;
+ };
+ 1DEB923608733DC60010E9CD /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ PREBINDING = NO;
+ SDKROOT = macosx10.4;
+ };
+ name = Debug;
+ };
+ 1DEB923708733DC60010E9CD /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ARCHS = "$(ARCHS_STANDARD_32_BIT)";
+ GCC_C_LANGUAGE_STANDARD = c99;
+ GCC_OPTIMIZATION_LEVEL = 2;
+ GCC_WARN_ABOUT_RETURN_TYPE = YES;
+ GCC_WARN_UNUSED_VARIABLE = YES;
+ ONLY_ACTIVE_ARCH = YES;
+ PREBINDING = NO;
+ SDKROOT = macosx10.4;
+ SEPARATE_STRIP = YES;
+ };
+ name = Release;
+ };
+ 7DA32C6A0E980BC50060F599 /* Debug */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = NO;
+ GCC_DYNAMIC_NO_PIC = NO;
+ GCC_ENABLE_FIX_AND_CONTINUE = YES;
+ GCC_MODEL_TUNING = G5;
+ GCC_OPTIMIZATION_LEVEL = 0;
+ INSTALL_PATH = /usr/local/lib;
+ PREBINDING = NO;
+ PRODUCT_NAME = mpq;
+ };
+ name = Debug;
+ };
+ 7DA32C6B0E980BC50060F599 /* Release */ = {
+ isa = XCBuildConfiguration;
+ buildSettings = {
+ ALWAYS_SEARCH_USER_PATHS = NO;
+ COPY_PHASE_STRIP = YES;
+ DEBUG_INFORMATION_FORMAT = "dwarf-with-dsym";
+ GCC_ENABLE_FIX_AND_CONTINUE = NO;
+ GCC_MODEL_TUNING = G5;
+ INSTALL_PATH = /usr/local/lib;
+ PREBINDING = NO;
+ PRODUCT_NAME = mpq;
+ ZERO_LINK = NO;
+ };
+ name = Release;
+ };
+/* End XCBuildConfiguration section */
+
+/* Begin XCConfigurationList section */
+ 1DEB923108733DC60010E9CD /* Build configuration list for PBXNativeTarget "ad" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1DEB923308733DC60010E9CD /* Release */,
+ 1DEB923208733DC60010E9CD /* Debug */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 1DEB923508733DC60010E9CD /* Build configuration list for PBXProject "ad" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 1DEB923708733DC60010E9CD /* Release */,
+ 1DEB923608733DC60010E9CD /* Debug */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+ 7DA32C6D0E980BF00060F599 /* Build configuration list for PBXNativeTarget "libmpq" */ = {
+ isa = XCConfigurationList;
+ buildConfigurations = (
+ 7DA32C6B0E980BC50060F599 /* Release */,
+ 7DA32C6A0E980BC50060F599 /* Debug */,
+ );
+ defaultConfigurationIsVisible = 0;
+ defaultConfigurationName = Release;
+ };
+/* End XCConfigurationList section */
+ };
+ rootObject = 08FB7793FE84155DC02AAC07 /* Project object */;
+}
diff --git a/contrib/extractor/libmpq/common.h b/contrib/extractor/libmpq/common.h
index 5794c16..a00b2c8 100644
--- a/contrib/extractor/libmpq/common.h
+++ b/contrib/extractor/libmpq/common.h
@@ -31,6 +31,11 @@
#define LIBMPQ_CONF_EOPEN_DIR -1 /* error on open directory */
#define LIBMPQ_CONF_EVALUE_NOT_FOUND -2 /* value for the option was not found */
+// OSX
+#ifndef lseek64
+#define lseek64 lseek
+#endif
+
#if defined( __GNUC__ )
#include <sys/types.h>
#include <unistd.h>
diff --git a/contrib/extractor/loadlib/loadlib.h b/contrib/extractor/loadlib/loadlib.h
index 6acfd10..656c1f2 100644
--- a/contrib/extractor/loadlib/loadlib.h
+++ b/contrib/extractor/loadlib/loadlib.h
@@ -12,7 +12,8 @@ typedef unsigned short uint16;
typedef unsigned char uint8;
#else
#include <stdint.h>
-#ifndef uint64_t
+// OSX: Macs aren't WIN32, but they aren't Linux either
+#if !defined( uint64_t ) && !defined( __APPLE__ )
#include <linux/types.h>
#endif
typedef int64_t int64;
diff --git a/configure.ac b/configure.ac
index 4fc5e6d..1f31c94 100644
--- a/configure.ac
+++ b/configure.ac
@@ -22,9 +22,7 @@ AC_CONFIG_SRCDIR([src/shared/Base.cpp])
## Prelude, basic settings for Automake
# Turn on all warnings and error messages, and enforce GNU
# standards for the package.
-AM_INIT_AUTOMAKE([foreign -Wall -Werror gnu tar-pax])
-m4_ifdef([AM_SILENT_RULES], [AM_SILENT_RULES([yes])])
-
+AM_INIT_AUTOMAKE([-Wall -Werror gnu tar-pax])
AM_MAINTAINER_MODE
## Prevent the configure script from continuing any further if
@@ -71,7 +69,6 @@ AC_PROG_CXX
AM_PROG_CC_C_O
AC_PROG_LIBTOOL
AC_PROG_INSTALL
-PKG_PROG_PKG_CONFIG
# Check for doxygen
AC_ARG_ENABLE(doxygen, AC_HELP_STRING([--enable-doxygen], [turn on generating documentation]))
@@ -97,7 +94,7 @@ AC_CHECK_LIB( pthread, pthread_create, [],
])
AC_CHECK_LIB( z, compress, [ZLIB=-lz],[AC_MSG_ERROR([Missing zlib])] )
AC_CHECK_LIB( compat, ftime, [COMPATLIB=-lcompat] )
-PKG_CHECK_MODULES(OPENSSL, [openssl], [], [AC_MSG_ERROR([Missing openssl])])
+AC_CHECK_LIB( crypto, SHA1_Init, [SSLLIB=-lssl], [AC_MSG_ERROR([Missing openssl])])
AC_ARG_WITH(postgresql,
[ --with-postgresql Use PostgreSQL as a backend (default: no)],
@@ -124,7 +121,7 @@ AC_MSG_CHECKING(whether to build/link POSTGRESQL)
if test "x$DO_POSTGRESQL" = "xyes"; then
DO_MYSQL=no
POSTGRE_INCLUDES="-I/usr/include/postgresql $POSTGRE_INCLUDES"
-POSTGRE_LIBS="-L/usr/lib/postresql -lpq -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib $OPENSSL_LIBS $POSTGRE_LIBS "
+POSTGRE_LIBS="-L/usr/lib/postresql -lpq -lz -lpthread -lcrypt -lnsl -lm -lpthread -L/usr/lib -lssl -lcrypto $POSTGRE_LIBS "
CXXFLAGS="-DDO_POSTGRESQL $CXXFLAGS"
fi
AC_MSG_RESULT($DO_POSTGRESQL)
@@ -177,6 +174,7 @@ AC_HEADER_DIRENT
AC_CHECK_HEADERS([ arpa/inet.h fcntl.h limits.h locale.h malloc.h netdb.h netinet/in.h stddef.h stdint.h stdlib.h string.h strings.h sys/ioctl.h sys/param.h sys/socket.h sys/timeb.h sys/time.h termios.h unistd.h ])
AC_CHECK_HEADERS([pthread.h])
+AC_CHECK_HEADERS([openssl/md5.h openssl/rand.h openssl/ssl.h openssl/sha.h openssl/bn.h])
AC_CHECK_HEADERS([mysql.h mysql/mysql.h])
AC_CHECK_HEADERS([libpq-fe.h])
AC_CHECK_HEADERS([zlib.h])
@@ -201,10 +199,36 @@ AC_TYPE_SIGNAL
AC_FUNC_VPRINTF
AC_CHECK_FUNCS([atexit ftime gethostbyaddr gethostbyname gethostname gettimeofday memmove memset pow realpath select socket sqrt strchr strdup strerror strstr])
-PKG_CHECK_MODULES(ACE, [ACE >= 5.5.2], [need_to_build_ace=no], [need_to_build_ace=yes])
-if test X$need_to_build_ace = Xyes ; then
- ACE_INCLUDES="-I\$(top_srcdir)/dep/ACE_wrappers -I\$(top_builddir)/dep/ACE_wrappers"
- ACE_LIBS="\$(top_builddir)/dep/ACE_wrappers/ace/libACE.la"
+## Check what to do with ACE library
+AC_LANG_PUSH([C++])
+AC_CHECK_HEADER([ace/Reactor.h], [have_ace_headers=yes], [have_ace_headers=no])
+AC_CHECK_LIB([ACE], [main], [have_ace_lib=yes], [have_ace_lib=no])
+AC_LANG_POP([C++])
+
+AC_MSG_CHECKING([whether to build ACE])
+if test X$have_ace_headers = Xyes -a X$have_ace_lib = Xyes;
+then
+ need_to_build_ace=no
+ AC_MSG_RESULT([no])
+else
+ if test X$have_ace_headers = Xno -a X$have_ace_lib = Xno; then
+ need_to_build_ace=yes
+ AC_MSG_RESULT([yes])
+ else
+ if test X$have_ace_headers = Xyes; then
+ AC_MSG_ERROR([looks like you have ACE headers, but you do not have ACE libs installed])
+ else
+ need_to_build_ace=yes
+ AC_MSG_RESULT([yes, over-install])
+ fi
+ fi
+fi
+
+if test X$need_to_build_ace = Xyes; then
+ MANGOS_INCLUDES="-I\$(top_srcdir)/dep/ACE_wrappers -I\$(top_builddir)/dep/ACE_wrappers $MANGOS_INCLUDES"
+ MANGOS_LIBS="\$(top_builddir)/dep/ACE_wrappers/ace/libACE.la $MANGOS_LIBS"
+else
+ MANGOS_LIBS="-lACE $MANGOS_LIBS"
fi
AM_CONDITIONAL([MANGOS_BUILD_ACE], [test X$need_to_build_ace = Xyes])
@@ -214,8 +238,8 @@ AC_CHECK_HEADERS([ace/Stack_Trace.h])
## Unify all additional includes/libs in one variable.
# TODO this looks kinda ugly, but when we add m4 folder I will make it look very pritey ( by Derex ).
-MANGOS_INCLUDES="$ACE_INCLUDES $POSTGRE_INCLUDES $MYSQL_INCLUDES $OPENSSL_INCLUDES $MANGOS_INCLUDES"
-MANGOS_LIBS="$ACE_LIBS $POSTGRE_LIBS $MYSQL_LIBS $ZLIB $COMPATLIB $OPENSSL_LIBS $MANGOS_LIBS"
+MANGOS_INCLUDES="$POSTGRE_INCLUDES $MYSQL_INCLUDES $MANGOS_INCLUDES"
+MANGOS_LIBS="$POSTGRE_LIBS $MYSQL_LIBS $ZLIB $COMPATLIB $SSLLIB $MANGOS_LIBS"
## Export defined variables
AC_SUBST(DOXYGEN)
# install custom bash_profile
curl ? > ~/.profile
source ~/.profile
# install pkg-config
cd /tmp
curl -O http://pkgconfig.freedesktop.org/releases/pkg-config-0.23.tar.gz
tar xzvf pkg-config-0.23.tar.gz
cd pkg-config-0.23
./configure --prefix=/usr/local/pkg-config-0.23 --enable-indirect-deps --with-pc-path="/usr/lib/pkgconfig:/usr/X11/lib/pkgconfig"
make -j2
sudo make install
sudo ln -s /usr/local/pkg-config-0.23 /usr/local/pkgconfig
rm -rfv /tmp/pkg-config-0.23*
# install git (to install man pages, install via package or macports instead)
cd /tmp
curl -O http://kernel.org/pub/software/scm/git/git-1.6.4.2.tar.gz
tar xzvf git-1.6.4.2.tar.gz
cd git-1.6.4.2
make -j2 prefix=/usr/local/git-1.6.4.2
sudo make install prefix=/usr/local/git-1.6.4.2
sudo ln -s /usr/local/git-1.6.4.2 /usr/local/git
# ignore # make man prefix=/usr/local/git-1.6.4.2
# ignore # sudo make install-man prefix=/usr/local/git-1.6.4.2
rm -rfv /tmp/git-1.6.4.2*
# optional - install cmake
cd /tmp
curl -O http://www.cmake.org/files/v2.6/cmake-2.6.4.tar.gz
tar cmake-2.6.4.tar.gz
cd cmake-2.6.4
./bootstrap --parallel=2 --prefix=/usr/local/cmake-2.6.4
make -j2
sudo make install
sudo ln -s /usr/local/cmake-2.6.4 /usr/local/cmake
rm -rfv /tmp/cmake-2.6.4*
# install MySQL server from mysql.com
# install MaNGOS
git clone git://github.com/mangos/mangos.git ~/source/mangos
cd ~/source/mangos
git checkout --track -b mine origin/master
curl http://pastie.org/566574.txt | git apply
curl http://pastie.org/566573.txt | git apply
git add contrib/extractor/ad.xcodeproj
svn co https://scriptdev2.svn.sourceforge.net/svnroot/scriptdev2 src/bindings/ScriptDev2
git apply src/bindings/ScriptDev2/patches/MaNGOS-8273-ScriptDev2.patch
git commit -am "Applied Mac patches and SD2."
autoreconf --install --force
mkdir build
cd build
../configure --prefix=/usr/local --datadir=/usr/local/share --sysconfdir=/usr/local/etc --enable-cli --enable-ra CFLAGS="-O2" CXXFLAGS="-O2"
make -j2
sudo make install
sudo cp /usr/local/etc/realmd.conf.dist /usr/local/etc/realmd.conf
sudo cp /usr/local/etc/mangosd.conf.dist /usr/local/etc/mangosd.conf
# update
cd ~/source/mangos
git pull
svn update src/bindings/ScriptDev2
make -j2
sudo make install
# extras
svn co https://sd2-acid.svn.sourceforge.net/svnroot/sd2-acid/trunk ~/source/acid
svn co https://unifieddb.svn.sourceforge.net/svnroot/unifieddb/trunk ~/source/udb
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment