summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorJason Sarich <sarich@mcs.anl.gov>2017-01-24 13:48:01 -0600
committerTodd Gamblin <tgamblin@llnl.gov>2017-01-24 12:48:01 -0700
commit6e895c4cccb67304d3391478cc3fd0c5641bca51 (patch)
tree07fd7932a6c274533ab59e23a1e1623ab677a153
parent7d3da2ebdcdbd5e42aebb41db4cf497d8219a53d (diff)
downloadspack-6e895c4cccb67304d3391478cc3fd0c5641bca51.tar.gz
spack-6e895c4cccb67304d3391478cc3fd0c5641bca51.tar.bz2
spack-6e895c4cccb67304d3391478cc3fd0c5641bca51.tar.xz
spack-6e895c4cccb67304d3391478cc3fd0c5641bca51.zip
add static options for some libraries (#2876)
* add static options for some libraries * make requested changes: add comments and use configure_args
-rw-r--r--var/spack/repos/builtin/packages/bzip2/package.py34
-rw-r--r--var/spack/repos/builtin/packages/matio/package.py4
-rw-r--r--var/spack/repos/builtin/packages/metis/package.py9
-rw-r--r--var/spack/repos/builtin/packages/parmetis/package.py10
-rw-r--r--var/spack/repos/builtin/packages/zlib/package.py8
5 files changed, 50 insertions, 15 deletions
diff --git a/var/spack/repos/builtin/packages/bzip2/package.py b/var/spack/repos/builtin/packages/bzip2/package.py
index 9e5894a6a8..d12b88e734 100644
--- a/var/spack/repos/builtin/packages/bzip2/package.py
+++ b/var/spack/repos/builtin/packages/bzip2/package.py
@@ -36,6 +36,7 @@ class Bzip2(Package):
url = "http://www.bzip.org/1.0.6/bzip2-1.0.6.tar.gz"
version('1.0.6', '00b516f4704d4a7cb50a1d97e6e8e15b')
+ variant('shared', default=True, description='Enables the build of shared libraries.')
def patch(self):
# bzip2 comes with two separate Makefiles for static and dynamic builds
@@ -71,27 +72,30 @@ class Bzip2(Package):
def install(self, spec, prefix):
# Build the dynamic library first
- make('-f', 'Makefile-libbz2_so')
+ if '+shared' in spec:
+ make('-f', 'Makefile-libbz2_so')
+
# Build the static library and everything else
make()
make('install', 'PREFIX={0}'.format(prefix))
- install('bzip2-shared', join_path(prefix.bin, 'bzip2'))
+ if '+shared' in spec:
+ install('bzip2-shared', join_path(prefix.bin, 'bzip2'))
- v1, v2, v3 = (self.spec.version.up_to(i) for i in (1, 2, 3))
- if 'darwin' in self.spec.architecture:
- lib = 'libbz2.dylib'
- lib1, lib2, lib3 = ('libbz2.{0}.dylib'.format(v)
- for v in (v1, v2, v3))
- else:
- lib = 'libbz2.so'
- lib1, lib2, lib3 = ('libbz2.so.{0}'.format(v)
- for v in (v1, v2, v3))
+ v1, v2, v3 = (self.spec.version.up_to(i) for i in (1, 2, 3))
+ if 'darwin' in self.spec.architecture:
+ lib = 'libbz2.dylib'
+ lib1, lib2, lib3 = ('libbz2.{0}.dylib'.format(v)
+ for v in (v1, v2, v3))
+ else:
+ lib = 'libbz2.so'
+ lib1, lib2, lib3 = ('libbz2.so.{0}'.format(v)
+ for v in (v1, v2, v3))
- install(lib3, join_path(prefix.lib, lib3))
- with working_dir(prefix.lib):
- for l in (lib, lib1, lib2):
- symlink(lib3, l)
+ install(lib3, join_path(prefix.lib, lib3))
+ with working_dir(prefix.lib):
+ for l in (lib, lib1, lib2):
+ symlink(lib3, l)
with working_dir(prefix.bin):
force_remove('bunzip2', 'bzcat')
diff --git a/var/spack/repos/builtin/packages/matio/package.py b/var/spack/repos/builtin/packages/matio/package.py
index a33b23a4e9..3c48b8f3fc 100644
--- a/var/spack/repos/builtin/packages/matio/package.py
+++ b/var/spack/repos/builtin/packages/matio/package.py
@@ -37,6 +37,8 @@ class Matio(AutotoolsPackage):
description='support for compressed mat files')
variant("hdf5", default=True,
description='support for version 7.3 mat files via hdf5')
+ variant("shared", default=True, description='Enables the build of shared libraries.')
+
depends_on("zlib", when="+zlib")
depends_on("hdf5", when="+hdf5")
@@ -47,4 +49,6 @@ class Matio(AutotoolsPackage):
args.append("--with-zlib=%s" % self.spec['zlib'].prefix)
if '+hdf5' in self.spec:
args.append("--with-hdf5=%s" % self.spec['hdf5'].prefix)
+ if '+shared' not in self.spec:
+ args.append("--disable-shared")
return args
diff --git a/var/spack/repos/builtin/packages/metis/package.py b/var/spack/repos/builtin/packages/metis/package.py
index b66677288c..f15d544b7b 100644
--- a/var/spack/repos/builtin/packages/metis/package.py
+++ b/var/spack/repos/builtin/packages/metis/package.py
@@ -186,6 +186,15 @@ class Metis(Package):
if '+shared' in spec:
options.append('-DSHARED:BOOL=ON')
+ else:
+ # Remove all RPATH options
+ # (RPATHxxx options somehow trigger cmake to link dynamically)
+ rpath_options = []
+ for o in options:
+ if o.find('RPATH') >= 0:
+ rpath_options.append(o)
+ for o in rpath_options:
+ options.remove(o)
if '+debug' in spec:
options.extend(['-DDEBUG:BOOL=ON',
'-DCMAKE_BUILD_TYPE:STRING=Debug'])
diff --git a/var/spack/repos/builtin/packages/parmetis/package.py b/var/spack/repos/builtin/packages/parmetis/package.py
index 74e00cc9e0..0e6cd5390a 100644
--- a/var/spack/repos/builtin/packages/parmetis/package.py
+++ b/var/spack/repos/builtin/packages/parmetis/package.py
@@ -71,6 +71,16 @@ class Parmetis(Package):
if '+shared' in spec:
options.append('-DSHARED:BOOL=ON')
+ else:
+ # Remove all RPATH options
+ # (RPATHxxx options somehow trigger cmake to link dynamically)
+ rpath_options = []
+ for o in options:
+ if o.find('RPATH') >= 0:
+ rpath_options.append(o)
+ for o in rpath_options:
+ options.remove(o)
+
if '+debug' in spec:
options.extend(['-DDEBUG:BOOL=ON',
'-DCMAKE_BUILD_TYPE:STRING=Debug'])
diff --git a/var/spack/repos/builtin/packages/zlib/package.py b/var/spack/repos/builtin/packages/zlib/package.py
index ea758e0188..05b9bb8ded 100644
--- a/var/spack/repos/builtin/packages/zlib/package.py
+++ b/var/spack/repos/builtin/packages/zlib/package.py
@@ -40,7 +40,15 @@ class Zlib(AutotoolsPackage):
variant('pic', default=True,
description='Produce position-independent code (for shared libs)')
+ variant('shared', default=True,
+ description='Enables the build of shared libraries.')
def setup_environment(self, spack_env, run_env):
if '+pic' in self.spec:
spack_env.set('CFLAGS', self.compiler.pic_flag)
+
+ def configure_args(self):
+ config_args = []
+ if '+shared' not in self.spec:
+ config_args.append('--static')
+ return config_args