summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--var/spack/repos/builtin/packages/boost/package.py98
1 files changed, 71 insertions, 27 deletions
diff --git a/var/spack/repos/builtin/packages/boost/package.py b/var/spack/repos/builtin/packages/boost/package.py
index 3427b74ad6..1992d4d39a 100644
--- a/var/spack/repos/builtin/packages/boost/package.py
+++ b/var/spack/repos/builtin/packages/boost/package.py
@@ -1,4 +1,5 @@
from spack import *
+import spack
class Boost(Package):
"""Boost provides free peer-reviewed portable C++ source
@@ -44,15 +45,35 @@ class Boost(Package):
version('1.34.1', '2d938467e8a448a2c9763e0a9f8ca7e5')
version('1.34.0', 'ed5b9291ffad776f8757a916e1726ad0')
+ libs = ['chrono',
+ 'date_time',
+ 'filesystem',
+ 'iostreams',
+ 'random',
+ 'regex',
+ 'serialization',
+ 'signals',
+ 'system',
+ 'thread',
+ 'wave',
+ 'mpi',
+ 'python']
+
+ for lib in libs:
+ variant(lib, default=False, description="Compile with {0} library"
+ .format(lib))
+
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')
+ variant('shared', default=True, description="Additionally build shared libraries")
+ variant('multithreaded', default=True, description="Build multi-threaded versions of libraries")
+ variant('singlethreaded', default=False, description="Build single-threaded versions of libraries")
+ variant('regex_icu', default=False, description="Include regex ICU support (by default false even if regex library is compiled)")
+ depends_on('icu', when='+regex_icu')
depends_on('python', when='+python')
depends_on('mpi', when='+mpi')
- depends_on('bzip2', when='+compression')
- depends_on('zlib', when='+compression')
+ depends_on('bzip2', when='+iostreams')
+ depends_on('zlib', when='+iostreams')
def url_for_version(self, version):
"""Handle Boost's weird URLs, which write the version two different ways."""
@@ -77,22 +98,20 @@ class Boost(Package):
# fallback to gcc if no toolset found
return 'gcc'
- def determine_bootstrap_options(self, spec, options):
- options.append('--with-toolset=%s' % self.determine_toolset(spec))
+ def determine_bootstrap_options(self, spec, withLibs, options):
+ boostToolsetId = self.determine_toolset(spec)
+ options.append('--with-toolset=%s' % boostToolsetId)
+ options.append("--with-libraries=%s" % ','.join(withLibs))
- without_libs = []
- if '~mpi' in spec:
- without_libs.append('mpi')
- if '~python' in spec:
- without_libs.append('python')
- else:
+ if '+python' in spec:
options.append('--with-python=%s' %
join_path(spec['python'].prefix.bin, 'python'))
- if without_libs:
- options.append('--without-libraries=%s' % ','.join(without_libs))
-
with open('user-config.jam', 'w') as f:
+ compiler_wrapper = join_path(spack.build_env_path, 'c++')
+ f.write("using {0} : : {1} ;\n".format(boostToolsetId,
+ compiler_wrapper))
+
if '+mpi' in spec:
f.write('using mpi : %s ;\n' %
join_path(spec['mpi'].prefix.bin, 'mpicxx'))
@@ -107,12 +126,7 @@ class Boost(Package):
else:
options.append('variant=release')
- if '~compression' in spec:
- options.extend([
- '-s', 'NO_BZIP2=1',
- '-s', 'NO_ZLIB=1'])
-
- if '+compression' in spec:
+ if '+iostreams' in spec:
options.extend([
'-s', 'BZIP2_INCLUDE=%s' % spec['bzip2'].prefix.include,
'-s', 'BZIP2_LIBPATH=%s' % spec['bzip2'].prefix.lib,
@@ -120,20 +134,46 @@ class Boost(Package):
'-s', 'ZLIB_LIBPATH=%s' % spec['zlib'].prefix.lib,
])
+ linkTypes = ['static']
+ if '+shared' in spec:
+ linkTypes.append('shared')
+
+ threadingOpts = []
+ if '+multithreaded' in spec:
+ threadingOpts.append('multi')
+ if '+singlethreaded' in spec:
+ threadingOpts.append('single')
+ if not threadingOpts:
+ raise RuntimeError("At least one of {singlethreaded, multithreaded} must be enabled")
+
options.extend([
'toolset=%s' % self.determine_toolset(spec),
- 'link=static,shared',
- 'threading=single,multi',
+ 'link=%s' % ','.join(linkTypes),
'--layout=tagged'])
+
+ return threadingOpts
def install(self, spec, prefix):
+ withLibs = list()
+ for lib in Boost.libs:
+ if "+{0}".format(lib) in spec:
+ withLibs.append(lib)
+ if not withLibs:
+ # if no libraries are specified for compilation, then you dont have
+ # to configure/build anything, just copy over to the prefix directory.
+ src = join_path(self.stage.source_path, 'boost')
+ mkdirp(join_path(prefix, 'include'))
+ dst = join_path(prefix, 'include', 'boost')
+ install_tree(src, dst)
+ return
+
# to make Boost find the user-config.jam
env['BOOST_BUILD_PATH'] = './'
bootstrap = Executable('./bootstrap.sh')
bootstrap_options = ['--prefix=%s' % prefix]
- self.determine_bootstrap_options(spec, bootstrap_options)
+ self.determine_bootstrap_options(spec, withLibs, bootstrap_options)
bootstrap(*bootstrap_options)
@@ -143,6 +183,10 @@ class Boost(Package):
b2 = Executable(b2name)
b2_options = ['-j', '%s' % make_jobs]
- self.determine_b2_options(spec, b2_options)
+ threadingOpts = self.determine_b2_options(spec, b2_options)
- b2('install', *b2_options)
+ # In theory it could be done on one call but it fails on
+ # Boost.MPI if the threading options are not separated.
+ for threadingOpt in threadingOpts:
+ b2('install', 'threading=%s' % threadingOpt, *b2_options)
+