summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorDenis Davydov <davydden@gmail.com>2016-06-14 15:54:58 +0200
committerDenis Davydov <davydden@gmail.com>2016-06-15 18:21:13 +0200
commita860a3d6145e6c35fd1b523b2f8166a0db1ed4b2 (patch)
tree686b9dbbf1c8f5dda576ad5d90018d14631fc38d
parentc803f7ae98dd7a1762e4eda89145e6ca50091136 (diff)
downloadspack-a860a3d6145e6c35fd1b523b2f8166a0db1ed4b2.tar.gz
spack-a860a3d6145e6c35fd1b523b2f8166a0db1ed4b2.tar.bz2
spack-a860a3d6145e6c35fd1b523b2f8166a0db1ed4b2.tar.xz
spack-a860a3d6145e6c35fd1b523b2f8166a0db1ed4b2.zip
superlu-dist: avoid harcoding blas/lapack/mpi; remove preferred version
-rw-r--r--lib/spack/llnl/util/filesystem.py15
-rw-r--r--var/spack/repos/builtin/packages/superlu-dist/package.py13
2 files changed, 20 insertions, 8 deletions
diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py
index 6661a80f27..431289488d 100644
--- a/lib/spack/llnl/util/filesystem.py
+++ b/lib/spack/llnl/util/filesystem.py
@@ -28,7 +28,7 @@ __all__ = ['set_install_permissions', 'install', 'install_tree', 'traverse_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']
+ 'fix_darwin_install_name','to_link_flags']
import os
import glob
@@ -424,6 +424,19 @@ def fix_darwin_install_name(path):
break
+def to_link_flags(library):
+ """Transforms a path to a <library> into linking flags -L<dir> -l<name>.
+
+ Return:
+ A string of linking flags.
+ """
+ dir = os.path.dirname(library)
+ # Asume libXYZ.suffix
+ name = os.path.basename(library)[3:].split(".")[0]
+ res = '-L%s -l%s' % (dir,name)
+ return res
+
+
def find_library_path(libname, *paths):
"""Searches for a file called <libname> in each path.
diff --git a/var/spack/repos/builtin/packages/superlu-dist/package.py b/var/spack/repos/builtin/packages/superlu-dist/package.py
index 6c06b5497c..d24f03c230 100644
--- a/var/spack/repos/builtin/packages/superlu-dist/package.py
+++ b/var/spack/repos/builtin/packages/superlu-dist/package.py
@@ -31,8 +31,7 @@ class SuperluDist(Package):
url = "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/superlu_dist_4.1.tar.gz"
version('5.0.0', '2b53baf1b0ddbd9fcf724992577f0670')
- # default to version 4.3 since petsc and trilinos are not tested with 5.0.
- version('4.3', 'ee66c84e37b4f7cc557771ccc3dc43ae', preferred=True)
+ version('4.3', 'ee66c84e37b4f7cc557771ccc3dc43ae')
version('4.2', 'ae9fafae161f775fbac6eba11e530a65')
version('4.1', '4edee38cc29f687bd0c8eb361096a455')
version('4.0', 'c0b98b611df227ae050bc1635c6940e0')
@@ -47,10 +46,10 @@ class SuperluDist(Package):
makefile_inc = []
makefile_inc.extend([
'PLAT = _mac_x',
- 'DSuperLUroot = %s' % self.stage.source_path, #self.stage.path, prefix
+ 'DSuperLUroot = %s' % self.stage.source_path,
'DSUPERLULIB = $(DSuperLUroot)/lib/libsuperlu_dist.a',
'BLASDEF = -DUSE_VENDOR_BLAS',
- 'BLASLIB = -L%s -llapack %s -lblas' % (spec['lapack'].prefix.lib, spec['blas'].prefix.lib), # FIXME: avoid hardcoding blas/lapack lib names
+ 'BLASLIB = %s %s' % (to_link_flags(spec['lapack'].lapack_shared_lib),to_link_flags(spec['blas'].blas_shared_lib)),
'METISLIB = -L%s -lmetis' % spec['metis'].prefix.lib,
'PARMETISLIB = -L%s -lparmetis' % spec['parmetis'].prefix.lib,
'FLIBS =',
@@ -58,12 +57,12 @@ class SuperluDist(Package):
'ARCH = ar',
'ARCHFLAGS = cr',
'RANLIB = true',
- 'CC = mpicc', # FIXME avoid hardcoding MPI compiler names
+ 'CC = %s' % spec['mpi'].mpicc,
'CFLAGS = -fPIC -std=c99 -O2 -I%s -I%s' %(spec['parmetis'].prefix.include, spec['metis'].prefix.include),
'NOOPTS = -fPIC -std=c99',
- 'FORTRAN = mpif77',
+ 'FORTRAN = %s' % spec['mpi'].mpif77,
'F90FLAGS = -O2',
- 'LOADER = mpif77',
+ 'LOADER = %s' % spec['mpi'].mpif77,
'LOADOPTS =',
'CDEFS = -DAdd_'
])