Fix spcomp compilation on OS X 10.9

Summary:
10.9's SDK changed strlcat and strlcmp to macros, which has broken lots of code. As they will always be available from the system (being BSD functions), just use the system ones there.

tempnam has also been deprecated, refactoring spcomp to use it safely is quite a bit of work, and it's not critical, so just hacking around it with mkstemp.

Test Plan: Compiled spcomp.

Reviewers: dvander

Differential Revision: https://phabricator.alliedmods.net/D3

--HG--
extra : rebase_source : 535b88f815727b186fa6a141036599651a60e334
This commit is contained in:
Asher Baker 2013-12-02 13:08:27 +00:00
parent 398b05afed
commit 29ddb9f4d9
2 changed files with 4 additions and 2 deletions

View File

@ -18,7 +18,7 @@ elif compiler.cc.name == 'msvc':
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'])
compiler['CDEFINES'].extend(['DARWIN', 'HAVE_STDINT_H', 'AMX_ANSIONLY', 'ENABLE_BINRELOC', 'HAVE_SAFESTR'])
extension = AMBuild.AddJob('spcomp')
binary = Cpp.ExecutableBuilder('spcomp', AMBuild, extension, compiler)

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++) {