Merge AMBuild2 upgrade from sourcemod-1.6 to sourcemod-1.5.

This commit is contained in:
David Anderson
2014-01-22 22:40:57 -08:00
parent de8157302d
commit 1030c9b1b3
61 changed files with 3829 additions and 1669 deletions
+72 -69
View File
@@ -1,72 +1,75 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
import os
compiler = SM.DefaultCompiler()
compiler['CINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public'))
compiler['CINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'public', 'sourcepawn'))
compiler['CINCLUDES'].append(os.path.join(AMBuild.sourceFolder, 'sourcepawn', 'compiler'))
compiler['CINCLUDES'].append(os.path.join(AMBuild.outputFolder, 'includes'))
if compiler.cc.name == 'gcc' or compiler.cc.name == 'clang':
compiler['CFLAGS'].extend(['-Wno-parentheses', '-Wno-format'])
if AMBuild.target['platform'] == 'linux':
compiler['POSTLINKFLAGS'].extend(['-lgcc', '-lm'])
elif compiler.cc.name == 'msvc':
compiler['POSTLINKFLAGS'].remove('/SUBSYSTEM:WINDOWS')
compiler['POSTLINKFLAGS'].append('/SUBSYSTEM:CONSOLE')
if AMBuild.target['platform'] == 'linux':
compiler['CDEFINES'].extend(['LINUX', 'HAVE_STDINT_H', 'AMX_ANSIONLY', 'ENABLE_BINRELOC', '_GNU_SOURCE'])
elif AMBuild.target['platform'] == 'darwin':
compiler['CDEFINES'].extend(['DARWIN', 'HAVE_STDINT_H', 'AMX_ANSIONLY', 'ENABLE_BINRELOC'])
extension = AMBuild.AddJob('spcomp')
binary = Cpp.ExecutableBuilder('spcomp', AMBuild, extension, compiler)
files = [
'libpawnc.c',
'lstring.c',
'memfile.c',
'pawncc.c',
'sc1.c',
'sc2.c',
'sc3.c',
'sc4.c',
'sc5.c',
'sc6.c',
'sc7.c',
'scexpand.c',
'sci18n.c',
'sclist.c',
'scmemfil.c',
'scstate.c',
'sctracker.c',
'scvars.c',
'sp_file.c',
'zlib/adler32.c',
'zlib/compress.c',
'zlib/crc32.c',
'zlib/deflate.c',
'zlib/gzio.c',
'zlib/infback.c',
'zlib/inffast.c',
'zlib/inflate.c',
'zlib/inftrees.c',
'zlib/trees.c',
'zlib/uncompr.c',
'zlib/zutil.c',
'sp_symhash.c'
]
if AMBuild.target['platform'] == 'linux':
files.append('binreloc.c')
binary.AddSourceFiles('sourcepawn/compiler', files)
if AMBuild.target['platform'] == 'windows':
env = {'RCDEFINES': ['BINARY_NAME="' + binary.binaryFile + '"', 'SM_GENERATED_BUILD']}
binary.AddResourceFile('sourcepawn/compiler/libpawnc.rc', env)
elif AMBuild.target['platform'] == 'darwin' and isinstance(binary, Cpp.LibraryBuilder):
binary.compiler['POSTLINKFLAGS'].extend(['-compatibility_version', '1.0.0'])
binary.compiler['POSTLINKFLAGS'].extend(['-current_version', AMBuild.cache['version']])
SM.ExtractDebugInfo(extension, binary)
binary.SendToJob()
binary = SM.Program(builder, 'spcomp')
compiler = binary.compiler
compiler.includes += [
os.path.join(builder.sourcePath, 'public'),
os.path.join(builder.sourcePath, 'public', 'sourcepawn'),
os.path.join(builder.sourcePath, 'sourcepawn', 'compiler'),
os.path.join(builder.buildPath, 'includes'),
]
if compiler.cc.behavior is 'gcc':
compiler.cflags += ['-Wno-format']
if builder.target_platform is 'linux':
compiler.postlink += ['-lgcc', '-lm']
elif compiler.cc.behavior is 'msvc':
compiler.linkflags.remove('/SUBSYSTEM:WINDOWS')
compiler.linkflags.append('/SUBSYSTEM:CONSOLE')
if builder.target_platform is 'linux':
compiler.defines += [
'LINUX',
'HAVE_STDINT_H',
'AMX_ANSIONLY',
'ENABLE_BINRELOC',
'_GNU_SOURCE'
]
elif builder.target_platform is 'mac':
compiler.defines += [
'DARWIN',
'HAVE_STDINT_H',
'AMX_ANSIONLY',
'ENABLE_BINRELOC',
'HAVE_SAFESTR'
]
binary.sources += [
'libpawnc.c',
'lstring.c',
'memfile.c',
'pawncc.c',
'sc1.c',
'sc2.c',
'sc3.c',
'sc4.c',
'sc5.c',
'sc6.c',
'sc7.c',
'scexpand.c',
'sci18n.c',
'sclist.c',
'scmemfil.c',
'scstate.c',
'sctracker.c',
'scvars.c',
'sp_file.c',
'zlib/adler32.c',
'zlib/compress.c',
'zlib/crc32.c',
'zlib/deflate.c',
'zlib/gzio.c',
'zlib/infback.c',
'zlib/inffast.c',
'zlib/inflate.c',
'zlib/inftrees.c',
'zlib/trees.c',
'zlib/uncompr.c',
'zlib/zutil.c',
'sp_symhash.c'
]
if builder.target_platform is 'linux':
binary.sources.append('binreloc.c')
SM.spcomp = builder.Add(binary)
+1
View File
@@ -809,6 +809,7 @@ SC_VDECL int sc_needsemicolon;/* semicolon required to terminate expressions? */
SC_VDECL int sc_dataalign; /* data alignment value */
SC_VDECL int sc_alignnext; /* must frame of the next function be aligned? */
SC_VDECL int pc_docexpr; /* must expression be attached to documentation comment? */
SC_VDECL int sc_showincludes; /* show include files? */
SC_VDECL int curseg; /* 1 if currently parsing CODE, 2 if parsing DATA */
SC_VDECL cell pc_stksize; /* stack size */
SC_VDECL cell pc_amxlimit; /* abstract machine size limit (code + data, or only code) */
+13 -7
View File
@@ -267,7 +267,9 @@ int pc_compile(int argc, char *argv[])
tname=NULL;
sname=NULL;
#else
tname=tempnam(NULL,"pawn");
char buffer[] = P_tmpdir "/pawn.XXXXXX";
close(mkstemp(buffer));
tname=buffer;
#endif
ftmp=(FILE*)pc_createsrc(tname);
for (fidx=0; (sname=get_sourcefile(fidx))!=NULL; fidx++) {
@@ -851,11 +853,11 @@ static void parseoptions(int argc,char **argv,char *oname,char *ename,char *pnam
int arg,i,isoption;
for (arg=1; arg<argc; arg++) {
#if DIRSEP_CHAR=='/'
isoption= argv[arg][0]=='-';
#else
isoption= argv[arg][0]=='/' || argv[arg][0]=='-';
#endif
#if DIRSEP_CHAR=='/'
isoption= argv[arg][0]=='-';
#else
isoption= argv[arg][0]=='/' || argv[arg][0]=='-';
#endif
if (isoption) {
ptr=&argv[arg][1];
switch (*ptr) {
@@ -925,6 +927,9 @@ static void parseoptions(int argc,char **argv,char *oname,char *ename,char *pnam
hwndFinish=(HWND)0;
break;
#endif
case 'h':
sc_showincludes = 1;
break;
case 'i':
strlcpy(str,option_value(ptr),sizeof str); /* set name of include directory */
i=strlen(str);
@@ -1233,7 +1238,7 @@ static void setconfig(char *root)
static void setcaption(void)
{
pc_printf("SourcePawn Compiler " SM_VERSION_STRING "\n");
pc_printf("SourcePawn Compiler %s\n", SOURCEMOD_VERSION);
pc_printf("Copyright (c) 1997-2006, ITB CompuPhase, (C)2004-2008 AlliedModders, LLC\n\n");
}
@@ -1263,6 +1268,7 @@ static void about(void)
#if defined __WIN32__ || defined _WIN32 || defined _Windows
pc_printf(" -H<hwnd> window handle to send a notification message on finish\n");
#endif
pc_printf(" -h show included file paths\n");
pc_printf(" -i<name> path for include files\n");
pc_printf(" -l create list file (preprocess only)\n");
pc_printf(" -o<name> set base name of (P-code) output file\n");
+3
View File
@@ -153,6 +153,9 @@ static char *extensions[] = { ".inc", ".p", ".pawn" };
*ext='\0'; /* restore filename */
return FALSE;
} /* if */
if (sc_showincludes && sc_status==statFIRST) {
fprintf(stdout, "Note: including file: %s\n", name);
}
PUSHSTK_P(inpf);
PUSHSTK_P(inpfname); /* pointer to current file name */
PUSHSTK_P(curlibrary);
+1
View File
@@ -91,6 +91,7 @@ SC_VDEFINE char *pc_deprecate=NULL;/* if non-null, mark next declaration as depr
SC_VDEFINE int sc_curstates=0; /* ID of the current state list */
SC_VDEFINE int pc_optimize=sOPTIMIZE_NOMACRO; /* (peephole) optimization level */
SC_VDEFINE int pc_memflags=0; /* special flags for the stack/heap usage */
SC_VDEFINE int sc_showincludes=0; /* show include files */
SC_VDEFINE constvalue sc_automaton_tab = { NULL, "", 0, 0}; /* automaton table */
SC_VDEFINE constvalue sc_state_tab = { NULL, "", 0, 0}; /* state table */
+43 -41
View File
@@ -1,45 +1,47 @@
# vim: set ts=2 sw=2 tw=99 noet ft=python:
# vim: set sts=2 ts=8 sw=2 tw=99 et ft=python:
import os
compiler = SM.DefaultCompiler()
base = AMBuild.sourceFolder
compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
compiler['CXXINCLUDES'].append(os.path.join(base, 'sourcepawn', 'jit'))
compiler['CXXINCLUDES'].append(os.path.join(base, 'sourcepawn', 'jit', 'x86'))
compiler['CXXINCLUDES'].append(os.path.join(base, 'public'))
compiler['CXXINCLUDES'].append(os.path.join(base, 'public', 'sourcepawn'))
compiler['CXXINCLUDES'].append(os.path.join(base, 'public', 'jit'))
compiler['CXXINCLUDES'].append(os.path.join(base, 'public', 'jit', 'x86'))
compiler['CXXINCLUDES'].append(os.path.join(base, 'knight', 'shared'))
binary = SM.Library(builder, 'sourcepawn.jit.x86')
binary.compiler.includes += [
os.path.join(SM.mms_root, 'core', 'sourcehook'),
os.path.join(builder.sourcePath, 'sourcepawn', 'jit'),
os.path.join(builder.sourcePath, 'sourcepawn', 'jit', 'x86'),
os.path.join(builder.sourcePath, 'public'),
os.path.join(builder.sourcePath, 'public', 'sourcepawn'),
os.path.join(builder.sourcePath, 'public', 'amtl'),
os.path.join(builder.sourcePath, 'public', 'jit'),
os.path.join(builder.sourcePath, 'public', 'jit', 'x86'),
os.path.join(builder.sourcePath, 'knight', 'shared'),
]
extension = AMBuild.AddJob('sourcepawn.jit.x86')
binary = Cpp.LibraryBuilder('sourcepawn.jit.x86', AMBuild, extension, compiler)
binary.AddSourceFiles('sourcepawn/jit', [
'BaseRuntime.cpp',
'engine2.cpp',
'dll_exports.cpp',
'jit_function.cpp',
'sp_vm_basecontext.cpp',
'sp_vm_engine.cpp',
'sp_vm_function.cpp',
'x86/jit_x86.cpp',
'x86/opcode_helpers.cpp',
'zlib/adler32.c',
'zlib/compress.c',
'zlib/crc32.c',
'zlib/deflate.c',
'zlib/gzio.c',
'zlib/infback.c',
'zlib/inffast.c',
'zlib/inflate.c',
'zlib/inftrees.c',
'zlib/trees.c',
'zlib/uncompr.c',
'zlib/zutil.c',
'md5/md5.cpp',
'../../knight/shared/KeCodeAllocator.cpp'
])
SM.AutoVersion('sourcepawn/jit', binary)
SM.ExtractDebugInfo(extension, binary)
binary.SendToJob()
if builder.target_platform is 'linux':
binary.compiler.postlink += ['-lpthread', '-lrt']
elif builder.target_platform is 'darwin':
binary.compiler.postlink += ['-lpthread', '-ldl']
binary.sources += [
'BaseRuntime.cpp',
'engine2.cpp',
'dll_exports.cpp',
'jit_function.cpp',
'sp_vm_basecontext.cpp',
'sp_vm_engine.cpp',
'sp_vm_function.cpp',
'x86/jit_x86.cpp',
'x86/opcode_helpers.cpp',
'zlib/adler32.c',
'zlib/compress.c',
'zlib/crc32.c',
'zlib/deflate.c',
'zlib/gzio.c',
'zlib/infback.c',
'zlib/inffast.c',
'zlib/inflate.c',
'zlib/inftrees.c',
'zlib/trees.c',
'zlib/uncompr.c',
'zlib/zutil.c',
'md5/md5.cpp',
'../../knight/shared/KeCodeAllocator.cpp',
]
SM.binaries += [builder.Add(binary)]