Merge branch 'features/cantera' of https://github.com/adamjstewart/spack into adamjstewart-features/cantera
This commit is contained in:
		| @@ -63,7 +63,7 @@ | |||||||
| import spack | import spack | ||||||
| from spack.environment import EnvironmentModifications, validate | from spack.environment import EnvironmentModifications, validate | ||||||
| from spack.util.environment import * | from spack.util.environment import * | ||||||
| from spack.util.executable import Executable, which | from spack.util.executable import Executable | ||||||
|  |  | ||||||
| # | # | ||||||
| # This can be set by the user to globally disable parallel builds. | # This can be set by the user to globally disable parallel builds. | ||||||
| @@ -130,8 +130,13 @@ def load_module(mod): | |||||||
|     text = modulecmd('show', mod, output=str, error=str).split() |     text = modulecmd('show', mod, output=str, error=str).split() | ||||||
|     for i, word in enumerate(text): |     for i, word in enumerate(text): | ||||||
|         if word == 'conflict': |         if word == 'conflict': | ||||||
|  | <<<<<<< HEAD | ||||||
|             exec(compile(modulecmd('unload', text[ |             exec(compile(modulecmd('unload', text[ | ||||||
|                  i + 1], output=str, error=str), '<string>', 'exec')) |                  i + 1], output=str, error=str), '<string>', 'exec')) | ||||||
|  | ======= | ||||||
|  |             exec(compile(modulecmd('unload', text[i + 1], output=str, | ||||||
|  |                                    error=str), '<string>', 'exec')) | ||||||
|  | >>>>>>> aa86488fd9809ced16704e4bd4d607c89d6dda75 | ||||||
|     # Load the module now that there are no conflicts |     # Load the module now that there are no conflicts | ||||||
|     load = modulecmd('load', mod, output=str, error=str) |     load = modulecmd('load', mod, output=str, error=str) | ||||||
|     exec(compile(load, '<string>', 'exec')) |     exec(compile(load, '<string>', 'exec')) | ||||||
| @@ -239,8 +244,13 @@ def set_build_environment_variables(pkg, env): | |||||||
|     # handled by putting one in the <build_env_path>/case-insensitive |     # handled by putting one in the <build_env_path>/case-insensitive | ||||||
|     # directory.  Add that to the path too. |     # directory.  Add that to the path too. | ||||||
|     env_paths = [] |     env_paths = [] | ||||||
|  | <<<<<<< HEAD | ||||||
|     compiler_specific = join_path(spack.build_env_path, pkg.compiler.name) |     compiler_specific = join_path(spack.build_env_path, pkg.compiler.name) | ||||||
|     for item in [spack.build_env_path, compiler_specific]: |     for item in [spack.build_env_path, compiler_specific]: | ||||||
|  | ======= | ||||||
|  |     for item in [spack.build_env_path, join_path(spack.build_env_path, | ||||||
|  |                                                  pkg.compiler.name)]: | ||||||
|  | >>>>>>> aa86488fd9809ced16704e4bd4d607c89d6dda75 | ||||||
|         env_paths.append(item) |         env_paths.append(item) | ||||||
|         ci = join_path(item, 'case-insensitive') |         ci = join_path(item, 'case-insensitive') | ||||||
|         if os.path.isdir(ci): |         if os.path.isdir(ci): | ||||||
| @@ -270,8 +280,13 @@ def set_build_environment_variables(pkg, env): | |||||||
|     env.unset('DYLD_LIBRARY_PATH') |     env.unset('DYLD_LIBRARY_PATH') | ||||||
|  |  | ||||||
|     # Add bin directories from dependencies to the PATH for the build. |     # Add bin directories from dependencies to the PATH for the build. | ||||||
|  | <<<<<<< HEAD | ||||||
|     bin_dirs = reversed( |     bin_dirs = reversed( | ||||||
|         filter(os.path.isdir, ['%s/bin' % prefix for prefix in dep_prefixes])) |         filter(os.path.isdir, ['%s/bin' % prefix for prefix in dep_prefixes])) | ||||||
|  | ======= | ||||||
|  |     bin_dirs = reversed(filter(os.path.isdir, | ||||||
|  |                                ['%s/bin' % prefix for prefix in dep_prefixes])) | ||||||
|  | >>>>>>> aa86488fd9809ced16704e4bd4d607c89d6dda75 | ||||||
|     for item in bin_dirs: |     for item in bin_dirs: | ||||||
|         env.prepend_path('PATH', item) |         env.prepend_path('PATH', item) | ||||||
|  |  | ||||||
| @@ -286,7 +301,10 @@ def set_build_environment_variables(pkg, env): | |||||||
|         for directory in ('lib', 'lib64', 'share'): |         for directory in ('lib', 'lib64', 'share'): | ||||||
|             pcdir = join_path(pre, directory, 'pkgconfig') |             pcdir = join_path(pre, directory, 'pkgconfig') | ||||||
|             if os.path.isdir(pcdir): |             if os.path.isdir(pcdir): | ||||||
|  | <<<<<<< HEAD | ||||||
|                 # pkg_config_dirs.append(pcdir) |                 # pkg_config_dirs.append(pcdir) | ||||||
|  | ======= | ||||||
|  | >>>>>>> aa86488fd9809ced16704e4bd4d607c89d6dda75 | ||||||
|                 env.prepend_path('PKG_CONFIG_PATH', pcdir) |                 env.prepend_path('PKG_CONFIG_PATH', pcdir) | ||||||
|  |  | ||||||
|     if pkg.spec.architecture.target.module_name: |     if pkg.spec.architecture.target.module_name: | ||||||
| @@ -299,7 +317,7 @@ def set_module_variables_for_package(pkg, module): | |||||||
|     """Populate the module scope of install() with some useful functions. |     """Populate the module scope of install() with some useful functions. | ||||||
|        This makes things easier for package writers. |        This makes things easier for package writers. | ||||||
|     """ |     """ | ||||||
|     # number of jobs spack will to build with. |     # number of jobs spack will build with. | ||||||
|     jobs = multiprocessing.cpu_count() |     jobs = multiprocessing.cpu_count() | ||||||
|     if not pkg.parallel: |     if not pkg.parallel: | ||||||
|         jobs = 1 |         jobs = 1 | ||||||
| @@ -312,6 +330,7 @@ def set_module_variables_for_package(pkg, module): | |||||||
|     # TODO: make these build deps that can be installed if not found. |     # TODO: make these build deps that can be installed if not found. | ||||||
|     m.make = MakeExecutable('make', jobs) |     m.make = MakeExecutable('make', jobs) | ||||||
|     m.gmake = MakeExecutable('gmake', jobs) |     m.gmake = MakeExecutable('gmake', jobs) | ||||||
|  |     m.scons = MakeExecutable('scons', jobs) | ||||||
|  |  | ||||||
|     # easy shortcut to os.environ |     # easy shortcut to os.environ | ||||||
|     m.env = os.environ |     m.env = os.environ | ||||||
| @@ -325,6 +344,7 @@ def set_module_variables_for_package(pkg, module): | |||||||
|     # TODO: Currently, everything is a link dependency, but tools like |     # TODO: Currently, everything is a link dependency, but tools like | ||||||
|     # TODO: this shouldn't be. |     # TODO: this shouldn't be. | ||||||
|     m.cmake = Executable('cmake') |     m.cmake = Executable('cmake') | ||||||
|  |     m.ctest = Executable('ctest') | ||||||
|  |  | ||||||
|     # standard CMake arguments |     # standard CMake arguments | ||||||
|     m.std_cmake_args = ['-DCMAKE_INSTALL_PREFIX=%s' % pkg.prefix, |     m.std_cmake_args = ['-DCMAKE_INSTALL_PREFIX=%s' % pkg.prefix, | ||||||
| @@ -382,9 +402,13 @@ def get_rpaths(pkg): | |||||||
|  |  | ||||||
|  |  | ||||||
| def parent_class_modules(cls): | def parent_class_modules(cls): | ||||||
|  | <<<<<<< HEAD | ||||||
|     """ |     """ | ||||||
|     Get list of super class modules that are all descend from spack.Package |     Get list of super class modules that are all descend from spack.Package | ||||||
|     """ |     """ | ||||||
|  | ======= | ||||||
|  |     """Get list of super class modules that all descend from spack.Package""" | ||||||
|  | >>>>>>> aa86488fd9809ced16704e4bd4d607c89d6dda75 | ||||||
|     if not issubclass(cls, spack.Package) or issubclass(spack.Package, cls): |     if not issubclass(cls, spack.Package) or issubclass(spack.Package, cls): | ||||||
|         return [] |         return [] | ||||||
|     result = [] |     result = [] | ||||||
|   | |||||||
| @@ -1,4 +1,3 @@ | |||||||
| _copyright = """\ |  | ||||||
| ############################################################################## | ############################################################################## | ||||||
| # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. | # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. | ||||||
| # Produced at the Lawrence Livermore National Laboratory. | # Produced at the Lawrence Livermore National Laboratory. | ||||||
| @@ -23,10 +22,8 @@ | |||||||
| # License along with this program; if not, write to the Free Software | # License along with this program; if not, write to the Free Software | ||||||
| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||||
| ############################################################################## | ############################################################################## | ||||||
| """ |  | ||||||
| import string | import string | ||||||
| import os | import os | ||||||
| import hashlib |  | ||||||
| import re | import re | ||||||
|  |  | ||||||
| from ordereddict_backport import OrderedDict | from ordereddict_backport import OrderedDict | ||||||
| @@ -41,16 +38,37 @@ | |||||||
| from spack.spec import Spec | from spack.spec import Spec | ||||||
| from spack.util.naming import * | from spack.util.naming import * | ||||||
| from spack.repository import Repo, RepoError | from spack.repository import Repo, RepoError | ||||||
| import spack.util.crypto as crypto |  | ||||||
|  |  | ||||||
| from spack.util.executable import which | from spack.util.executable import which | ||||||
| from spack.stage import Stage |  | ||||||
|  |  | ||||||
|  |  | ||||||
| description = "Create a new package file from an archive URL" | description = "Create a new package file from an archive URL" | ||||||
|  |  | ||||||
| package_template = string.Template( | package_template = string.Template("""\ | ||||||
|     _copyright + """ | ############################################################################## | ||||||
|  | # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. | ||||||
|  | # Produced at the Lawrence Livermore National Laboratory. | ||||||
|  | # | ||||||
|  | # 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/llnl/spack | ||||||
|  | # Please also see the LICENSE file 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 | ||||||
|  | ############################################################################## | ||||||
| # | # | ||||||
| # This is a template package file for Spack.  We've put "FIXME" | # This is a template package file for Spack.  We've put "FIXME" | ||||||
| # next to all the things you'll want to change. Once you've handled | # next to all the things you'll want to change. Once you've handled | ||||||
| @@ -68,24 +86,21 @@ | |||||||
| # | # | ||||||
| from spack import * | from spack import * | ||||||
|  |  | ||||||
|  |  | ||||||
| class ${class_name}(Package): | class ${class_name}(Package): | ||||||
|     ""\"FIXME: put a proper description of your package here.""\" |     ""\"FIXME: Put a proper description of your package here.""\" | ||||||
|     # FIXME: add a proper url for your package's homepage here. |  | ||||||
|  |     # FIXME: Add a proper url for your package's homepage here. | ||||||
|     homepage = "http://www.example.com" |     homepage = "http://www.example.com" | ||||||
|     url      = "${url}" |     url      = "${url}" | ||||||
|  |  | ||||||
| ${versions} | ${versions} | ||||||
|  | ${extends} | ||||||
|     # FIXME: Add dependencies if this package requires them. |     # FIXME: Add dependencies if this package requires them. | ||||||
|     # depends_on("foo") |     # depends_on("foo") | ||||||
|  |  | ||||||
|     def install(self, spec, prefix): |     def install(self, spec, prefix): | ||||||
|         # FIXME: Modify the configure line to suit your build system here. | ${install} | ||||||
|         ${configure} |  | ||||||
|  |  | ||||||
|         # FIXME: Add logic to build and install here |  | ||||||
|         make() |  | ||||||
|         make("install") |  | ||||||
| """) | """) | ||||||
|  |  | ||||||
|  |  | ||||||
| @@ -120,41 +135,95 @@ def setup_parser(subparser): | |||||||
|  |  | ||||||
| class ConfigureGuesser(object): | class ConfigureGuesser(object): | ||||||
|     def __call__(self, stage): |     def __call__(self, stage): | ||||||
|         """Try to guess the type of build system used by the project, and return |         """Try to guess the type of build system used by the project. | ||||||
|            an appropriate configure line. |         Set the appropriate default installation instructions and any | ||||||
|         """ |         necessary extensions for Python and R.""" | ||||||
|         autotools = "configure('--prefix=%s' % prefix)" |  | ||||||
|         cmake     = "cmake('.', *std_cmake_args)" |  | ||||||
|         python    = "python('setup.py', 'install', '--prefix=%s' % prefix)" |  | ||||||
|         r         = "R('CMD', 'INSTALL', '--library=%s' % self.module.r_lib_dir, '%s' % self.stage.archive_file)" |  | ||||||
|  |  | ||||||
|         config_lines = ((r'/configure$',      'autotools', autotools), |         # Default installation instructions | ||||||
|                         (r'/CMakeLists.txt$', 'cmake',     cmake), |         installDict = { | ||||||
|                         (r'/setup.py$',       'python',    python), |             'autotools': """\ | ||||||
|                         (r'/NAMESPACE$',      'r',         r)) |         # FIXME: Modify the configure line to suit your build system here. | ||||||
|  |         configure('--prefix={0}'.format(prefix)) | ||||||
|  |  | ||||||
|         # Peek inside the tarball. |         # FIXME: Add logic to build and install here. | ||||||
|         tar = which('tar') |         make() | ||||||
|         output = tar( |         make('install')""", | ||||||
|             "--exclude=*/*/*", "-tf", stage.archive_file, output=str) |  | ||||||
|         lines = output.split("\n") |  | ||||||
|  |  | ||||||
|         # Set the configure line to the one that matched. |             'cmake':     """\ | ||||||
|         for pattern, bs, cl in config_lines: |         with working_dir('spack-build', create=True): | ||||||
|             if any(re.search(pattern, l) for l in lines): |             # FIXME: Modify the cmake line to suit your build system here. | ||||||
|                 config_line = cl |             cmake('..', *std_cmake_args) | ||||||
|                 build_system = bs |  | ||||||
|                 break |             # FIXME: Add logic to build and install here. | ||||||
|  |             make() | ||||||
|  |             make('install')""", | ||||||
|  |  | ||||||
|  |             'scons':     """\ | ||||||
|  |         # FIXME: Add logic to build and install here. | ||||||
|  |         scons('prefix={0}'.format(prefix)) | ||||||
|  |         scons('install')""", | ||||||
|  |  | ||||||
|  |             'python':    """\ | ||||||
|  |         # FIXME: Add logic to build and install here. | ||||||
|  |         python('setup.py', 'install', '--prefix={0}'.format(prefix))""", | ||||||
|  |  | ||||||
|  |             'R':         """\ | ||||||
|  |         # FIXME: Add logic to build and install here. | ||||||
|  |         R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir), | ||||||
|  |           self.stage.source_path)""", | ||||||
|  |  | ||||||
|  |             'unknown':   """\ | ||||||
|  |         # FIXME: Unknown build system | ||||||
|  |         make() | ||||||
|  |         make('install')""" | ||||||
|  |         } | ||||||
|  |  | ||||||
|  |         # A list of clues that give us an idea of the build system a package | ||||||
|  |         # uses. If the regular expression matches a file contained in the | ||||||
|  |         # archive, the corresponding build system is assumed. | ||||||
|  |         clues = [ | ||||||
|  |             (r'/configure$',      'autotools'), | ||||||
|  |             (r'/CMakeLists.txt$', 'cmake'), | ||||||
|  |             (r'/SConstruct$',     'scons'), | ||||||
|  |             (r'/setup.py$',       'python'), | ||||||
|  |             (r'/NAMESPACE$',      'R') | ||||||
|  |         ] | ||||||
|  |  | ||||||
|  |         # Peek inside the compressed file. | ||||||
|  |         if stage.archive_file.endswith('.zip'): | ||||||
|  |             try: | ||||||
|  |                 unzip  = which('unzip') | ||||||
|  |                 output = unzip('-l', stage.archive_file, output=str) | ||||||
|  |             except: | ||||||
|  |                 output = '' | ||||||
|         else: |         else: | ||||||
|             # None matched -- just put both, with cmake commented out |             try: | ||||||
|             config_line =  "# FIXME: Spack couldn't guess one, so here are some options:\n" |                 tar    = which('tar') | ||||||
|             config_line += "        # " + autotools + "\n" |                 output = tar('--exclude=*/*/*', '-tf', | ||||||
|             config_line += "        # " + cmake |                              stage.archive_file, output=str) | ||||||
|             build_system = 'unknown' |             except: | ||||||
|  |                 output = '' | ||||||
|  |         lines = output.split('\n') | ||||||
|  |  | ||||||
|  |         # Determine the build system based on the files contained | ||||||
|  |         # in the archive. | ||||||
|  |         build_system = 'unknown' | ||||||
|  |         for pattern, bs in clues: | ||||||
|  |             if any(re.search(pattern, l) for l in lines): | ||||||
|  |                 build_system = bs | ||||||
|  |  | ||||||
|         self.configure = config_line |  | ||||||
|         self.build_system = build_system |         self.build_system = build_system | ||||||
|  |  | ||||||
|  |         # Set the appropriate default installation instructions | ||||||
|  |         self.install = installDict[build_system] | ||||||
|  |  | ||||||
|  |         # Set any necessary extensions for Python and R | ||||||
|  |         extensions = '' | ||||||
|  |         if build_system in ['python', 'R']: | ||||||
|  |             extensions = "\n    extends('{0}')\n".format(build_system) | ||||||
|  |  | ||||||
|  |         self.extends = extensions | ||||||
|  |  | ||||||
|  |  | ||||||
| def guess_name_and_version(url, args): | def guess_name_and_version(url, args): | ||||||
|     # Try to deduce name and version of the new package from the URL |     # Try to deduce name and version of the new package from the URL | ||||||
| @@ -168,7 +237,7 @@ def guess_name_and_version(url, args): | |||||||
|     else: |     else: | ||||||
|         try: |         try: | ||||||
|             name = spack.url.parse_name(url, version) |             name = spack.url.parse_name(url, version) | ||||||
|         except spack.url.UndetectableNameError, e: |         except spack.url.UndetectableNameError: | ||||||
|             # Use a user-supplied name if one is present |             # Use a user-supplied name if one is present | ||||||
|             tty.die("Couldn't guess a name for this package. Try running:", "", |             tty.die("Couldn't guess a name for this package. Try running:", "", | ||||||
|                     "spack create --name <name> <url>") |                     "spack create --name <name> <url>") | ||||||
| @@ -182,7 +251,8 @@ def guess_name_and_version(url, args): | |||||||
| def find_repository(spec, args): | def find_repository(spec, args): | ||||||
|     # figure out namespace for spec |     # figure out namespace for spec | ||||||
|     if spec.namespace and args.namespace and spec.namespace != args.namespace: |     if spec.namespace and args.namespace and spec.namespace != args.namespace: | ||||||
|         tty.die("Namespaces '%s' and '%s' do not match." % (spec.namespace, args.namespace)) |         tty.die("Namespaces '%s' and '%s' do not match." % (spec.namespace, | ||||||
|  |                                                             args.namespace)) | ||||||
|  |  | ||||||
|     if not spec.namespace and args.namespace: |     if not spec.namespace and args.namespace: | ||||||
|         spec.namespace = args.namespace |         spec.namespace = args.namespace | ||||||
| @@ -193,8 +263,8 @@ def find_repository(spec, args): | |||||||
|         try: |         try: | ||||||
|             repo = Repo(repo_path) |             repo = Repo(repo_path) | ||||||
|             if spec.namespace and spec.namespace != repo.namespace: |             if spec.namespace and spec.namespace != repo.namespace: | ||||||
|                 tty.die("Can't create package with namespace %s in repo with namespace %s" |                 tty.die("Can't create package with namespace %s in repo with " | ||||||
|                         % (spec.namespace, repo.namespace)) |                         "namespace %s" % (spec.namespace, repo.namespace)) | ||||||
|         except RepoError as e: |         except RepoError as e: | ||||||
|             tty.die(str(e)) |             tty.die(str(e)) | ||||||
|     else: |     else: | ||||||
| @@ -214,11 +284,7 @@ def find_repository(spec, args): | |||||||
|  |  | ||||||
| def fetch_tarballs(url, name, version): | def fetch_tarballs(url, name, version): | ||||||
|     """Try to find versions of the supplied archive by scraping the web. |     """Try to find versions of the supplied archive by scraping the web. | ||||||
|  |     Prompts the user to select how many to download if many are found.""" | ||||||
|     Prompts the user to select how many to download if many are found. |  | ||||||
|  |  | ||||||
|  |  | ||||||
|     """ |  | ||||||
|     versions = spack.util.web.find_versions_of_archive(url) |     versions = spack.util.web.find_versions_of_archive(url) | ||||||
|     rkeys = sorted(versions.keys(), reverse=True) |     rkeys = sorted(versions.keys(), reverse=True) | ||||||
|     versions = OrderedDict(zip(rkeys, (versions[v] for v in rkeys))) |     versions = OrderedDict(zip(rkeys, (versions[v] for v in rkeys))) | ||||||
| @@ -277,7 +343,7 @@ def create(parser, args): | |||||||
|         name = 'py-%s' % name |         name = 'py-%s' % name | ||||||
|  |  | ||||||
|     # Prepend 'r-' to R package names, by convention. |     # Prepend 'r-' to R package names, by convention. | ||||||
|     if guesser.build_system == 'r': |     if guesser.build_system == 'R': | ||||||
|         name = 'r-%s' % name |         name = 'r-%s' % name | ||||||
|  |  | ||||||
|     # Create a directory for the new package. |     # Create a directory for the new package. | ||||||
| @@ -292,10 +358,11 @@ def create(parser, args): | |||||||
|         pkg_file.write( |         pkg_file.write( | ||||||
|             package_template.substitute( |             package_template.substitute( | ||||||
|                 name=name, |                 name=name, | ||||||
|                 configure=guesser.configure, |  | ||||||
|                 class_name=mod_to_class(name), |                 class_name=mod_to_class(name), | ||||||
|                 url=url, |                 url=url, | ||||||
|                 versions=make_version_calls(ver_hash_tuples))) |                 versions=make_version_calls(ver_hash_tuples), | ||||||
|  |                 extends=guesser.extends, | ||||||
|  |                 install=guesser.install)) | ||||||
|  |  | ||||||
|     # If everything checks out, go ahead and edit. |     # If everything checks out, go ahead and edit. | ||||||
|     spack.editor(pkg_path) |     spack.editor(pkg_path) | ||||||
|   | |||||||
							
								
								
									
										197
									
								
								var/spack/repos/builtin/packages/cantera/package.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										197
									
								
								var/spack/repos/builtin/packages/cantera/package.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,197 @@ | |||||||
|  | ############################################################################## | ||||||
|  | # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. | ||||||
|  | # Produced at the Lawrence Livermore National Laboratory. | ||||||
|  | # | ||||||
|  | # 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/llnl/spack | ||||||
|  | # Please also see the LICENSE file 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 | ||||||
|  | ############################################################################## | ||||||
|  | from spack import * | ||||||
|  | import os | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class Cantera(Package): | ||||||
|  |     """Cantera is a suite of object-oriented software tools for problems | ||||||
|  |     involving chemical kinetics, thermodynamics, and/or transport processes.""" | ||||||
|  |  | ||||||
|  |     homepage = "http://www.cantera.org/docs/sphinx/html/index.html" | ||||||
|  |     url      = "https://github.com/Cantera/cantera/archive/v2.2.1.tar.gz" | ||||||
|  |  | ||||||
|  |     version('2.2.1', '9d1919bdef39ddec54485fc8a741a3aa') | ||||||
|  |  | ||||||
|  |     variant('lapack',     default=True,  description='Build with external BLAS/LAPACK libraries') | ||||||
|  |     variant('threadsafe', default=True,  description='Build threadsafe, requires Boost') | ||||||
|  |     variant('sundials',   default=True,  description='Build with external Sundials') | ||||||
|  |     variant('python',     default=False, description='Build the Cantera Python module') | ||||||
|  |     variant('matlab',     default=False, description='Build the Cantera Matlab toolbox') | ||||||
|  |  | ||||||
|  |     # Required dependencies | ||||||
|  |     depends_on('scons') | ||||||
|  |  | ||||||
|  |     # Recommended dependencies | ||||||
|  |     depends_on('blas',      when='+lapack') | ||||||
|  |     depends_on('lapack',    when='+lapack') | ||||||
|  |     depends_on('boost',     when='+threadsafe') | ||||||
|  |     depends_on('sundials',  when='+sundials')  # must be compiled with -fPIC | ||||||
|  |  | ||||||
|  |     # Python module dependencies | ||||||
|  |     extends('python', when='+python') | ||||||
|  |     depends_on('py-numpy',  when='+python') | ||||||
|  |     depends_on('py-scipy',  when='+python') | ||||||
|  |     depends_on('py-cython', when='+python') | ||||||
|  |     depends_on('py-3to2',   when='+python') | ||||||
|  |     # TODO: these "when" specs don't actually work | ||||||
|  |     # depends_on('py-unittest2',     when='+python^python@2.6') | ||||||
|  |     # depends_on('py-unittest2py3k', when='+python^python@3.1') | ||||||
|  |  | ||||||
|  |     # Matlab toolbox dependencies | ||||||
|  |     # TODO: add Matlab package | ||||||
|  |     # TODO: allow packages to extend multiple other packages | ||||||
|  |     # extends('matlab',   when='+matlab') | ||||||
|  |  | ||||||
|  |     def install(self, spec, prefix): | ||||||
|  |         # Required options | ||||||
|  |         options = [ | ||||||
|  |             'prefix={0}'.format(prefix), | ||||||
|  |             'CC={0}'.format(os.environ['CC']), | ||||||
|  |             'CXX={0}'.format(os.environ['CXX']), | ||||||
|  |             'F77={0}'.format(os.environ['F77']), | ||||||
|  |             'FORTRAN={0}'.format(os.environ['FC']), | ||||||
|  |             'cc_flags=-fPIC', | ||||||
|  |             # Allow Spack environment variables to propagate through to SCons | ||||||
|  |             'env_vars=all' | ||||||
|  |         ] | ||||||
|  |  | ||||||
|  |         # BLAS/LAPACK support | ||||||
|  |         if '+lapack' in spec: | ||||||
|  |             options.extend([ | ||||||
|  |                 'blas_lapack_libs=lapack,blas', | ||||||
|  |                 'blas_lapack_dir={0}'.format(spec['lapack'].prefix.lib) | ||||||
|  |             ]) | ||||||
|  |  | ||||||
|  |         # Threadsafe build, requires Boost | ||||||
|  |         if '+threadsafe' in spec: | ||||||
|  |             options.extend([ | ||||||
|  |                 'build_thread_safe=yes', | ||||||
|  |                 'boost_inc_dir={0}'.format(spec['boost'].prefix.include), | ||||||
|  |                 'boost_lib_dir={0}'.format(spec['boost'].prefix.lib), | ||||||
|  |                 'boost_thread_lib=boost_thread-mt,boost_system-mt' | ||||||
|  |             ]) | ||||||
|  |         else: | ||||||
|  |             options.append('build_thread_safe=no') | ||||||
|  |  | ||||||
|  |         # Sundials support | ||||||
|  |         if '+sundials' in spec: | ||||||
|  |             options.extend([ | ||||||
|  |                 'use_sundials=y', | ||||||
|  |                 'sundials_include={0}'.format(spec['sundials'].prefix.include), | ||||||
|  |                 'sundials_libdir={0}'.format(spec['sundials'].prefix.lib), | ||||||
|  |                 'sundials_license={0}'.format( | ||||||
|  |                     join_path(spec['sundials'].prefix, 'LICENSE')) | ||||||
|  |             ]) | ||||||
|  |         else: | ||||||
|  |             options.append('use_sundials=n') | ||||||
|  |  | ||||||
|  |         # Python module | ||||||
|  |         if '+python' in spec: | ||||||
|  |             options.extend([ | ||||||
|  |                 'python_package=full', | ||||||
|  |                 'python_cmd={0}'.format( | ||||||
|  |                     join_path(spec['python'].prefix.bin, 'python')), | ||||||
|  |                 'python_array_home={0}'.format(spec['py-numpy'].prefix) | ||||||
|  |             ]) | ||||||
|  |             if spec['python'].satisfies('@3'): | ||||||
|  |                 options.extend([ | ||||||
|  |                     'python3_package=y', | ||||||
|  |                     'python3_cmd={0}'.format( | ||||||
|  |                         join_path(spec['python'].prefix.bin, 'python')), | ||||||
|  |                     'python3_array_home={0}'.format(spec['py-numpy'].prefix) | ||||||
|  |                 ]) | ||||||
|  |             else: | ||||||
|  |                 options.append('python3_package=n') | ||||||
|  |         else: | ||||||
|  |             options.append('python_package=none') | ||||||
|  |             options.append('python3_package=n') | ||||||
|  |  | ||||||
|  |         # Matlab toolbox | ||||||
|  |         if '+matlab' in spec: | ||||||
|  |             options.extend([ | ||||||
|  |                 'matlab_toolbox=y', | ||||||
|  |                 'matlab_path={0}'.format(spec['matlab'].prefix) | ||||||
|  |             ]) | ||||||
|  |         else: | ||||||
|  |             options.append('matlab_toolbox=n') | ||||||
|  |  | ||||||
|  |         scons('build', *options) | ||||||
|  |  | ||||||
|  |         if '+python' in spec: | ||||||
|  |             # Tests will always fail if Python dependencies aren't built | ||||||
|  |             # In addition, 3 of the tests fail when run in parallel | ||||||
|  |             scons('test', parallel=False) | ||||||
|  |  | ||||||
|  |         scons('install') | ||||||
|  |  | ||||||
|  |         self.filter_compilers() | ||||||
|  |  | ||||||
|  |     def filter_compilers(self): | ||||||
|  |         """Run after install to tell the Makefile and SConstruct files to use | ||||||
|  |         the compilers that Spack built the package with. | ||||||
|  |  | ||||||
|  |         If this isn't done, they'll have CC, CXX, F77, and FC set to Spack's | ||||||
|  |         generic cc, c++, f77, and f90. We want them to be bound to whatever | ||||||
|  |         compiler they were built with.""" | ||||||
|  |  | ||||||
|  |         kwargs = {'ignore_absent': True, 'backup': False, 'string': True} | ||||||
|  |         dirname = os.path.join(self.prefix, 'share/cantera/samples') | ||||||
|  |  | ||||||
|  |         cc_files = [ | ||||||
|  |             'cxx/rankine/Makefile',   'cxx/NASA_coeffs/Makefile', | ||||||
|  |             'cxx/kinetics1/Makefile', 'cxx/flamespeed/Makefile', | ||||||
|  |             'cxx/combustor/Makefile', 'f77/SConstruct' | ||||||
|  |         ] | ||||||
|  |  | ||||||
|  |         cxx_files = [ | ||||||
|  |             'cxx/rankine/Makefile',   'cxx/NASA_coeffs/Makefile', | ||||||
|  |             'cxx/kinetics1/Makefile', 'cxx/flamespeed/Makefile', | ||||||
|  |             'cxx/combustor/Makefile' | ||||||
|  |         ] | ||||||
|  |  | ||||||
|  |         f77_files = [ | ||||||
|  |             'f77/Makefile', 'f77/SConstruct' | ||||||
|  |         ] | ||||||
|  |  | ||||||
|  |         fc_files = [ | ||||||
|  |             'f90/Makefile', 'f90/SConstruct' | ||||||
|  |         ] | ||||||
|  |  | ||||||
|  |         for filename in cc_files: | ||||||
|  |             filter_file(os.environ['CC'], self.compiler.cc, | ||||||
|  |                         os.path.join(dirname, filename), **kwargs) | ||||||
|  |  | ||||||
|  |         for filename in cxx_files: | ||||||
|  |             filter_file(os.environ['CXX'], self.compiler.cxx, | ||||||
|  |                         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 fc_files: | ||||||
|  |             filter_file(os.environ['FC'], self.compiler.fc, | ||||||
|  |                         os.path.join(dirname, filename), **kwargs) | ||||||
							
								
								
									
										40
									
								
								var/spack/repos/builtin/packages/py-3to2/package.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										40
									
								
								var/spack/repos/builtin/packages/py-3to2/package.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,40 @@ | |||||||
|  | ############################################################################## | ||||||
|  | # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. | ||||||
|  | # Produced at the Lawrence Livermore National Laboratory. | ||||||
|  | # | ||||||
|  | # 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/llnl/spack | ||||||
|  | # Please also see the LICENSE file 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 | ||||||
|  | ############################################################################## | ||||||
|  | from spack import * | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class Py3to2(Package): | ||||||
|  |     """lib3to2 is a set of fixers that are intended to backport code written | ||||||
|  |     for Python version 3.x into Python version 2.x.""" | ||||||
|  |  | ||||||
|  |     homepage = "https://pypi.python.org/pypi/3to2" | ||||||
|  |     url      = "https://pypi.python.org/packages/source/3/3to2/3to2-1.1.1.zip" | ||||||
|  |  | ||||||
|  |     version('1.1.1', 'cbeed28e350dbdaef86111ace3052824') | ||||||
|  |  | ||||||
|  |     extends('python') | ||||||
|  |  | ||||||
|  |     def install(self, spec, prefix): | ||||||
|  |         python('setup.py', 'install', '--prefix=%s' % prefix) | ||||||
							
								
								
									
										41
									
								
								var/spack/repos/builtin/packages/py-unittest2/package.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										41
									
								
								var/spack/repos/builtin/packages/py-unittest2/package.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,41 @@ | |||||||
|  | ############################################################################## | ||||||
|  | # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. | ||||||
|  | # Produced at the Lawrence Livermore National Laboratory. | ||||||
|  | # | ||||||
|  | # 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/llnl/spack | ||||||
|  | # Please also see the LICENSE file 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 | ||||||
|  | ############################################################################## | ||||||
|  | from spack import * | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class PyUnittest2(Package): | ||||||
|  |     """unittest2 is a backport of the new features added to the unittest | ||||||
|  |     testing framework in Python 2.7 and onwards.""" | ||||||
|  |  | ||||||
|  |     homepage = "https://pypi.python.org/pypi/unittest2" | ||||||
|  |     url      = "https://pypi.python.org/packages/source/u/unittest2/unittest2-1.1.0.tar.gz" | ||||||
|  |  | ||||||
|  |     version('1.1.0', 'f72dae5d44f091df36b6b513305ea000') | ||||||
|  |  | ||||||
|  |     extends('python') | ||||||
|  |     depends_on('py-setuptools') | ||||||
|  |  | ||||||
|  |     def install(self, spec, prefix): | ||||||
|  |         python('setup.py', 'install', '--prefix=%s' % prefix) | ||||||
							
								
								
									
										42
									
								
								var/spack/repos/builtin/packages/py-unittest2py3k/package.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										42
									
								
								var/spack/repos/builtin/packages/py-unittest2py3k/package.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,42 @@ | |||||||
|  | ############################################################################## | ||||||
|  | # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. | ||||||
|  | # Produced at the Lawrence Livermore National Laboratory. | ||||||
|  | # | ||||||
|  | # 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/llnl/spack | ||||||
|  | # Please also see the LICENSE file 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 | ||||||
|  | ############################################################################## | ||||||
|  | from spack import * | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class PyUnittest2py3k(Package): | ||||||
|  |     """unittest2 is a backport of the new features added to the unittest | ||||||
|  |     testing framework in Python 2.7 and 3.2. This is a Python 3 compatible | ||||||
|  |     version of unittest2.""" | ||||||
|  |  | ||||||
|  |     homepage = "https://pypi.python.org/pypi/unittest2py3k" | ||||||
|  |     url      = "https://pypi.python.org/packages/source/u/unittest2py3k/unittest2py3k-0.5.1.tar.gz" | ||||||
|  |  | ||||||
|  |     version('0.5.1', '8824ff92044310d9365f90d892bf0f09') | ||||||
|  |  | ||||||
|  |     extends('python') | ||||||
|  |     depends_on('py-setuptools') | ||||||
|  |  | ||||||
|  |     def install(self, spec, prefix): | ||||||
|  |         python('setup.py', 'install', '--prefix=%s' % prefix) | ||||||
| @@ -28,6 +28,7 @@ | |||||||
| class Serf(Package): | class Serf(Package): | ||||||
|     """Apache Serf - a high performance C-based HTTP client library |     """Apache Serf - a high performance C-based HTTP client library | ||||||
|     built upon the Apache Portable Runtime (APR) library""" |     built upon the Apache Portable Runtime (APR) library""" | ||||||
|  |  | ||||||
|     homepage  = 'https://serf.apache.org/' |     homepage  = 'https://serf.apache.org/' | ||||||
|     url       = 'https://archive.apache.org/dist/serf/serf-1.3.8.tar.bz2' |     url       = 'https://archive.apache.org/dist/serf/serf-1.3.8.tar.bz2' | ||||||
|  |  | ||||||
| @@ -41,8 +42,6 @@ class Serf(Package): | |||||||
|     depends_on('zlib') |     depends_on('zlib') | ||||||
|  |  | ||||||
|     def install(self, spec, prefix): |     def install(self, spec, prefix): | ||||||
|         scons = which("scons") |  | ||||||
|  |  | ||||||
|         options = ['PREFIX=%s' % prefix] |         options = ['PREFIX=%s' % prefix] | ||||||
|         options.append('APR=%s' % spec['apr'].prefix) |         options.append('APR=%s' % spec['apr'].prefix) | ||||||
|         options.append('APU=%s' % spec['apr-util'].prefix) |         options.append('APU=%s' % spec['apr-util'].prefix) | ||||||
|   | |||||||
| @@ -23,17 +23,151 @@ | |||||||
| # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA | ||||||
| ############################################################################## | ############################################################################## | ||||||
| from spack import * | from spack import * | ||||||
|  | import os | ||||||
|  |  | ||||||
|  |  | ||||||
| class Sundials(Package): | class Sundials(Package): | ||||||
|     """SUNDIALS (SUite of Nonlinear and DIfferential/ALgebraic equation Solvers)""" |     """SUNDIALS (SUite of Nonlinear and DIfferential/ALgebraic equation | ||||||
|  |     Solvers)""" | ||||||
|  |  | ||||||
|     homepage = "http://computation.llnl.gov/casc/sundials/" |     homepage = "http://computation.llnl.gov/casc/sundials/" | ||||||
|     url      = "http://computation.llnl.gov/casc/sundials/download/code/sundials-2.5.0.tar.gz" |     url      = "http://computation.llnl.gov/projects/sundials-suite-nonlinear-differential-algebraic-equation-solvers/download/sundials-2.6.2.tar.gz" | ||||||
|  |  | ||||||
|     version('2.5.0', 'aba8b56eec600de3109cfb967aa3ba0f') |     version('2.6.2', '3deeb0ede9f514184c6bd83ecab77d95') | ||||||
|  |  | ||||||
|     depends_on("mpi") |     variant('mpi',     default=True,  description='Enable MPI support') | ||||||
|  |     variant('lapack',  default=True,  description='Build with external BLAS/LAPACK libraries') | ||||||
|  |     variant('klu',     default=False, description='Build with SuiteSparse KLU libraries') | ||||||
|  |     variant('superlu', default=False, description='Build with SuperLU_MT libraries') | ||||||
|  |     variant('openmp',  default=False, description='Enable OpenMP support') | ||||||
|  |     variant('pthread', default=True,  description='Enable POSIX threads support') | ||||||
|  |  | ||||||
|  |     depends_on('mpi',                when='+mpi') | ||||||
|  |     depends_on('blas',               when='+lapack') | ||||||
|  |     depends_on('lapack',             when='+lapack') | ||||||
|  |     depends_on('suite-sparse',       when='+klu') | ||||||
|  |     depends_on('superlu-mt+openmp',  when='+superlu+openmp') | ||||||
|  |     depends_on('superlu-mt+pthread', when='+superlu+pthread') | ||||||
|  |  | ||||||
|     def install(self, spec, prefix): |     def install(self, spec, prefix): | ||||||
|         configure("--prefix=%s" % prefix) |         cmake_args = std_cmake_args[:] | ||||||
|  |         cmake_args.extend([ | ||||||
|  |             '-DBUILD_SHARED_LIBS=ON', | ||||||
|  |             '-DCMAKE_C_FLAGS=-fPIC', | ||||||
|  |             '-DCMAKE_Fortran_FLAGS=-fPIC', | ||||||
|  |             '-DEXAMPLES_ENABLE=ON', | ||||||
|  |             '-DEXAMPLES_INSTALL=ON', | ||||||
|  |             '-DFCMIX_ENABLE=ON' | ||||||
|  |         ]) | ||||||
|  |  | ||||||
|  |         # MPI support | ||||||
|  |         if '+mpi' in spec: | ||||||
|  |             cmake_args.extend([ | ||||||
|  |                 '-DMPI_ENABLE=ON', | ||||||
|  |                 '-DMPI_MPICC={0}'.format(spec['mpi'].mpicc), | ||||||
|  |                 '-DMPI_MPIF77={0}'.format(spec['mpi'].mpif77) | ||||||
|  |             ]) | ||||||
|  |         else: | ||||||
|  |             cmake_args.append('-DMPI_ENABLE=OFF') | ||||||
|  |  | ||||||
|  |         # Building with LAPACK and BLAS | ||||||
|  |         if '+lapack' in spec: | ||||||
|  |             cmake_args.extend([ | ||||||
|  |                 '-DLAPACK_ENABLE=ON', | ||||||
|  |                 '-DLAPACK_LIBRARIES={0};{1}'.format( | ||||||
|  |                     spec['lapack'].lapack_shared_lib, | ||||||
|  |                     spec['blas'].blas_shared_lib | ||||||
|  |                 ) | ||||||
|  |             ]) | ||||||
|  |         else: | ||||||
|  |             cmake_args.append('-DLAPACK_ENABLE=OFF') | ||||||
|  |  | ||||||
|  |         # Building with KLU | ||||||
|  |         if '+klu' in spec: | ||||||
|  |             cmake_args.extend([ | ||||||
|  |                 '-DKLU_ENABLE=ON', | ||||||
|  |                 '-DKLU_INCLUDE_DIR={0}'.format( | ||||||
|  |                     spec['suite-sparse'].prefix.include), | ||||||
|  |                 '-DKLU_LIBRARY_DIR={0}'.format( | ||||||
|  |                     spec['suite-sparse'].prefix.lib) | ||||||
|  |             ]) | ||||||
|  |         else: | ||||||
|  |             cmake_args.append('-DKLU_ENABLE=OFF') | ||||||
|  |  | ||||||
|  |         # Building with SuperLU_MT | ||||||
|  |         if '+superlu' in spec: | ||||||
|  |             cmake_args.extend([ | ||||||
|  |                 '-DSUPERLUMT_ENABLE=ON', | ||||||
|  |                 '-DSUPERLUMT_INCLUDE_DIR={0}'.format( | ||||||
|  |                     spec['superlu-mt'].prefix.include), | ||||||
|  |                 '-DSUPERLUMT_LIBRARY_DIR={0}'.format( | ||||||
|  |                     spec['superlu-mt'].prefix.lib) | ||||||
|  |             ]) | ||||||
|  |             if '+openmp' in spec: | ||||||
|  |                 cmake_args.append('-DSUPERLUMT_THREAD_TYPE=OpenMP') | ||||||
|  |             elif '+pthread' in spec: | ||||||
|  |                 cmake_args.append('-DSUPERLUMT_THREAD_TYPE=Pthread') | ||||||
|  |             else: | ||||||
|  |                 msg  = 'You must choose either +openmp or +pthread when ' | ||||||
|  |                 msg += 'building with SuperLU_MT' | ||||||
|  |                 raise RuntimeError(msg) | ||||||
|  |         else: | ||||||
|  |             cmake_args.append('-DSUPERLUMT_ENABLE=OFF') | ||||||
|  |  | ||||||
|  |         # OpenMP support | ||||||
|  |         if '+openmp' in spec: | ||||||
|  |             cmake_args.append('-DOPENMP_ENABLE=ON') | ||||||
|  |         else: | ||||||
|  |             cmake_args.append('-DOPENMP_ENABLE=OFF') | ||||||
|  |  | ||||||
|  |         # POSIX threads support | ||||||
|  |         if '+pthread' in spec: | ||||||
|  |             cmake_args.append('-DPTHREAD_ENABLE=ON') | ||||||
|  |         else: | ||||||
|  |             cmake_args.append('-DPTHREAD_ENABLE=OFF') | ||||||
|  |  | ||||||
|  |         with working_dir('build', create=True): | ||||||
|  |             cmake('..', *cmake_args) | ||||||
|  |  | ||||||
|             make() |             make() | ||||||
|         make("install") |             make('install') | ||||||
|  |  | ||||||
|  |         install('LICENSE', prefix) | ||||||
|  |  | ||||||
|  |         self.filter_compilers() | ||||||
|  |  | ||||||
|  |     def filter_compilers(self): | ||||||
|  |         """Run after install to tell the Makefiles to use | ||||||
|  |         the compilers that Spack built the package with. | ||||||
|  |  | ||||||
|  |         If this isn't done, they'll have CC, CPP, and F77 set to | ||||||
|  |         Spack's generic cc and f77. We want them to be bound to | ||||||
|  |         whatever compiler they were built with.""" | ||||||
|  |  | ||||||
|  |         kwargs = {'ignore_absent': True, 'backup': False, 'string': True} | ||||||
|  |         dirname = os.path.join(self.prefix, 'examples') | ||||||
|  |  | ||||||
|  |         cc_files = [ | ||||||
|  |             'arkode/C_serial/Makefile',  'arkode/C_parallel/Makefile', | ||||||
|  |             'cvode/serial/Makefile',     'cvode/parallel/Makefile', | ||||||
|  |             'cvodes/serial/Makefile',    'cvodes/parallel/Makefile', | ||||||
|  |             'ida/serial/Makefile',       'ida/parallel/Makefile', | ||||||
|  |             'idas/serial/Makefile',      'idas/parallel/Makefile', | ||||||
|  |             'kinsol/serial/Makefile',    'kinsol/parallel/Makefile', | ||||||
|  |             'nvector/serial/Makefile',   'nvector/parallel/Makefile', | ||||||
|  |             'nvector/pthreads/Makefile' | ||||||
|  |         ] | ||||||
|  |  | ||||||
|  |         f77_files = [ | ||||||
|  |             'arkode/F77_serial/Makefile', 'cvode/fcmix_serial/Makefile', | ||||||
|  |             'ida/fcmix_serial/Makefile',  'ida/fcmix_pthreads/Makefile', | ||||||
|  |             'kinsol/fcmix_serial/Makefile' | ||||||
|  |         ] | ||||||
|  |  | ||||||
|  |         for filename in cc_files: | ||||||
|  |             filter_file(os.environ['CC'], 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) | ||||||
|   | |||||||
							
								
								
									
										134
									
								
								var/spack/repos/builtin/packages/superlu-mt/package.py
									
									
									
									
									
										Normal file
									
								
							
							
						
						
									
										134
									
								
								var/spack/repos/builtin/packages/superlu-mt/package.py
									
									
									
									
									
										Normal file
									
								
							| @@ -0,0 +1,134 @@ | |||||||
|  | ############################################################################## | ||||||
|  | # Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. | ||||||
|  | # Produced at the Lawrence Livermore National Laboratory. | ||||||
|  | # | ||||||
|  | # 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/llnl/spack | ||||||
|  | # Please also see the LICENSE file 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 | ||||||
|  | ############################################################################## | ||||||
|  | from spack import * | ||||||
|  | import glob | ||||||
|  | import os | ||||||
|  |  | ||||||
|  |  | ||||||
|  | class SuperluMt(Package): | ||||||
|  |     """SuperLU is a general purpose library for the direct solution of large, | ||||||
|  |     sparse, nonsymmetric systems of linear equations on high performance | ||||||
|  |     machines. SuperLU_MT is designed for shared memory parallel machines.""" | ||||||
|  |  | ||||||
|  |     homepage = "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/#superlu_mt" | ||||||
|  |     url      = "http://crd-legacy.lbl.gov/~xiaoye/SuperLU/superlu_mt_3.1.tar.gz" | ||||||
|  |  | ||||||
|  |     version('3.1', '06ac62f1b4b7d17123fffa0d0c315e91') | ||||||
|  |  | ||||||
|  |     variant('blas',    default=True,  description='Build with external BLAS library') | ||||||
|  |  | ||||||
|  |     # Must choose one or the other | ||||||
|  |     variant('openmp',  default=False, description='Build with OpenMP support') | ||||||
|  |     variant('pthread', default=True,  description='Build with POSIX threads support') | ||||||
|  |  | ||||||
|  |     # NOTE: must link with a single-threaded BLAS library | ||||||
|  |     depends_on('blas', when='+blas') | ||||||
|  |  | ||||||
|  |     # Cannot be built in parallel | ||||||
|  |     parallel = False | ||||||
|  |  | ||||||
|  |     def configure(self, spec): | ||||||
|  |         # Validate chosen variants | ||||||
|  |         if '+openmp' in spec and '+pthread' in spec: | ||||||
|  |             msg = 'You cannot choose both +openmp and +pthread' | ||||||
|  |             raise RuntimeError(msg) | ||||||
|  |         if '~openmp' in spec and '~pthread' in spec: | ||||||
|  |             msg = 'You must choose either +openmp or +pthread' | ||||||
|  |             raise RuntimeError(msg) | ||||||
|  |  | ||||||
|  |         # List of configuration options | ||||||
|  |         config = [] | ||||||
|  |  | ||||||
|  |         # The machine (platform) identifier to append to the library names | ||||||
|  |         if '+openmp' in spec: | ||||||
|  |             # OpenMP | ||||||
|  |             config.extend([ | ||||||
|  |                 'PLAT       = _OPENMP', | ||||||
|  |                 'TMGLIB     = libtmglib.a', | ||||||
|  |                 'MPLIB      = {0}'.format(self.compiler.openmp_flag), | ||||||
|  |                 'CFLAGS     = {0}'.format(self.compiler.openmp_flag), | ||||||
|  |                 'FFLAGS     = {0}'.format(self.compiler.openmp_flag) | ||||||
|  |             ]) | ||||||
|  |         elif '+pthread' in spec: | ||||||
|  |             # POSIX threads | ||||||
|  |             config.extend([ | ||||||
|  |                 'PLAT       = _PTHREAD', | ||||||
|  |                 'TMGLIB     = libtmglib$(PLAT).a', | ||||||
|  |                 'MPLIB      = -lpthread' | ||||||
|  |             ]) | ||||||
|  |  | ||||||
|  |         # The BLAS library | ||||||
|  |         # NOTE: must link with a single-threaded BLAS library | ||||||
|  |         if '+blas' in spec: | ||||||
|  |             config.extend([ | ||||||
|  |                 'BLASDEF    = -DUSE_VENDOR_BLAS', | ||||||
|  |                 'BLASLIB    = -L{0} -lblas'.format(spec['blas'].prefix.lib) | ||||||
|  |             ]) | ||||||
|  |         else: | ||||||
|  |             config.append('BLASLIB    = ../lib/libblas$(PLAT).a') | ||||||
|  |  | ||||||
|  |         # Generic options | ||||||
|  |         config.extend([ | ||||||
|  |             # The name of the libraries to be created/linked to | ||||||
|  |             'SUPERLULIB = libsuperlu_mt$(PLAT).a', | ||||||
|  |             'MATHLIB    = -lm', | ||||||
|  |             # The archiver and the flag(s) to use when building archives | ||||||
|  |             'ARCH       = ar', | ||||||
|  |             'ARCHFLAGS  = cr', | ||||||
|  |             'RANLIB     = {0}'.format('ranlib' if which('ranlib') else 'echo'), | ||||||
|  |             # Definitions used by CPP | ||||||
|  |             'PREDEFS    = -D_$(PLAT)', | ||||||
|  |             # Compilers and flags | ||||||
|  |             'CC         = {0}'.format(os.environ['CC']), | ||||||
|  |             'CFLAGS    += $(PREDEFS) -D_LONGINT', | ||||||
|  |             'NOOPTS     = -O0', | ||||||
|  |             'FORTRAN    = {0}'.format(os.environ['FC']), | ||||||
|  |             'LOADER     = {0}'.format(os.environ['CC']), | ||||||
|  |             # C preprocessor defs for compilation | ||||||
|  |             'CDEFS      = -DAdd_' | ||||||
|  |         ]) | ||||||
|  |  | ||||||
|  |         # Write configuration options to include file | ||||||
|  |         with open('make.inc', 'w') as inc: | ||||||
|  |             for option in config: | ||||||
|  |                 inc.write('{0}\n'.format(option)) | ||||||
|  |  | ||||||
|  |     def install(self, spec, prefix): | ||||||
|  |         # Set up make include file manually | ||||||
|  |         self.configure(spec) | ||||||
|  |  | ||||||
|  |         # BLAS needs to be compiled separately if using internal BLAS library | ||||||
|  |         if '+blas' not in spec: | ||||||
|  |             make('blaslib') | ||||||
|  |  | ||||||
|  |         make() | ||||||
|  |  | ||||||
|  |         # Install manually | ||||||
|  |         install_tree('lib', prefix.lib) | ||||||
|  |  | ||||||
|  |         headers = glob.glob(join_path('SRC', '*.h')) | ||||||
|  |         mkdir(prefix.include) | ||||||
|  |         for h in headers: | ||||||
|  |             install(h, prefix.include) | ||||||
		Reference in New Issue
	
	Block a user
	 Todd Gamblin
					Todd Gamblin