SourceMod can now be somewhat compiled on OS X for patch sanity testing (bug 3516, r=ds).

This adds the ability for us to change the GCC version we use more flexibly.
This commit is contained in:
David Anderson
2008-12-23 01:33:37 -05:00
parent 58ec9a4f38
commit 1fe38c7473
65 changed files with 599 additions and 149 deletions
+12 -5
View File
@@ -19,9 +19,9 @@ C_OPT_FLAGS = -DNDEBUG -O3 -funroll-loops -pipe -fno-strict-aliasing
C_DEBUG_FLAGS = -D_DEBUG -DDEBUG -g -ggdb3
C_GCC4_FLAGS = -fvisibility=hidden
CPP_GCC4_FLAGS = -fvisibility-inlines-hidden
CPP = gcc-4.1
CPP = gcc
LINK = -static-libgcc
LINK = -m32 -ldl -lm
INCLUDE = -I$(MMSOURCE17)/core -I$(MMSOURCE17)/core/sourcehook
@@ -42,14 +42,21 @@ else
CFLAGS += $(C_OPT_FLAGS)
endif
OS := $(shell uname -s)
ifeq "$(OS)" "Darwin"
LINK += -dynamiclib
BINARY = $(PROJECT).dylib
else
LINK += -static-libgcc -shared
BINARY = $(PROJECT)_i486.so
endif
GCC_VERSION := $(shell $(CPP) -dumpversion >&1 | cut -b1)
ifeq "$(GCC_VERSION)" "4"
CFLAGS += $(C_GCC4_FLAGS)
CPPFLAGS += $(CPP_GCC4_FLAGS)
endif
BINARY = $(PROJECT)_i486.so
OBJ_LINUX := $(OBJECTS:%.cpp=$(BIN_DIR)/%.o)
$(BIN_DIR)/%.o: %.cpp
@@ -60,7 +67,7 @@ all:
$(MAKE) -f Makefile loader
loader: $(OBJ_LINUX)
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -m32 -shared -ldl -lm -o$(BIN_DIR)/$(BINARY)
$(CPP) $(INCLUDE) $(OBJ_LINUX) $(LINK) -o $(BIN_DIR)/$(BINARY)
debug:
$(MAKE) -f Makefile all DEBUG=true
+3 -3
View File
@@ -33,7 +33,7 @@
#include <stdarg.h>
#include <string.h>
#include <stdio.h>
#include <malloc.h>
#include <stdlib.h>
#if defined _MSC_VER
#define DLL_EXPORT extern "C" __declspec(dllexport)
@@ -119,7 +119,7 @@ METAMOD_PLUGIN *_GetPluginPtr(const char *path, int fail_api)
if (!(g_hCore=openlib(path)))
{
#if defined __linux__
#if defined __linux__ || defined __APPLE__
UTIL_Format(s_FailPlugin.error_buffer,
sizeof(s_FailPlugin.error_buffer),
"%s",
@@ -289,7 +289,7 @@ __attribute__((destructor)) static void gcc_fini()
#endif
/* Overload a few things to prevent libstdc++ linking */
#if defined __linux__
#if defined __linux__ || defined __APPLE__
extern "C" void __cxa_pure_virtual(void)
{
}