merge in win32 changes to setup file

This commit is contained in:
Marcos Pinto 2007-09-10 08:51:21 +00:00
parent 8b7419eb51
commit 9a18581b20
1 changed files with 67 additions and 23 deletions

View File

@ -75,6 +75,8 @@ from distutils import cmd
from distutils.command.install import install as _install from distutils.command.install import install as _install
from distutils.command.install_data import install_data as _install_data from distutils.command.install_data import install_data as _install_data
from distutils.command.build import build as _build from distutils.command.build import build as _build
if OS == "win":
from distutils.command.build_ext import build_ext as _build_ext
import msgfmt import msgfmt
python_version = platform.python_version()[0:3] python_version = platform.python_version()[0:3]
@ -133,10 +135,19 @@ if not OS == "win":
sysconfig.get_config_vars()["OPT"] = ' '.join(cv_opt.split()) sysconfig.get_config_vars()["OPT"] = ' '.join(cv_opt.split())
else: else:
boosttype = 'mt' boosttype = 'mt'
EXTRA_COMPILE_ARGS = ['/link /LIBPATH: C:\Program Files\boost\boost_1_34_0\lib'] EXTRA_COMPILE_ARGS = [ '-DBOOST_WINDOWS',
includedirs = ['./libtorrent', './libtorrent/include', '-Wno-missing-braces',
'./libtorrent/include/libtorrent', '-D_WIN32_WINNT=0x0500',
'c:\Python25\include', 'c:\win32-build-deps\include'] '-D_WIN32',
'-DWIN32',
'-DBOOST_ALL_NO_LIB',
'-D_FILE_OFFSET_BITS=64',
'-DBOOST_THREAD_USE_LIB',
'-DTORRENT_USE_OPENSSL=1',
'-DNDEBUG=1']
EXTRA_LINK_ARGS = ['-L.\win32\lib']
includedirs = ['./libtorrent', './libtorrent/include', './libtorrent/include/libtorrent', './win32/boost', './win32/zlib', './win32/openssl/include']
# NOTE: The Rasterbar Libtorrent source code is in the libtorrent/ directory # NOTE: The Rasterbar Libtorrent source code is in the libtorrent/ directory
# inside of Deluge's source tarball. On several occasions, it has been # inside of Deluge's source tarball. On several occasions, it has been
@ -148,14 +159,19 @@ else:
# we will probably begin to build against a system libtorrent, but at the # we will probably begin to build against a system libtorrent, but at the
# moment, we are including the source code to make packaging on Debian and # moment, we are including the source code to make packaging on Debian and
# Ubuntu possible. # Ubuntu possible.
if boosttype == "nomt": if not OS == "win":
if boosttype == "nomt":
librariestype = ['boost_filesystem', 'boost_date_time', librariestype = ['boost_filesystem', 'boost_date_time',
'boost_thread', 'z', 'pthread', 'ssl'] 'boost_thread', 'z', 'pthread', 'ssl']
print 'Libraries nomt' print 'Libraries nomt'
elif boosttype == "mt": elif boosttype == "mt":
librariestype = ['boost_filesystem-mt', 'boost_date_time-mt', librariestype = ['boost_filesystem-mt', 'boost_date_time-mt',
'boost_thread-mt', 'z', 'pthread', 'ssl'] 'boost_thread-mt', 'z', 'pthread', 'ssl']
print 'Libraries mt' print 'Libraries mt'
else:
librariestype = ['boost_filesystem-mt', 'boost_date_time-mt',
'boost_thread-mt', 'z', 'ssl' ,'wsock32' ,'crypto' ,'gdi32' ,'ws2_32']
print 'Libraries mt'
def fetchCpp(): def fetchCpp():
for root,dirs,files in os.walk('libtorrent'): for root,dirs,files in os.walk('libtorrent'):
@ -169,13 +185,20 @@ sources=list(fetchCpp())
sources.append(os.path.join('src','deluge_core.cpp')) sources.append(os.path.join('src','deluge_core.cpp'))
if not OS == "win": if not OS == "win":
sources.remove('libtorrent/src/file_win.cpp') sources.remove('libtorrent/src/file_win.cpp')
deluge_core = Extension('deluge_core',
deluge_core = Extension('deluge_core',
include_dirs = includedirs, include_dirs = includedirs,
libraries = librariestype, libraries = librariestype,
extra_compile_args = EXTRA_COMPILE_ARGS, extra_compile_args = EXTRA_COMPILE_ARGS,
sources = sources) sources = sources)
else:
sources.remove('libtorrent\\src\\file.cpp')
deluge_core = Extension('deluge_core',
include_dirs = includedirs,
libraries = librariestype,
extra_compile_args = EXTRA_COMPILE_ARGS,
extra_link_args = EXTRA_LINK_ARGS,
sources = sources)
# Thanks to Iain Nicol for code to save the location for installed prefix # Thanks to Iain Nicol for code to save the location for installed prefix
# At runtime, we need to know where we installed the data to. # At runtime, we need to know where we installed the data to.
@ -270,15 +293,36 @@ class install_data(_install_data):
lang_file = os.path.join('build', 'locale', lang, 'LC_MESSAGES', 'deluge.mo') lang_file = os.path.join('build', 'locale', lang, 'LC_MESSAGES', 'deluge.mo')
self.data_files.append( (lang_dir, [lang_file]) ) self.data_files.append( (lang_dir, [lang_file]) )
_install_data.run(self) _install_data.run(self)
if OS == "win":
class build_ext(_build_ext):
def build_extensions(self):
# Linking against this library causes deluge_core.pyd to crash
# on Python >= 2.4. Maybe related to strdup calls, cfr.
# http://mail.python.org/pipermail/distutils-sig/2005-April/004433.html
if 'msvcr71' in self.compiler.dll_libraries:
self.compiler.dll_libraries.remove('msvcr71')
_build_ext.build_extensions(self)
cmdclass = { if not OS == "win":
cmdclass = {
'build': build, 'build': build,
'install': install, 'install': install,
'build_trans': build_trans, 'build_trans': build_trans,
'install_data': install_data, 'install_data': install_data,
'write_data_install_path': write_data_install_path, 'write_data_install_path': write_data_install_path,
'unwrite_data_install_path': unwrite_data_install_path, 'unwrite_data_install_path': unwrite_data_install_path,
} }
else:
cmdclass = {
'build': build,
'build_ext' : build_ext,
'install': install,
'build_trans': build_trans,
'install_data': install_data,
'write_data_install_path': write_data_install_path,
'unwrite_data_install_path': unwrite_data_install_path,
}
data = [('share/deluge/glade', glob.glob('glade/*.glade')), data = [('share/deluge/glade', glob.glob('glade/*.glade')),
('share/deluge/pixmaps', glob.glob('pixmaps/*.png')), ('share/deluge/pixmaps', glob.glob('pixmaps/*.png')),