From f90692cf812ba9313c66dee405dee7d0e47535d3 Mon Sep 17 00:00:00 2001 From: Denis Davydov Date: Wed, 13 Jul 2016 10:30:54 +0200 Subject: [PATCH] arpack-ng: fix blas/lapack libraries --- .../builtin/packages/arpack-ng/package.py | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/var/spack/repos/builtin/packages/arpack-ng/package.py b/var/spack/repos/builtin/packages/arpack-ng/package.py index d5dc703c06..2874930cdd 100644 --- a/var/spack/repos/builtin/packages/arpack-ng/package.py +++ b/var/spack/repos/builtin/packages/arpack-ng/package.py @@ -86,10 +86,19 @@ def install(self, spec, prefix): options.extend(std_cmake_args) options.append('-DCMAKE_INSTALL_NAME_DIR:PATH=%s/lib' % prefix) - # TODO: - # Arpack calls directly find_package(BLAS REQUIRED) and - # find_package(LAPACK REQUIRED). Make sure correct Blas/Lapack are - # picked up. + # Make sure we use Spack's blas/lapack: + options.extend([ + '-DLAPACK_FOUND=true', + '-DLAPACK_INCLUDE_DIRS=%s' % spec['lapack'].prefix.include, + '-DLAPACK_LIBRARIES=%s' % ( + spec['lapack'].lapack_shared_lib if '+shared' in spec else + spec['lapack'].lapack_static_lib), + '-DBLAS_FOUND=true', + '-DBLAS_INCLUDE_DIRS=%s' % spec['blas'].prefix.include, + '-DBLAS_LIBRARIES=%s' % ( + spec['blas'].blas_shared_lib if '+shared' in spec else + spec['blas'].blas_static_lib) + ]) if '+mpi' in spec: options.append('-DMPI=ON') @@ -101,9 +110,8 @@ def install(self, spec, prefix): cmake('.', *options) make() - # TODO: make test does not work - # make('test') - + if self.run_tests: + make('test') make('install') @when('@3.3.0') @@ -120,10 +128,23 @@ def install(self, spec, prefix): 'F77=%s' % spec['mpi'].mpif77 ]) - if '~shared' in spec: - options.append('--enable-shared=no') + if '+shared' in spec: + options.extend([ + '--with-blas=%s' % to_link_flags( + spec['blas'].blas_shared_lib), + '--with-lapack=%s' % to_link_flags( + spec['lapack'].lapack_shared_lib) + ]) + else: + options.extend([ + '--with-blas=%s' % spec['blas'].blas_static_lib, + '--with-lapack=%s' % spec['lapack'].lapack_static_lib, + '--enable-shared=no' + ]) bootstrap() configure(*options) make() + if self.run_tests: + make('check') make('install')