Handle OS X better in the build system - patch from hydri

This commit is contained in:
Andrew Resch 2008-10-23 08:05:02 +00:00
parent 16cc7be912
commit 718c789c8e

View File

@ -51,6 +51,12 @@ def windows_check():
else:
return False
def osx_check():
if platform.system() in ("Darwin"):
return True
else:
return False
# Try to get SVN revision number to append to version
revision_string = ""
try:
@ -133,7 +139,7 @@ _library_dirs = [
_include_dirs = [
'./libtorrent',
'./libtorrent/include',
'./libtorrent/include/libtorrent',
'./libtorrent/include/libtorrent'
]
if windows_check():
@ -156,6 +162,12 @@ if windows_check():
]
else:
_include_dirs += ['/usr/include/python' + python_version]
_library_dirs += [sysconfig.get_config_var("LIBDIR"), '/opt/local/lib']
if osx_check():
_include_dirs += [
'/opt/local/include/boost-1_35',
'/opt/local/include/boost-1_36'
]
_libraries = [
'boost_filesystem',
'boost_date_time',
@ -167,12 +179,22 @@ else:
'z'
]
dynamic_lib_extension = ".so"
if osx_check():
dynamic_lib_extension = ".dylib"
_lib_extensions = ['-mt-1_36', '-mt-1_35', '-mt']
# Modify the libs if necessary for systems with only -mt boost libs
for lib in _libraries:
if lib[:6] == "boost_":
for lib_prefix in _library_dirs:
for lib_suffix in _lib_extensions:
# If there is a -mt version use that
if os.path.exists(os.path.join(sysconfig.get_config_var("LIBDIR"), "lib" + lib + "-mt.so")):
_libraries[_libraries.index(lib)] = lib + "-mt"
if os.path.exists(os.path.join(lib_prefix, "lib" + lib + lib_suffix + dynamic_lib_extension)):
_libraries[_libraries.index(lib)] = lib + lib_suffix
lib = lib + lib_suffix
break
_sources = glob.glob("./libtorrent/src/*.cpp") + \
glob.glob("./libtorrent/src/*.c") + \