Mac build fixes (bug 4392, r=me).

This commit is contained in:
David Anderson 2010-05-11 01:46:55 -07:00
parent 26c404adee
commit 271b52158e
7 changed files with 21 additions and 9 deletions

View File

@ -5,7 +5,7 @@ import ambuild.osutil as osutil
def BuildCURL():
curl = AMBuild.AddJob('curl')
if AMBuild.target['platform'] == 'linux':
if AMBuild.target['platform'] == 'linux' or AMBuild.target['platform'] == 'darwin':
if not osutil.FileExists(os.path.join(AMBuild.outputFolder, 'curl', 'Makefile')):
args = ['/bin/bash',
os.path.join(AMBuild.sourceFolder, 'extensions', 'curl', 'curl-src', 'configure'),
@ -16,7 +16,13 @@ def BuildCURL():
'--without-libidn',
'--without-libssh2',
'--without-zlib']
curl.AddCommand(command.DirectCommand(args))
if AMBuild.target['platform'] == 'linux':
env = None
elif AMBuild.target['platform'] == 'darwin':
env = os.environ.copy()
env['CFLAGS'] = '-m32 -isysroot /Developer/SDKs/MacOSX10.5.sdk'
env['LDFLAGS'] = '-mmacosx-version-min=10.5'
curl.AddCommand(command.DirectCommand(argv = args, env = env))
curl.AddCommand(command.ShellCommand('cd lib && make'))
else:
args = ['vcbuild',
@ -42,13 +48,14 @@ binary.AddSourceFiles('extensions/curl', [
'sdk/smsdk_ext.cpp',
])
if AMBuild.target['platform'] == 'linux':
if AMBuild.target['platform'] == 'linux' or AMBuild.target['platform'] == 'darwin':
path = os.path.join(AMBuild.outputFolder,
'curl',
'lib',
'.libs',
'libcurl.a')
binary['POSTLINKFLAGS'].append('-lrt')
if AMBuild.target['platform'] == 'linux':
binary['POSTLINKFLAGS'].append('-lrt')
binary.AddObjectFiles([path])
elif AMBuild.target['platform'] == 'windows':
path = os.path.join(AMBuild.sourceFolder,

View File

@ -8,7 +8,7 @@ compiler['CXXINCLUDES'].append(os.path.join(SM.mmsPath, 'core', 'sourcehook'))
extension = AMBuild.AddJob('dbi.mysql.ext')
binary = Cpp.LibraryBuilder('dbi.mysql.ext', AMBuild, extension, compiler)
if AMBuild.target['platform'] == 'linux':
if AMBuild.target['platform'] == 'linux' or AMBuild.target['platform'] == 'darwin':
lib = os.path.join(AMBuild.cache['MYSQL5'], 'lib', 'libmysqlclient_r.a')
link = [lib,
'-lz',

View File

@ -39,6 +39,8 @@
#endif
#include <mysql.h>
#include <my_global.h>
#include <my_sys.h>
#include <sh_string.h>
#include <sh_list.h>

View File

@ -32,7 +32,7 @@ files = [
]
if AMBuild.target['platform'] == 'windows':
files.extend(['sqlite-source/mutex_w32.c', 'sqlite-source/os_win.c'])
elif AMBuild.target['platform'] == 'linux':
elif AMBuild.target['platform'] == 'linux' or AMBuild.target['platform'] == 'darwin':
files.extend(['sqlite-source/mutex_unix.c', 'sqlite-source/os_unix.c'])
binary.AddSourceFiles('extensions/sqlite', files)
SM.AutoVersion('extensions/sqlite', binary)

View File

@ -9,13 +9,16 @@ compiler['CINCLUDES'].append(os.path.join(AMBuild.outputFolder, 'includes'))
if compiler.cc.name == 'gcc':
compiler['CFLAGS'].extend(['-Wno-parentheses', '-Wno-format'])
compiler['POSTLINKFLAGS'].extend(['-lgcc', '-lm'])
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'])
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)

View File

@ -8,7 +8,7 @@
#include "amxdbg.h"
#include "osdefs.h"
#include "zlib/zlib.h"
#if defined LINUX
#if defined LINUX || defined DARWIN
#include <unistd.h>
#elif defined WIN32
#include <io.h>

View File

@ -35,7 +35,7 @@
#include <io.h>
#endif
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__
#if defined LINUX || defined __FreeBSD__ || defined __OpenBSD__ || defined DARWIN
#include <sclinux.h>
#include <binreloc.h> /* from BinReloc, see www.autopackage.org */
#include <unistd.h>