hypre: don't hardcode blas/lapack/mpi; optionally run tests

This commit is contained in:
Denis Davydov 2016-07-16 07:28:31 +02:00
parent 992250ddea
commit 514c61b8fe

View File

@ -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 @@ def install(self, spec, prefix):
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")