SourceMod can now be somewhat compiled on OS X for patch sanity testing (bug 3516, r=ds).
1.1 --- a/core/CDataPack.cpp Mon Dec 15 18:47:11 2008 +1300
1.2 +++ b/core/CDataPack.cpp Tue Dec 23 01:33:37 2008 -0500
1.3 @@ -29,7 +29,7 @@
1.4 * Version: $Id$
1.5 */
1.6
1.7 -#include <malloc.h>
1.8 +#include <stdlib.h>
1.9 #include <string.h>
1.10 #include "CDataPack.h"
1.11
2.1 --- a/core/CellArray.h Mon Dec 15 18:47:11 2008 +1300
2.2 +++ b/core/CellArray.h Tue Dec 23 01:33:37 2008 -0500
2.3 @@ -29,7 +29,7 @@
2.4 * Version: $Id$
2.5 */
2.6
2.7 -#include <malloc.h>
2.8 +#include <stdlib.h>
2.9 #include <string.h>
2.10
2.11 extern HandleType_t htCellArray;
3.1 --- a/core/CoreConfig.cpp Mon Dec 15 18:47:11 2008 +1300
3.2 +++ b/core/CoreConfig.cpp Tue Dec 23 01:33:37 2008 -0500
3.3 @@ -44,7 +44,7 @@
3.4
3.5 #ifdef PLATFORM_WINDOWS
3.6 ConVar sm_corecfgfile("sm_corecfgfile", "addons\\sourcemod\\configs\\core.cfg", 0, "SourceMod core configuration file");
3.7 -#elif defined PLATFORM_LINUX
3.8 +#elif defined PLATFORM_LINUX || defined PLATFORM_APPLE
3.9 ConVar sm_corecfgfile("sm_corecfgfile", "addons/sourcemod/configs/core.cfg", 0, "SourceMod core configuration file");
3.10 #endif
3.11
3.12 @@ -275,7 +275,7 @@
3.13 {
3.14 #if defined PLATFORM_WINDOWS
3.15 return (c == '\\' || c == '/');
3.16 -#elif defined PLATFORM_LINUX
3.17 +#elif defined PLATFORM_LINUX || defined PLATFORM_POSIX
3.18 return (c == '/');
3.19 #endif
3.20 }
4.1 --- a/core/GameConfigs.cpp Mon Dec 15 18:47:11 2008 +1300
4.2 +++ b/core/GameConfigs.cpp Tue Dec 23 01:33:37 2008 -0500
4.3 @@ -73,6 +73,9 @@
4.4 #elif defined PLATFORM_LINUX
4.5 #define PLATFORM_NAME "linux"
4.6 #define PLATFORM_SERVER_BINARY "server_i486.so"
4.7 +#elif defined PLATFORM_APPLE
4.8 +#define PLATFORM_NAME "undef"
4.9 +#define PLATFORM_SERVER_BINARY "undef.dylib"
4.10 #endif
4.11
4.12 struct TempSigInfo
5.1 --- a/core/LibrarySys.cpp Mon Dec 15 18:47:11 2008 +1300
5.2 +++ b/core/LibrarySys.cpp Tue Dec 23 01:33:37 2008 -0500
5.3 @@ -138,7 +138,7 @@
5.4 {
5.5 #if defined PLATFORM_WINDOWS
5.6 return ((m_fd.dwFileAttributes & FILE_ATTRIBUTE_DIRECTORY) == FILE_ATTRIBUTE_DIRECTORY);
5.7 -#elif defined PLATFORM_LINUX
5.8 +#elif defined PLATFORM_POSIX
5.9 char temppath[PLATFORM_MAX_PATH];
5.10 snprintf(temppath, sizeof(temppath), "%s/%s", m_origpath, GetEntryName());
5.11 return g_LibSys.IsPathDirectory(temppath);
5.12 @@ -160,7 +160,7 @@
5.13 {
5.14 #if defined PLATFORM_WINDOWS
5.15 return m_fd.cFileName;
5.16 -#elif defined PLATFORM_LINUX
5.17 +#elif defined PLATFORM_POSIX
5.18 return ep ? ep->d_name : "";
5.19 #endif
5.20 }
5.21 @@ -174,7 +174,7 @@
5.22 {
5.23 #if defined PLATFORM_WINDOWS
5.24 return (m_dir != INVALID_HANDLE_VALUE);
5.25 -#elif defined PLATFORM_LINUX
5.26 +#elif defined PLATFORM_POSIX
5.27 return (m_dir != NULL);
5.28 #endif
5.29 }
5.30 @@ -214,7 +214,7 @@
5.31 }
5.32
5.33 return true;
5.34 -#elif defined PLATFORM_LINUX
5.35 +#elif defined PLATFORM_POSIX
5.36 struct stat s;
5.37
5.38 if (stat(path, &s) != 0)
6.1 --- a/core/Makefile Mon Dec 15 18:47:11 2008 +1300
6.2 +++ b/core/Makefile Tue Dec 23 01:33:37 2008 -0500
6.3 @@ -43,7 +43,7 @@
6.4 C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
6.5 C_GCC4_FLAGS = -fvisibility=hidden
6.6 CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
6.7 -CPP = gcc-4.1
6.8 +CPP = gcc
6.9
6.10 override ENGSET = false
6.11 ifeq "$(ENGINE)" "original"
7.1 --- a/core/md5.cpp Mon Dec 15 18:47:11 2008 +1300
7.2 +++ b/core/md5.cpp Tue Dec 23 01:33:37 2008 -0500
7.3 @@ -201,11 +201,7 @@
7.4 int i;
7.5 char *s= new char[33];
7.6
7.7 - if (!finalized){
7.8 -/* cerr << "MD5::hex_digest: Can't get digest if you haven't "<<
7.9 - "finalized the digest!" <<endl;*/
7.10 - return "";
7.11 - }
7.12 + assert(finalized);
7.13
7.14 for (i=0; i<16; i++)
7.15 sprintf(s+i*2, "%02x", digest[i]);
7.16 @@ -220,12 +216,7 @@
7.17
7.18 int i;
7.19
7.20 - if (!finalized)
7.21 - {
7.22 - /* cerr << "MD5::hex_digest: Can't get digest if you haven't "<<
7.23 - "finalized the digest!" <<endl;*/
7.24 - return "";
7.25 - }
7.26 + assert(finalized);
7.27
7.28 for (i=0; i<16; i++)
7.29 sprintf(buffer+i*2, "%02x", digest[i]);
8.1 --- a/core/sm_memtable.cpp Mon Dec 15 18:47:11 2008 +1300
8.2 +++ b/core/sm_memtable.cpp Tue Dec 23 01:33:37 2008 -0500
8.3 @@ -30,7 +30,7 @@
8.4 */
8.5
8.6 #include <string.h>
8.7 -#include <malloc.h>
8.8 +#include <stdlib.h>
8.9 #include "sm_memtable.h"
8.10
8.11 BaseMemTable::BaseMemTable(unsigned int init_size)
9.1 --- a/core/sm_queue.h Mon Dec 15 18:47:11 2008 +1300
9.2 +++ b/core/sm_queue.h Tue Dec 23 01:33:37 2008 -0500
9.3 @@ -33,7 +33,7 @@
9.4 #define _INCLUDE_SM_QUEUE_H
9.5
9.6 #include <new>
9.7 -#include <malloc.h>
9.8 +#include <stdlib.h>
9.9 #include <sh_stack.h>
9.10
9.11 using namespace SourceHook;
10.1 --- a/core/smn_adt_array.cpp Mon Dec 15 18:47:11 2008 +1300
10.2 +++ b/core/smn_adt_array.cpp Tue Dec 23 01:33:37 2008 -0500
10.3 @@ -29,7 +29,7 @@
10.4 * Version: $Id$
10.5 */
10.6
10.7 -#include <malloc.h>
10.8 +#include <stdlib.h>
10.9 #include "sm_globals.h"
10.10 #include "sm_stringutil.h"
10.11 #include "CellArray.h"
11.1 --- a/core/smn_adt_stack.cpp Mon Dec 15 18:47:11 2008 +1300
11.2 +++ b/core/smn_adt_stack.cpp Tue Dec 23 01:33:37 2008 -0500
11.3 @@ -29,7 +29,7 @@
11.4 * Version: $Id$
11.5 */
11.6
11.7 -#include <malloc.h>
11.8 +#include <stdlib.h>
11.9 #include "sm_globals.h"
11.10 #include "sm_stringutil.h"
11.11 #include "CellArray.h"
12.1 --- a/core/smn_adt_trie.cpp Mon Dec 15 18:47:11 2008 +1300
12.2 +++ b/core/smn_adt_trie.cpp Tue Dec 23 01:33:37 2008 -0500
12.3 @@ -29,7 +29,7 @@
12.4 * Version: $Id$
12.5 */
12.6
12.7 -#include <malloc.h>
12.8 +#include <stdlib.h>
12.9 #include "sm_globals.h"
12.10 #include "sm_stringutil.h"
12.11 #include "HandleSys.h"
13.1 --- a/core/smn_core.cpp Mon Dec 15 18:47:11 2008 +1300
13.2 +++ b/core/smn_core.cpp Tue Dec 23 01:33:37 2008 -0500
13.3 @@ -418,6 +418,9 @@
13.4 fticks -= r;
13.5 }
13.6 return (cell_t)fticks;
13.7 +#elif defined PLATFORM_APPLE
13.8 + assert(false);
13.9 + return 0;
13.10 #endif
13.11 }
13.12
14.1 --- a/core/smn_string.cpp Mon Dec 15 18:47:11 2008 +1300
14.2 +++ b/core/smn_string.cpp Tue Dec 23 01:33:37 2008 -0500
14.3 @@ -40,7 +40,7 @@
14.4 {
14.5 #ifdef PLATFORM_WINDOWS
14.6 return strstr(str, substr);
14.7 -#elif defined PLATFORM_LINUX
14.8 +#elif defined PLATFORM_LINUX || defined PLATFORM_APPLE
14.9 return (const char *)strstr(str, substr);
14.10 #endif
14.11 }
15.1 --- a/extensions/bintools/Makefile Mon Dec 15 18:47:11 2008 +1300
15.2 +++ b/extensions/bintools/Makefile Tue Dec 23 01:33:37 2008 -0500
15.3 @@ -26,7 +26,7 @@
15.4 C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
15.5 C_GCC4_FLAGS = -fvisibility=hidden
15.6 CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
15.7 -CPP = gcc-4.1
15.8 +CPP = gcc
15.9
15.10 override ENGSET = false
15.11 ifeq "$(ENGINE)" "original"
15.12 @@ -61,7 +61,7 @@
15.13 -I$(SMSDK)/public/jit/x86 -I$(SMSDK)/public/sourcepawn
15.14 endif
15.15
15.16 -LINK += -static-libgcc
15.17 +LINK += -m32 -ldl -lm
15.18
15.19 CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
15.20 -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -mfpmath=sse \
15.21 @@ -84,14 +84,21 @@
15.22 BIN_DIR := $(BIN_DIR).$(ENGINE)
15.23 endif
15.24
15.25 +OS := $(shell uname -s)
15.26 +ifeq "$(OS)" "Darwin"
15.27 + LINK += -dynamiclib
15.28 + BINARY = $(PROJECT).ext.dylib
15.29 +else
15.30 + LINK += -static-libgcc -shared
15.31 + BINARY = $(PROJECT).ext.so
15.32 +endif
15.33 +
15.34 GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
15.35 ifeq "$(GCC_VERSION)" "4"
15.36 CFLAGS += $(C_GCC4_FLAGS)
15.37 CPPFLAGS += $(CPP_GCC4_FLAGS)
15.38 endif
15.39
15.40 -BINARY = $(PROJECT).ext.so
15.41 -
15.42 OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
15.43
15.44 $(BIN_DIR)/%.o: %.cpp
15.45 @@ -112,7 +119,7 @@
15.46 fi
15.47
15.48 extension: check $(OBJ_LINUX)
15.49 - $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
15.50 + $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
15.51
15.52 debug:
15.53 $(MAKE) -f Makefile all DEBUG=true
15.54 @@ -123,3 +130,4 @@
15.55 rm -rf $(BIN_DIR)/*.o
15.56 rm -rf $(BIN_DIR)/sdk/*.o
15.57 rm -rf $(BIN_DIR)/$(BINARY)
15.58 +
16.1 --- a/extensions/bintools/sdk/smsdk_ext.cpp Mon Dec 15 18:47:11 2008 +1300
16.2 +++ b/extensions/bintools/sdk/smsdk_ext.cpp Tue Dec 23 01:33:37 2008 -0500
16.3 @@ -30,7 +30,7 @@
16.4 */
16.5
16.6 #include <stdio.h>
16.7 -#include <malloc.h>
16.8 +#include <stdlib.h>
16.9 #include "smsdk_ext.h"
16.10
16.11 /**
16.12 @@ -79,6 +79,24 @@
16.13 #if defined SMEXT_ENABLE_LIBSYS
16.14 ILibrarySys *libsys = NULL;
16.15 #endif
16.16 +#if defined SMEXT_ENABLE_PLUGINSYS
16.17 +SourceMod::IPluginManager *plsys;
16.18 +#endif
16.19 +#if defined SMEXT_ENABLE_MENUS
16.20 +IMenuManager *menus = NULL;
16.21 +#endif
16.22 +#if defined SMEXT_ENABLE_ADMINSYS
16.23 +IAdminSystem *adminsys = NULL;
16.24 +#endif
16.25 +#if defined SMEXT_ENABLE_TEXTPARSERS
16.26 +ITextParsers *textparsers = NULL;
16.27 +#endif
16.28 +#if defined SMEXT_ENABLE_USERMSGS
16.29 +IUserMessages *usermsgs = NULL;
16.30 +#endif
16.31 +#if defined SMEXT_ENABLE_TRANSLATOR
16.32 +ITranslator *translator = NULL;
16.33 +#endif
16.34
16.35 /** Exports the main interface */
16.36 PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
16.37 @@ -149,6 +167,24 @@
16.38 #if defined SMEXT_ENABLE_LIBSYS
16.39 SM_GET_IFACE(LIBRARYSYS, libsys);
16.40 #endif
16.41 +#if defined SMEXT_ENABLE_PLUGINSYS
16.42 + SM_GET_IFACE(PLUGINSYSTEM, plsys);
16.43 +#endif
16.44 +#if defined SMEXT_ENABLE_MENUS
16.45 + SM_GET_IFACE(MENUMANAGER, menus);
16.46 +#endif
16.47 +#if defined SMEXT_ENABLE_ADMINSYS
16.48 + SM_GET_IFACE(ADMINSYS, adminsys);
16.49 +#endif
16.50 +#if defined SMEXT_ENABLE_TEXTPARSERS
16.51 + SM_GET_IFACE(TEXTPARSERS, textparsers);
16.52 +#endif
16.53 +#if defined SMEXT_ENABLE_USERMSGS
16.54 + SM_GET_IFACE(USERMSGS, usermsgs);
16.55 +#endif
16.56 +#if defined SMEXT_ENABLE_TRANSLATOR
16.57 + SM_GET_IFACE(TRANSLATOR, translator);
16.58 +#endif
16.59
16.60 if (SDK_OnLoad(error, maxlength, late))
16.61 {
16.62 @@ -256,7 +292,11 @@
16.63 /** Exposes the extension to Metamod */
16.64 SMM_API void *PL_EXPOSURE(const char *name, int *code)
16.65 {
16.66 +#if defined METAMOD_PLAPI_VERSION
16.67 + if (name && !strcmp(name, METAMOD_PLAPI_NAME))
16.68 +#else
16.69 if (name && !strcmp(name, PLAPI_NAME))
16.70 +#endif
16.71 {
16.72 if (code)
16.73 {
16.74 @@ -277,8 +317,13 @@
16.75 {
16.76 PLUGIN_SAVEVARS();
16.77
16.78 +#if !defined METAMOD_PLAPI_VERSION
16.79 GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
16.80 GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
16.81 +#else
16.82 + GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
16.83 + GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
16.84 +#endif
16.85
16.86 m_SourceMMLoaded = true;
16.87
16.88 @@ -389,7 +434,7 @@
16.89 #endif
16.90
16.91 /* Overload a few things to prevent libstdc++ linking */
16.92 -#if defined __linux__
16.93 +#if defined __linux__ || defined __APPLE__
16.94 extern "C" void __cxa_pure_virtual(void)
16.95 {
16.96 }
16.97 @@ -414,3 +459,4 @@
16.98 free(ptr);
16.99 }
16.100 #endif
16.101 +
17.1 --- a/extensions/clientprefs/Makefile Mon Dec 15 18:47:11 2008 +1300
17.2 +++ b/extensions/clientprefs/Makefile Tue Dec 23 01:33:37 2008 -0500
17.3 @@ -26,7 +26,7 @@
17.4 C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
17.5 C_GCC4_FLAGS = -fvisibility=hidden
17.6 CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
17.7 -CPP = gcc-4.1
17.8 +CPP = gcc
17.9
17.10 override ENGSET = false
17.11 ifeq "$(ENGINE)" "original"
17.12 @@ -61,7 +61,7 @@
17.13 -I$(MMSOURCE17)/core/sourcehook
17.14 endif
17.15
17.16 -LINK += -static-libgcc
17.17 +LINK += -m32 -ldl -lm
17.18
17.19 CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
17.20 -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \
17.21 @@ -84,14 +84,21 @@
17.22 BIN_DIR := $(BIN_DIR).$(ENGINE)
17.23 endif
17.24
17.25 +OS := $(shell uname -s)
17.26 +ifeq "$(OS)" "Darwin"
17.27 + LINK += -dynamiclib
17.28 + BINARY = $(PROJECT).ext.dylib
17.29 +else
17.30 + LINK += -static-libgcc -shared
17.31 + BINARY = $(PROJECT).ext.so
17.32 +endif
17.33 +
17.34 GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
17.35 ifeq "$(GCC_VERSION)" "4"
17.36 CFLAGS += $(C_GCC4_FLAGS)
17.37 CPPFLAGS += $(CPP_GCC4_FLAGS)
17.38 endif
17.39
17.40 -BINARY = $(PROJECT).ext.so
17.41 -
17.42 OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
17.43
17.44 $(BIN_DIR)/%.o: %.cpp
17.45 @@ -112,7 +119,7 @@
17.46 fi
17.47
17.48 extension: check $(OBJ_LINUX)
17.49 - $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
17.50 + $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
17.51
17.52 debug:
17.53 $(MAKE) -f Makefile all DEBUG=true
18.1 --- a/extensions/clientprefs/sdk/smsdk_ext.cpp Mon Dec 15 18:47:11 2008 +1300
18.2 +++ b/extensions/clientprefs/sdk/smsdk_ext.cpp Tue Dec 23 01:33:37 2008 -0500
18.3 @@ -30,7 +30,7 @@
18.4 */
18.5
18.6 #include <stdio.h>
18.7 -#include <malloc.h>
18.8 +#include <stdlib.h>
18.9 #include "smsdk_ext.h"
18.10
18.11 /**
18.12 @@ -434,7 +434,7 @@
18.13 #endif
18.14
18.15 /* Overload a few things to prevent libstdc++ linking */
18.16 -#if defined __linux__
18.17 +#if defined __linux__ || defined __APPLE__
18.18 extern "C" void __cxa_pure_virtual(void)
18.19 {
18.20 }
18.21 @@ -459,3 +459,4 @@
18.22 free(ptr);
18.23 }
18.24 #endif
18.25 +
19.1 --- a/extensions/cstrike/Makefile Mon Dec 15 18:47:11 2008 +1300
19.2 +++ b/extensions/cstrike/Makefile Tue Dec 23 01:33:37 2008 -0500
19.3 @@ -26,7 +26,7 @@
19.4 C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
19.5 C_GCC4_FLAGS = -fvisibility=hidden
19.6 CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
19.7 -CPP = gcc-4.1
19.8 +CPP = gcc
19.9
19.10 override ENGSET = false
19.11 ifeq "$(ENGINE)" "original"
19.12 @@ -61,7 +61,7 @@
19.13 INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
19.14 endif
19.15
19.16 -LINK += -static-libgcc
19.17 +LINK += -m32 -ldl -lm
19.18
19.19 CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
19.20 -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -mfpmath=sse \
19.21 @@ -84,6 +84,15 @@
19.22 BIN_DIR := $(BIN_DIR).$(ENGINE)
19.23 endif
19.24
19.25 +OS := $(shell uname -s)
19.26 +ifeq "$(OS)" "Darwin"
19.27 + LINK += -dynamiclib
19.28 + BINARY = $(PROJECT).ext.dylib
19.29 +else
19.30 + LINK += -static-libgcc -shared
19.31 + BINARY = $(PROJECT).ext.so
19.32 +endif
19.33 +
19.34 GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
19.35 ifeq "$(GCC_VERSION)" "4"
19.36 CFLAGS += $(C_GCC4_FLAGS)
19.37 @@ -111,7 +120,7 @@
19.38 fi
19.39
19.40 extension: check $(OBJ_LINUX)
19.41 - $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
19.42 + $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
19.43
19.44 debug:
19.45 $(MAKE) -f Makefile all DEBUG=true
20.1 --- a/extensions/cstrike/sdk/smsdk_ext.cpp Mon Dec 15 18:47:11 2008 +1300
20.2 +++ b/extensions/cstrike/sdk/smsdk_ext.cpp Tue Dec 23 01:33:37 2008 -0500
20.3 @@ -30,7 +30,7 @@
20.4 */
20.5
20.6 #include <stdio.h>
20.7 -#include <malloc.h>
20.8 +#include <stdlib.h>
20.9 #include "smsdk_ext.h"
20.10
20.11 /**
20.12 @@ -79,9 +79,24 @@
20.13 #if defined SMEXT_ENABLE_LIBSYS
20.14 ILibrarySys *libsys = NULL;
20.15 #endif
20.16 +#if defined SMEXT_ENABLE_PLUGINSYS
20.17 +SourceMod::IPluginManager *plsys;
20.18 +#endif
20.19 +#if defined SMEXT_ENABLE_MENUS
20.20 +IMenuManager *menus = NULL;
20.21 +#endif
20.22 +#if defined SMEXT_ENABLE_ADMINSYS
20.23 +IAdminSystem *adminsys = NULL;
20.24 +#endif
20.25 +#if defined SMEXT_ENABLE_TEXTPARSERS
20.26 +ITextParsers *textparsers = NULL;
20.27 +#endif
20.28 #if defined SMEXT_ENABLE_USERMSGS
20.29 IUserMessages *usermsgs = NULL;
20.30 #endif
20.31 +#if defined SMEXT_ENABLE_TRANSLATOR
20.32 +ITranslator *translator = NULL;
20.33 +#endif
20.34
20.35 /** Exports the main interface */
20.36 PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
20.37 @@ -152,9 +167,24 @@
20.38 #if defined SMEXT_ENABLE_LIBSYS
20.39 SM_GET_IFACE(LIBRARYSYS, libsys);
20.40 #endif
20.41 +#if defined SMEXT_ENABLE_PLUGINSYS
20.42 + SM_GET_IFACE(PLUGINSYSTEM, plsys);
20.43 +#endif
20.44 +#if defined SMEXT_ENABLE_MENUS
20.45 + SM_GET_IFACE(MENUMANAGER, menus);
20.46 +#endif
20.47 +#if defined SMEXT_ENABLE_ADMINSYS
20.48 + SM_GET_IFACE(ADMINSYS, adminsys);
20.49 +#endif
20.50 +#if defined SMEXT_ENABLE_TEXTPARSERS
20.51 + SM_GET_IFACE(TEXTPARSERS, textparsers);
20.52 +#endif
20.53 #if defined SMEXT_ENABLE_USERMSGS
20.54 SM_GET_IFACE(USERMSGS, usermsgs);
20.55 #endif
20.56 +#if defined SMEXT_ENABLE_TRANSLATOR
20.57 + SM_GET_IFACE(TRANSLATOR, translator);
20.58 +#endif
20.59
20.60 if (SDK_OnLoad(error, maxlength, late))
20.61 {
20.62 @@ -262,7 +292,11 @@
20.63 /** Exposes the extension to Metamod */
20.64 SMM_API void *PL_EXPOSURE(const char *name, int *code)
20.65 {
20.66 +#if defined METAMOD_PLAPI_VERSION
20.67 if (name && !strcmp(name, METAMOD_PLAPI_NAME))
20.68 +#else
20.69 + if (name && !strcmp(name, PLAPI_NAME))
20.70 +#endif
20.71 {
20.72 if (code)
20.73 {
20.74 @@ -283,8 +317,13 @@
20.75 {
20.76 PLUGIN_SAVEVARS();
20.77
20.78 +#if !defined METAMOD_PLAPI_VERSION
20.79 + GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
20.80 + GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
20.81 +#else
20.82 GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
20.83 GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
20.84 +#endif
20.85
20.86 m_SourceMMLoaded = true;
20.87
20.88 @@ -395,7 +434,7 @@
20.89 #endif
20.90
20.91 /* Overload a few things to prevent libstdc++ linking */
20.92 -#if defined __linux__
20.93 +#if defined __linux__ || defined __APPLE__
20.94 extern "C" void __cxa_pure_virtual(void)
20.95 {
20.96 }
20.97 @@ -420,3 +459,4 @@
20.98 free(ptr);
20.99 }
20.100 #endif
20.101 +
21.1 --- a/extensions/geoip/Makefile Mon Dec 15 18:47:11 2008 +1300
21.2 +++ b/extensions/geoip/Makefile Tue Dec 23 01:33:37 2008 -0500
21.3 @@ -26,7 +26,7 @@
21.4 C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
21.5 C_GCC4_FLAGS = -fvisibility=hidden
21.6 CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
21.7 -CPP = gcc-4.1
21.8 +CPP = gcc
21.9
21.10 override ENGSET = false
21.11 ifeq "$(ENGINE)" "original"
21.12 @@ -60,7 +60,7 @@
21.13 INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
21.14 endif
21.15
21.16 -LINK += -static-libgcc
21.17 +LINK += -m32 -ldl -lm
21.18
21.19 CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
21.20 -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -mfpmath=sse \
21.21 @@ -83,14 +83,21 @@
21.22 BIN_DIR := $(BIN_DIR).$(ENGINE)
21.23 endif
21.24
21.25 +OS := $(shell uname -s)
21.26 +ifeq "$(OS)" "Darwin"
21.27 + LINK += -dynamiclib
21.28 + BINARY = $(PROJECT).ext.dylib
21.29 +else
21.30 + LINK += -static-libgcc -shared
21.31 + BINARY = $(PROJECT).ext.so
21.32 +endif
21.33 +
21.34 GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
21.35 ifeq "$(GCC_VERSION)" "4"
21.36 CFLAGS += $(C_GCC4_FLAGS)
21.37 CPPFLAGS += $(CPP_GCC4_FLAGS)
21.38 endif
21.39
21.40 -BINARY = $(PROJECT).ext.so
21.41 -
21.42 OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
21.43
21.44 $(BIN_DIR)/%.o: %.cpp
21.45 @@ -111,7 +118,7 @@
21.46 fi
21.47
21.48 extension: check $(OBJ_LINUX)
21.49 - $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
21.50 + $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
21.51
21.52 debug:
21.53 $(MAKE) -f Makefile all DEBUG=true
22.1 --- a/extensions/geoip/sdk/smsdk_ext.cpp Mon Dec 15 18:47:11 2008 +1300
22.2 +++ b/extensions/geoip/sdk/smsdk_ext.cpp Tue Dec 23 01:33:37 2008 -0500
22.3 @@ -30,7 +30,7 @@
22.4 */
22.5
22.6 #include <stdio.h>
22.7 -#include <malloc.h>
22.8 +#include <stdlib.h>
22.9 #include "smsdk_ext.h"
22.10
22.11 /**
22.12 @@ -79,6 +79,24 @@
22.13 #if defined SMEXT_ENABLE_LIBSYS
22.14 ILibrarySys *libsys = NULL;
22.15 #endif
22.16 +#if defined SMEXT_ENABLE_PLUGINSYS
22.17 +SourceMod::IPluginManager *plsys;
22.18 +#endif
22.19 +#if defined SMEXT_ENABLE_MENUS
22.20 +IMenuManager *menus = NULL;
22.21 +#endif
22.22 +#if defined SMEXT_ENABLE_ADMINSYS
22.23 +IAdminSystem *adminsys = NULL;
22.24 +#endif
22.25 +#if defined SMEXT_ENABLE_TEXTPARSERS
22.26 +ITextParsers *textparsers = NULL;
22.27 +#endif
22.28 +#if defined SMEXT_ENABLE_USERMSGS
22.29 +IUserMessages *usermsgs = NULL;
22.30 +#endif
22.31 +#if defined SMEXT_ENABLE_TRANSLATOR
22.32 +ITranslator *translator = NULL;
22.33 +#endif
22.34
22.35 /** Exports the main interface */
22.36 PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
22.37 @@ -149,6 +167,24 @@
22.38 #if defined SMEXT_ENABLE_LIBSYS
22.39 SM_GET_IFACE(LIBRARYSYS, libsys);
22.40 #endif
22.41 +#if defined SMEXT_ENABLE_PLUGINSYS
22.42 + SM_GET_IFACE(PLUGINSYSTEM, plsys);
22.43 +#endif
22.44 +#if defined SMEXT_ENABLE_MENUS
22.45 + SM_GET_IFACE(MENUMANAGER, menus);
22.46 +#endif
22.47 +#if defined SMEXT_ENABLE_ADMINSYS
22.48 + SM_GET_IFACE(ADMINSYS, adminsys);
22.49 +#endif
22.50 +#if defined SMEXT_ENABLE_TEXTPARSERS
22.51 + SM_GET_IFACE(TEXTPARSERS, textparsers);
22.52 +#endif
22.53 +#if defined SMEXT_ENABLE_USERMSGS
22.54 + SM_GET_IFACE(USERMSGS, usermsgs);
22.55 +#endif
22.56 +#if defined SMEXT_ENABLE_TRANSLATOR
22.57 + SM_GET_IFACE(TRANSLATOR, translator);
22.58 +#endif
22.59
22.60 if (SDK_OnLoad(error, maxlength, late))
22.61 {
22.62 @@ -256,7 +292,11 @@
22.63 /** Exposes the extension to Metamod */
22.64 SMM_API void *PL_EXPOSURE(const char *name, int *code)
22.65 {
22.66 +#if defined METAMOD_PLAPI_VERSION
22.67 + if (name && !strcmp(name, METAMOD_PLAPI_NAME))
22.68 +#else
22.69 if (name && !strcmp(name, PLAPI_NAME))
22.70 +#endif
22.71 {
22.72 if (code)
22.73 {
22.74 @@ -277,8 +317,13 @@
22.75 {
22.76 PLUGIN_SAVEVARS();
22.77
22.78 +#if !defined METAMOD_PLAPI_VERSION
22.79 GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
22.80 GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
22.81 +#else
22.82 + GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
22.83 + GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
22.84 +#endif
22.85
22.86 m_SourceMMLoaded = true;
22.87
22.88 @@ -389,7 +434,7 @@
22.89 #endif
22.90
22.91 /* Overload a few things to prevent libstdc++ linking */
22.92 -#if defined __linux__
22.93 +#if defined __linux__ || defined __APPLE__
22.94 extern "C" void __cxa_pure_virtual(void)
22.95 {
22.96 }
22.97 @@ -414,3 +459,4 @@
22.98 free(ptr);
22.99 }
22.100 #endif
22.101 +
23.1 --- a/extensions/mysql/Makefile Mon Dec 15 18:47:11 2008 +1300
23.2 +++ b/extensions/mysql/Makefile Tue Dec 23 01:33:37 2008 -0500
23.3 @@ -30,7 +30,7 @@
23.4 C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
23.5 C_GCC4_FLAGS = -fvisibility=hidden
23.6 CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
23.7 -CPP = gcc-4.1
23.8 +CPP = gcc
23.9
23.10 override ENGSET = false
23.11 ifeq "$(ENGINE)" "original"
23.12 @@ -65,7 +65,7 @@
23.13 -I$(MYSQL)/include
23.14 endif
23.15
23.16 -LINK += $(MYSQL)/lib/libmysqlclient_r.a -lz -static-libgcc -lpthread
23.17 +LINK += $(MYSQL)/lib/libmysqlclient_r.a -lz -lpthread
23.18
23.19 CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
23.20 -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \
23.21 @@ -94,7 +94,14 @@
23.22 CPPFLAGS += $(CPP_GCC4_FLAGS)
23.23 endif
23.24
23.25 -BINARY = $(PROJECT).ext.so
23.26 +OS := $(shell uname -s)
23.27 +ifeq "$(OS)" "Darwin"
23.28 + LINK += -dynamiclib
23.29 + BINARY = $(PROJECT).ext.dylib
23.30 +else
23.31 + LINK += -static-libgcc -shared
23.32 + BINARY = $(PROJECT).ext.so
23.33 +endif
23.34
23.35 OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
23.36
23.37 @@ -117,7 +124,7 @@
23.38 fi
23.39
23.40 extension: check $(OBJ_LINUX)
23.41 - $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
23.42 + $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
23.43
23.44 debug:
23.45 $(MAKE) -f Makefile all DEBUG=true
24.1 --- a/extensions/mysql/sdk/smsdk_ext.cpp Mon Dec 15 18:47:11 2008 +1300
24.2 +++ b/extensions/mysql/sdk/smsdk_ext.cpp Tue Dec 23 01:33:37 2008 -0500
24.3 @@ -30,7 +30,7 @@
24.4 */
24.5
24.6 #include <stdio.h>
24.7 -#include <malloc.h>
24.8 +#include <stdlib.h>
24.9 #include "smsdk_ext.h"
24.10
24.11 /**
24.12 @@ -79,6 +79,24 @@
24.13 #if defined SMEXT_ENABLE_LIBSYS
24.14 ILibrarySys *libsys = NULL;
24.15 #endif
24.16 +#if defined SMEXT_ENABLE_PLUGINSYS
24.17 +SourceMod::IPluginManager *plsys;
24.18 +#endif
24.19 +#if defined SMEXT_ENABLE_MENUS
24.20 +IMenuManager *menus = NULL;
24.21 +#endif
24.22 +#if defined SMEXT_ENABLE_ADMINSYS
24.23 +IAdminSystem *adminsys = NULL;
24.24 +#endif
24.25 +#if defined SMEXT_ENABLE_TEXTPARSERS
24.26 +ITextParsers *textparsers = NULL;
24.27 +#endif
24.28 +#if defined SMEXT_ENABLE_USERMSGS
24.29 +IUserMessages *usermsgs = NULL;
24.30 +#endif
24.31 +#if defined SMEXT_ENABLE_TRANSLATOR
24.32 +ITranslator *translator = NULL;
24.33 +#endif
24.34
24.35 /** Exports the main interface */
24.36 PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
24.37 @@ -149,6 +167,24 @@
24.38 #if defined SMEXT_ENABLE_LIBSYS
24.39 SM_GET_IFACE(LIBRARYSYS, libsys);
24.40 #endif
24.41 +#if defined SMEXT_ENABLE_PLUGINSYS
24.42 + SM_GET_IFACE(PLUGINSYSTEM, plsys);
24.43 +#endif
24.44 +#if defined SMEXT_ENABLE_MENUS
24.45 + SM_GET_IFACE(MENUMANAGER, menus);
24.46 +#endif
24.47 +#if defined SMEXT_ENABLE_ADMINSYS
24.48 + SM_GET_IFACE(ADMINSYS, adminsys);
24.49 +#endif
24.50 +#if defined SMEXT_ENABLE_TEXTPARSERS
24.51 + SM_GET_IFACE(TEXTPARSERS, textparsers);
24.52 +#endif
24.53 +#if defined SMEXT_ENABLE_USERMSGS
24.54 + SM_GET_IFACE(USERMSGS, usermsgs);
24.55 +#endif
24.56 +#if defined SMEXT_ENABLE_TRANSLATOR
24.57 + SM_GET_IFACE(TRANSLATOR, translator);
24.58 +#endif
24.59
24.60 if (SDK_OnLoad(error, maxlength, late))
24.61 {
24.62 @@ -256,7 +292,11 @@
24.63 /** Exposes the extension to Metamod */
24.64 SMM_API void *PL_EXPOSURE(const char *name, int *code)
24.65 {
24.66 +#if defined METAMOD_PLAPI_VERSION
24.67 + if (name && !strcmp(name, METAMOD_PLAPI_NAME))
24.68 +#else
24.69 if (name && !strcmp(name, PLAPI_NAME))
24.70 +#endif
24.71 {
24.72 if (code)
24.73 {
24.74 @@ -277,8 +317,13 @@
24.75 {
24.76 PLUGIN_SAVEVARS();
24.77
24.78 +#if !defined METAMOD_PLAPI_VERSION
24.79 GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
24.80 GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
24.81 +#else
24.82 + GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
24.83 + GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
24.84 +#endif
24.85
24.86 m_SourceMMLoaded = true;
24.87
24.88 @@ -389,7 +434,7 @@
24.89 #endif
24.90
24.91 /* Overload a few things to prevent libstdc++ linking */
24.92 -#if defined __linux__
24.93 +#if defined __linux__ || defined __APPLE__
24.94 extern "C" void __cxa_pure_virtual(void)
24.95 {
24.96 }
24.97 @@ -414,3 +459,4 @@
24.98 free(ptr);
24.99 }
24.100 #endif
24.101 +
25.1 --- a/extensions/regex/Makefile Mon Dec 15 18:47:11 2008 +1300
25.2 +++ b/extensions/regex/Makefile Tue Dec 23 01:33:37 2008 -0500
25.3 @@ -26,7 +26,7 @@
25.4 C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
25.5 C_GCC4_FLAGS = -fvisibility=hidden
25.6 CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
25.7 -CPP = gcc-4.1
25.8 +CPP = gcc
25.9
25.10 override ENGSET = false
25.11 ifeq "$(ENGINE)" "original"
25.12 @@ -60,7 +60,7 @@
25.13 INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(MMSOURCE17)/core/sourcehook
25.14 endif
25.15
25.16 -LINK += lib_linux/libpcre.a -static-libgcc
25.17 +LINK += -m32 -ldl -lm
25.18
25.19 CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
25.20 -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -mfpmath=sse \
25.21 @@ -83,14 +83,21 @@
25.22 BIN_DIR := $(BIN_DIR).$(ENGINE)
25.23 endif
25.24
25.25 +OS := $(shell uname -s)
25.26 +ifeq "$(OS)" "Darwin"
25.27 + LINK += lib_darwin_x86/libpcre.a -dynamiclib
25.28 + BINARY = $(PROJECT).ext.dylib
25.29 +else
25.30 + LINK += lib_linux/libpcre.a -static-libgcc -shared
25.31 + BINARY = $(PROJECT).ext.so
25.32 +endif
25.33 +
25.34 GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
25.35 ifeq "$(GCC_VERSION)" "4"
25.36 CFLAGS += $(C_GCC4_FLAGS)
25.37 CPPFLAGS += $(CPP_GCC4_FLAGS)
25.38 endif
25.39
25.40 -BINARY = $(PROJECT).ext.so
25.41 -
25.42 OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
25.43
25.44 $(BIN_DIR)/%.o: %.cpp
25.45 @@ -111,7 +118,7 @@
25.46 fi
25.47
25.48 extension: check $(OBJ_LINUX)
25.49 - $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
25.50 + $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
25.51
25.52 debug:
25.53 $(MAKE) -f Makefile all DEBUG=true
26.1 --- a/extensions/regex/sdk/smsdk_ext.cpp Mon Dec 15 18:47:11 2008 +1300
26.2 +++ b/extensions/regex/sdk/smsdk_ext.cpp Tue Dec 23 01:33:37 2008 -0500
26.3 @@ -30,7 +30,7 @@
26.4 */
26.5
26.6 #include <stdio.h>
26.7 -#include <malloc.h>
26.8 +#include <stdlib.h>
26.9 #include "smsdk_ext.h"
26.10
26.11 /**
26.12 @@ -94,6 +94,9 @@
26.13 #if defined SMEXT_ENABLE_USERMSGS
26.14 IUserMessages *usermsgs = NULL;
26.15 #endif
26.16 +#if defined SMEXT_ENABLE_TRANSLATOR
26.17 +ITranslator *translator = NULL;
26.18 +#endif
26.19
26.20 /** Exports the main interface */
26.21 PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
26.22 @@ -179,6 +182,9 @@
26.23 #if defined SMEXT_ENABLE_USERMSGS
26.24 SM_GET_IFACE(USERMSGS, usermsgs);
26.25 #endif
26.26 +#if defined SMEXT_ENABLE_TRANSLATOR
26.27 + SM_GET_IFACE(TRANSLATOR, translator);
26.28 +#endif
26.29
26.30 if (SDK_OnLoad(error, maxlength, late))
26.31 {
26.32 @@ -311,7 +317,7 @@
26.33 {
26.34 PLUGIN_SAVEVARS();
26.35
26.36 -#if defined METAMOD_PLAPI_VERSION
26.37 +#if !defined METAMOD_PLAPI_VERSION
26.38 GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
26.39 GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
26.40 #else
26.41 @@ -428,7 +434,7 @@
26.42 #endif
26.43
26.44 /* Overload a few things to prevent libstdc++ linking */
26.45 -#if defined __linux__
26.46 +#if defined __linux__ || defined __APPLE__
26.47 extern "C" void __cxa_pure_virtual(void)
26.48 {
26.49 }
26.50 @@ -453,3 +459,4 @@
26.51 free(ptr);
26.52 }
26.53 #endif
26.54 +
27.1 --- a/extensions/sdktools/Makefile Mon Dec 15 18:47:11 2008 +1300
27.2 +++ b/extensions/sdktools/Makefile Tue Dec 23 01:33:37 2008 -0500
27.3 @@ -29,7 +29,7 @@
27.4 C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
27.5 C_GCC4_FLAGS = -fvisibility=hidden
27.6 CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
27.7 -CPP = gcc-4.1
27.8 +CPP = gcc
27.9
27.10 override ENGSET = false
27.11 ifeq "$(ENGINE)" "original"
27.12 @@ -64,7 +64,7 @@
27.13 INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
27.14 endif
27.15
27.16 -LINK += -static-libgcc
27.17 +LINK += -m32 -ldl -lm
27.18
27.19 CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
27.20 -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \
27.21 @@ -87,6 +87,15 @@
27.22 BIN_DIR := $(BIN_DIR).$(ENGINE)
27.23 endif
27.24
27.25 +OS := $(shell uname -s)
27.26 +ifeq "$(OS)" "Darwin"
27.27 + LINK += -dynamiclib
27.28 + BINARY = $(PROJECT).ext.dylib
27.29 +else
27.30 + LINK += -static-libgcc -shared
27.31 + BINARY = $(PROJECT).ext.so
27.32 +endif
27.33 +
27.34 GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
27.35 ifeq "$(GCC_VERSION)" "4"
27.36 CFLAGS += $(C_GCC4_FLAGS)
27.37 @@ -115,7 +124,7 @@
27.38 fi
27.39
27.40 extension: check $(OBJ_LINUX)
27.41 - $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
27.42 + $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
27.43
27.44 debug:
27.45 $(MAKE) -f Makefile all DEBUG=true
28.1 --- a/extensions/sdktools/detours.h Mon Dec 15 18:47:11 2008 +1300
28.2 +++ b/extensions/sdktools/detours.h Tue Dec 23 01:33:37 2008 -0500
28.3 @@ -32,7 +32,7 @@
28.4 #ifndef _INCLUDE_SOURCEMOD_DETOURS_H_
28.5 #define _INCLUDE_SOURCEMOD_DETOURS_H_
28.6
28.7 -#if defined PLATFORM_LINUX
28.8 +#if defined PLATFORM_POSIX
28.9 #include <sys/mman.h>
28.10 #define PAGE_SIZE 4096
28.11 #define ALIGN(ar) ((long)ar & ~(PAGE_SIZE-1))
29.1 --- a/extensions/sdktools/sdk/smsdk_ext.cpp Mon Dec 15 18:47:11 2008 +1300
29.2 +++ b/extensions/sdktools/sdk/smsdk_ext.cpp Tue Dec 23 01:33:37 2008 -0500
29.3 @@ -30,7 +30,7 @@
29.4 */
29.5
29.6 #include <stdio.h>
29.7 -#include <malloc.h>
29.8 +#include <stdlib.h>
29.9 #include "smsdk_ext.h"
29.10
29.11 /**
29.12 @@ -82,6 +82,21 @@
29.13 #if defined SMEXT_ENABLE_PLUGINSYS
29.14 SourceMod::IPluginManager *plsys;
29.15 #endif
29.16 +#if defined SMEXT_ENABLE_MENUS
29.17 +IMenuManager *menus = NULL;
29.18 +#endif
29.19 +#if defined SMEXT_ENABLE_ADMINSYS
29.20 +IAdminSystem *adminsys = NULL;
29.21 +#endif
29.22 +#if defined SMEXT_ENABLE_TEXTPARSERS
29.23 +ITextParsers *textparsers = NULL;
29.24 +#endif
29.25 +#if defined SMEXT_ENABLE_USERMSGS
29.26 +IUserMessages *usermsgs = NULL;
29.27 +#endif
29.28 +#if defined SMEXT_ENABLE_TRANSLATOR
29.29 +ITranslator *translator = NULL;
29.30 +#endif
29.31
29.32 /** Exports the main interface */
29.33 PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
29.34 @@ -155,6 +170,21 @@
29.35 #if defined SMEXT_ENABLE_PLUGINSYS
29.36 SM_GET_IFACE(PLUGINSYSTEM, plsys);
29.37 #endif
29.38 +#if defined SMEXT_ENABLE_MENUS
29.39 + SM_GET_IFACE(MENUMANAGER, menus);
29.40 +#endif
29.41 +#if defined SMEXT_ENABLE_ADMINSYS
29.42 + SM_GET_IFACE(ADMINSYS, adminsys);
29.43 +#endif
29.44 +#if defined SMEXT_ENABLE_TEXTPARSERS
29.45 + SM_GET_IFACE(TEXTPARSERS, textparsers);
29.46 +#endif
29.47 +#if defined SMEXT_ENABLE_USERMSGS
29.48 + SM_GET_IFACE(USERMSGS, usermsgs);
29.49 +#endif
29.50 +#if defined SMEXT_ENABLE_TRANSLATOR
29.51 + SM_GET_IFACE(TRANSLATOR, translator);
29.52 +#endif
29.53
29.54 if (SDK_OnLoad(error, maxlength, late))
29.55 {
29.56 @@ -262,7 +292,11 @@
29.57 /** Exposes the extension to Metamod */
29.58 SMM_API void *PL_EXPOSURE(const char *name, int *code)
29.59 {
29.60 +#if defined METAMOD_PLAPI_VERSION
29.61 if (name && !strcmp(name, METAMOD_PLAPI_NAME))
29.62 +#else
29.63 + if (name && !strcmp(name, PLAPI_NAME))
29.64 +#endif
29.65 {
29.66 if (code)
29.67 {
29.68 @@ -283,8 +317,13 @@
29.69 {
29.70 PLUGIN_SAVEVARS();
29.71
29.72 +#if !defined METAMOD_PLAPI_VERSION
29.73 + GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
29.74 + GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
29.75 +#else
29.76 GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
29.77 GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
29.78 +#endif
29.79
29.80 m_SourceMMLoaded = true;
29.81
29.82 @@ -395,7 +434,7 @@
29.83 #endif
29.84
29.85 /* Overload a few things to prevent libstdc++ linking */
29.86 -#if defined __linux__
29.87 +#if defined __linux__ || defined __APPLE__
29.88 extern "C" void __cxa_pure_virtual(void)
29.89 {
29.90 }
29.91 @@ -420,3 +459,4 @@
29.92 free(ptr);
29.93 }
29.94 #endif
29.95 +
30.1 --- a/extensions/sqlite/Makefile Mon Dec 15 18:47:11 2008 +1300
30.2 +++ b/extensions/sqlite/Makefile Tue Dec 23 01:33:37 2008 -0500
30.3 @@ -46,7 +46,7 @@
30.4 C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
30.5 C_GCC4_FLAGS = -fvisibility=hidden
30.6 CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
30.7 -CPP = gcc-4.1
30.8 +CPP = gcc
30.9
30.10 override ENGSET = false
30.11 ifeq "$(ENGINE)" "original"
30.12 @@ -80,7 +80,7 @@
30.13 INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn -I$(MMSOURCE17)/core/sourcehook
30.14 endif
30.15
30.16 -LINK += -static-libgcc -lpthread
30.17 +LINK += -lpthread -m32 -ldl -lm
30.18
30.19 CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
30.20 -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror \
30.21 @@ -104,14 +104,21 @@
30.22 BIN_DIR := $(BIN_DIR).$(ENGINE)
30.23 endif
30.24
30.25 +OS := $(shell uname -s)
30.26 +ifeq "$(OS)" "Darwin"
30.27 + LINK += -dynamiclib
30.28 + BINARY = $(PROJECT).ext.dylib
30.29 +else
30.30 + LINK += -static-libgcc -shared
30.31 + BINARY = $(PROJECT).ext.so
30.32 +endif
30.33 +
30.34 GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
30.35 ifeq "$(GCC_VERSION)" "4"
30.36 CFLAGS += $(C_GCC4_FLAGS)
30.37 CPPFLAGS += $(CPP_GCC4_FLAGS)
30.38 endif
30.39
30.40 -BINARY = $(PROJECT).ext.so
30.41 -
30.42 OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
30.43 OBJ_LINUX := $(OBJ_LINUX:%.c=$(BIN_DIR)/%.o)
30.44
30.45 @@ -138,7 +145,7 @@
30.46 fi
30.47
30.48 extension: check $(OBJ_LINUX)
30.49 - $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
30.50 + $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
30.51
30.52 debug:
30.53 $(MAKE) -f Makefile all DEBUG=true
31.1 --- a/extensions/sqlite/driver/SqDriver.cpp Mon Dec 15 18:47:11 2008 +1300
31.2 +++ b/extensions/sqlite/driver/SqDriver.cpp Tue Dec 23 01:33:37 2008 -0500
31.3 @@ -151,7 +151,7 @@
31.4 {
31.5 #if defined PLATFORM_WINDOWS
31.6 return (c == '\\' || c == '/');
31.7 -#elif defined PLATFORM_LINUX
31.8 +#elif defined PLATFORM_LINUX || defined PLATFORM_APPLE
31.9 return (c == '/');
31.10 #endif
31.11 }
32.1 --- a/extensions/sqlite/driver/SqResults.cpp Mon Dec 15 18:47:11 2008 +1300
32.2 +++ b/extensions/sqlite/driver/SqResults.cpp Tue Dec 23 01:33:37 2008 -0500
32.3 @@ -343,7 +343,7 @@
32.4 return (field->type == SQLITE_NULL);
32.5 }
32.6
32.7 -unsigned int SqResults::GetDataSize(unsigned int columnId)
32.8 +size_t SqResults::GetDataSize(unsigned int columnId)
32.9 {
32.10 SqField *field = GetField(columnId);
32.11 if (!field)
33.1 --- a/extensions/sqlite/sdk/sm_memtable.cpp Mon Dec 15 18:47:11 2008 +1300
33.2 +++ b/extensions/sqlite/sdk/sm_memtable.cpp Tue Dec 23 01:33:37 2008 -0500
33.3 @@ -30,7 +30,7 @@
33.4 */
33.5
33.6 #include <string.h>
33.7 -#include <malloc.h>
33.8 +#include <stdlib.h>
33.9 #include "sm_memtable.h"
33.10
33.11 BaseMemTable::BaseMemTable(unsigned int init_size)
34.1 --- a/extensions/sqlite/sdk/smsdk_ext.cpp Mon Dec 15 18:47:11 2008 +1300
34.2 +++ b/extensions/sqlite/sdk/smsdk_ext.cpp Tue Dec 23 01:33:37 2008 -0500
34.3 @@ -28,8 +28,9 @@
34.4 *
34.5 * Version: $Id$
34.6 */
34.7 +
34.8 #include <stdio.h>
34.9 -#include <malloc.h>
34.10 +#include <stdlib.h>
34.11 #include "smsdk_ext.h"
34.12
34.13 /**
34.14 @@ -78,6 +79,24 @@
34.15 #if defined SMEXT_ENABLE_LIBSYS
34.16 ILibrarySys *libsys = NULL;
34.17 #endif
34.18 +#if defined SMEXT_ENABLE_PLUGINSYS
34.19 +SourceMod::IPluginManager *plsys;
34.20 +#endif
34.21 +#if defined SMEXT_ENABLE_MENUS
34.22 +IMenuManager *menus = NULL;
34.23 +#endif
34.24 +#if defined SMEXT_ENABLE_ADMINSYS
34.25 +IAdminSystem *adminsys = NULL;
34.26 +#endif
34.27 +#if defined SMEXT_ENABLE_TEXTPARSERS
34.28 +ITextParsers *textparsers = NULL;
34.29 +#endif
34.30 +#if defined SMEXT_ENABLE_USERMSGS
34.31 +IUserMessages *usermsgs = NULL;
34.32 +#endif
34.33 +#if defined SMEXT_ENABLE_TRANSLATOR
34.34 +ITranslator *translator = NULL;
34.35 +#endif
34.36
34.37 /** Exports the main interface */
34.38 PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
34.39 @@ -148,6 +167,24 @@
34.40 #if defined SMEXT_ENABLE_LIBSYS
34.41 SM_GET_IFACE(LIBRARYSYS, libsys);
34.42 #endif
34.43 +#if defined SMEXT_ENABLE_PLUGINSYS
34.44 + SM_GET_IFACE(PLUGINSYSTEM, plsys);
34.45 +#endif
34.46 +#if defined SMEXT_ENABLE_MENUS
34.47 + SM_GET_IFACE(MENUMANAGER, menus);
34.48 +#endif
34.49 +#if defined SMEXT_ENABLE_ADMINSYS
34.50 + SM_GET_IFACE(ADMINSYS, adminsys);
34.51 +#endif
34.52 +#if defined SMEXT_ENABLE_TEXTPARSERS
34.53 + SM_GET_IFACE(TEXTPARSERS, textparsers);
34.54 +#endif
34.55 +#if defined SMEXT_ENABLE_USERMSGS
34.56 + SM_GET_IFACE(USERMSGS, usermsgs);
34.57 +#endif
34.58 +#if defined SMEXT_ENABLE_TRANSLATOR
34.59 + SM_GET_IFACE(TRANSLATOR, translator);
34.60 +#endif
34.61
34.62 if (SDK_OnLoad(error, maxlength, late))
34.63 {
34.64 @@ -255,7 +292,11 @@
34.65 /** Exposes the extension to Metamod */
34.66 SMM_API void *PL_EXPOSURE(const char *name, int *code)
34.67 {
34.68 +#if defined METAMOD_PLAPI_VERSION
34.69 + if (name && !strcmp(name, METAMOD_PLAPI_NAME))
34.70 +#else
34.71 if (name && !strcmp(name, PLAPI_NAME))
34.72 +#endif
34.73 {
34.74 if (code)
34.75 {
34.76 @@ -276,8 +317,13 @@
34.77 {
34.78 PLUGIN_SAVEVARS();
34.79
34.80 +#if !defined METAMOD_PLAPI_VERSION
34.81 GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
34.82 GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
34.83 +#else
34.84 + GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
34.85 + GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
34.86 +#endif
34.87
34.88 m_SourceMMLoaded = true;
34.89
34.90 @@ -388,7 +434,7 @@
34.91 #endif
34.92
34.93 /* Overload a few things to prevent libstdc++ linking */
34.94 -#if defined __linux__
34.95 +#if defined __linux__ || defined __APPLE__
34.96 extern "C" void __cxa_pure_virtual(void)
34.97 {
34.98 }
34.99 @@ -413,3 +459,4 @@
34.100 free(ptr);
34.101 }
34.102 #endif
34.103 +
35.1 --- a/extensions/tf2/CDetour/detourhelpers.h Mon Dec 15 18:47:11 2008 +1300
35.2 +++ b/extensions/tf2/CDetour/detourhelpers.h Tue Dec 23 01:33:37 2008 -0500
35.3 @@ -32,7 +32,7 @@
35.4 #ifndef _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
35.5 #define _INCLUDE_SOURCEMOD_DETOURHELPERS_H_
35.6
35.7 -#if defined PLATFORM_LINUX
35.8 +#if defined PLATFORM_POSIX
35.9 #include <sys/mman.h>
35.10 #define PAGE_SIZE 4096
35.11 #define ALIGN(ar) ((long)ar & ~(PAGE_SIZE-1))
35.12 @@ -52,7 +52,7 @@
35.13
35.14 inline void ProtectMemory(void *addr, int length, int prot)
35.15 {
35.16 -#if defined PLATFORM_LINUX
35.17 +#if defined PLATFORM_POSIX
35.18 void *addr2 = (void *)ALIGN(addr);
35.19 mprotect(addr2, sysconf(_SC_PAGESIZE), prot);
35.20 #elif defined PLATFORM_WINDOWS
36.1 --- a/extensions/tf2/Makefile Mon Dec 15 18:47:11 2008 +1300
36.2 +++ b/extensions/tf2/Makefile Tue Dec 23 01:33:37 2008 -0500
36.3 @@ -27,7 +27,7 @@
36.4 C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
36.5 C_GCC4_FLAGS = -fvisibility=hidden
36.6 CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
36.7 -CPP = gcc-4.1
36.8 +CPP = gcc
36.9
36.10 override ENGSET = false
36.11 ifeq "$(ENGINE)" "original"
36.12 @@ -62,7 +62,7 @@
36.13 INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
36.14 endif
36.15
36.16 -LINK += -static-libgcc
36.17 +LINK += -m32 -ldl -lm
36.18
36.19 CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
36.20 -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \
36.21 @@ -85,14 +85,21 @@
36.22 BIN_DIR := $(BIN_DIR).$(ENGINE)
36.23 endif
36.24
36.25 +OS := $(shell uname -s)
36.26 +ifeq "$(OS)" "Darwin"
36.27 + LINK += -dynamiclib
36.28 + BINARY = $(PROJECT).ext.dylib
36.29 +else
36.30 + LINK += -static-libgcc -shared
36.31 + BINARY = $(PROJECT).ext.so
36.32 +endif
36.33 +
36.34 GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
36.35 ifeq "$(GCC_VERSION)" "4"
36.36 CFLAGS += $(C_GCC4_FLAGS)
36.37 CPPFLAGS += $(CPP_GCC4_FLAGS)
36.38 endif
36.39
36.40 -BINARY = $(PROJECT).ext.so
36.41 -
36.42 OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
36.43
36.44 $(BIN_DIR)/%.o: %.cpp
36.45 @@ -114,7 +121,7 @@
36.46 fi
36.47
36.48 extension: check $(OBJ_LINUX)
36.49 - $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
36.50 + $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
36.51
36.52 debug:
36.53 $(MAKE) -f Makefile all DEBUG=true
37.1 --- a/extensions/tf2/sdk/smsdk_ext.cpp Mon Dec 15 18:47:11 2008 +1300
37.2 +++ b/extensions/tf2/sdk/smsdk_ext.cpp Tue Dec 23 01:33:37 2008 -0500
37.3 @@ -30,7 +30,7 @@
37.4 */
37.5
37.6 #include <stdio.h>
37.7 -#include <malloc.h>
37.8 +#include <stdlib.h>
37.9 #include "smsdk_ext.h"
37.10
37.11 /**
37.12 @@ -79,9 +79,24 @@
37.13 #if defined SMEXT_ENABLE_LIBSYS
37.14 ILibrarySys *libsys = NULL;
37.15 #endif
37.16 +#if defined SMEXT_ENABLE_PLUGINSYS
37.17 +SourceMod::IPluginManager *plsys;
37.18 +#endif
37.19 +#if defined SMEXT_ENABLE_MENUS
37.20 +IMenuManager *menus = NULL;
37.21 +#endif
37.22 +#if defined SMEXT_ENABLE_ADMINSYS
37.23 +IAdminSystem *adminsys = NULL;
37.24 +#endif
37.25 +#if defined SMEXT_ENABLE_TEXTPARSERS
37.26 +ITextParsers *textparsers = NULL;
37.27 +#endif
37.28 #if defined SMEXT_ENABLE_USERMSGS
37.29 IUserMessages *usermsgs = NULL;
37.30 #endif
37.31 +#if defined SMEXT_ENABLE_TRANSLATOR
37.32 +ITranslator *translator = NULL;
37.33 +#endif
37.34
37.35 /** Exports the main interface */
37.36 PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
37.37 @@ -152,9 +167,24 @@
37.38 #if defined SMEXT_ENABLE_LIBSYS
37.39 SM_GET_IFACE(LIBRARYSYS, libsys);
37.40 #endif
37.41 +#if defined SMEXT_ENABLE_PLUGINSYS
37.42 + SM_GET_IFACE(PLUGINSYSTEM, plsys);
37.43 +#endif
37.44 +#if defined SMEXT_ENABLE_MENUS
37.45 + SM_GET_IFACE(MENUMANAGER, menus);
37.46 +#endif
37.47 +#if defined SMEXT_ENABLE_ADMINSYS
37.48 + SM_GET_IFACE(ADMINSYS, adminsys);
37.49 +#endif
37.50 +#if defined SMEXT_ENABLE_TEXTPARSERS
37.51 + SM_GET_IFACE(TEXTPARSERS, textparsers);
37.52 +#endif
37.53 #if defined SMEXT_ENABLE_USERMSGS
37.54 SM_GET_IFACE(USERMSGS, usermsgs);
37.55 #endif
37.56 +#if defined SMEXT_ENABLE_TRANSLATOR
37.57 + SM_GET_IFACE(TRANSLATOR, translator);
37.58 +#endif
37.59
37.60 if (SDK_OnLoad(error, maxlength, late))
37.61 {
37.62 @@ -262,7 +292,11 @@
37.63 /** Exposes the extension to Metamod */
37.64 SMM_API void *PL_EXPOSURE(const char *name, int *code)
37.65 {
37.66 +#if defined METAMOD_PLAPI_VERSION
37.67 if (name && !strcmp(name, METAMOD_PLAPI_NAME))
37.68 +#else
37.69 + if (name && !strcmp(name, PLAPI_NAME))
37.70 +#endif
37.71 {
37.72 if (code)
37.73 {
37.74 @@ -283,8 +317,13 @@
37.75 {
37.76 PLUGIN_SAVEVARS();
37.77
37.78 +#if !defined METAMOD_PLAPI_VERSION
37.79 + GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
37.80 + GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
37.81 +#else
37.82 GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
37.83 GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
37.84 +#endif
37.85
37.86 m_SourceMMLoaded = true;
37.87
37.88 @@ -395,7 +434,7 @@
37.89 #endif
37.90
37.91 /* Overload a few things to prevent libstdc++ linking */
37.92 -#if defined __linux__
37.93 +#if defined __linux__ || defined __APPLE__
37.94 extern "C" void __cxa_pure_virtual(void)
37.95 {
37.96 }
37.97 @@ -420,3 +459,4 @@
37.98 free(ptr);
37.99 }
37.100 #endif
37.101 +
38.1 --- a/extensions/topmenus/Makefile Mon Dec 15 18:47:11 2008 +1300
38.2 +++ b/extensions/topmenus/Makefile Tue Dec 23 01:33:37 2008 -0500
38.3 @@ -27,7 +27,7 @@
38.4 C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
38.5 C_GCC4_FLAGS = -fvisibility=hidden
38.6 CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
38.7 -CPP = gcc-4.1
38.8 +CPP = gcc
38.9
38.10 override ENGSET = false
38.11 ifeq "$(ENGINE)" "original"
38.12 @@ -62,7 +62,7 @@
38.13 -I$(MMSOURCE17)/core/sourcehook
38.14 endif
38.15
38.16 -LINK += -static-libgcc
38.17 +LINK += -m32 -ldl -lm
38.18
38.19 CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
38.20 -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \
38.21 @@ -85,14 +85,21 @@
38.22 BIN_DIR := $(BIN_DIR).$(ENGINE)
38.23 endif
38.24
38.25 +OS := $(shell uname -s)
38.26 +ifeq "$(OS)" "Darwin"
38.27 + LINK += -dynamiclib
38.28 + BINARY = $(PROJECT).ext.dylib
38.29 +else
38.30 + LINK += -static-libgcc -shared
38.31 + BINARY = $(PROJECT).ext.so
38.32 +endif
38.33 +
38.34 GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
38.35 ifeq "$(GCC_VERSION)" "4"
38.36 CFLAGS += $(C_GCC4_FLAGS)
38.37 CPPFLAGS += $(CPP_GCC4_FLAGS)
38.38 endif
38.39
38.40 -BINARY = $(PROJECT).ext.so
38.41 -
38.42 OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
38.43
38.44 $(BIN_DIR)/%.o: %.cpp
38.45 @@ -113,7 +120,7 @@
38.46 fi
38.47
38.48 extension: check $(OBJ_LINUX)
38.49 - $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
38.50 + $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
38.51
38.52 debug:
38.53 $(MAKE) -f Makefile all DEBUG=true
39.1 --- a/extensions/topmenus/sdk/sm_memtable.cpp Mon Dec 15 18:47:11 2008 +1300
39.2 +++ b/extensions/topmenus/sdk/sm_memtable.cpp Tue Dec 23 01:33:37 2008 -0500
39.3 @@ -30,7 +30,7 @@
39.4 */
39.5
39.6 #include <string.h>
39.7 -#include <malloc.h>
39.8 +#include <stdlib.h>
39.9 #include "sm_memtable.h"
39.10
39.11 BaseMemTable::BaseMemTable(unsigned int init_size)
40.1 --- a/extensions/topmenus/sdk/smsdk_ext.cpp Mon Dec 15 18:47:11 2008 +1300
40.2 +++ b/extensions/topmenus/sdk/smsdk_ext.cpp Tue Dec 23 01:33:37 2008 -0500
40.3 @@ -30,7 +30,7 @@
40.4 */
40.5
40.6 #include <stdio.h>
40.7 -#include <malloc.h>
40.8 +#include <stdlib.h>
40.9 #include "smsdk_ext.h"
40.10
40.11 /**
40.12 @@ -91,6 +91,12 @@
40.13 #if defined SMEXT_ENABLE_TEXTPARSERS
40.14 ITextParsers *textparsers = NULL;
40.15 #endif
40.16 +#if defined SMEXT_ENABLE_USERMSGS
40.17 +IUserMessages *usermsgs = NULL;
40.18 +#endif
40.19 +#if defined SMEXT_ENABLE_TRANSLATOR
40.20 +ITranslator *translator = NULL;
40.21 +#endif
40.22
40.23 /** Exports the main interface */
40.24 PLATFORM_EXTERN_C IExtensionInterface *GetSMExtAPI()
40.25 @@ -173,6 +179,12 @@
40.26 #if defined SMEXT_ENABLE_TEXTPARSERS
40.27 SM_GET_IFACE(TEXTPARSERS, textparsers);
40.28 #endif
40.29 +#if defined SMEXT_ENABLE_USERMSGS
40.30 + SM_GET_IFACE(USERMSGS, usermsgs);
40.31 +#endif
40.32 +#if defined SMEXT_ENABLE_TRANSLATOR
40.33 + SM_GET_IFACE(TRANSLATOR, translator);
40.34 +#endif
40.35
40.36 if (SDK_OnLoad(error, maxlength, late))
40.37 {
40.38 @@ -280,7 +292,11 @@
40.39 /** Exposes the extension to Metamod */
40.40 SMM_API void *PL_EXPOSURE(const char *name, int *code)
40.41 {
40.42 +#if defined METAMOD_PLAPI_VERSION
40.43 + if (name && !strcmp(name, METAMOD_PLAPI_NAME))
40.44 +#else
40.45 if (name && !strcmp(name, PLAPI_NAME))
40.46 +#endif
40.47 {
40.48 if (code)
40.49 {
40.50 @@ -301,8 +317,13 @@
40.51 {
40.52 PLUGIN_SAVEVARS();
40.53
40.54 +#if !defined METAMOD_PLAPI_VERSION
40.55 GET_V_IFACE_ANY(serverFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
40.56 GET_V_IFACE_CURRENT(engineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
40.57 +#else
40.58 + GET_V_IFACE_ANY(GetServerFactory, gamedll, IServerGameDLL, INTERFACEVERSION_SERVERGAMEDLL);
40.59 + GET_V_IFACE_CURRENT(GetEngineFactory, engine, IVEngineServer, INTERFACEVERSION_VENGINESERVER);
40.60 +#endif
40.61
40.62 m_SourceMMLoaded = true;
40.63
40.64 @@ -413,7 +434,7 @@
40.65 #endif
40.66
40.67 /* Overload a few things to prevent libstdc++ linking */
40.68 -#if defined __linux__
40.69 +#if defined __linux__ || defined __APPLE__
40.70 extern "C" void __cxa_pure_virtual(void)
40.71 {
40.72 }
40.73 @@ -438,3 +459,4 @@
40.74 free(ptr);
40.75 }
40.76 #endif
40.77 +
41.1 --- a/knight/shared/KePlatform.h Mon Dec 15 18:47:11 2008 +1300
41.2 +++ b/knight/shared/KePlatform.h Tue Dec 23 01:33:37 2008 -0500
41.3 @@ -18,6 +18,8 @@
41.4
41.5 #if defined linux
41.6 #define KE_PLATFORM_LINUX
41.7 +#elif defined __APPLE__
41.8 +#define KE_PLATFORM_APPLE
41.9 #else
41.10 #error "TODO"
41.11 #endif
42.1 --- a/loader/Makefile Mon Dec 15 18:47:11 2008 +1300
42.2 +++ b/loader/Makefile Tue Dec 23 01:33:37 2008 -0500
42.3 @@ -19,9 +19,9 @@
42.4 C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
42.5 C_GCC4_FLAGS = -fvisibility=hidden
42.6 CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
42.7 -CPP = gcc-4.1
42.8 +CPP = gcc
42.9
42.10 -LINK = -static-libgcc
42.11 +LINK = -m32 -ldl -lm
42.12
42.13 INCLUDE = -I$(MMSOURCE17)/core -I$(MMSOURCE17)/core/sourcehook
42.14
42.15 @@ -42,14 +42,21 @@
42.16 CFLAGS += $(C_OPT_FLAGS)
42.17 endif
42.18
42.19 +OS := $(shell uname -s)
42.20 +ifeq "$(OS)" "Darwin"
42.21 + LINK += -dynamiclib
42.22 + BINARY = $(PROJECT).dylib
42.23 +else
42.24 + LINK += -static-libgcc -shared
42.25 + BINARY = $(PROJECT)_i486.so
42.26 +endif
42.27 +
42.28 GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
42.29 ifeq "$(GCC_VERSION)" "4"
42.30 CFLAGS += $(C_GCC4_FLAGS)
42.31 CPPFLAGS += $(CPP_GCC4_FLAGS)
42.32 endif
42.33
42.34 -BINARY = $(PROJECT)_i486.so
42.35 -
42.36 OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
42.37
42.38 $(BIN_DIR)/%.o: %.cpp
42.39 @@ -60,7 +67,7 @@
42.40 $(MAKE) -f Makefile loader
42.41
42.42 loader: $(OBJ_LINUX)
42.43 - $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
42.44 + $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
42.45
42.46 debug:
42.47 $(MAKE) -f Makefile all DEBUG=true
43.1 --- a/loader/loader.cpp Mon Dec 15 18:47:11 2008 +1300
43.2 +++ b/loader/loader.cpp Tue Dec 23 01:33:37 2008 -0500
43.3 @@ -33,7 +33,7 @@
43.4 #include <stdarg.h>
43.5 #include <string.h>
43.6 #include <stdio.h>
43.7 -#include <malloc.h>
43.8 +#include <stdlib.h>
43.9
43.10 #if defined _MSC_VER
43.11 #define DLL_EXPORT extern "C" __declspec(dllexport)
43.12 @@ -119,7 +119,7 @@
43.13
43.14 if (!(g_hCore=openlib(path)))
43.15 {
43.16 -#if defined __linux__
43.17 +#if defined __linux__ || defined __APPLE__
43.18 UTIL_Format(s_FailPlugin.error_buffer,
43.19 sizeof(s_FailPlugin.error_buffer),
43.20 "%s",
43.21 @@ -289,7 +289,7 @@
43.22 #endif
43.23
43.24 /* Overload a few things to prevent libstdc++ linking */
43.25 -#if defined __linux__
43.26 +#if defined __linux__ || defined __APPLE__
43.27 extern "C" void __cxa_pure_virtual(void)
43.28 {
43.29 }
44.1 --- a/public/mms_sample_ext/Makefile Mon Dec 15 18:47:11 2008 +1300
44.2 +++ b/public/mms_sample_ext/Makefile Tue Dec 23 01:33:37 2008 -0500
44.3 @@ -23,7 +23,7 @@
44.4 C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
44.5 C_GCC4_FLAGS = -fvisibility=hidden
44.6 CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
44.7 -CPP = gcc-4.1
44.8 +CPP = gcc
44.9
44.10 override ENGSET = false
44.11 ifeq "$(ENGINE)" "original"
44.12 @@ -46,7 +46,7 @@
44.13 override ENGSET = true
44.14 endif
44.15
44.16 -LINK = vstdlib_i486.so tier0_i486.so -static-libgcc
44.17 +LINK = vstdlib_i486.so tier0_i486.so -m32 -ldl -lm
44.18
44.19 INCLUDE += -I. -I.. -I$(HL2PUB) -I$(HL2PUB)/engine -I$(HL2PUB)/tier0 -I$(HL2PUB)/tier1 \
44.20 -I$(METAMOD) -I$(METAMOD)/sourcehook -I$(SMSDK) -I$(SMSDK)/jit -I$(SMSDK)/jit/x86 \
44.21 @@ -69,14 +69,21 @@
44.22 CFLAGS += $(C_OPT_FLAGS)
44.23 endif
44.24
44.25 +OS := $(shell uname -s)
44.26 +ifeq "$(OS)" "Darwin"
44.27 + LINK += -dynamiclib
44.28 + BINARY = $(PROJECT).dylib
44.29 +else
44.30 + LINK += -static-libgcc -shared
44.31 + BINARY = $(PROJECT)_i486.so
44.32 +endif
44.33 +
44.34 GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
44.35 ifeq "$(GCC_VERSION)" "4"
44.36 CFLAGS += $(C_GCC4_FLAGS)
44.37 CPPFLAGS += $(CPP_GCC4_FLAGS)
44.38 endif
44.39
44.40 -BINARY = $(PROJECT)_i486.so
44.41 -
44.42 OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
44.43
44.44 $(BIN_DIR)/%.o: %.cpp
44.45 @@ -95,7 +102,7 @@
44.46 fi
44.47
44.48 mms_ext: check $(OBJ_LINUX)
44.49 - $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
44.50 + $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
44.51
44.52 debug:
44.53 $(MAKE) -f Makefile all DEBUG=true
45.1 --- a/public/sample_ext/Makefile Mon Dec 15 18:47:11 2008 +1300
45.2 +++ b/public/sample_ext/Makefile Tue Dec 23 01:33:37 2008 -0500
45.3 @@ -26,7 +26,7 @@
45.4 C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
45.5 C_GCC4_FLAGS = -fvisibility=hidden
45.6 CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
45.7 -CPP = gcc-4.1
45.8 +CPP = gcc
45.9
45.10 override ENGSET = false
45.11 ifeq "$(ENGINE)" "original"
45.12 @@ -60,7 +60,7 @@
45.13 INCLUDE += -I. -I.. -Isdk -I$(SMSDK)/public -I$(SMSDK)/public/sourcepawn
45.14 endif
45.15
45.16 -LINK += -static-libgcc
45.17 +LINK += -m32 -lm -ldl
45.18
45.19 CFLAGS += -D_LINUX -Dstricmp=strcasecmp -D_stricmp=strcasecmp -D_strnicmp=strncasecmp -Dstrnicmp=strncasecmp \
45.20 -D_snprintf=snprintf -D_vsnprintf=vsnprintf -D_alloca=alloca -Dstrcmpi=strcasecmp -Wall -Werror -Wno-switch \
45.21 @@ -83,14 +83,21 @@
45.22 BIN_DIR := $(BIN_DIR).$(ENGINE)
45.23 endif
45.24
45.25 +OS := $(shell uname -s)
45.26 +ifeq "$(OS)" "Darwin"
45.27 + LINK += -dynamiclib
45.28 + BINARY = $(PROJECT).ext.dylib
45.29 +else
45.30 + LINK += -static-libgcc -shared
45.31 + BINARY = $(PROJECT).ext.so
45.32 +endif
45.33 +
45.34 GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
45.35 ifeq "$(GCC_VERSION)" "4"
45.36 CFLAGS += $(C_GCC4_FLAGS)
45.37 CPPFLAGS += $(CPP_GCC4_FLAGS)
45.38 endif
45.39
45.40 -BINARY = $(PROJECT).ext.so
45.41 -
45.42 OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
45.43
45.44 $(BIN_DIR)/%.o: %.cpp
45.45 @@ -111,7 +118,7 @@
45.46 fi
45.47
45.48 extension: check $(OBJ_LINUX)
45.49 - $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
45.50 + $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
45.51
45.52 debug:
45.53 $(MAKE) -f Makefile all DEBUG=true
46.1 --- a/public/sample_ext/sdk/smsdk_ext.cpp Mon Dec 15 18:47:11 2008 +1300
46.2 +++ b/public/sample_ext/sdk/smsdk_ext.cpp Tue Dec 23 01:33:37 2008 -0500
46.3 @@ -30,7 +30,7 @@
46.4 */
46.5
46.6 #include <stdio.h>
46.7 -#include <malloc.h>
46.8 +#include <stdlib.h>
46.9 #include "smsdk_ext.h"
46.10
46.11 /**
46.12 @@ -434,7 +434,7 @@
46.13 #endif
46.14
46.15 /* Overload a few things to prevent libstdc++ linking */
46.16 -#if defined __linux__
46.17 +#if defined __linux__ || defined __APPLE__
46.18 extern "C" void __cxa_pure_virtual(void)
46.19 {
46.20 }
46.21 @@ -459,3 +459,4 @@
46.22 free(ptr);
46.23 }
46.24 #endif
46.25 +
47.1 --- a/public/sm_platform.h Mon Dec 15 18:47:11 2008 +1300
47.2 +++ b/public/sm_platform.h Tue Dec 23 01:33:37 2008 -0500
47.3 @@ -60,14 +60,21 @@
47.4 #if defined _MSC_VER && _MSC_VER >= 1400
47.5 #define SUBPLATFORM_SECURECRT
47.6 #endif
47.7 -#elif defined __linux__
47.8 -#define PLATFORM_LINUX
47.9 +#elif defined __linux__ || defined __APPLE__
47.10 +#if defined __linux__
47.11 +# define PLATFORM_LINUX
47.12 +#elif defined __APPLE__
47.13 +# define PLATFORM_APPLE
47.14 +#endif
47.15 #define PLATFORM_POSIX
47.16 #include <errno.h>
47.17 #include <unistd.h>
47.18 #include <dirent.h>
47.19 #include <dlfcn.h>
47.20 #include <sys/stat.h>
47.21 +#if defined PLATFORM_APPLE
47.22 +#include <sys/syslimits.h>
47.23 +#endif
47.24 #define PLATFORM_MAX_PATH PATH_MAX
47.25 #define PLATFORM_LIB_EXT "so"
47.26 #define PLATFORM_SEP_CHAR '/'
47.27 @@ -80,3 +87,4 @@
47.28 #endif
47.29
47.30 #endif //_INCLUDE_SOURCEMOD_PLATFORM_H_
47.31 +
48.1 --- a/public/sm_trie_tpl.h Mon Dec 15 18:47:11 2008 +1300
48.2 +++ b/public/sm_trie_tpl.h Tue Dec 23 01:33:37 2008 -0500
48.3 @@ -34,7 +34,7 @@
48.4
48.5 #include <new>
48.6 #include <string.h>
48.7 -#include <malloc.h>
48.8 +#include <stdlib.h>
48.9 #include <assert.h>
48.10
48.11 enum NodeType
49.1 --- a/public/sourcepawn/sp_file_headers.h Mon Dec 15 18:47:11 2008 +1300
49.2 +++ b/public/sourcepawn/sp_file_headers.h Tue Dec 23 01:33:37 2008 -0500
49.3 @@ -60,7 +60,7 @@
49.4 #define SPFILE_VERSION 0x0102 /**< File format version */
49.5
49.6 //:TODO: better compiler/nix support
49.7 -#if defined __linux__
49.8 +#if defined __GNUC__
49.9 #pragma pack(1) /* structures must be packed (byte-aligned) */
49.10 #else
49.11 #pragma pack(push)
50.1 --- a/sourcepawn/compiler/Makefile Mon Dec 15 18:47:11 2008 +1300
50.2 +++ b/sourcepawn/compiler/Makefile Tue Dec 23 01:33:37 2008 -0500
50.3 @@ -24,7 +24,7 @@
50.4 C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
50.5 C_GCC4_FLAGS = -fvisibility=hidden
50.6 CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
50.7 -CPP = gcc-4.1
50.8 +CPP = gcc
50.9
50.10 LINK = -lgcc -static-libgcc
50.11
50.12 @@ -61,7 +61,7 @@
50.13 $(MAKE) -f Makefile compiler
50.14
50.15 compiler: $(OBJ_LINUX)
50.16 - $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -ldl -lm -o$(BIN_DIR)/$(BINARY)
50.17 + $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -ldl -lm -o $(BIN_DIR)/$(BINARY)
50.18
50.19 debug:
50.20 $(MAKE) -f Makefile all DEBUG=true
51.1 --- a/sourcepawn/compiler/libpawnc.c Mon Dec 15 18:47:11 2008 +1300
51.2 +++ b/sourcepawn/compiler/libpawnc.c Tue Dec 23 01:33:37 2008 -0500
51.3 @@ -26,7 +26,6 @@
51.4 #include <stdio.h>
51.5 #include <stdlib.h>
51.6 #include <string.h>
51.7 -#include <malloc.h>
51.8 #include "sc.h"
51.9 #include "memfile.h"
51.10
52.1 --- a/sourcepawn/compiler/memfile.h Mon Dec 15 18:47:11 2008 +1300
52.2 +++ b/sourcepawn/compiler/memfile.h Tue Dec 23 01:33:37 2008 -0500
52.3 @@ -1,7 +1,7 @@
52.4 #ifndef _INCLUDE_MEMFILE_H
52.5 #define _INCLUDE_MEMFILE_H
52.6
52.7 -#include <malloc.h>
52.8 +#include <stdlib.h>
52.9
52.10 typedef struct memfile_s
52.11 {
53.1 --- a/sourcepawn/compiler/osdefs.h Mon Dec 15 18:47:11 2008 +1300
53.2 +++ b/sourcepawn/compiler/osdefs.h Tue Dec 23 01:33:37 2008 -0500
53.3 @@ -48,6 +48,8 @@
53.4
53.5 #if defined __FreeBSD__
53.6 #include <sys/endian.h>
53.7 +#elif defined __APPLE__
53.8 + #include <machine/endian.h>
53.9 #elif defined LINUX
53.10 #include <endian.h>
53.11 #endif
54.1 --- a/sourcepawn/compiler/sclinux.h Mon Dec 15 18:47:11 2008 +1300
54.2 +++ b/sourcepawn/compiler/sclinux.h Tue Dec 23 01:33:37 2008 -0500
54.3 @@ -34,7 +34,7 @@
54.4 # include <stdlib.h>
54.5 #endif
54.6
54.7 -#if defined __OpenBSD__ || defined __FreeBSD__
54.8 +#if defined __OpenBSD__ || defined __FreeBSD__ || defined __APPLE__
54.9 # define __BYTE_ORDER BYTE_ORDER
54.10 # define __LITTLE_ENDIAN LITTLE_ENDIAN
54.11 # define __BIG_ENDIAN BIG_ENDIAN
55.1 --- a/sourcepawn/compiler/sctracker.c Mon Dec 15 18:47:11 2008 +1300
55.2 +++ b/sourcepawn/compiler/sctracker.c Tue Dec 23 01:33:37 2008 -0500
55.3 @@ -1,4 +1,4 @@
55.4 -#include <malloc.h>
55.5 +#include <stdlib.h>
55.6 #include <string.h>
55.7 #include <assert.h>
55.8 #include "sc.h"
56.1 --- a/sourcepawn/compiler/sp_file.c Mon Dec 15 18:47:11 2008 +1300
56.2 +++ b/sourcepawn/compiler/sp_file.c Tue Dec 23 01:33:37 2008 -0500
56.3 @@ -1,6 +1,6 @@
56.4 #include <stdio.h>
56.5 #include <string.h>
56.6 -#include <malloc.h>
56.7 +#include <stdlib.h>
56.8 #include "sp_file.h"
56.9 #include "memfile.h"
56.10
57.1 --- a/sourcepawn/jit/Makefile Mon Dec 15 18:47:11 2008 +1300
57.2 +++ b/sourcepawn/jit/Makefile Tue Dec 23 01:33:37 2008 -0500
57.3 @@ -42,9 +42,9 @@
57.4 C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
57.5 C_GCC4_FLAGS = -fvisibility=hidden
57.6 CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
57.7 -CPP = gcc-4.1
57.8 +CPP = gcc
57.9
57.10 -LINK = -static-libgcc
57.11 +LINK = -m32 -ldl -lm
57.12
57.13 INCLUDE = -I. -I.. -I$(SMSDK)/public -I$(SMSDK)/public/jit -I$(SMSDK)/public/jit/x86 \
57.14 -I$(SMSDK)/public/sourcepawn -I$(MMSOURCE17)/core/sourcehook -I$(SMSDK)/knight/shared -Ix86
57.15 @@ -66,14 +66,21 @@
57.16 CFLAGS += $(C_OPT_FLAGS)
57.17 endif
57.18
57.19 +OS := $(shell uname -s)
57.20 +ifeq "$(OS)" "Darwin"
57.21 + LINK += -dynamiclib
57.22 + BINARY = $(PROJECT).dylib
57.23 +else
57.24 + LINK += -static-libgcc-shared
57.25 + BINARY = $(PROJECT).so
57.26 +endif
57.27 +
57.28 GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
57.29 ifeq "$(GCC_VERSION)" "4"
57.30 CFLAGS += $(C_GCC4_FLAGS)
57.31 CPPFLAGS += $(CPP_GCC4_FLAGS)
57.32 endif
57.33
57.34 -BINARY = $(PROJECT).so
57.35 -
57.36 OBJ_LINUX := $(OBJECTS:../../knight/shared/%.cpp=$(BIN_DIR)/knight/%.o)
57.37 OBJ_LINUX := $(OBJ_LINUX:%.cpp=$(BIN_DIR)/%.o)
57.38 OBJ_LINUX := $(OBJ_LINUX:%.c=$(BIN_DIR)/%.o)
57.39 @@ -96,7 +103,7 @@
57.40 $(MAKE) -f Makefile jit
57.41
57.42 jit: $(OBJ_LINUX)
57.43 - $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
57.44 + $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
57.45
57.46 debug:
57.47 $(MAKE) -f Makefile all DEBUG=true
58.1 --- a/sourcepawn/jit/dll_exports.cpp Mon Dec 15 18:47:11 2008 +1300
58.2 +++ b/sourcepawn/jit/dll_exports.cpp Tue Dec 23 01:33:37 2008 -0500
58.3 @@ -30,7 +30,7 @@
58.4 */
58.5
58.6 #include <sp_vm_api.h>
58.7 -#include <malloc.h>
58.8 +#include <stdlib.h>
58.9 #include "x86/jit_x86.h"
58.10 #include "dll_exports.h"
58.11 #include "sp_vm_engine.h"
58.12 @@ -48,7 +48,7 @@
58.13 return &g_engine2;
58.14 }
58.15
58.16 -#if defined __linux__
58.17 +#if defined __linux__ || defined __APPLE__
58.18 extern "C" void __cxa_pure_virtual(void)
58.19 {
58.20 }
59.1 --- a/sourcepawn/jit/sp_vm_engine.cpp Mon Dec 15 18:47:11 2008 +1300
59.2 +++ b/sourcepawn/jit/sp_vm_engine.cpp Tue Dec 23 01:33:37 2008 -0500
59.3 @@ -29,7 +29,7 @@
59.4 * Version: $Id$
59.5 */
59.6
59.7 -#include <malloc.h>
59.8 +#include <stdlib.h>
59.9 #include <string.h>
59.10 #include <assert.h>
59.11 #include "sp_vm_types.h"
59.12 @@ -111,7 +111,11 @@
59.13 #if defined WIN32
59.14 return VirtualAlloc(NULL, size, MEM_COMMIT, PAGE_EXECUTE_READWRITE);
59.15 #elif defined __GNUC__
59.16 +# if defined __APPLE__
59.17 + void *base = valloc(size);
59.18 +# else
59.19 void *base = memalign(sysconf(_SC_PAGESIZE), size);
59.20 +# endif
59.21 if (mprotect(base, size, PROT_READ|PROT_WRITE|PROT_EXEC) != 0)
59.22 {
59.23 free(base);
60.1 --- a/sourcepawn/jit/x86/opcode_helpers.cpp Mon Dec 15 18:47:11 2008 +1300
60.2 +++ b/sourcepawn/jit/x86/opcode_helpers.cpp Tue Dec 23 01:33:37 2008 -0500
60.3 @@ -31,7 +31,7 @@
60.4
60.5 #include <limits.h>
60.6 #include <string.h>
60.7 -#include <malloc.h>
60.8 +#include <stdlib.h>
60.9 #include "jit_x86.h"
60.10 #include "opcode_helpers.h"
60.11 #include "x86_macros.h"
61.1 --- a/tools/builder/LinuxBuilder.cs Mon Dec 15 18:47:11 2008 +1300
61.2 +++ b/tools/builder/LinuxBuilder.cs Tue Dec 23 01:33:37 2008 -0500
61.3 @@ -60,19 +60,18 @@
61.4 File.Delete(binpath);
61.5 }
61.6
61.7 - string makefile_args = "";
61.8 + string makefile_args = "CPP=gcc-4.1 ";
61.9
61.10 if (lib.build_mode == BuildMode.BuildMode_Episode1)
61.11 {
61.12 - makefile_args = null;
61.13 }
61.14 else if (lib.build_mode == BuildMode.BuildMode_Episode2)
61.15 {
61.16 - makefile_args = "ENGINE=\"orangebox\"";
61.17 + makefile_args += "ENGINE=\"orangebox\" ";
61.18 }
61.19 else if (lib.build_mode == BuildMode.BuildMode_OldMetamod)
61.20 {
61.21 - makefile_args = "ENGINE=\"original\"";
61.22 + makefile_args += "ENGINE=\"original\" ";
61.23 }
61.24
61.25 /* Clean the project first */
62.1 --- a/tools/crc32/build.sh Mon Dec 15 18:47:11 2008 +1300
62.2 +++ b/tools/crc32/build.sh Tue Dec 23 01:33:37 2008 -0500
62.3 @@ -1,2 +1,2 @@
62.4 -g++ -I../../core ../../core/sm_crc32.cpp main.cpp -ocrc32
62.5 +g++ -I../../core ../../core/sm_crc32.cpp main.cpp -o crc32
62.6
63.1 --- a/tools/daemon/Makefile Mon Dec 15 18:47:11 2008 +1300
63.2 +++ b/tools/daemon/Makefile Tue Dec 23 01:33:37 2008 -0500
63.3 @@ -16,7 +16,7 @@
63.4 C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
63.5 C_GCC4_FLAGS = -fvisibility=hidden
63.6 CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
63.7 -CPP = gcc-4.1
63.8 +CPP = gcc
63.9
63.10 BINARY = smupdated
63.11
63.12 @@ -65,7 +65,7 @@
63.13 $(MAKE) -f Makefile sourcemod
63.14
63.15 sourcemod: $(OBJ_LINUX)
63.16 - $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -lstdc++ -o$(BIN_DIR)/$(BINARY)
63.17 + $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -lstdc++ -o $(BIN_DIR)/$(BINARY)
63.18
63.19 debug:
63.20 $(MAKE) -f Makefile all DEBUG=true
64.1 --- a/tools/gamedata_md5/Makefile Mon Dec 15 18:47:11 2008 +1300
64.2 +++ b/tools/gamedata_md5/Makefile Tue Dec 23 01:33:37 2008 -0500
64.3 @@ -16,7 +16,7 @@
64.4 C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
64.5 C_GCC4_FLAGS = -fvisibility=hidden
64.6 CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
64.7 -CPP = gcc-4.1
64.8 +CPP = gcc
64.9
64.10 BINARY = gamedatamd5
64.11
64.12 @@ -63,7 +63,7 @@
64.13 $(MAKE) -f Makefile sourcemod
64.14
64.15 sourcemod: $(OBJ_LINUX)
64.16 - $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -lstdc++ -o$(BIN_DIR)/$(BINARY)
64.17 + $(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -lstdc++ -o $(BIN_DIR)/$(BINARY)
64.18
64.19 debug:
64.20 $(MAKE) -f Makefile all DEBUG=true
65.1 --- a/tools/gamedata_md5/sm_memtable.cpp Mon Dec 15 18:47:11 2008 +1300
65.2 +++ b/tools/gamedata_md5/sm_memtable.cpp Tue Dec 23 01:33:37 2008 -0500
65.3 @@ -30,7 +30,7 @@
65.4 */
65.5
65.6 #include <string.h>
65.7 -#include <malloc.h>
65.8 +#include <stdlib.h>
65.9 #include "sm_memtable.h"
65.10
65.11 BaseMemTable::BaseMemTable(unsigned int init_size)