summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/llnl/util/filesystem.py12
-rw-r--r--var/spack/repos/builtin/packages/hypre/package.py45
-rw-r--r--var/spack/repos/builtin/packages/trilinos/package.py7
3 files changed, 44 insertions, 20 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py
index e800c6717a..6e4cd338fe 100644
--- a/lib/spack/llnl/util/filesystem.py
+++ b/lib/spack/llnl/util/filesystem.py
@@ -42,7 +42,7 @@ __all__ = ['set_install_permissions', 'install', 'install_tree',
'FileFilter', 'change_sed_delimiter', 'is_exe', 'force_symlink',
'set_executable', 'copy_mode', 'unset_executable_mode',
'remove_dead_links', 'remove_linked_tree', 'find_library_path',
- 'fix_darwin_install_name', 'to_link_flags']
+ 'fix_darwin_install_name', 'to_link_flags', 'to_lib_name']
def filter_file(regex, repl, *filenames, **kwargs):
@@ -431,6 +431,13 @@ def fix_darwin_install_name(path):
break
+def to_lib_name(library):
+ """Transforms a path to the library /path/to/lib<name>.xyz into <name>
+ """
+ # Assume libXYZ.suffix
+ return os.path.basename(library)[3:].split(".")[0]
+
+
def to_link_flags(library):
"""Transforms a path to a <library> into linking flags -L<dir> -l<name>.
@@ -438,8 +445,7 @@ def to_link_flags(library):
A string of linking flags.
"""
dir = os.path.dirname(library)
- # Assume libXYZ.suffix
- name = os.path.basename(library)[3:].split(".")[0]
+ name = to_lib_name(library)
res = '-L%s -l%s' % (dir, name)
return res
diff --git a/var/spack/repos/builtin/packages/hypre/package.py b/var/spack/repos/builtin/packages/hypre/package.py
index f87dae9f4e..65fef57559 100644
--- a/var/spack/repos/builtin/packages/hypre/package.py
+++ b/var/spack/repos/builtin/packages/hypre/package.py
@@ -23,7 +23,9 @@
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
##############################################################################
from spack import *
-import os, sys
+import os
+import sys
+
class Hypre(Package):
"""Hypre is a library of high performance preconditioners that
@@ -37,7 +39,7 @@ class Hypre(Package):
version('2.10.0b', '768be38793a35bb5d055905b271f5b8e')
# hypre does not know how to build shared libraries on Darwin
- variant('shared', default=sys.platform!='darwin', description="Build shared library version (disables static library)")
+ variant('shared', default=(sys.platform != 'darwin'), description="Build shared library version (disables static library)")
# SuperluDist have conflicting headers with those in Hypre
variant('internal-superlu', default=True, description="Use internal Superlu routines")
@@ -46,21 +48,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 +83,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")
diff --git a/var/spack/repos/builtin/packages/trilinos/package.py b/var/spack/repos/builtin/packages/trilinos/package.py
index 56499af8d9..77589bb8f9 100644
--- a/var/spack/repos/builtin/packages/trilinos/package.py
+++ b/var/spack/repos/builtin/packages/trilinos/package.py
@@ -118,6 +118,7 @@ class Trilinos(Package):
options.extend(std_cmake_args)
mpi_bin = spec['mpi'].prefix.bin
+ # Note: -DXYZ_LIBRARY_NAMES= needs semicolon separated list of names
options.extend([
'-DTrilinos_ENABLE_ALL_PACKAGES:BOOL=ON',
'-DTrilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=ON',
@@ -131,10 +132,12 @@ class Trilinos(Package):
'-DTPL_ENABLE_MPI:BOOL=ON',
'-DMPI_BASE_DIR:PATH=%s' % spec['mpi'].prefix,
'-DTPL_ENABLE_BLAS=ON',
- '-DBLAS_LIBRARY_NAMES=blas', # FIXME: don't hardcode names
+ '-DBLAS_LIBRARY_NAMES=%s' % to_lib_name(
+ spec['blas'].blas_shared_lib),
'-DBLAS_LIBRARY_DIRS=%s' % spec['blas'].prefix.lib,
'-DTPL_ENABLE_LAPACK=ON',
- '-DLAPACK_LIBRARY_NAMES=lapack',
+ '-DLAPACK_LIBRARY_NAMES=%s' % to_lib_name(
+ spec['lapack'].lapack_shared_lib),
'-DLAPACK_LIBRARY_DIRS=%s' % spec['lapack'].prefix,
'-DTrilinos_ENABLE_EXPLICIT_INSTANTIATION:BOOL=ON',
'-DTrilinos_ENABLE_CXX11:BOOL=ON',