summaryrefslogtreecommitdiff
path: root/var/spack/repos/builtin/packages/sundials/package.py
diff options
context:
space:
mode:
Diffstat (limited to 'var/spack/repos/builtin/packages/sundials/package.py')
-rw-r--r--var/spack/repos/builtin/packages/sundials/package.py114
1 files changed, 74 insertions, 40 deletions
diff --git a/var/spack/repos/builtin/packages/sundials/package.py b/var/spack/repos/builtin/packages/sundials/package.py
index 16cbcbe34f..0002b3e376 100644
--- a/var/spack/repos/builtin/packages/sundials/package.py
+++ b/var/spack/repos/builtin/packages/sundials/package.py
@@ -1,27 +1,8 @@
-##############################################################################
-# Copyright (c) 2013-2017, Lawrence Livermore National Security, LLC.
-# Produced at the Lawrence Livermore National Laboratory.
+# Copyright 2013-2018 Lawrence Livermore National Security, LLC and other
+# Spack Project Developers. See the top-level COPYRIGHT file for details.
#
-# This file is part of Spack.
-# Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved.
-# LLNL-CODE-647188
-#
-# For details, see https://github.com/spack/spack
-# Please also see the NOTICE and LICENSE files for our notice and the LGPL.
-#
-# This program is free software; you can redistribute it and/or modify
-# it under the terms of the GNU Lesser General Public License (as
-# published by the Free Software Foundation) version 2.1, February 1999.
-#
-# This program is distributed in the hope that it will be useful, but
-# WITHOUT ANY WARRANTY; without even the IMPLIED WARRANTY OF
-# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the terms and
-# conditions of the GNU Lesser General Public License for more details.
-#
-# You should have received a copy of the GNU Lesser General Public
-# License along with this program; if not, write to the Free Software
-# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
-##############################################################################
+# SPDX-License-Identifier: (Apache-2.0 OR MIT)
+
from spack import *
import os
import sys
@@ -33,16 +14,22 @@ class Sundials(CMakePackage):
homepage = "https://computation.llnl.gov/projects/sundials"
url = "https://computation.llnl.gov/projects/sundials/download/sundials-2.7.0.tar.gz"
- maintainers = ['cswoodward', 'gardner48']
+ maintainers = ['cswoodward', 'gardner48', 'balos1']
# ==========================================================================
# Versions
# ==========================================================================
-
- version('3.1.0', '1a84ca41c7f71067e03d519ddbcd9dae')
- version('3.0.0', '5163a44cedd7398bddda442ba00313b8')
- version('2.7.0', 'c304631b9bc82877d7b0e9f4d4fd94d3')
- version('2.6.2', '3deeb0ede9f514184c6bd83ecab77d95')
+ version('4.0.0-dev.2', sha256='124fc12f2a68d32210c20f5005510607e0833764afaef2a70b741bc922519984')
+ version('4.0.0-dev.1', sha256='6354e1d266b60c23766137b4ffa9bbde8bca97a562ccd94cab756b597ed753c1')
+ version('4.0.0-dev', sha256='50e526327461aebe463accf6ef56f9c6773df65025f3020b9ce68b83bbf5dd27')
+ version('3.2.1', sha256='47d94d977ab2382cdcdd02f72a25ebd4ba8ca2634bbb2f191fe1636e71c86808', preferred=True)
+ version('3.2.0', sha256='d2b690afecadf8b5a048bb27ab341de591d714605b98d3518985dfc2250e93f9')
+ version('3.1.2', sha256='a8985bb1e851d90e24260450667b134bc13d71f5c6effc9e1d7183bd874fe116')
+ version('3.1.1', sha256='a24d643d31ed1f31a25b102a1e1759508ce84b1e4739425ad0e18106ab471a24')
+ version('3.1.0', sha256='18d52f8f329626f77b99b8bf91e05b7d16b49fde2483d3a0ea55496ce4cdd43a')
+ version('3.0.0', sha256='28b8e07eecfdef66e2c0d0ea0cb1b91af6e4e94d71008abfe80c27bf39f63fde')
+ version('2.7.0', sha256='d39fcac7175d701398e4eb209f7e92a5b30a78358d4a0c0fcc23db23c11ba104')
+ version('2.6.2', sha256='d8ed0151509dd2b0f317b318a4175f8b95a174340fc3080b8c20617da8aa4d2f')
# ==========================================================================
# Variants
@@ -164,6 +151,9 @@ class Sundials(CMakePackage):
# Build dependencies
depends_on('cmake@2.8.1:', type='build')
+ depends_on('cmake@2.8.12:', type='build', when='@3.1.2')
+ depends_on('cmake@3.0.2:', type='build', when='@4.0.0-dev.1')
+ depends_on('cmake@3.1.3:', type='build', when='@3.2.0,4.0.0-dev.2')
# MPI related dependencies
depends_on('mpi', when='+mpi')
@@ -215,10 +205,10 @@ class Sundials(CMakePackage):
return 'ON' if varstr in self.spec else 'OFF'
fortran_flag = self.compiler.pic_flag
- if spec.satisfies('%clang platform=darwin'):
- mpif77 = Executable(self.spec['mpi'].mpif77)
- libgfortran = LibraryList(mpif77('--print-file-name',
- 'libgfortran.a', output=str))
+ if (spec.satisfies('%clang platform=darwin')) and ('+fcmix' in spec):
+ f77 = Executable(self.compiler.f77)
+ libgfortran = LibraryList(f77('--print-file-name',
+ 'libgfortran.a', output=str))
fortran_flag += ' ' + libgfortran.ld_flags
# List of CMake arguments
@@ -325,6 +315,12 @@ class Sundials(CMakePackage):
'-DPETSC_LIBRARY_DIR=%s' % spec['petsc'].prefix.lib
])
+ # Building with RAJA
+ if '+raja' in spec:
+ args.extend([
+ '-DRAJA_DIR=%s' % spec['raja'].prefix.share.raja.cmake
+ ])
+
# Examples
if spec.satisfies('@3.0.0:'):
args.extend([
@@ -374,6 +370,8 @@ class Sundials(CMakePackage):
Spack's generic cc and f77. We want them to be bound to
whatever compiler they were built with."""
+ spec = self.spec
+
kwargs = {'ignore_absent': True, 'backup': False, 'string': True}
dirname = os.path.join(self.prefix, 'examples')
@@ -469,10 +467,46 @@ class Sundials(CMakePackage):
filter_file(r'^CPP\s*=.*', self.compiler.cc,
os.path.join(dirname, filename), **kwargs)
- for filename in f77_files:
- filter_file(os.environ['F77'], self.compiler.f77,
- os.path.join(dirname, filename), **kwargs)
-
- for filename in f90_files:
- filter_file(os.environ['FC'], self.compiler.fc,
- os.path.join(dirname, filename), **kwargs)
+ if ('+fcmix' in spec) and ('+examples-f77' in spec):
+ for filename in f77_files:
+ filter_file(os.environ['F77'], self.compiler.f77,
+ os.path.join(dirname, filename), **kwargs)
+
+ if ('+fcmix' in spec) and ('+examples-f90' in spec):
+ for filename in f90_files:
+ filter_file(os.environ['FC'], self.compiler.fc,
+ os.path.join(dirname, filename), **kwargs)
+
+ @property
+ def headers(self):
+ """Export the headers and defines of SUNDIALS.
+ Sample usage: spec['sundials'].headers.cpp_flags
+ """
+ # SUNDIALS headers are inside subdirectories, so we use a fake header
+ # in the include directory.
+ hdr = find(self.prefix.include.nvector, 'nvector_serial.h',
+ recursive=False)
+ return HeaderList(join_path(self.spec.prefix.include, 'fake.h')) \
+ if hdr else None
+
+ @property
+ def libs(self):
+ """Export the libraries of SUNDIALS.
+ Sample usage: spec['sundials'].libs.ld_flags
+ spec['sundials:arkode,cvode'].libs.ld_flags
+ """
+ query_parameters = self.spec.last_query.extra_parameters
+ if not query_parameters:
+ sun_libs = 'libsundials_*[!0-9]'
+ # Q: should the result be ordered by dependency?
+ else:
+ sun_libs = ['libsundials_' + p for p in query_parameters]
+ search_paths = [[self.prefix.lib, False], [self.prefix.lib64, False],
+ [self.prefix, True]]
+ is_shared = '+shared' in self.spec
+ for path, recursive in search_paths:
+ libs = find_libraries(sun_libs, root=path, shared=is_shared,
+ recursive=recursive)
+ if libs:
+ return libs
+ return None # Raise an error