summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Davydov <davydden@gmail.com>2016-07-16 07:28:31 +0200
committerDenis Davydov <davydden@gmail.com>2016-07-16 07:28:31 +0200
commit514c61b8fe923de7eb0c41205fdfaae48afb5cdf (patch)
tree921373cf3a6785a9ce03ef92501ea499e7893cc8
parent992250ddeab77a605c1e0c47363bd750949d59a5 (diff)
downloadspack-514c61b8fe923de7eb0c41205fdfaae48afb5cdf.tar.gz
spack-514c61b8fe923de7eb0c41205fdfaae48afb5cdf.tar.bz2
spack-514c61b8fe923de7eb0c41205fdfaae48afb5cdf.tar.xz
spack-514c61b8fe923de7eb0c41205fdfaae48afb5cdf.zip
hypre: don't hardcode blas/lapack/mpi; optionally run tests
-rw-r--r--var/spack/repos/builtin/packages/hypre/package.py39
1 files changed, 26 insertions, 13 deletions
diff --git a/var/spack/repos/builtin/packages/hypre/package.py b/var/spack/repos/builtin/packages/hypre/package.py
index f87dae9f4e..0941d07ebe 100644
--- a/var/spack/repos/builtin/packages/hypre/package.py
+++ b/var/spack/repos/builtin/packages/hypre/package.py
@@ -46,21 +46,26 @@ class Hypre(Package):
depends_on("lapack")
def install(self, spec, prefix):
- blas_dir = spec['blas'].prefix
- lapack_dir = spec['lapack'].prefix
- mpi_dir = spec['mpi'].prefix
-
- os.environ['CC'] = os.path.join(mpi_dir, 'bin', 'mpicc')
- os.environ['CXX'] = os.path.join(mpi_dir, 'bin', 'mpicxx')
- os.environ['F77'] = os.path.join(mpi_dir, 'bin', 'mpif77')
-
+ os.environ['CC'] = spec['mpi'].mpicc
+ os.environ['CXX'] = spec['mpi'].mpicxx
+ os.environ['F77'] = spec['mpi'].mpif77
+ # Since +shared does not build on macOS and also Atlas does not have
+ # a single static lib to build against, link against shared libs with
+ # a hope that --whole-archive linker option (or alike) was used
+ # to command the linker to include whole static libs' content into the
+ # shared lib
+ # Note: --with-(lapack|blas)_libs= needs space separated list of names
configure_args = [
- "--prefix=%s" % prefix,
- "--with-lapack-libs=lapack",
- "--with-lapack-lib-dirs=%s/lib" % lapack_dir,
- "--with-blas-libs=blas",
- "--with-blas-lib-dirs=%s/lib" % blas_dir]
+ '--prefix=%s' % prefix,
+ '--with-lapack-libs=%s' % to_lib_name(
+ spec['lapack'].lapack_shared_lib),
+ '--with-lapack-lib-dirs=%s/lib' % spec['lapack'].prefix,
+ '--with-blas-libs=%s' % to_lib_name(
+ spec['blas'].blas_shared_lib),
+ '--with-blas-lib-dirs=%s/lib' % spec['blas'].prefix
+ ]
+
if '+shared' in self.spec:
configure_args.append("--enable-shared")
@@ -76,4 +81,12 @@ class Hypre(Package):
configure(*configure_args)
make()
+ if self.run_tests:
+ make("check")
+ make("test")
+ Executable(join_path('test', 'ij'))()
+ sstruct = Executable(join_path('test', 'struct'))
+ sstruct()
+ sstruct('-in', 'test/sstruct.in.default', '-solver', '40',
+ '-rhsone')
make("install")