Merge pull request #214 from epfl-scitas/packages/boost
Boost: mpi, python and compression for iostream variants
This commit is contained in:
commit
5a5990be09
1 changed files with 76 additions and 4 deletions
|
@ -43,7 +43,16 @@ class Boost(Package):
|
|||
version('1.34.1', '2d938467e8a448a2c9763e0a9f8ca7e5')
|
||||
version('1.34.0', 'ed5b9291ffad776f8757a916e1726ad0')
|
||||
|
||||
variant('debug', default=False, description='Switch to the debug version of Boost')
|
||||
variant('python', default=False, description='Activate the component Boost.Python')
|
||||
variant('mpi', default=False, description='Activate the component Boost.MPI')
|
||||
variant('compression', default=True, description='Activate the compression Boost.iostreams')
|
||||
|
||||
depends_on('mpi', when='+mpi')
|
||||
depends_on('python', when='+python')
|
||||
depends_on('zlib', when='+compression')
|
||||
depends_on('bzip2', when='+compression')
|
||||
|
||||
def url_for_version(self, version):
|
||||
"""Handle Boost's weird URLs, which write the version two different ways."""
|
||||
parts = [str(p) for p in Version(version)]
|
||||
|
@ -52,15 +61,78 @@ def url_for_version(self, version):
|
|||
return "http://downloads.sourceforge.net/project/boost/boost/%s/boost_%s.tar.bz2" % (
|
||||
dots, underscores)
|
||||
|
||||
def determine_toolset(self):
|
||||
toolsets = {'gcc': 'gcc',
|
||||
'icpc': 'intel',
|
||||
'clang++': 'clang'}
|
||||
|
||||
for cc, toolset in toolsets.iteritems():
|
||||
if(cc in self.compiler.cxx_names):
|
||||
return toolset
|
||||
|
||||
# fallback to gcc if no toolset found
|
||||
return 'gcc'
|
||||
|
||||
def determine_bootstrap_options(self, spec, options):
|
||||
options.append('--with-toolset=%s' % self.determine_toolset())
|
||||
|
||||
without_libs = []
|
||||
if '~mpi' in spec:
|
||||
without_libs.append('mpi')
|
||||
if '~python' in spec:
|
||||
without_libs.append('python')
|
||||
else:
|
||||
options.append('--with-python=%s' % (spec['python'].prefix.bin + '/python'))
|
||||
|
||||
if without_libs:
|
||||
options.append('--without-libraries=%s' % ','.join(without_libs))
|
||||
|
||||
with open('user-config.jam', 'w') as f:
|
||||
if '+mpi' in spec:
|
||||
f.write('using mpi : %s ;\n' % (spec['mpi'].prefix.bin + '/mpicxx'))
|
||||
if '+python' in spec:
|
||||
f.write('using python : %s : %s ;\n' % (spec['python'].version,
|
||||
(spec['python'].prefix.bin + '/python')))
|
||||
|
||||
def determine_b2_options(self, spec, options):
|
||||
if '+debug' in spec:
|
||||
options.append('variant=debug')
|
||||
else:
|
||||
options.append('variant=release')
|
||||
|
||||
if '~compression' in spec:
|
||||
options.extend(['-s NO_BZIP2=1',
|
||||
'-s NO_ZLIB=1',
|
||||
])
|
||||
|
||||
if '+compression' in spec:
|
||||
options.extend(['-s BZIP2_INCLUDE=%s' % spec['bzip2'].prefix.include,
|
||||
'-s BZIP2_LIBPATH=%s' % spec['bzip2'].prefix.lib,
|
||||
'-s ZLIB_INCLUDE=%s' % spec['zlib'].prefix.include,
|
||||
'-s ZLIB_LIBPATH=%s' % spec['zlib'].prefix.lib])
|
||||
|
||||
options.extend(['toolset=%s' % self.determine_toolset(),
|
||||
'link=static,shared',
|
||||
'--layout=tagged'])
|
||||
|
||||
def install(self, spec, prefix):
|
||||
# to make him find the user-config.jam
|
||||
env['BOOST_BUILD_PATH'] = './'
|
||||
|
||||
bootstrap = Executable('./bootstrap.sh')
|
||||
bootstrap()
|
||||
|
||||
bootstrap_options = ['--prefix=%s' % prefix]
|
||||
self.determine_bootstrap_options(spec, bootstrap_options)
|
||||
|
||||
bootstrap(*bootstrap_options)
|
||||
|
||||
# b2 used to be called bjam, before 1.47 (sigh)
|
||||
b2name = './b2' if spec.satisfies('@1.47:') else './bjam'
|
||||
|
||||
b2 = Executable(b2name)
|
||||
b2('install',
|
||||
'-j %s' % make_jobs,
|
||||
'--prefix=%s' % prefix)
|
||||
b2_options = ['-j %s' % make_jobs]
|
||||
|
||||
self.determine_b2_options(spec, b2_options)
|
||||
|
||||
b2('install', 'threading=single', *b2_options)
|
||||
b2('install', 'threading=multi', *b2_options)
|
||||
|
|
Loading…
Reference in a new issue