diff options
211 files changed, 5596 insertions, 1240 deletions
diff --git a/.gitignore b/.gitignore index b1215f0c7e..e6200a0676 100644 --- a/.gitignore +++ b/.gitignore @@ -1,3 +1,4 @@ +/db /var/spack/stage /var/spack/cache /var/spack/repos/*/index.yaml @@ -12,6 +13,7 @@ /etc/spackconfig /share/spack/dotkit /share/spack/modules +/share/spack/lmod /TAGS /htmlcov .coverage @@ -20,7 +20,7 @@ written in pure Python, and specs allow package authors to write a single build script for many different builds of the same package. See the -[Feature Overview](http://spack.readthedocs.io/latest/features.html) +[Feature Overview](http://spack.readthedocs.io/en/latest/features.html) for examples and highlights. To install spack and install your first package: @@ -111,8 +111,12 @@ while read line && ((lines < 2)) ; do done < "$script" # Invoke any interpreter found, or raise an error if none was found. -if [ -n "$interpreter" ]; then - exec $interpreter "$@" +if [[ -n "$interpreter" ]]; then + if [[ "${interpreter##*/}" = "perl" ]]; then + exec $interpreter -x "$@" + else + exec $interpreter "$@" + fi else echo "error: sbang found no interpreter in $script" exit 1 @@ -25,9 +25,9 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## import sys -if not sys.version_info[:2] >= (2, 6): +if (sys.version_info[0] > 2) or (sys.version_info[:2] < (2, 6)): v_info = sys.version_info[:3] - sys.exit("Spack requires Python 2.6 or higher. " + sys.exit("Spack requires Python 2.6 or 2.7. " "This is Python %d.%d.%d." % v_info) import os diff --git a/etc/spack/defaults/packages.yaml b/etc/spack/defaults/packages.yaml index 83f9eb7ece..a6b361d908 100644 --- a/etc/spack/defaults/packages.yaml +++ b/etc/spack/defaults/packages.yaml @@ -19,3 +19,4 @@ packages: mpi: [openmpi, mpich] blas: [openblas] lapack: [openblas] + pil: [py-pillow] diff --git a/lib/spack/docs/Makefile b/lib/spack/docs/Makefile index 95d26041b7..1b56959aad 100644 --- a/lib/spack/docs/Makefile +++ b/lib/spack/docs/Makefile @@ -2,12 +2,12 @@ # # You can set these variables from the command line. -SPHINXOPTS = +SPHINXOPTS = -E SPHINXBUILD = sphinx-build PAPER = BUILDDIR = _build -export PYTHONPATH = ../../spack +export PYTHONPATH := ../../spack:$(PYTHONPATH) APIDOC_FILES = spack*.rst # Internal variables. diff --git a/lib/spack/docs/command_index.in b/lib/spack/docs/command_index.in index 94cdf38109..8c5c97dd9c 100644 --- a/lib/spack/docs/command_index.in +++ b/lib/spack/docs/command_index.in @@ -1,5 +1,4 @@ -.. _command_index: - +================= Command index ================= diff --git a/lib/spack/docs/conf.py b/lib/spack/docs/conf.py index 43d37f1526..57469964ee 100644 --- a/lib/spack/docs/conf.py +++ b/lib/spack/docs/conf.py @@ -1,10 +1,7 @@ # flake8: noqa ############################################################################## -# Copyright (c) 2013, Lawrence Livermore National Security, LLC. -# Produced at the Lawrence Livermore National Laboratory. -# # This file is part of Spack. -# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# Created by Todd Gamblin, tgamblin@llnl.gov. # LLNL-CODE-647188 # # For details, see https://github.com/llnl/spack @@ -65,14 +62,15 @@ spack_version = subprocess.Popen( # Set an environment variable so that colify will print output like it would to # a terminal. -os.environ['COLIFY_SIZE'] = '25x80' +os.environ['COLIFY_SIZE'] = '25x120' # # Generate package list using spack command # -with open('package_list.rst', 'w') as plist_file: - subprocess.Popen( - [spack_root + '/bin/spack', 'package-list'], stdout=plist_file) +if not os.path.exists('package_list.rst'): + with open('package_list.rst', 'w') as plist_file: + subprocess.Popen( + [spack_root + '/bin/spack', 'package-list'], stdout=plist_file) # # Find all the `spack-*` references and add them to a command index @@ -85,11 +83,12 @@ for filename in glob('*rst'): if match: command_names.append(match.group(1).strip()) -shutil.copy('command_index.in', 'command_index.rst') -with open('command_index.rst', 'a') as index: - index.write('\n') - for cmd in sorted(command_names): - index.write(' * :ref:`%s`\n' % cmd) +if not os.path.exists('command_index.rst'): + shutil.copy('command_index.in', 'command_index.rst') + with open('command_index.rst', 'a') as index: + index.write('\n') + for cmd in sorted(command_names): + index.write(' * :ref:`%s`\n' % cmd) # Run sphinx-apidoc diff --git a/lib/spack/docs/configuration.rst b/lib/spack/docs/configuration.rst index ba534d1e62..6de823c845 100644 --- a/lib/spack/docs/configuration.rst +++ b/lib/spack/docs/configuration.rst @@ -207,7 +207,7 @@ supply ``-p`` to Spack on the command line, before any subcommands. ``spack --profile`` output looks like this: -.. command-output:: spack --profile graph dyninst +.. command-output:: spack --profile graph --deptype=nobuild dyninst :ellipsis: 25 The bottom of the output shows the top most time consuming functions, diff --git a/lib/spack/docs/packaging_guide.rst b/lib/spack/docs/packaging_guide.rst index 6936b5e423..70cd58f6c1 100644 --- a/lib/spack/docs/packaging_guide.rst +++ b/lib/spack/docs/packaging_guide.rst @@ -2090,12 +2090,11 @@ Blas and Lapack libraries Different packages provide implementation of ``Blas`` and ``Lapack`` routines. The names of the resulting static and/or shared libraries differ from package -to package. In order to make the ``install()`` method indifferent to the +to package. In order to make the ``install()`` method independent of the choice of ``Blas`` implementation, each package which provides it -sets up ``self.spec.blas_shared_lib`` and ``self.spec.blas_static_lib`` to -point to the shared and static ``Blas`` libraries, respectively. The same -applies to packages which provide ``Lapack``. Package developers are advised to -use these variables, for example ``spec['blas'].blas_shared_lib`` instead of +sets up ``self.spec.blas_libs`` to point to the correct ``Blas`` libraries. +The same applies to packages which provide ``Lapack``. Package developers are advised to +use these variables, for example ``spec['blas'].blas_libs.joined()`` instead of hard-coding ``join_path(spec['blas'].prefix.lib, 'libopenblas.so')``. ^^^^^^^^^^^^^^^^^^^^^ @@ -2889,9 +2888,22 @@ dependency graph. For example: .. command-output:: spack graph mpileaks -At the top is the root package in the DAG, with dependency edges -emerging from it. On a color terminal, the edges are colored by which -dependency they lead to. +At the top is the root package in the DAG, with dependency edges emerging +from it. On a color terminal, the edges are colored by which dependency +they lead to. + +.. command-output:: spack graph --deptype=all mpileaks + +The ``deptype`` argument tells Spack what types of dependencies to graph. +By default it includes link and run dependencies but not build +dependencies. Supplying ``--deptype=all`` will show the build +dependencies as well. This is equivalent to +``--deptype=build,link,run``. Options for ``deptype`` include: + +* Any combination of ``build``, ``link``, and ``run`` separated by + commas. +* ``nobuild``, ``nolink``, ``norun`` to omit one type. +* ``all`` or ``alldeps`` for all types of dependencies. You can also use ``spack graph`` to generate graphs in the widely used `Dot <http://www.graphviz.org/doc/info/lang.html>`_ format. For diff --git a/lib/spack/env/cc b/lib/spack/env/cc index c6bb50d261..4b8922178a 100755 --- a/lib/spack/env/cc +++ b/lib/spack/env/cc @@ -266,22 +266,38 @@ for dep in "${deps[@]}"; do # Prepend lib and RPATH directories if [[ -d $dep/lib ]]; then if [[ $mode == ccld ]]; then - $add_rpaths && args=("$rpath$dep/lib" "${args[@]}") - args=("-L$dep/lib" "${args[@]}") + if [[ $SPACK_RPATH_DEPS == *$dep* ]]; then + $add_rpaths && args=("$rpath$dep/lib" "${args[@]}") + fi + if [[ $SPACK_LINK_DEPS == *$dep* ]]; then + args=("-L$dep/lib" "${args[@]}") + fi elif [[ $mode == ld ]]; then - $add_rpaths && args=("-rpath" "$dep/lib" "${args[@]}") - args=("-L$dep/lib" "${args[@]}") + if [[ $SPACK_RPATH_DEPS == *$dep* ]]; then + $add_rpaths && args=("-rpath" "$dep/lib" "${args[@]}") + fi + if [[ $SPACK_LINK_DEPS == *$dep* ]]; then + args=("-L$dep/lib" "${args[@]}") + fi fi fi # Prepend lib64 and RPATH directories if [[ -d $dep/lib64 ]]; then if [[ $mode == ccld ]]; then - $add_rpaths && args=("$rpath$dep/lib64" "${args[@]}") - args=("-L$dep/lib64" "${args[@]}") + if [[ $SPACK_RPATH_DEPS == *$dep* ]]; then + $add_rpaths && args=("$rpath$dep/lib64" "${args[@]}") + fi + if [[ $SPACK_LINK_DEPS == *$dep* ]]; then + args=("-L$dep/lib64" "${args[@]}") + fi elif [[ $mode == ld ]]; then - $add_rpaths && args=("-rpath" "$dep/lib64" "${args[@]}") - args=("-L$dep/lib64" "${args[@]}") + if [[ $SPACK_RPATH_DEPS == *$dep* ]]; then + $add_rpaths && args=("-rpath" "$dep/lib64" "${args[@]}") + fi + if [[ $SPACK_LINK_DEPS == *$dep* ]]; then + args=("-L$dep/lib64" "${args[@]}") + fi fi fi done diff --git a/lib/spack/llnl/util/filesystem.py b/lib/spack/llnl/util/filesystem.py index 22ca85abf9..c3ecfde4f4 100644 --- a/lib/spack/llnl/util/filesystem.py +++ b/lib/spack/llnl/util/filesystem.py @@ -22,18 +22,22 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## -import os +import collections +import errno +import fileinput +import getpass import glob +import numbers +import os import re import shutil import stat -import errno -import getpass -from contextlib import contextmanager import subprocess -import fileinput +import sys +from contextlib import contextmanager import llnl.util.tty as tty +from llnl.util.lang import dedupe __all__ = ['set_install_permissions', 'install', 'install_tree', 'traverse_tree', @@ -42,8 +46,8 @@ __all__ = ['set_install_permissions', 'install', 'install_tree', 'filter_file', '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', 'to_lib_name'] + 'remove_dead_links', 'remove_linked_tree', + 'fix_darwin_install_name', 'find_libraries', 'LibraryList'] def filter_file(regex, repl, *filenames, **kwargs): @@ -326,7 +330,7 @@ def traverse_tree(source_root, dest_root, rel_path='', **kwargs): follow_links = kwargs.get('follow_link', False) # Yield in pre or post order? - order = kwargs.get('order', 'pre') + order = kwargs.get('order', 'pre') if order not in ('pre', 'post'): raise ValueError("Order must be 'pre' or 'post'.") @@ -338,7 +342,7 @@ def traverse_tree(source_root, dest_root, rel_path='', **kwargs): return source_path = os.path.join(source_root, rel_path) - dest_path = os.path.join(dest_root, rel_path) + dest_path = os.path.join(dest_root, rel_path) # preorder yields directories before children if order == 'pre': @@ -346,8 +350,8 @@ def traverse_tree(source_root, dest_root, rel_path='', **kwargs): for f in os.listdir(source_path): source_child = os.path.join(source_path, f) - dest_child = os.path.join(dest_path, f) - rel_child = os.path.join(rel_path, f) + dest_child = os.path.join(dest_path, f) + rel_child = os.path.join(rel_path, f) # Treat as a directory if os.path.isdir(source_child) and ( @@ -440,35 +444,162 @@ def fix_darwin_install_name(path): stdout=subprocess.PIPE).communicate()[0] break +# Utilities for libraries + -def to_lib_name(library): - """Transforms a path to the library /path/to/lib<name>.xyz into <name> +class LibraryList(collections.Sequence): + """Sequence of absolute paths to libraries + + Provides a few convenience methods to manipulate library paths and get + commonly used compiler flags or names """ - # Assume libXYZ.suffix - return os.path.basename(library)[3:].split(".")[0] + def __init__(self, libraries): + self.libraries = list(libraries) -def to_link_flags(library): - """Transforms a path to a <library> into linking flags -L<dir> -l<name>. + @property + def directories(self): + """Stable de-duplication of the directories where the libraries + reside - Return: - A string of linking flags. - """ - dir = os.path.dirname(library) - name = to_lib_name(library) - res = '-L%s -l%s' % (dir, name) - return res + >>> l = LibraryList(['/dir1/liba.a', '/dir2/libb.a', '/dir1/libc.a']) + >>> assert l.directories == ['/dir1', '/dir2'] + """ + return list(dedupe( + os.path.dirname(x) for x in self.libraries if os.path.dirname(x) + )) + + @property + def basenames(self): + """Stable de-duplication of the base-names in the list + + >>> l = LibraryList(['/dir1/liba.a', '/dir2/libb.a', '/dir3/liba.a']) + >>> assert l.basenames == ['liba.a', 'libb.a'] + """ + return list(dedupe(os.path.basename(x) for x in self.libraries)) + + @property + def names(self): + """Stable de-duplication of library names in the list + + >>> l = LibraryList(['/dir1/liba.a', '/dir2/libb.a', '/dir3/liba.so']) + >>> assert l.names == ['a', 'b'] + """ + return list(dedupe(x.split('.')[0][3:] for x in self.basenames)) + + @property + def search_flags(self): + """Search flags for the libraries + + >>> l = LibraryList(['/dir1/liba.a', '/dir2/libb.a', '/dir1/liba.so']) + >>> assert l.search_flags == '-L/dir1 -L/dir2' + """ + return ' '.join(['-L' + x for x in self.directories]) + + @property + def link_flags(self): + """Link flags for the libraries + + >>> l = LibraryList(['/dir1/liba.a', '/dir2/libb.a', '/dir1/liba.so']) + >>> assert l.search_flags == '-la -lb' + """ + return ' '.join(['-l' + name for name in self.names]) + @property + def ld_flags(self): + """Search flags + link flags -def find_library_path(libname, *paths): - """Searches for a file called <libname> in each path. + >>> l = LibraryList(['/dir1/liba.a', '/dir2/libb.a', '/dir1/liba.so']) + >>> assert l.search_flags == '-L/dir1 -L/dir2 -la -lb' + """ + return self.search_flags + ' ' + self.link_flags - Return: - directory where the library was found, if found. None otherwise. + def __getitem__(self, item): + cls = type(self) + if isinstance(item, numbers.Integral): + return self.libraries[item] + return cls(self.libraries[item]) + def __add__(self, other): + return LibraryList(dedupe(self.libraries + list(other))) + + def __radd__(self, other): + return self.__add__(other) + + def __eq__(self, other): + return self.libraries == other.libraries + + def __len__(self): + return len(self.libraries) + + def joined(self, separator=' '): + return separator.join(self.libraries) + + def __repr__(self): + return self.__class__.__name__ + '(' + repr(self.libraries) + ')' + + def __str__(self): + return self.joined() + + +def find_libraries(args, root, shared=True, recurse=False): + """Returns an iterable object containing a list of full paths to + libraries if found. + + Args: + args: iterable object containing a list of library names to \ + search for (e.g. 'libhdf5') + root: root folder where to start searching + shared: if True searches for shared libraries, otherwise for static + recurse: if False search only root folder, if True descends top-down \ + from the root + + Returns: + list of full paths to the libraries that have been found """ - for path in paths: - library = join_path(path, libname) - if os.path.exists(library): - return path - return None + if not isinstance(args, collections.Sequence) or isinstance(args, str): + message = '{0} expects a sequence of strings as first argument' + message += ' [got {1} instead]' + raise TypeError(message.format(find_libraries.__name__, type(args))) + + # Construct the right suffix for the library + if shared is True: + suffix = 'dylib' if sys.platform == 'darwin' else 'so' + else: + suffix = 'a' + # List of libraries we are searching with suffixes + libraries = ['{0}.{1}'.format(lib, suffix) for lib in args] + # Search method + if recurse is False: + search_method = _find_libraries_non_recursive + else: + search_method = _find_libraries_recursive + + return search_method(libraries, root) + + +def _find_libraries_recursive(libraries, root): + library_dict = collections.defaultdict(list) + for path, _, files in os.walk(root): + for lib in libraries: + if lib in files: + library_dict[lib].append( + join_path(path, lib) + ) + answer = [] + for lib in libraries: + answer.extend(library_dict[lib]) + return LibraryList(answer) + + +def _find_libraries_non_recursive(libraries, root): + + def lib_or_none(lib): + library = join_path(root, lib) + if not os.path.exists(library): + return None + return library + + return LibraryList( + [lib_or_none(lib) for lib in libraries if lib_or_none(lib) is not None] + ) diff --git a/lib/spack/llnl/util/lang.py b/lib/spack/llnl/util/lang.py index df32012e2d..253334c416 100644 --- a/lib/spack/llnl/util/lang.py +++ b/lib/spack/llnl/util/lang.py @@ -374,6 +374,22 @@ def DictWrapper(dictionary): return wrapper() +def dedupe(sequence): + """Yields a stable de-duplication of an hashable sequence + + Args: + sequence: hashable sequence to be de-duplicated + + Returns: + stable de-duplication of the sequence + """ + seen = set() + for x in sequence: + if x not in seen: + yield x + seen.add(x) + + class RequiredAttributeError(ValueError): def __init__(self, message): diff --git a/lib/spack/llnl/util/lock.py b/lib/spack/llnl/util/lock.py index aa8272d5fe..f5f53101ae 100644 --- a/lib/spack/llnl/util/lock.py +++ b/lib/spack/llnl/util/lock.py @@ -69,8 +69,17 @@ class Lock(object): start_time = time.time() while (time.time() - start_time) < timeout: try: + # If this is already open read-only and we want to + # upgrade to an exclusive write lock, close first. + if self._fd is not None: + flags = fcntl.fcntl(self._fd, fcntl.F_GETFL) + if op == fcntl.LOCK_EX and flags | os.O_RDONLY: + os.close(self._fd) + self._fd = None + if self._fd is None: - self._fd = os.open(self._file_path, os.O_RDWR) + mode = os.O_RDWR if op == fcntl.LOCK_EX else os.O_RDONLY + self._fd = os.open(self._file_path, mode) fcntl.lockf(self._fd, op | fcntl.LOCK_NB) if op == fcntl.LOCK_EX: diff --git a/lib/spack/spack/abi.py b/lib/spack/spack/abi.py index 064abb9782..7a6f9c3f40 100644 --- a/lib/spack/spack/abi.py +++ b/lib/spack/spack/abi.py @@ -54,10 +54,10 @@ class ABI(object): output = None if compiler.cxx: rungcc = Executable(compiler.cxx) - libname = "libstdc++.so" + libname = "libstdc++." + dso_suffix elif compiler.cc: rungcc = Executable(compiler.cc) - libname = "libgcc_s.so" + libname = "libgcc_s." + dso_suffix else: return None try: diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 9f7cf0bb1b..c7cfcf9328 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -75,6 +75,8 @@ SPACK_NO_PARALLEL_MAKE = 'SPACK_NO_PARALLEL_MAKE' # SPACK_ENV_PATH = 'SPACK_ENV_PATH' SPACK_DEPENDENCIES = 'SPACK_DEPENDENCIES' +SPACK_RPATH_DEPS = 'SPACK_RPATH_DEPS' +SPACK_LINK_DEPS = 'SPACK_LINK_DEPS' SPACK_PREFIX = 'SPACK_PREFIX' SPACK_INSTALL = 'SPACK_INSTALL' SPACK_DEBUG = 'SPACK_DEBUG' @@ -252,9 +254,15 @@ def set_build_environment_variables(pkg, env, dirty=False): env.set_path(SPACK_ENV_PATH, env_paths) # Prefixes of all of the package's dependencies go in SPACK_DEPENDENCIES - dep_prefixes = [d.prefix - for d in pkg.spec.traverse(root=False, deptype='build')] + dep_prefixes = [d.prefix for d in + pkg.spec.traverse(root=False, deptype=('build', 'link'))] env.set_path(SPACK_DEPENDENCIES, dep_prefixes) + + # These variables control compiler wrapper behavior + env.set_path(SPACK_RPATH_DEPS, [d.prefix for d in get_rpath_deps(pkg)]) + env.set_path(SPACK_LINK_DEPS, [ + d.prefix for d in pkg.spec.traverse(root=False, deptype=('link'))]) + # Add dependencies to CMAKE_PREFIX_PATH env.set_path('CMAKE_PREFIX_PATH', dep_prefixes) @@ -286,8 +294,8 @@ def set_build_environment_variables(pkg, env, dirty=False): env.remove_path('PATH', p) # Add bin directories from dependencies to the PATH for the build. - bin_dirs = reversed( - filter(os.path.isdir, ['%s/bin' % prefix for prefix in dep_prefixes])) + bin_dirs = reversed(filter(os.path.isdir, [ + '%s/bin' % d.prefix for d in pkg.spec.dependencies(deptype='build')])) for item in bin_dirs: env.prepend_path('PATH', item) @@ -372,10 +380,15 @@ def set_module_variables_for_package(pkg, module): m.dso_suffix = dso_suffix +def get_rpath_deps(pkg): + """We only need to RPATH immediate dependencies.""" + return pkg.spec.dependencies(deptype='link') + + def get_rpaths(pkg): """Get a list of all the rpaths for a package.""" rpaths = [pkg.prefix.lib, pkg.prefix.lib64] - deps = pkg.spec.dependencies(deptype='link') + deps = get_rpath_deps(pkg) rpaths.extend(d.prefix.lib for d in deps if os.path.isdir(d.prefix.lib)) rpaths.extend(d.prefix.lib64 for d in deps diff --git a/lib/spack/spack/cmd/__init__.py b/lib/spack/spack/cmd/__init__.py index f69f434afd..6b1561b7fc 100644 --- a/lib/spack/spack/cmd/__init__.py +++ b/lib/spack/spack/cmd/__init__.py @@ -69,17 +69,17 @@ def get_cmd_function_name(name): def get_module(name): """Imports the module for a particular command name and returns it.""" module_name = "%s.%s" % (__name__, name) - module = __import__( - module_name, fromlist=[name, SETUP_PARSER, DESCRIPTION], - level=0) + module = __import__(module_name, + fromlist=[name, SETUP_PARSER, DESCRIPTION], + level=0) attr_setdefault(module, SETUP_PARSER, lambda *args: None) # null-op attr_setdefault(module, DESCRIPTION, "") fn_name = get_cmd_function_name(name) if not hasattr(module, fn_name): - tty.die("Command module %s (%s) must define function '%s'." - % (module.__name__, module.__file__, fn_name)) + tty.die("Command module %s (%s) must define function '%s'." % + (module.__name__, module.__file__, fn_name)) return module diff --git a/lib/spack/spack/cmd/checksum.py b/lib/spack/spack/cmd/checksum.py index aedb0fd99c..2e24d0527e 100644 --- a/lib/spack/spack/cmd/checksum.py +++ b/lib/spack/spack/cmd/checksum.py @@ -113,6 +113,6 @@ def checksum(parser, args): tty.die("Could not fetch any versions for %s" % pkg.name) version_lines = [ - " version('%s', '%s')" % (v, h) for v, h in version_hashes + " version('%s', '%s')" % (v, h) for v, h in version_hashes ] tty.msg("Checksummed new versions of %s:" % pkg.name, *version_lines) diff --git a/lib/spack/spack/cmd/debug.py b/lib/spack/spack/cmd/debug.py new file mode 100644 index 0000000000..958eb829b4 --- /dev/null +++ b/lib/spack/spack/cmd/debug.py @@ -0,0 +1,84 @@ +############################################################################## +# 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 +############################################################################## +import os +from datetime import datetime +from glob import glob + +import llnl.util.tty as tty +from llnl.util.filesystem import working_dir + +import spack +from spack.util.executable import which + +description = "Debugging commands for troubleshooting Spack." + + +def setup_parser(subparser): + sp = subparser.add_subparsers(metavar='SUBCOMMAND', dest='debug_command') + sp.add_parser('create-db-tarball', + help="Create a tarball of Spack's installation metadata.") + + +def _debug_tarball_suffix(): + now = datetime.now() + suffix = now.strftime('%Y-%m-%d-%H%M%S') + + git = which('git') + if not git: + return 'nobranch-nogit-%s' % suffix + + with working_dir(spack.spack_root): + if not os.path.isdir('.git'): + return 'nobranch.nogit.%s' % suffix + + symbolic = git( + 'rev-parse', '--abbrev-ref', '--short', 'HEAD', output=str).strip() + commit = git( + 'rev-parse', '--short', 'HEAD', output=str).strip() + + if symbolic == commit: + return "nobranch.%s.%s" % (commit, suffix) + else: + return "%s.%s.%s" % (symbolic, commit, suffix) + + +def create_db_tarball(args): + tar = which('tar') + tarball_name = "spack-db.%s.tar.gz" % _debug_tarball_suffix() + tarball_path = os.path.abspath(tarball_name) + + with working_dir(spack.spack_root): + files = [spack.installed_db._index_path] + files += glob('%s/*/*/*/.spack/spec.yaml' % spack.install_path) + files = [os.path.relpath(f) for f in files] + + tar('-czf', tarball_path, *files) + + tty.msg('Created %s' % tarball_name) + + +def debug(parser, args): + action = {'create-db-tarball': create_db_tarball} + action[args.debug_command](args) diff --git a/lib/spack/spack/cmd/diy.py b/lib/spack/spack/cmd/diy.py index 487654d261..9833e8cdce 100644 --- a/lib/spack/spack/cmd/diy.py +++ b/lib/spack/spack/cmd/diy.py @@ -52,6 +52,9 @@ def setup_parser(subparser): subparser.add_argument( 'spec', nargs=argparse.REMAINDER, help="specs to use for install. Must contain package AND version.") + subparser.add_argument( + '--dirty', action='store_true', dest='dirty', + help="Install a package *without* cleaning the environment.") def diy(self, args): @@ -100,4 +103,5 @@ def diy(self, args): keep_prefix=args.keep_prefix, ignore_deps=args.ignore_deps, verbose=not args.quiet, - keep_stage=True) # don't remove source dir for DIY. + keep_stage=True, # don't remove source dir for DIY. + dirty=args.dirty) diff --git a/lib/spack/spack/cmd/graph.py b/lib/spack/spack/cmd/graph.py index 8faabfbb7b..ed3aed1946 100644 --- a/lib/spack/spack/cmd/graph.py +++ b/lib/spack/spack/cmd/graph.py @@ -24,8 +24,11 @@ ############################################################################## import argparse +import llnl.util.tty as tty + import spack import spack.cmd +from spack.spec import * from spack.graph import * description = "Generate graphs of package dependency relationships." @@ -36,15 +39,28 @@ def setup_parser(subparser): method = subparser.add_mutually_exclusive_group() method.add_argument( - '--ascii', action='store_true', + '-a', '--ascii', action='store_true', help="Draw graph as ascii to stdout (default).") method.add_argument( - '--dot', action='store_true', + '-d', '--dot', action='store_true', help="Generate graph in dot format and print to stdout.") subparser.add_argument( - '--concretize', action='store_true', - help="Concretize specs before graphing.") + '-n', '--normalize', action='store_true', + help="Skip concretization; only print normalized spec.") + + subparser.add_argument( + '-s', '--static', action='store_true', + help="Use static information from packages, not dynamic spec info.") + + subparser.add_argument( + '-i', '--installed', action='store_true', + help="Graph all installed specs in dot format (implies --dot).") + + subparser.add_argument( + '-t', '--deptype', action='store', + help="Comma-separated list of deptypes to traverse. default=%s." + % ','.join(alldeps)) subparser.add_argument( 'specs', nargs=argparse.REMAINDER, @@ -52,18 +68,32 @@ def setup_parser(subparser): def graph(parser, args): - specs = spack.cmd.parse_specs( - args.specs, normalize=True, concretize=args.concretize) + concretize = not args.normalize + if args.installed: + if args.specs: + tty.die("Can't specify specs with --installed") + args.dot = True + specs = spack.installed_db.query() + + else: + specs = spack.cmd.parse_specs( + args.specs, normalize=True, concretize=concretize) if not specs: setup_parser.parser.print_help() return 1 + deptype = nobuild + if args.deptype: + deptype = tuple(args.deptype.split(',')) + validate_deptype(deptype) + deptype = canonical_deptype(deptype) + if args.dot: # Dot graph only if asked for. - graph_dot(*specs) + graph_dot(specs, static=args.static, deptype=deptype) elif specs: # ascii is default: user doesn't need to provide it explicitly - graph_ascii(specs[0], debug=spack.debug) + graph_ascii(specs[0], debug=spack.debug, deptype=deptype) for spec in specs[1:]: print # extra line bt/w independent graphs graph_ascii(spec, debug=spack.debug) diff --git a/lib/spack/spack/cmd/location.py b/lib/spack/spack/cmd/location.py index b9c8b5c330..54f7185707 100644 --- a/lib/spack/spack/cmd/location.py +++ b/lib/spack/spack/cmd/location.py @@ -25,7 +25,6 @@ import argparse import llnl.util.tty as tty -from llnl.util.filesystem import join_path import spack import spack.cmd @@ -77,7 +76,7 @@ def location(parser, args): print spack.prefix elif args.packages: - print spack.repo.root + print spack.repo.first_repo().root elif args.stages: print spack.stage_path @@ -99,7 +98,7 @@ def location(parser, args): if args.package_dir: # This one just needs the spec name. - print join_path(spack.repo.root, spec.name) + print spack.repo.dirname_for_package_name(spec.name) else: # These versions need concretized specs. diff --git a/lib/spack/spack/cmd/module.py b/lib/spack/spack/cmd/module.py index 2d0b83fe00..c6fa84109e 100644 --- a/lib/spack/spack/cmd/module.py +++ b/lib/spack/spack/cmd/module.py @@ -29,10 +29,10 @@ import os import shutil import sys +import llnl.util.filesystem as filesystem import llnl.util.tty as tty import spack.cmd import spack.cmd.common.arguments as arguments -import llnl.util.filesystem as filesystem from spack.modules import module_types description = "Manipulate module files" diff --git a/lib/spack/spack/cmd/setup.py b/lib/spack/spack/cmd/setup.py index 652c08354f..f39a827a8d 100644 --- a/lib/spack/spack/cmd/setup.py +++ b/lib/spack/spack/cmd/setup.py @@ -48,6 +48,9 @@ def setup_parser(subparser): subparser.add_argument( 'spec', nargs=argparse.REMAINDER, help="specs to use for install. Must contain package AND version.") + subparser.add_argument( + '--dirty', action='store_true', dest='dirty', + help="Install a package *without* cleaning the environment.") def spack_transitive_include_path(): diff --git a/lib/spack/spack/cmd/test.py b/lib/spack/spack/cmd/test.py index bf7342f606..52c2a06778 100644 --- a/lib/spack/spack/cmd/test.py +++ b/lib/spack/spack/cmd/test.py @@ -56,7 +56,7 @@ class MockCache(object): def store(self, copyCmd, relativeDst): pass - def fetcher(self, targetPath, digest): + def fetcher(self, targetPath, digest, **kwargs): return MockCacheFetcher() diff --git a/lib/spack/spack/database.py b/lib/spack/spack/database.py index e450b4d424..f73d3765c8 100644 --- a/lib/spack/spack/database.py +++ b/lib/spack/spack/database.py @@ -49,8 +49,9 @@ from llnl.util.filesystem import * from llnl.util.lock import * import spack.spec +from spack.directory_layout import DirectoryLayoutError from spack.version import Version -from spack.spec import Spec +from spack.spec import * from spack.error import SpackError from spack.repository import UnknownPackageError import spack.util.spack_yaml as syaml @@ -64,6 +65,9 @@ _db_version = Version('0.9.2') # Default timeout for spack database locks is 5 min. _db_lock_timeout = 60 +# Types of dependencies tracked by the database +_tracked_deps = nobuild + def _autospec(function): """Decorator that automatically converts the argument of a single-arg @@ -232,8 +236,6 @@ class Database(object): spec.format('$_$#'), dname, dhash[:7])) continue - # defensive copy (not sure everything handles extra - # parent links yet) child = data[dhash].spec spec._add_dependency(child, dtypes) @@ -328,7 +330,7 @@ class Database(object): self._data = data def reindex(self, directory_layout): - """Build database index from scratch based from a directory layout. + """Build database index from scratch based on a directory layout. Locks the DB if it isn't locked already. @@ -359,9 +361,6 @@ class Database(object): # Ask the directory layout to traverse the filesystem. for spec in directory_layout.all_specs(): - # Create a spec for each known package and add it. - path = directory_layout.path_for_spec(spec) - # Try to recover explicit value from old DB, but # default it to False if DB was corrupt. explicit = False @@ -370,7 +369,7 @@ class Database(object): if old_info is not None: explicit = old_info.explicit - self._add(spec, path, directory_layout, explicit=explicit) + self._add(spec, directory_layout, explicit=explicit) self._check_ref_counts() @@ -389,10 +388,7 @@ class Database(object): counts = {} for key, rec in self._data.items(): counts.setdefault(key, 0) - # XXX(deptype): This checks all dependencies, but build - # dependencies might be able to be dropped in the - # future. - for dep in rec.spec.dependencies(): + for dep in rec.spec.dependencies(_tracked_deps): dep_key = dep.dag_hash() counts.setdefault(dep_key, 0) counts[dep_key] += 1 @@ -450,52 +446,62 @@ class Database(object): # reindex() takes its own write lock, so no lock here. self.reindex(spack.install_layout) - def _add(self, spec, path, directory_layout=None, explicit=False): - """Add an install record for spec at path to the database. + def _add(self, spec, directory_layout=None, explicit=False): + """Add an install record for this spec to the database. - This assumes that the spec is not already installed. It - updates the ref counts on dependencies of the spec in the DB. + Assumes spec is installed in ``layout.path_for_spec(spec)``. - This operation is in-memory, and does not lock the DB. + Also ensures dependencies are present and updated in the DB as + either intsalled or missing. """ - key = spec.dag_hash() - if key in self._data: - rec = self._data[key] - rec.installed = True + if not spec.concrete: + raise NonConcreteSpecAddError( + "Specs added to DB must be concrete.") - # TODO: this overwrites a previous install path (when path != - # self._data[key].path), and the old path still has a - # dependent in the DB. We could consider re-RPATH-ing the - # dependents. This case is probably infrequent and may not be - # worth fixing, but this is where we can discover it. - rec.path = path - - else: - self._data[key] = InstallRecord(spec, path, True, - explicit=explicit) - for dep in spec.dependencies(('link', 'run')): - self._increment_ref_count(dep, directory_layout) + for dep in spec.dependencies(_tracked_deps): + dkey = dep.dag_hash() + if dkey not in self._data: + self._add(dep, directory_layout, explicit=False) - def _increment_ref_count(self, spec, directory_layout=None): - """Recursively examine dependencies and update their DB entries.""" key = spec.dag_hash() if key not in self._data: installed = False path = None if directory_layout: path = directory_layout.path_for_spec(spec) - installed = os.path.isdir(path) + try: + directory_layout.check_installed(spec) + installed = True + except DirectoryLayoutError as e: + tty.warn( + 'Dependency missing due to corrupt install directory:', + path, str(e)) + + # Create a new install record with no deps initially. + new_spec = spec.copy(deps=False) + self._data[key] = InstallRecord( + new_spec, path, installed, ref_count=0, explicit=explicit) + + # Connect dependencies from the DB to the new copy. + for name, dep in spec.dependencies_dict(_tracked_deps).iteritems(): + dkey = dep.spec.dag_hash() + new_spec._add_dependency(self._data[dkey].spec, dep.deptypes) + self._data[dkey].ref_count += 1 + + # Mark concrete once everything is built, and preserve + # the original hash of concrete specs. + new_spec._mark_concrete() + new_spec._hash = key - self._data[key] = InstallRecord(spec.copy(), path, installed) - - for dep in spec.dependencies(('link', 'run')): - self._increment_ref_count(dep) + else: + # If it is already there, mark it as installed. + self._data[key].installed = True - self._data[key].ref_count += 1 + self._data[key].explicit = explicit @_autospec - def add(self, spec, path, explicit=False): + def add(self, spec, directory_layout, explicit=False): """Add spec at path to database, locking and reading DB to sync. ``add()`` will lock and read from the DB on disk. @@ -504,7 +510,7 @@ class Database(object): # TODO: ensure that spec is concrete? # Entire add is transactional. with self.write_transaction(): - self._add(spec, path, explicit=explicit) + self._add(spec, directory_layout, explicit=explicit) def _get_matching_spec_key(self, spec, **kwargs): """Get the exact spec OR get a single spec that matches.""" @@ -534,7 +540,7 @@ class Database(object): if rec.ref_count == 0 and not rec.installed: del self._data[key] - for dep in spec.dependencies('link'): + for dep in spec.dependencies(_tracked_deps): self._decrement_ref_count(dep) def _remove(self, spec): @@ -548,7 +554,7 @@ class Database(object): return rec.spec del self._data[key] - for dep in rec.spec.dependencies('link'): + for dep in rec.spec.dependencies(_tracked_deps): self._decrement_ref_count(dep) # Returns the concrete spec so we know it in the case where a @@ -657,6 +663,10 @@ class CorruptDatabaseError(SpackError): """Raised when errors are found while reading the database.""" +class NonConcreteSpecAddError(SpackError): + """Raised when attemptint to add non-concrete spec to DB.""" + + class InvalidDatabaseVersionError(SpackError): def __init__(self, expected, found): diff --git a/lib/spack/spack/directory_layout.py b/lib/spack/spack/directory_layout.py index 73286483ef..8ef7d3c480 100644 --- a/lib/spack/spack/directory_layout.py +++ b/lib/spack/spack/directory_layout.py @@ -423,7 +423,7 @@ class RemoveFailedError(DirectoryLayoutError): def __init__(self, installed_spec, prefix, error): super(RemoveFailedError, self).__init__( 'Could not remove prefix %s for %s : %s' - % prefix, installed_spec.short_spec, error) + % (prefix, installed_spec.short_spec, error)) self.cause = error diff --git a/lib/spack/spack/fetch_strategy.py b/lib/spack/spack/fetch_strategy.py index c69a23033c..21802c4556 100644 --- a/lib/spack/spack/fetch_strategy.py +++ b/lib/spack/spack/fetch_strategy.py @@ -170,12 +170,11 @@ class URLFetchStrategy(FetchStrategy): tty.msg("Already downloaded %s" % self.archive_file) return - possible_files = self.stage.expected_archive_files save_file = None partial_file = None - if possible_files: - save_file = self.stage.expected_archive_files[0] - partial_file = self.stage.expected_archive_files[0] + '.part' + if self.stage.save_filename: + save_file = self.stage.save_filename + partial_file = self.stage.save_filename + '.part' tty.msg("Trying to fetch from %s" % self.url) @@ -307,7 +306,7 @@ class URLFetchStrategy(FetchStrategy): if not self.archive_file: raise NoArchiveFileError("Cannot call archive() before fetching.") - shutil.copy(self.archive_file, destination) + shutil.copyfile(self.archive_file, destination) @_needs_stage def check(self): @@ -858,9 +857,9 @@ class FsCache(object): mkdirp(os.path.dirname(dst)) fetcher.archive(dst) - def fetcher(self, targetPath, digest): + def fetcher(self, targetPath, digest, **kwargs): url = "file://" + join_path(self.root, targetPath) - return CacheURLFetchStrategy(url, digest) + return CacheURLFetchStrategy(url, digest, **kwargs) def destroy(self): shutil.rmtree(self.root, ignore_errors=True) diff --git a/lib/spack/spack/graph.py b/lib/spack/spack/graph.py index b875e9da99..9753741c61 100644 --- a/lib/spack/spack/graph.py +++ b/lib/spack/spack/graph.py @@ -67,22 +67,20 @@ from heapq import * from llnl.util.lang import * from llnl.util.tty.color import * -import spack -from spack.spec import Spec +from spack.spec import * __all__ = ['topological_sort', 'graph_ascii', 'AsciiGraph', 'graph_dot'] -def topological_sort(spec, **kwargs): +def topological_sort(spec, reverse=False, deptype=None): """Topological sort for specs. Return a list of dependency specs sorted topologically. The spec argument is not modified in the process. """ - reverse = kwargs.get('reverse', False) - # XXX(deptype): iterate over a certain kind of dependency. Maybe color - # edges based on the type of dependency? + deptype = canonical_deptype(deptype) + if not reverse: parents = lambda s: s.dependents() children = lambda s: s.dependencies() @@ -91,7 +89,7 @@ def topological_sort(spec, **kwargs): children = lambda s: s.dependents() # Work on a copy so this is nondestructive. - spec = spec.copy() + spec = spec.copy(deps=deptype) nodes = spec.index() topo_order = [] @@ -129,7 +127,7 @@ def find(seq, predicate): return -1 -# Names of different graph line states. We Record previous line +# Names of different graph line states. We record previous line # states so that we can easily determine what to do when connecting. states = ('node', 'collapse', 'merge-right', 'expand-right', 'back-edge') NODE, COLLAPSE, MERGE_RIGHT, EXPAND_RIGHT, BACK_EDGE = states @@ -143,6 +141,7 @@ class AsciiGraph(object): self.node_character = '*' self.debug = False self.indent = 0 + self.deptype = alldeps # These are colors in the order they'll be used for edges. # See llnl.util.tty.color for details on color characters. @@ -162,6 +161,9 @@ class AsciiGraph(object): def _write_edge(self, string, index, sub=0): """Write a colored edge to the output stream.""" + # Ignore empty frontier entries (they're just collapsed) + if not self._frontier[index]: + return name = self._frontier[index][sub] edge = "@%s{%s}" % (self._name_to_color[name], string) self._out.write(edge) @@ -386,7 +388,7 @@ class AsciiGraph(object): self._out = ColorStream(sys.stdout, color=color) # We'll traverse the spec in topo order as we graph it. - topo_order = topological_sort(spec, reverse=True) + topo_order = topological_sort(spec, reverse=True, deptype=self.deptype) # Work on a copy to be nondestructive spec = spec.copy() @@ -420,20 +422,26 @@ class AsciiGraph(object): if back: back.sort() prev_ends = [] + collapse_l1 = False for j, (b, d) in enumerate(back): self._frontier[i].remove(d) if i - b > 1: - self._back_edge_line(prev_ends, b, i, False, - 'left-1') + collapse_l1 = any(not e for e in self._frontier) + self._back_edge_line( + prev_ends, b, i, collapse_l1, 'left-1') del prev_ends[:] prev_ends.append(b) # Check whether we did ALL the deps as back edges, # in which case we're done. - collapse = not self._frontier[i] - if collapse: + pop = not self._frontier[i] + collapse_l2 = pop + if collapse_l1: + collapse_l2 = False + if pop: self._frontier.pop(i) - self._back_edge_line(prev_ends, -1, -1, collapse, 'left-2') + self._back_edge_line( + prev_ends, -1, -1, collapse_l2, 'left-2') elif len(self._frontier[i]) > 1: # Expand forward after doing all back connections @@ -476,32 +484,28 @@ class AsciiGraph(object): # Replace node with its dependencies self._frontier.pop(i) - if node.dependencies(): - deps = sorted((d.name for d in node.dependencies()), - reverse=True) + deps = node.dependencies(self.deptype) + if deps: + deps = sorted((d.name for d in deps), reverse=True) self._connect_deps(i, deps, "new-deps") # anywhere. elif self._frontier: self._collapse_line(i) -def graph_ascii(spec, **kwargs): - node_character = kwargs.get('node', 'o') - out = kwargs.pop('out', None) - debug = kwargs.pop('debug', False) - indent = kwargs.pop('indent', 0) - color = kwargs.pop('color', None) - check_kwargs(kwargs, graph_ascii) - +def graph_ascii(spec, node='o', out=None, debug=False, + indent=0, color=None, deptype=None): graph = AsciiGraph() graph.debug = debug graph.indent = indent - graph.node_character = node_character + graph.node_character = node + if deptype: + graph.deptype = canonical_deptype(deptype) graph.write(spec, color=color, out=out) -def graph_dot(*specs, **kwargs): +def graph_dot(specs, deptype=None, static=False, out=None): """Generate a graph in dot format of all provided specs. Print out a dot formatted graph of all the dependencies between @@ -510,42 +514,73 @@ def graph_dot(*specs, **kwargs): spack graph --dot qt | dot -Tpdf > spack-graph.pdf """ - out = kwargs.pop('out', sys.stdout) - check_kwargs(kwargs, graph_dot) + if out is None: + out = sys.stdout + + if deptype is None: + deptype = alldeps out.write('digraph G {\n') - out.write(' label = "Spack Dependencies"\n') out.write(' labelloc = "b"\n') - out.write(' rankdir = "LR"\n') + out.write(' rankdir = "TB"\n') out.write(' ranksep = "5"\n') + out.write('node[\n') + out.write(' fontname=Monaco,\n') + out.write(' penwidth=2,\n') + out.write(' fontsize=12,\n') + out.write(' margin=.1,\n') + out.write(' shape=box,\n') + out.write(' fillcolor=lightblue,\n') + out.write(' style="rounded,filled"]\n') + out.write('\n') - def quote(string): + def q(string): return '"%s"' % string if not specs: - specs = [p.name for p in spack.repo.all_packages()] - else: - roots = specs - specs = set() - for spec in roots: - specs.update(Spec(s.name) for s in spec.normalized().traverse()) + raise ValueError("Must provide specs ot graph_dot") + + # Static graph includes anything a package COULD depend on. + if static: + names = set.union(*[s.package.possible_dependencies() for s in specs]) + specs = [Spec(name) for name in names] - deps = [] + labeled = set() + + def label(key, label): + if key not in labeled: + out.write(' "%s" [label="%s"]\n' % (key, label)) + labeled.add(key) + + deps = set() for spec in specs: - out.write(' %-30s [label="%s"]\n' % (quote(spec.name), spec.name)) + if static: + out.write(' "%s" [label="%s"]\n' % (spec.name, spec.name)) + + # Skip virtual specs (we'll find out about them from concrete ones. + if spec.virtual: + continue - # Skip virtual specs (we'll find out about them from concrete ones. - if spec.virtual: - continue + # Add edges for each depends_on in the package. + for dep_name, dep in spec.package.dependencies.iteritems(): + deps.add((spec.name, dep_name)) + + # If the package provides something, add an edge for that. + for provider in set(s.name for s in spec.package.provided): + deps.add((provider, spec.name)) + + else: + def key_label(s): + return s.dag_hash(), "%s-%s" % (s.name, s.dag_hash(7)) - # Add edges for each depends_on in the package. - for dep_name, dep in spec.package.dependencies.iteritems(): - deps.append((spec.name, dep_name)) + for s in spec.traverse(deptype=deptype): + skey, slabel = key_label(s) + out.write(' "%s" [label="%s"]\n' % (skey, slabel)) - # If the package provides something, add an edge for that. - for provider in set(s.name for s in spec.package.provided): - deps.append((provider, spec.name)) + for d in s.dependencies(deptype=deptype): + dkey, _ = key_label(d) + deps.add((skey, dkey)) out.write('\n') diff --git a/lib/spack/spack/hooks/__init__.py b/lib/spack/spack/hooks/__init__.py index c7c84defa0..ff4ebc2e57 100644 --- a/lib/spack/spack/hooks/__init__.py +++ b/lib/spack/spack/hooks/__init__.py @@ -24,7 +24,7 @@ ############################################################################## """This package contains modules with hooks for various stages in the Spack install process. You can add modules here and they'll be - executaed by package at various times during the package lifecycle. + executed by package at various times during the package lifecycle. Each hook is just a function that takes a package as a parameter. Hooks are not executed in any particular order. @@ -41,9 +41,10 @@ features. """ import imp -from llnl.util.lang import memoized, list_modules -from llnl.util.filesystem import join_path + import spack +from llnl.util.filesystem import join_path +from llnl.util.lang import memoized, list_modules @memoized @@ -70,12 +71,11 @@ class HookRunner(object): if hasattr(hook, '__call__'): hook(pkg) - # # Define some functions that can be called to fire off hooks. # -pre_install = HookRunner('pre_install') -post_install = HookRunner('post_install') +pre_install = HookRunner('pre_install') +post_install = HookRunner('post_install') -pre_uninstall = HookRunner('pre_uninstall') +pre_uninstall = HookRunner('pre_uninstall') post_uninstall = HookRunner('post_uninstall') diff --git a/lib/spack/spack/hooks/lmodmodule.py b/lib/spack/spack/hooks/lmodmodule.py new file mode 100644 index 0000000000..6b4318b1d0 --- /dev/null +++ b/lib/spack/spack/hooks/lmodmodule.py @@ -0,0 +1,35 @@ +############################################################################## +# Copyright (c) 2013, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Written by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. +# LLNL-CODE-647188 +# +# For details, see https://scalability-llnl.github.io/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 General Public License (as published by +# the Free Software Foundation) version 2.1 dated 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 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 +############################################################################## +import spack.modules + + +def post_install(pkg): + dk = spack.modules.LmodModule(pkg.spec) + dk.write() + + +def post_uninstall(pkg): + dk = spack.modules.LmodModule(pkg.spec) + dk.remove() diff --git a/lib/spack/spack/hooks/sbang.py b/lib/spack/spack/hooks/sbang.py index 02c1ce3816..6f9736a018 100644 --- a/lib/spack/spack/hooks/sbang.py +++ b/lib/spack/spack/hooks/sbang.py @@ -81,8 +81,10 @@ def filter_shebang(path): tty.warn("Patched overlong shebang in %s" % path) -def filter_shebangs_in_directory(directory): - for file in os.listdir(directory): +def filter_shebangs_in_directory(directory, filenames=None): + if filenames is None: + filenames = os.listdir(directory) + for file in filenames: path = os.path.join(directory, file) # only handle files @@ -104,6 +106,6 @@ def post_install(pkg): """This hook edits scripts so that they call /bin/bash $spack_prefix/bin/sbang instead of something longer than the shebang limit.""" - if not os.path.isdir(pkg.prefix.bin): - return - filter_shebangs_in_directory(pkg.prefix.bin) + + for directory, _, filenames in os.walk(pkg.prefix): + filter_shebangs_in_directory(directory, filenames) diff --git a/lib/spack/spack/modules.py b/lib/spack/spack/modules.py index 70c3c35d8c..aa3ad5843f 100644 --- a/lib/spack/spack/modules.py +++ b/lib/spack/spack/modules.py @@ -40,6 +40,7 @@ module file. """ import copy import datetime +import itertools import os import os.path import re @@ -48,6 +49,7 @@ import textwrap import llnl.util.tty as tty import spack +import spack.compilers # Needed by LmodModules import spack.config from llnl.util.filesystem import join_path, mkdirp from spack.build_environment import parent_class_modules @@ -56,7 +58,8 @@ from spack.environment import * __all__ = ['EnvModule', 'Dotkit', 'TclModule'] -# Registry of all types of modules. Entries created by EnvModule's metaclass +"""Registry of all types of modules. Entries created by EnvModule's + metaclass.""" module_types = {} CONFIGURATION = spack.config.get_config('modules') @@ -120,7 +123,7 @@ def dependencies(spec, request='all'): return [] if request == 'direct': - return spec.dependencies() + return spec.dependencies(deptype=('link', 'run')) # FIXME : during module file creation nodes seem to be visited multiple # FIXME : times even if cover='nodes' is given. This work around permits @@ -133,6 +136,7 @@ def dependencies(spec, request='all'): spec.traverse(order='post', depth=True, cover='nodes', + deptype=('link', 'run'), root=False), reverse=True)] return [xx for ii, xx in l if not (xx in seen or seen_add(xx))] @@ -388,6 +392,7 @@ class EnvModule(object): for mod in modules: set_module_variables_for_package(package, mod) set_module_variables_for_package(package, package.module) + package.setup_environment(spack_env, env) package.setup_dependent_package(self.pkg.module, self.spec) package.setup_dependent_environment(spack_env, env, self.spec) @@ -632,3 +637,237 @@ class TclModule(EnvModule): raise SystemExit('Module generation aborted.') line = line.format(**naming_tokens) yield line + +# To construct an arbitrary hierarchy of module files: +# 1. Parse the configuration file and check that all the items in +# hierarchical_scheme are indeed virtual packages +# This needs to be done only once at start-up +# 2. Order the stack as `hierarchical_scheme + ['mpi, 'compiler'] +# 3. Check which of the services are provided by the package +# -> may be more than one +# 4. Check which of the services are needed by the package +# -> this determines where to write the module file +# 5. For each combination of services in which we have at least one provider +# here add the appropriate conditional MODULEPATH modifications + + +class LmodModule(EnvModule): + name = 'lmod' + path = join_path(spack.share_path, "lmod") + + environment_modifications_formats = { + PrependPath: 'prepend_path("{name}", "{value}")\n', + AppendPath: 'append_path("{name}", "{value}")\n', + RemovePath: 'remove_path("{name}", "{value}")\n', + SetEnv: 'setenv("{name}", "{value}")\n', + UnsetEnv: 'unsetenv("{name}")\n' + } + + autoload_format = ('if not isloaded("{module_file}") then\n' + ' LmodMessage("Autoloading {module_file}")\n' + ' load("{module_file}")\n' + 'end\n\n') + + prerequisite_format = 'prereq("{module_file}")\n' + + family_format = 'family("{family}")\n' + + path_part_with_hash = join_path('{token.name}', '{token.version}-{token.hash}') # NOQA: ignore=E501 + path_part_without_hash = join_path('{token.name}', '{token.version}') + + # TODO : Check that extra tokens specified in configuration file + # TODO : are actually virtual dependencies + configuration = CONFIGURATION.get('lmod', {}) + hierarchy_tokens = configuration.get('hierarchical_scheme', []) + hierarchy_tokens = hierarchy_tokens + ['mpi', 'compiler'] + + def __init__(self, spec=None): + super(LmodModule, self).__init__(spec) + # Sets the root directory for this architecture + self.modules_root = join_path(LmodModule.path, self.spec.architecture) + # Retrieve core compilers + self.core_compilers = self.configuration.get('core_compilers', []) + # Keep track of the requirements that this package has in terms + # of virtual packages + # that participate in the hierarchical structure + self.requires = {'compiler': self.spec.compiler} + # For each virtual dependency in the hierarchy + for x in self.hierarchy_tokens: + if x in self.spec and not self.spec.package.provides( + x): # if I depend on it + self.requires[x] = self.spec[x] # record the actual provider + # Check what are the services I need (this will determine where the + # module file will be written) + self.substitutions = {} + self.substitutions.update(self.requires) + # TODO : complete substitutions + # Check what service I provide to others + self.provides = {} + # If it is in the list of supported compilers family -> compiler + if self.spec.name in spack.compilers.supported_compilers(): + self.provides['compiler'] = spack.spec.CompilerSpec(str(self.spec)) + # Special case for llvm + if self.spec.name == 'llvm': + self.provides['compiler'] = spack.spec.CompilerSpec(str(self.spec)) + self.provides['compiler'].name = 'clang' + + for x in self.hierarchy_tokens: + if self.spec.package.provides(x): + self.provides[x] = self.spec[x] + + def _hierarchy_token_combinations(self): + """ + Yields all the relevant combinations that could appear in the hierarchy + """ + for ii in range(len(self.hierarchy_tokens) + 1): + for item in itertools.combinations(self.hierarchy_tokens, ii): + if 'compiler' in item: + yield item + + def _hierarchy_to_be_provided(self): + """ + Filters a list of hierarchy tokens and yields only the one that we + need to provide + """ + for item in self._hierarchy_token_combinations(): + if any(x in self.provides for x in item): + yield item + + def token_to_path(self, name, value): + # If we are dealing with a core compiler, return 'Core' + if name == 'compiler' and str(value) in self.core_compilers: + return 'Core' + # CompilerSpec does not have an hash + if name == 'compiler': + return self.path_part_without_hash.format(token=value) + # For virtual providers add a small part of the hash + # to distinguish among different variants in a directory hierarchy + value.hash = value.dag_hash(length=6) + return self.path_part_with_hash.format(token=value) + + @property + def file_name(self): + parts = [self.token_to_path(x, self.requires[x]) + for x in self.hierarchy_tokens if x in self.requires] + hierarchy_name = join_path(*parts) + fullname = join_path(self.modules_root, hierarchy_name, + self.use_name + '.lua') + return fullname + + @property + def use_name(self): + return self.token_to_path('', self.spec) + + def modulepath_modifications(self): + # What is available is what we require plus what we provide + entry = '' + available = {} + available.update(self.requires) + available.update(self.provides) + available_parts = [self.token_to_path(x, available[x]) + for x in self.hierarchy_tokens if x in available] + # Missing parts + missing = [x for x in self.hierarchy_tokens if x not in available] + # Direct path we provide on top of compilers + modulepath = join_path(self.modules_root, *available_parts) + env = EnvironmentModifications() + env.prepend_path('MODULEPATH', modulepath) + for line in self.process_environment_command(env): + entry += line + + def local_variable(x): + lower, upper = x.lower(), x.upper() + fmt = 'local {lower}_name = os.getenv("LMOD_{upper}_NAME")\n' + fmt += 'local {lower}_version = os.getenv("LMOD_{upper}_VERSION")\n' # NOQA: ignore=501 + return fmt.format(lower=lower, upper=upper) + + def set_variables_for_service(env, x): + upper = x.upper() + s = self.provides[x] + name, version = os.path.split(self.token_to_path(x, s)) + + env.set('LMOD_{upper}_NAME'.format(upper=upper), name) + env.set('LMOD_{upper}_VERSION'.format(upper=upper), version) + + def conditional_modulepath_modifications(item): + entry = 'if ' + needed = [] + for x in self.hierarchy_tokens: + if x in missing: + needed.append('{x}_name '.format(x=x)) + entry += 'and '.join(needed) + 'then\n' + entry += ' local t = pathJoin("{root}"'.format( + root=self.modules_root) + for x in item: + if x in missing: + entry += ', {lower}_name, {lower}_version'.format( + lower=x.lower()) + else: + entry += ', "{x}"'.format( + x=self.token_to_path(x, available[x])) + entry += ')\n' + entry += ' prepend_path("MODULEPATH", t)\n' + entry += 'end\n\n' + return entry + + if 'compiler' not in self.provides: + # Retrieve variables + entry += '\n' + for x in missing: + entry += local_variable(x) + entry += '\n' + # Conditional modifications + conditionals = [x + for x in self._hierarchy_to_be_provided() + if any(t in missing for t in x)] + for item in conditionals: + entry += conditional_modulepath_modifications(item) + + # Set environment variables for the services we provide + env = EnvironmentModifications() + for x in self.provides: + set_variables_for_service(env, x) + for line in self.process_environment_command(env): + entry += line + + return entry + + @property + def header(self): + timestamp = datetime.datetime.now() + # Header as in + # https://www.tacc.utexas.edu/research-development/tacc-projects/lmod/advanced-user-guide/more-about-writing-module-files + header = "-- -*- lua -*-\n" + header += '-- Module file created by spack (https://github.com/LLNL/spack) on %s\n' % timestamp # NOQA: ignore=E501 + header += '--\n' + header += '-- %s\n' % self.spec.short_spec + header += '--\n' + + # Short description -> whatis() + if self.short_description: + header += "whatis([[Name : {name}]])\n".format(name=self.spec.name) + header += "whatis([[Version : {version}]])\n".format( + version=self.spec.version) + + # Long description -> help() + if self.long_description: + doc = re.sub(r'"', '\"', self.long_description) + header += "help([[{documentation}]])\n".format(documentation=doc) + + # Certain things need to be done only if we provide a service + if self.provides: + # Add family directives + header += '\n' + for x in self.provides: + header += self.family_format.format(family=x) + header += '\n' + header += '-- MODULEPATH modifications\n' + header += '\n' + # Modify MODULEPATH + header += self.modulepath_modifications() + # Set environment variables for services we provide + header += '\n' + header += '-- END MODULEPATH modifications\n' + header += '\n' + + return header diff --git a/lib/spack/spack/operating_systems/mac_os.py b/lib/spack/spack/operating_systems/mac_os.py index 3e5ab9b2e9..dafb5c1d41 100644 --- a/lib/spack/spack/operating_systems/mac_os.py +++ b/lib/spack/spack/operating_systems/mac_os.py @@ -22,7 +22,7 @@ class MacOs(OperatingSystem): "10.11": "elcapitan", "10.12": "sierra"} - mac_ver = py_platform.mac_ver()[0][:-2] + mac_ver = '.'.join(py_platform.mac_ver()[0].split('.')[:2]) name = mac_releases.get(mac_ver, "macos") super(MacOs, self).__init__(name, mac_ver) diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py index dcdcee293d..498f3d4a6d 100644 --- a/lib/spack/spack/package.py +++ b/lib/spack/spack/package.py @@ -575,6 +575,20 @@ class PackageBase(object): self.extra_args = {} + def possible_dependencies(self, visited=None): + """Return set of possible transitive dependencies of this package.""" + if visited is None: + visited = set() + + visited.add(self.name) + for name in self.dependencies: + if name not in visited and not spack.spec.Spec(name).virtual: + pkg = spack.repo.get(name) + for name in pkg.possible_dependencies(visited): + visited.add(name) + + return visited + @property def package_dir(self): """Return the directory where the package.py file lives.""" @@ -886,7 +900,7 @@ class PackageBase(object): if not ignore_checksum: raise FetchError("Will not fetch %s" % - self.spec.format('$_$@'), checksum_msg) + self.spec.format('$_$@'), ck_msg) self.stage.fetch(mirror_only) @@ -1080,7 +1094,8 @@ class PackageBase(object): skip_patch=skip_patch, verbose=verbose, make_jobs=make_jobs, - run_tests=run_tests) + run_tests=run_tests, + dirty=dirty) # Set run_tests flag before starting build. self.run_tests = run_tests @@ -1171,7 +1186,9 @@ class PackageBase(object): keep_prefix = True if self.last_phase is None else keep_prefix # note: PARENT of the build process adds the new package to # the database, so that we don't need to re-read from file. - spack.installed_db.add(self.spec, self.prefix, explicit=explicit) + spack.installed_db.add( + self.spec, spack.install_layout, explicit=explicit + ) except directory_layout.InstallDirectoryAlreadyExistsError: # Abort install if install directory exists. # But do NOT remove it (you'd be overwriting someone else's stuff) diff --git a/lib/spack/spack/platforms/cray.py b/lib/spack/spack/platforms/cray.py index 0059b49ff1..9138ad7afe 100644 --- a/lib/spack/spack/platforms/cray.py +++ b/lib/spack/spack/platforms/cray.py @@ -8,37 +8,21 @@ from spack.operating_systems.linux_distro import LinuxDistro from spack.operating_systems.cnl import Cnl from llnl.util.filesystem import join_path -# Craype- module prefixes that are not valid CPU targets. -NON_TARGETS = ('hugepages', 'network', 'target', 'accel', 'xtpe') - - -def _target_from_clean_env(name): - '''Return the default back_end target as loaded in a clean login session. - - A bash subshell is launched with a wiped environment and the list of loaded - modules is parsed for the first acceptable CrayPE target. - ''' - # Based on the incantation: - # echo "$(env - USER=$USER /bin/bash -l -c 'module list -lt')" - targets = [] - if name != 'front_end': - env = which('env') - env.add_default_arg('-') - # CAUTION - $USER is generally needed to initialize the environment. - # There may be other variables needed for general success. - output = env('USER=%s' % os.environ['USER'], - '/bin/bash', '--noprofile', '--norc', '-c', - '. /etc/profile; module list -lt', - output=str, error=str) - default_modules = [i for i in output.splitlines() - if len(i.split()) == 1] - tty.debug("Found default modules:", - *[" " + mod for mod in default_modules]) - pattern = 'craype-(?!{0})(\S*)'.format('|'.join(NON_TARGETS)) - for mod in default_modules: - if 'craype-' in mod: - targets.extend(re.findall(pattern, mod)) - return targets[0] if targets else None + +def _get_modules_in_modulecmd_output(output): + '''Return list of valid modules parsed from modulecmd output string.''' + return [i for i in output.splitlines() + if len(i.split()) == 1] + + +def _fill_craype_targets_from_modules(targets, modules): + '''Extend CrayPE CPU targets list with those found in list of modules.''' + # Craype- module prefixes that are not valid CPU targets. + non_targets = ('hugepages', 'network', 'target', 'accel', 'xtpe') + pattern = r'craype-(?!{0})(\S*)'.format('|'.join(non_targets)) + for mod in modules: + if 'craype-' in mod: + targets.extend(re.findall(pattern, mod)) class Cray(Platform): @@ -56,7 +40,12 @@ class Cray(Platform): ''' super(Cray, self).__init__('cray') - # Get targets from config or make best guess from environment: + # Make all craype targets available. + for target in self._avail_targets(): + name = target.replace('-', '_') + self.add_target(name, Target(name, 'craype-%s' % target)) + + # Get aliased targets from config or best guess from environment: conf = spack.config.get_config('targets') for name in ('front_end', 'back_end'): _target = getattr(self, name, None) @@ -64,18 +53,16 @@ class Cray(Platform): _target = os.environ.get('SPACK_' + name.upper()) if _target is None: _target = conf.get(name) - if _target is None: - _target = _target_from_clean_env(name) - setattr(self, name, _target) - + if _target is None and name == 'back_end': + _target = self._default_target_from_env() if _target is not None: - self.add_target(name, Target(_target, 'craype-' + _target)) - self.add_target(_target, Target(_target, 'craype-' + _target)) + safe_name = _target.replace('-', '_') + setattr(self, name, safe_name) + self.add_target(name, self.targets[safe_name]) if self.back_end is not None: self.default = self.back_end - self.add_target( - 'default', Target(self.default, 'craype-' + self.default)) + self.add_target('default', self.targets[self.back_end]) else: raise NoPlatformError() @@ -90,7 +77,7 @@ class Cray(Platform): self.add_operating_system(self.front_os, front_distro) @classmethod - def setup_platform_environment(self, pkg, env): + def setup_platform_environment(cls, pkg, env): """ Change the linker to default dynamic to be more similar to linux/standard linker behavior """ @@ -101,5 +88,43 @@ class Cray(Platform): env.prepend_path('SPACK_ENV_PATH', cray_wrapper_names) @classmethod - def detect(self): + def detect(cls): return os.environ.get('CRAYPE_VERSION') is not None + + def _default_target_from_env(self): + '''Set and return the default CrayPE target loaded in a clean login + session. + + A bash subshell is launched with a wiped environment and the list of + loaded modules is parsed for the first acceptable CrayPE target. + ''' + # Based on the incantation: + # echo "$(env - USER=$USER /bin/bash -l -c 'module list -lt')" + if getattr(self, 'default', None) is None: + env = which('env') + env.add_default_arg('-') + # CAUTION - $USER is generally needed in the sub-environment. + # There may be other variables needed for general success. + output = env('USER=%s' % os.environ['USER'], + 'HOME=%s' % os.environ['HOME'], + '/bin/bash', '--noprofile', '--norc', '-c', + '. /etc/profile; module list -lt', + output=str, error=str) + self._defmods = _get_modules_in_modulecmd_output(output) + targets = [] + _fill_craype_targets_from_modules(targets, self._defmods) + self.default = targets[0] if targets else None + tty.debug("Found default modules:", + *[" %s" % mod for mod in self._defmods]) + return self.default + + def _avail_targets(self): + '''Return a list of available CrayPE CPU targets.''' + if getattr(self, '_craype_targets', None) is None: + module = which('modulecmd', required=True) + module.add_default_arg('python') + output = module('avail', '-t', 'craype-', output=str, error=str) + craype_modules = _get_modules_in_modulecmd_output(output) + self._craype_targets = targets = [] + _fill_craype_targets_from_modules(targets, craype_modules) + return self._craype_targets diff --git a/lib/spack/spack/schema/modules.py b/lib/spack/spack/schema/modules.py index f8066919f1..bdc70c9ef1 100644 --- a/lib/spack/spack/schema/modules.py +++ b/lib/spack/spack/schema/modules.py @@ -139,7 +139,20 @@ schema = { 'default': [], 'items': { 'type': 'string', - 'enum': ['tcl', 'dotkit']}}, + 'enum': ['tcl', 'dotkit', 'lmod']}}, + 'lmod': { + 'allOf': [ + # Base configuration + {'$ref': '#/definitions/module_type_configuration'}, + { + 'core_compilers': { + '$ref': '#/definitions/array_of_strings' + }, + 'hierarchical_scheme': { + '$ref': '#/definitions/array_of_strings' + } + } # Specific lmod extensions + ]}, 'tcl': { 'allOf': [ # Base configuration diff --git a/lib/spack/spack/spec.py b/lib/spack/spack/spec.py index 8b0486c4da..ba9cea876d 100644 --- a/lib/spack/spack/spec.py +++ b/lib/spack/spack/spec.py @@ -123,6 +123,39 @@ from spack.util.spack_yaml import syaml_dict from spack.version import * from spack.provider_index import ProviderIndex +__all__ = [ + 'Spec', + 'alldeps', + 'nolink', + 'nobuild', + 'canonical_deptype', + 'validate_deptype', + 'parse', + 'parse_anonymous_spec', + 'SpecError', + 'SpecParseError', + 'DuplicateDependencyError', + 'DuplicateVariantError', + 'DuplicateCompilerSpecError', + 'UnsupportedCompilerError', + 'UnknownVariantError', + 'DuplicateArchitectureError', + 'InconsistentSpecError', + 'InvalidDependencyError', + 'InvalidDependencyTypeError', + 'NoProviderError', + 'MultipleProviderError', + 'UnsatisfiableSpecError', + 'UnsatisfiableSpecNameError', + 'UnsatisfiableVersionSpecError', + 'UnsatisfiableCompilerSpecError', + 'UnsatisfiableVariantSpecError', + 'UnsatisfiableCompilerFlagSpecError', + 'UnsatisfiableArchitectureSpecError', + 'UnsatisfiableProviderSpecError', + 'UnsatisfiableDependencySpecError', + 'SpackYAMLError', + 'AmbiguousHashError'] # Valid pattern for an identifier in Spack identifier_re = r'\w[\w-]*' @@ -156,12 +189,46 @@ _any_version = VersionList([':']) # Special types of dependencies. alldeps = ('build', 'link', 'run') -nolink = ('build', 'run') +nolink = ('build', 'run') +nobuild = ('link', 'run') +norun = ('link', 'build') special_types = { 'alldeps': alldeps, + 'all': alldeps, # allow "all" as string but not symbol. 'nolink': nolink, + 'nobuild': nobuild, + 'norun': norun, } +legal_deps = tuple(special_types) + alldeps + + +def validate_deptype(deptype): + if isinstance(deptype, str): + if deptype not in legal_deps: + raise InvalidDependencyTypeError( + "Invalid dependency type: %s" % deptype) + + elif isinstance(deptype, (list, tuple)): + for t in deptype: + validate_deptype(t) + + elif deptype is None: + raise InvalidDependencyTypeError("deptype cannot be None!") + + +def canonical_deptype(deptype): + if deptype is None: + return alldeps + + elif isinstance(deptype, str): + return special_types.get(deptype, (deptype,)) + + elif isinstance(deptype, (tuple, list)): + return (sum((canonical_deptype(d) for d in deptype), ())) + + return deptype + def colorize_spec(spec): """Returns a spec colorized according to the colors specified in @@ -527,6 +594,14 @@ class Spec(object): # XXX(deptype): default deptypes self._add_dependency(spec, ('build', 'link')) + def __getattr__(self, item): + """Delegate to self.package if the attribute is not in the spec""" + # This line is to avoid infinite recursion in case package is + # not present among self attributes + if item.endswith('libs'): + return getattr(self.package, item) + raise AttributeError() + def get_dependency(self, name): dep = self._dependencies.get(name) if dep is not None: @@ -534,17 +609,8 @@ class Spec(object): raise InvalidDependencyException( self.name + " does not depend on " + comma_or(name)) - def _deptype_norm(self, deptype): - if deptype is None: - return alldeps - # Force deptype to be a set object so that we can do set intersections. - if isinstance(deptype, str): - # Support special deptypes. - return special_types.get(deptype, (deptype,)) - return deptype - def _find_deps(self, where, deptype): - deptype = self._deptype_norm(deptype) + deptype = canonical_deptype(deptype) return [dep.spec for dep in where.values() @@ -557,7 +623,7 @@ class Spec(object): return self._find_deps(self._dependents, deptype) def _find_deps_dict(self, where, deptype): - deptype = self._deptype_norm(deptype) + deptype = canonical_deptype(deptype) return dict((dep.spec.name, dep) for dep in where.values() @@ -1353,12 +1419,11 @@ class Spec(object): # parser doesn't allow it. Spack must be broken! raise InconsistentSpecError("Invalid Spec DAG: %s" % e.message) - def index(self): + def index(self, deptype=None): """Return DependencyMap that points to all the dependencies in this spec.""" dm = DependencyMap() - # XXX(deptype): use a deptype kwarg. - for spec in self.traverse(): + for spec in self.traverse(deptype=deptype): dm[spec.name] = spec return dm @@ -1561,7 +1626,7 @@ class Spec(object): # actually deps of this package. Raise an error. extra = set(spec_deps.keys()).difference(visited) if extra: - raise InvalidDependencyException( + raise InvalidDependencyError( self.name + " does not depend on " + comma_or(extra)) # Mark the spec as normal once done. @@ -2659,17 +2724,11 @@ def parse_anonymous_spec(spec_like, pkg_name): class SpecError(spack.error.SpackError): - """Superclass for all errors that occur while constructing specs.""" - def __init__(self, message): - super(SpecError, self).__init__(message) - class SpecParseError(SpecError): - """Wrapper for ParseError for when we're parsing specs.""" - def __init__(self, parse_error): super(SpecParseError, self).__init__(parse_error.message) self.string = parse_error.string @@ -2677,79 +2736,53 @@ class SpecParseError(SpecError): class DuplicateDependencyError(SpecError): - """Raised when the same dependency occurs in a spec twice.""" - def __init__(self, message): - super(DuplicateDependencyError, self).__init__(message) - class DuplicateVariantError(SpecError): - """Raised when the same variant occurs in a spec twice.""" - def __init__(self, message): - super(DuplicateVariantError, self).__init__(message) - class DuplicateCompilerSpecError(SpecError): - """Raised when the same compiler occurs in a spec twice.""" - def __init__(self, message): - super(DuplicateCompilerSpecError, self).__init__(message) - class UnsupportedCompilerError(SpecError): - """Raised when the user asks for a compiler spack doesn't know about.""" - def __init__(self, compiler_name): super(UnsupportedCompilerError, self).__init__( "The '%s' compiler is not yet supported." % compiler_name) class UnknownVariantError(SpecError): - """Raised when the same variant occurs in a spec twice.""" - def __init__(self, pkg, variant): super(UnknownVariantError, self).__init__( "Package %s has no variant %s!" % (pkg, variant)) class DuplicateArchitectureError(SpecError): - """Raised when the same architecture occurs in a spec twice.""" - def __init__(self, message): - super(DuplicateArchitectureError, self).__init__(message) - class InconsistentSpecError(SpecError): - """Raised when two nodes in the same spec DAG have inconsistent constraints.""" - def __init__(self, message): - super(InconsistentSpecError, self).__init__(message) - - -class InvalidDependencyException(SpecError): +class InvalidDependencyError(SpecError): """Raised when a dependency in a spec is not actually a dependency of the package.""" - def __init__(self, message): - super(InvalidDependencyException, self).__init__(message) +class InvalidDependencyTypeError(SpecError): + """Raised when a dependency type is not a legal Spack dep type.""" -class NoProviderError(SpecError): +class NoProviderError(SpecError): """Raised when there is no package that provides a particular virtual dependency. """ - def __init__(self, vpkg): super(NoProviderError, self).__init__( "No providers found for virtual package: '%s'" % vpkg) @@ -2757,11 +2790,9 @@ class NoProviderError(SpecError): class MultipleProviderError(SpecError): - """Raised when there is no package that provides a particular virtual dependency. """ - def __init__(self, vpkg, providers): """Takes the name of the vpkg""" super(MultipleProviderError, self).__init__( @@ -2772,10 +2803,8 @@ class MultipleProviderError(SpecError): class UnsatisfiableSpecError(SpecError): - """Raised when a spec conflicts with package constraints. Provide the requirement that was violated when raising.""" - def __init__(self, provided, required, constraint_type): super(UnsatisfiableSpecError, self).__init__( "%s does not satisfy %s" % (provided, required)) @@ -2785,89 +2814,70 @@ class UnsatisfiableSpecError(SpecError): class UnsatisfiableSpecNameError(UnsatisfiableSpecError): - """Raised when two specs aren't even for the same package.""" - def __init__(self, provided, required): super(UnsatisfiableSpecNameError, self).__init__( provided, required, "name") class UnsatisfiableVersionSpecError(UnsatisfiableSpecError): - """Raised when a spec version conflicts with package constraints.""" - def __init__(self, provided, required): super(UnsatisfiableVersionSpecError, self).__init__( provided, required, "version") class UnsatisfiableCompilerSpecError(UnsatisfiableSpecError): - """Raised when a spec comiler conflicts with package constraints.""" - def __init__(self, provided, required): super(UnsatisfiableCompilerSpecError, self).__init__( provided, required, "compiler") class UnsatisfiableVariantSpecError(UnsatisfiableSpecError): - """Raised when a spec variant conflicts with package constraints.""" - def __init__(self, provided, required): super(UnsatisfiableVariantSpecError, self).__init__( provided, required, "variant") class UnsatisfiableCompilerFlagSpecError(UnsatisfiableSpecError): - """Raised when a spec variant conflicts with package constraints.""" - def __init__(self, provided, required): super(UnsatisfiableCompilerFlagSpecError, self).__init__( provided, required, "compiler_flags") class UnsatisfiableArchitectureSpecError(UnsatisfiableSpecError): - """Raised when a spec architecture conflicts with package constraints.""" - def __init__(self, provided, required): super(UnsatisfiableArchitectureSpecError, self).__init__( provided, required, "architecture") class UnsatisfiableProviderSpecError(UnsatisfiableSpecError): - """Raised when a provider is supplied but constraints don't match a vpkg requirement""" - def __init__(self, provided, required): super(UnsatisfiableProviderSpecError, self).__init__( provided, required, "provider") + # TODO: get rid of this and be more specific about particular incompatible # dep constraints - - class UnsatisfiableDependencySpecError(UnsatisfiableSpecError): - """Raised when some dependency of constrained specs are incompatible""" - def __init__(self, provided, required): super(UnsatisfiableDependencySpecError, self).__init__( provided, required, "dependency") class SpackYAMLError(spack.error.SpackError): - def __init__(self, msg, yaml_error): super(SpackYAMLError, self).__init__(msg, str(yaml_error)) class AmbiguousHashError(SpecError): - def __init__(self, msg, *specs): super(AmbiguousHashError, self).__init__(msg) for spec in specs: diff --git a/lib/spack/spack/stage.py b/lib/spack/spack/stage.py index c0705a89c8..b659cfb2fb 100644 --- a/lib/spack/spack/stage.py +++ b/lib/spack/spack/stage.py @@ -216,9 +216,9 @@ class Stage(object): def expected_archive_files(self): """Possible archive file paths.""" paths = [] - if isinstance(self.fetcher, fs.URLFetchStrategy): + if isinstance(self.default_fetcher, fs.URLFetchStrategy): paths.append(os.path.join( - self.path, os.path.basename(self.fetcher.url))) + self.path, os.path.basename(self.default_fetcher.url))) if self.mirror_path: paths.append(os.path.join( @@ -227,18 +227,18 @@ class Stage(object): return paths @property + def save_filename(self): + possible_filenames = self.expected_archive_files + if possible_filenames: + # This prefers using the URL associated with the default fetcher if + # available, so that the fetched resource name matches the remote + # name + return possible_filenames[0] + + @property def archive_file(self): """Path to the source archive within this stage directory.""" - paths = [] - if isinstance(self.fetcher, fs.URLFetchStrategy): - paths.append(os.path.join( - self.path, os.path.basename(self.fetcher.url))) - - if self.mirror_path: - paths.append(os.path.join( - self.path, os.path.basename(self.mirror_path))) - - for path in paths: + for path in self.expected_archive_files: if os.path.exists(path): return path else: @@ -301,8 +301,10 @@ class Stage(object): # then use the same digest. `spack mirror` ensures that # the checksum will be the same. digest = None + expand = True if isinstance(self.default_fetcher, fs.URLFetchStrategy): digest = self.default_fetcher.digest + expand = self.default_fetcher.expand_archive # Have to skip the checksum for things archived from # repositories. How can this be made safer? @@ -310,9 +312,11 @@ class Stage(object): # Add URL strategies for all the mirrors with the digest for url in urls: - fetchers.insert(0, fs.URLFetchStrategy(url, digest)) - fetchers.insert(0, spack.fetch_cache.fetcher(self.mirror_path, - digest)) + fetchers.insert( + 0, fs.URLFetchStrategy(url, digest, expand=expand)) + fetchers.insert( + 0, spack.fetch_cache.fetcher( + self.mirror_path, digest, expand=expand)) # Look for the archive in list_url package_name = os.path.dirname(self.mirror_path) diff --git a/lib/spack/spack/test/__init__.py b/lib/spack/spack/test/__init__.py index db683917b5..0a946ff2ff 100644 --- a/lib/spack/spack/test/__init__.py +++ b/lib/spack/spack/test/__init__.py @@ -53,6 +53,7 @@ test_names = [ 'git_fetch', 'hg_fetch', 'install', + 'library_list', 'link_tree', 'lock', 'make_executable', diff --git a/lib/spack/spack/test/cc.py b/lib/spack/spack/test/cc.py index f3e4bb31d2..73c711724c 100644 --- a/lib/spack/spack/test/cc.py +++ b/lib/spack/spack/test/cc.py @@ -223,6 +223,8 @@ class CompilerTest(unittest.TestCase): def test_dep_include(self): """Ensure a single dependency include directory is added.""" os.environ['SPACK_DEPENDENCIES'] = self.dep4 + os.environ['SPACK_RPATH_DEPS'] = os.environ['SPACK_DEPENDENCIES'] + os.environ['SPACK_LINK_DEPS'] = os.environ['SPACK_DEPENDENCIES'] self.check_cc('dump-args', test_command, self.realcc + ' ' + '-Wl,-rpath,' + self.prefix + '/lib ' + @@ -233,6 +235,8 @@ class CompilerTest(unittest.TestCase): def test_dep_lib(self): """Ensure a single dependency RPATH is added.""" os.environ['SPACK_DEPENDENCIES'] = self.dep2 + os.environ['SPACK_RPATH_DEPS'] = os.environ['SPACK_DEPENDENCIES'] + os.environ['SPACK_LINK_DEPS'] = os.environ['SPACK_DEPENDENCIES'] self.check_cc('dump-args', test_command, self.realcc + ' ' + '-Wl,-rpath,' + self.prefix + '/lib ' + @@ -241,10 +245,34 @@ class CompilerTest(unittest.TestCase): '-Wl,-rpath,' + self.dep2 + '/lib64 ' + ' '.join(test_command)) + def test_dep_lib_no_rpath(self): + """Ensure a single dependency link flag is added with no dep RPATH.""" + os.environ['SPACK_DEPENDENCIES'] = self.dep2 + os.environ['SPACK_LINK_DEPS'] = os.environ['SPACK_DEPENDENCIES'] + self.check_cc('dump-args', test_command, + self.realcc + ' ' + + '-Wl,-rpath,' + self.prefix + '/lib ' + + '-Wl,-rpath,' + self.prefix + '/lib64 ' + + '-L' + self.dep2 + '/lib64 ' + + ' '.join(test_command)) + + def test_dep_lib_no_lib(self): + """Ensure a single dependency RPATH is added with no -L.""" + os.environ['SPACK_DEPENDENCIES'] = self.dep2 + os.environ['SPACK_RPATH_DEPS'] = os.environ['SPACK_DEPENDENCIES'] + self.check_cc('dump-args', test_command, + self.realcc + ' ' + + '-Wl,-rpath,' + self.prefix + '/lib ' + + '-Wl,-rpath,' + self.prefix + '/lib64 ' + + '-Wl,-rpath,' + self.dep2 + '/lib64 ' + + ' '.join(test_command)) + def test_all_deps(self): """Ensure includes and RPATHs for all deps are added. """ os.environ['SPACK_DEPENDENCIES'] = ':'.join([ self.dep1, self.dep2, self.dep3, self.dep4]) + os.environ['SPACK_RPATH_DEPS'] = os.environ['SPACK_DEPENDENCIES'] + os.environ['SPACK_LINK_DEPS'] = os.environ['SPACK_DEPENDENCIES'] # This is probably more constrained than it needs to be; it # checks order within prepended args and doesn't strictly have @@ -273,6 +301,8 @@ class CompilerTest(unittest.TestCase): """Ensure no (extra) -I args or -Wl, are passed in ld mode.""" os.environ['SPACK_DEPENDENCIES'] = ':'.join([ self.dep1, self.dep2, self.dep3, self.dep4]) + os.environ['SPACK_RPATH_DEPS'] = os.environ['SPACK_DEPENDENCIES'] + os.environ['SPACK_LINK_DEPS'] = os.environ['SPACK_DEPENDENCIES'] self.check_ld('dump-args', test_command, 'ld ' + @@ -290,10 +320,46 @@ class CompilerTest(unittest.TestCase): ' '.join(test_command)) + def test_ld_deps_no_rpath(self): + """Ensure SPACK_RPATH_DEPS controls RPATHs for ld.""" + os.environ['SPACK_DEPENDENCIES'] = ':'.join([ + self.dep1, self.dep2, self.dep3, self.dep4]) + os.environ['SPACK_LINK_DEPS'] = os.environ['SPACK_DEPENDENCIES'] + + self.check_ld('dump-args', test_command, + 'ld ' + + '-rpath ' + self.prefix + '/lib ' + + '-rpath ' + self.prefix + '/lib64 ' + + + '-L' + self.dep3 + '/lib64 ' + + '-L' + self.dep2 + '/lib64 ' + + '-L' + self.dep1 + '/lib ' + + + ' '.join(test_command)) + + def test_ld_deps_no_link(self): + """Ensure SPACK_LINK_DEPS controls -L for ld.""" + os.environ['SPACK_DEPENDENCIES'] = ':'.join([ + self.dep1, self.dep2, self.dep3, self.dep4]) + os.environ['SPACK_RPATH_DEPS'] = os.environ['SPACK_DEPENDENCIES'] + + self.check_ld('dump-args', test_command, + 'ld ' + + '-rpath ' + self.prefix + '/lib ' + + '-rpath ' + self.prefix + '/lib64 ' + + + '-rpath ' + self.dep3 + '/lib64 ' + + '-rpath ' + self.dep2 + '/lib64 ' + + '-rpath ' + self.dep1 + '/lib ' + + + ' '.join(test_command)) + def test_ld_deps_reentrant(self): """Make sure ld -r is handled correctly on OS's where it doesn't support rpaths.""" os.environ['SPACK_DEPENDENCIES'] = ':'.join([self.dep1]) + os.environ['SPACK_RPATH_DEPS'] = os.environ['SPACK_DEPENDENCIES'] + os.environ['SPACK_LINK_DEPS'] = os.environ['SPACK_DEPENDENCIES'] os.environ['SPACK_SHORT_SPEC'] = "foo@1.2=linux-x86_64" reentrant_test_command = ['-r'] + test_command diff --git a/lib/spack/spack/test/database.py b/lib/spack/spack/test/database.py index 22b1f17890..4395f17f97 100644 --- a/lib/spack/spack/test/database.py +++ b/lib/spack/spack/test/database.py @@ -26,8 +26,8 @@ These tests check the database is functioning properly, both in memory and in its file """ -import os.path import multiprocessing +import os.path import spack from llnl.util.filesystem import join_path @@ -88,16 +88,16 @@ class DatabaseTest(MockDatabase): # query specs with multiple configurations mpileaks_specs = [s for s in all_specs if s.satisfies('mpileaks')] callpath_specs = [s for s in all_specs if s.satisfies('callpath')] - mpi_specs = [s for s in all_specs if s.satisfies('mpi')] + mpi_specs = [s for s in all_specs if s.satisfies('mpi')] self.assertEqual(len(mpileaks_specs), 3) self.assertEqual(len(callpath_specs), 3) self.assertEqual(len(mpi_specs), 3) # query specs with single configurations - dyninst_specs = [s for s in all_specs if s.satisfies('dyninst')] + dyninst_specs = [s for s in all_specs if s.satisfies('dyninst')] libdwarf_specs = [s for s in all_specs if s.satisfies('libdwarf')] - libelf_specs = [s for s in all_specs if s.satisfies('libelf')] + libelf_specs = [s for s in all_specs if s.satisfies('libelf')] self.assertEqual(len(dyninst_specs), 1) self.assertEqual(len(libdwarf_specs), 1) @@ -124,6 +124,19 @@ class DatabaseTest(MockDatabase): self.assertEqual(new_rec.path, rec.path) self.assertEqual(new_rec.installed, rec.installed) + def _check_merkleiness(self): + """Ensure the spack database is a valid merkle graph.""" + all_specs = spack.installed_db.query(installed=any) + + seen = {} + for spec in all_specs: + for dep in spec.dependencies(): + hash_key = dep.dag_hash() + if hash_key not in seen: + seen[hash_key] = id(dep) + else: + self.assertEqual(seen[hash_key], id(dep)) + def _check_db_sanity(self): """Utiilty function to check db against install layout.""" expected = sorted(spack.install_layout.all_specs()) @@ -133,10 +146,17 @@ class DatabaseTest(MockDatabase): for e, a in zip(expected, actual): self.assertEqual(e, a) + self._check_merkleiness() + def test_020_db_sanity(self): """Make sure query() returns what's actually in the db.""" self._check_db_sanity() + def test_025_reindex(self): + """Make sure reindex works and ref counts are valid.""" + spack.installed_db.reindex(spack.install_layout) + self._check_db_sanity() + def test_030_db_sanity_from_another_process(self): def read_and_modify(): self._check_db_sanity() # check that other process can read DB @@ -163,16 +183,16 @@ class DatabaseTest(MockDatabase): # query specs with multiple configurations mpileaks_specs = self.installed_db.query('mpileaks') callpath_specs = self.installed_db.query('callpath') - mpi_specs = self.installed_db.query('mpi') + mpi_specs = self.installed_db.query('mpi') self.assertEqual(len(mpileaks_specs), 3) self.assertEqual(len(callpath_specs), 3) self.assertEqual(len(mpi_specs), 3) # query specs with single configurations - dyninst_specs = self.installed_db.query('dyninst') + dyninst_specs = self.installed_db.query('dyninst') libdwarf_specs = self.installed_db.query('libdwarf') - libelf_specs = self.installed_db.query('libelf') + libelf_specs = self.installed_db.query('libelf') self.assertEqual(len(dyninst_specs), 1) self.assertEqual(len(libdwarf_specs), 1) @@ -203,9 +223,10 @@ class DatabaseTest(MockDatabase): self.assertTrue(concrete_spec not in remaining) # add it back and make sure everything is ok. - self.installed_db.add(concrete_spec, "") + self.installed_db.add(concrete_spec, spack.install_layout) installed = self.installed_db.query() - self.assertEqual(len(installed), len(original)) + self.assertTrue(concrete_spec in installed) + self.assertEqual(installed, original) # sanity check against direcory layout and check ref counts. self._check_db_sanity() @@ -233,7 +254,7 @@ class DatabaseTest(MockDatabase): self.assertEqual(self.installed_db.get_record('mpich').ref_count, 1) # Put the spec back - self.installed_db.add(rec.spec, rec.path) + self.installed_db.add(rec.spec, spack.install_layout) # record is present again self.assertEqual( diff --git a/lib/spack/spack/test/library_list.py b/lib/spack/spack/test/library_list.py new file mode 100644 index 0000000000..7fc2fd222f --- /dev/null +++ b/lib/spack/spack/test/library_list.py @@ -0,0 +1,111 @@ +############################################################################## +# 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 +############################################################################## + +import unittest + +from llnl.util.filesystem import LibraryList + + +class LibraryListTest(unittest.TestCase): + def setUp(self): + l = [ + '/dir1/liblapack.a', + '/dir2/libfoo.dylib', + '/dir1/libblas.a', + '/dir3/libbar.so', + 'libbaz.so' + ] + self.liblist = LibraryList(l) + + def test_repr(self): + x = eval(repr(self.liblist)) + self.assertEqual(self.liblist, x) + + def test_joined_and_str(self): + s1 = self.liblist.joined() + self.assertEqual( + s1, + '/dir1/liblapack.a /dir2/libfoo.dylib /dir1/libblas.a /dir3/libbar.so libbaz.so' # NOQA: ignore=E501 + ) + s2 = str(self.liblist) + self.assertEqual(s1, s2) + s3 = self.liblist.joined(';') + self.assertEqual( + s3, + '/dir1/liblapack.a;/dir2/libfoo.dylib;/dir1/libblas.a;/dir3/libbar.so;libbaz.so' # NOQA: ignore=E501 + ) + + def test_flags(self): + search_flags = self.liblist.search_flags + self.assertTrue('-L/dir1' in search_flags) + self.assertTrue('-L/dir2' in search_flags) + self.assertTrue('-L/dir3' in search_flags) + self.assertTrue(isinstance(search_flags, str)) + + link_flags = self.liblist.link_flags + self.assertEqual( + link_flags, + '-llapack -lfoo -lblas -lbar -lbaz' + ) + + ld_flags = self.liblist.ld_flags + self.assertEqual(ld_flags, search_flags + ' ' + link_flags) + + def test_paths_manipulation(self): + names = self.liblist.names + self.assertEqual(names, ['lapack', 'foo', 'blas', 'bar', 'baz']) + + directories = self.liblist.directories + self.assertEqual(directories, ['/dir1', '/dir2', '/dir3']) + + def test_get_item(self): + a = self.liblist[0] + self.assertEqual(a, '/dir1/liblapack.a') + + b = self.liblist[:] + self.assertEqual(type(b), type(self.liblist)) + self.assertEqual(self.liblist, b) + self.assertTrue(self.liblist is not b) + + def test_add(self): + pylist = [ + '/dir1/liblapack.a', # removed from the final list + '/dir2/libbaz.so', + '/dir4/libnew.a' + ] + another = LibraryList(pylist) + l = self.liblist + another + self.assertEqual(len(l), 7) + # Invariant : l == l + l + self.assertEqual(l, l + l) + # Always produce an instance of LibraryList + self.assertEqual( + type(self.liblist), + type(self.liblist + pylist) + ) + self.assertEqual( + type(pylist + self.liblist), + type(self.liblist) + ) diff --git a/lib/spack/spack/test/lock.py b/lib/spack/spack/test/lock.py index fb96539897..32cbe13ce1 100644 --- a/lib/spack/spack/test/lock.py +++ b/lib/spack/spack/test/lock.py @@ -158,6 +158,35 @@ class LockTest(unittest.TestCase): self.timeout_write, self.timeout_write) # + # Test that read can be upgraded to write. + # + def test_upgrade_read_to_write(self): + # ensure lock file exists the first time, so we open it read-only + # to begin wtih. + touch(self.lock_path) + + lock = Lock(self.lock_path) + self.assertTrue(lock._reads == 0) + self.assertTrue(lock._writes == 0) + + lock.acquire_read() + self.assertTrue(lock._reads == 1) + self.assertTrue(lock._writes == 0) + + lock.acquire_write() + self.assertTrue(lock._reads == 1) + self.assertTrue(lock._writes == 1) + + lock.release_write() + self.assertTrue(lock._reads == 1) + self.assertTrue(lock._writes == 0) + + lock.release_read() + self.assertTrue(lock._reads == 0) + self.assertTrue(lock._writes == 0) + self.assertTrue(lock._fd is None) + + # # Longer test case that ensures locks are reusable. Ordering is # enforced by barriers throughout -- steps are shown with numbers. # diff --git a/lib/spack/spack/test/modules.py b/lib/spack/spack/test/modules.py index 5e280d8e43..c4cf2865bb 100644 --- a/lib/spack/spack/test/modules.py +++ b/lib/spack/spack/test/modules.py @@ -49,105 +49,10 @@ def mock_open(filename, mode): handle.close() -configuration_autoload_direct = { - 'enable': ['tcl'], - 'tcl': { - 'all': { - 'autoload': 'direct' - } - } -} - -configuration_autoload_all = { - 'enable': ['tcl'], - 'tcl': { - 'all': { - 'autoload': 'all' - } - } -} - -configuration_prerequisites_direct = { - 'enable': ['tcl'], - 'tcl': { - 'all': { - 'prerequisites': 'direct' - } - } -} - -configuration_prerequisites_all = { - 'enable': ['tcl'], - 'tcl': { - 'all': { - 'prerequisites': 'all' - } - } -} - -configuration_alter_environment = { - 'enable': ['tcl'], - 'tcl': { - 'all': { - 'filter': {'environment_blacklist': ['CMAKE_PREFIX_PATH']}, - 'environment': { - 'set': {'{name}_ROOT': '{prefix}'} - } - }, - 'platform=test target=x86_64': { - 'environment': { - 'set': {'FOO': 'foo'}, - 'unset': ['BAR'] - } - }, - 'platform=test target=x86_32': { - 'load': ['foo/bar'] - } - } -} - -configuration_blacklist = { - 'enable': ['tcl'], - 'tcl': { - 'whitelist': ['zmpi'], - 'blacklist': ['callpath', 'mpi'], - 'all': { - 'autoload': 'direct' - } - } -} - -configuration_conflicts = { - 'enable': ['tcl'], - 'tcl': { - 'naming_scheme': '{name}/{version}-{compiler.name}', - 'all': { - 'conflict': ['{name}', 'intel/14.0.1'] - } - } -} - -configuration_wrong_conflicts = { - 'enable': ['tcl'], - 'tcl': { - 'naming_scheme': '{name}/{version}-{compiler.name}', - 'all': { - 'conflict': ['{name}/{compiler.name}'] - } - } -} - -configuration_suffix = { - 'enable': ['tcl'], - 'tcl': { - 'mpileaks': { - 'suffixes': { - '+debug': 'foo', - '~debug': 'bar' - } - } - } -} +# Spec strings that will be used throughout the tests +mpich_spec_string = 'mpich@3.0.4' +mpileaks_spec_string = 'mpileaks' +libdwarf_spec_string = 'libdwarf arch=x64-linux' class HelperFunctionsTests(MockPackagesTest): @@ -187,61 +92,195 @@ class HelperFunctionsTests(MockPackagesTest): self.assertTrue('CPATH' in names) -class TclTests(MockPackagesTest): +class ModuleFileGeneratorTests(MockPackagesTest): + """ + Base class to test module file generators. Relies on child having defined + a 'factory' attribute to create an instance of the generator to be tested. + """ def setUp(self): - super(TclTests, self).setUp() - self.configuration_obj = spack.modules.CONFIGURATION + super(ModuleFileGeneratorTests, self).setUp() + self.configuration_instance = spack.modules.CONFIGURATION + self.module_types_instance = spack.modules.module_types spack.modules.open = mock_open # Make sure that a non-mocked configuration will trigger an error spack.modules.CONFIGURATION = None + spack.modules.module_types = {self.factory.name: self.factory} def tearDown(self): del spack.modules.open - spack.modules.CONFIGURATION = self.configuration_obj - super(TclTests, self).tearDown() + spack.modules.module_types = self.module_types_instance + spack.modules.CONFIGURATION = self.configuration_instance + super(ModuleFileGeneratorTests, self).tearDown() def get_modulefile_content(self, spec): spec.concretize() - generator = spack.modules.TclModule(spec) + generator = self.factory(spec) generator.write() content = FILE_REGISTRY[generator.file_name].split('\n') return content + +class TclTests(ModuleFileGeneratorTests): + + factory = spack.modules.TclModule + + configuration_autoload_direct = { + 'enable': ['tcl'], + 'tcl': { + 'all': { + 'autoload': 'direct' + } + } + } + + configuration_autoload_all = { + 'enable': ['tcl'], + 'tcl': { + 'all': { + 'autoload': 'all' + } + } + } + + configuration_prerequisites_direct = { + 'enable': ['tcl'], + 'tcl': { + 'all': { + 'prerequisites': 'direct' + } + } + } + + configuration_prerequisites_all = { + 'enable': ['tcl'], + 'tcl': { + 'all': { + 'prerequisites': 'all' + } + } + } + + configuration_alter_environment = { + 'enable': ['tcl'], + 'tcl': { + 'all': { + 'filter': {'environment_blacklist': ['CMAKE_PREFIX_PATH']}, + 'environment': { + 'set': {'{name}_ROOT': '{prefix}'} + } + }, + 'platform=test target=x86_64': { + 'environment': { + 'set': {'FOO': 'foo'}, + 'unset': ['BAR'] + } + }, + 'platform=test target=x86_32': { + 'load': ['foo/bar'] + } + } + } + + configuration_blacklist = { + 'enable': ['tcl'], + 'tcl': { + 'whitelist': ['zmpi'], + 'blacklist': ['callpath', 'mpi'], + 'all': { + 'autoload': 'direct' + } + } + } + + configuration_conflicts = { + 'enable': ['tcl'], + 'tcl': { + 'naming_scheme': '{name}/{version}-{compiler.name}', + 'all': { + 'conflict': ['{name}', 'intel/14.0.1'] + } + } + } + + configuration_wrong_conflicts = { + 'enable': ['tcl'], + 'tcl': { + 'naming_scheme': '{name}/{version}-{compiler.name}', + 'all': { + 'conflict': ['{name}/{compiler.name}'] + } + } + } + + configuration_suffix = { + 'enable': ['tcl'], + 'tcl': { + 'mpileaks': { + 'suffixes': { + '+debug': 'foo', + '~debug': 'bar' + } + } + } + } + def test_simple_case(self): - spack.modules.CONFIGURATION = configuration_autoload_direct - spec = spack.spec.Spec('mpich@3.0.4') + spack.modules.CONFIGURATION = self.configuration_autoload_direct + spec = spack.spec.Spec(mpich_spec_string) content = self.get_modulefile_content(spec) self.assertTrue('module-whatis "mpich @3.0.4"' in content) self.assertRaises(TypeError, spack.modules.dependencies, spec, 'non-existing-tag') def test_autoload(self): - spack.modules.CONFIGURATION = configuration_autoload_direct - spec = spack.spec.Spec('mpileaks') + spack.modules.CONFIGURATION = self.configuration_autoload_direct + spec = spack.spec.Spec(mpileaks_spec_string) content = self.get_modulefile_content(spec) self.assertEqual(len([x for x in content if 'is-loaded' in x]), 2) self.assertEqual(len([x for x in content if 'module load ' in x]), 2) - spack.modules.CONFIGURATION = configuration_autoload_all - spec = spack.spec.Spec('mpileaks') + spack.modules.CONFIGURATION = self.configuration_autoload_all + spec = spack.spec.Spec(mpileaks_spec_string) content = self.get_modulefile_content(spec) self.assertEqual(len([x for x in content if 'is-loaded' in x]), 5) self.assertEqual(len([x for x in content if 'module load ' in x]), 5) + # dtbuild1 has + # - 1 ('run',) dependency + # - 1 ('build','link') dependency + # - 1 ('build',) dependency + # Just make sure the 'build' dependency is not there + spack.modules.CONFIGURATION = self.configuration_autoload_direct + spec = spack.spec.Spec('dtbuild1') + content = self.get_modulefile_content(spec) + self.assertEqual(len([x for x in content if 'is-loaded' in x]), 2) + self.assertEqual(len([x for x in content if 'module load ' in x]), 2) + + # dtbuild1 has + # - 1 ('run',) dependency + # - 1 ('build','link') dependency + # - 1 ('build',) dependency + # Just make sure the 'build' dependency is not there + spack.modules.CONFIGURATION = self.configuration_autoload_all + spec = spack.spec.Spec('dtbuild1') + content = self.get_modulefile_content(spec) + self.assertEqual(len([x for x in content if 'is-loaded' in x]), 2) + self.assertEqual(len([x for x in content if 'module load ' in x]), 2) + def test_prerequisites(self): - spack.modules.CONFIGURATION = configuration_prerequisites_direct + spack.modules.CONFIGURATION = self.configuration_prerequisites_direct spec = spack.spec.Spec('mpileaks arch=x86-linux') content = self.get_modulefile_content(spec) self.assertEqual(len([x for x in content if 'prereq' in x]), 2) - spack.modules.CONFIGURATION = configuration_prerequisites_all + spack.modules.CONFIGURATION = self.configuration_prerequisites_all spec = spack.spec.Spec('mpileaks arch=x86-linux') content = self.get_modulefile_content(spec) self.assertEqual(len([x for x in content if 'prereq' in x]), 5) def test_alter_environment(self): - spack.modules.CONFIGURATION = configuration_alter_environment + spack.modules.CONFIGURATION = self.configuration_alter_environment spec = spack.spec.Spec('mpileaks platform=test target=x86_64') content = self.get_modulefile_content(spec) self.assertEqual( @@ -271,7 +310,7 @@ class TclTests(MockPackagesTest): len([x for x in content if 'setenv LIBDWARF_ROOT' in x]), 1) def test_blacklist(self): - spack.modules.CONFIGURATION = configuration_blacklist + spack.modules.CONFIGURATION = self.configuration_blacklist spec = spack.spec.Spec('mpileaks ^zmpi') content = self.get_modulefile_content(spec) self.assertEqual(len([x for x in content if 'is-loaded' in x]), 1) @@ -285,7 +324,7 @@ class TclTests(MockPackagesTest): self.assertEqual(len([x for x in content if 'module load ' in x]), 1) def test_conflicts(self): - spack.modules.CONFIGURATION = configuration_conflicts + spack.modules.CONFIGURATION = self.configuration_conflicts spec = spack.spec.Spec('mpileaks') content = self.get_modulefile_content(spec) self.assertEqual( @@ -295,11 +334,11 @@ class TclTests(MockPackagesTest): self.assertEqual( len([x for x in content if x == 'conflict intel/14.0.1']), 1) - spack.modules.CONFIGURATION = configuration_wrong_conflicts + spack.modules.CONFIGURATION = self.configuration_wrong_conflicts self.assertRaises(SystemExit, self.get_modulefile_content, spec) def test_suffixes(self): - spack.modules.CONFIGURATION = configuration_suffix + spack.modules.CONFIGURATION = self.configuration_suffix spec = spack.spec.Spec('mpileaks+debug arch=x86-linux') spec.concretize() generator = spack.modules.TclModule(spec) @@ -311,18 +350,123 @@ class TclTests(MockPackagesTest): self.assertTrue('bar' in generator.use_name) -configuration_dotkit = { - 'enable': ['dotkit'], - 'dotkit': { - 'all': { - 'prerequisites': 'direct' +class LmodTests(ModuleFileGeneratorTests): + factory = spack.modules.LmodModule + + configuration_autoload_direct = { + 'enable': ['lmod'], + 'lmod': { + 'all': { + 'autoload': 'direct' + } + } + } + + configuration_autoload_all = { + 'enable': ['lmod'], + 'lmod': { + 'all': { + 'autoload': 'all' + } + } + } + + configuration_alter_environment = { + 'enable': ['lmod'], + 'lmod': { + 'all': { + 'filter': {'environment_blacklist': ['CMAKE_PREFIX_PATH']} + }, + 'platform=test target=x86_64': { + 'environment': { + 'set': {'FOO': 'foo'}, + 'unset': ['BAR'] + } + }, + 'platform=test target=x86_32': { + 'load': ['foo/bar'] + } + } + } + + configuration_blacklist = { + 'enable': ['lmod'], + 'lmod': { + 'blacklist': ['callpath'], + 'all': { + 'autoload': 'direct' + } } } -} + + def test_simple_case(self): + spack.modules.CONFIGURATION = self.configuration_autoload_direct + spec = spack.spec.Spec(mpich_spec_string) + content = self.get_modulefile_content(spec) + self.assertTrue('-- -*- lua -*-' in content) + self.assertTrue('whatis([[Name : mpich]])' in content) + self.assertTrue('whatis([[Version : 3.0.4]])' in content) + + def test_autoload(self): + spack.modules.CONFIGURATION = self.configuration_autoload_direct + spec = spack.spec.Spec(mpileaks_spec_string) + content = self.get_modulefile_content(spec) + self.assertEqual( + len([x for x in content if 'if not isloaded(' in x]), 2) + self.assertEqual(len([x for x in content if 'load(' in x]), 2) + + spack.modules.CONFIGURATION = self.configuration_autoload_all + spec = spack.spec.Spec(mpileaks_spec_string) + content = self.get_modulefile_content(spec) + self.assertEqual( + len([x for x in content if 'if not isloaded(' in x]), 5) + self.assertEqual(len([x for x in content if 'load(' in x]), 5) + + def test_alter_environment(self): + spack.modules.CONFIGURATION = self.configuration_alter_environment + spec = spack.spec.Spec('mpileaks platform=test target=x86_64') + content = self.get_modulefile_content(spec) + self.assertEqual( + len([x + for x in content + if x.startswith('prepend_path("CMAKE_PREFIX_PATH"')]), 0) + self.assertEqual( + len([x for x in content if 'setenv("FOO", "foo")' in x]), 1) + self.assertEqual( + len([x for x in content if 'unsetenv("BAR")' in x]), 1) + + spec = spack.spec.Spec('libdwarf %clang platform=test target=x86_32') + content = self.get_modulefile_content(spec) + print('\n'.join(content)) + self.assertEqual( + len([x + for x in content + if x.startswith('prepend-path("CMAKE_PREFIX_PATH"')]), 0) + self.assertEqual( + len([x for x in content if 'setenv("FOO", "foo")' in x]), 0) + self.assertEqual( + len([x for x in content if 'unsetenv("BAR")' in x]), 0) + + def test_blacklist(self): + spack.modules.CONFIGURATION = self.configuration_blacklist + spec = spack.spec.Spec(mpileaks_spec_string) + content = self.get_modulefile_content(spec) + self.assertEqual( + len([x for x in content if 'if not isloaded(' in x]), 1) + self.assertEqual(len([x for x in content if 'load(' in x]), 1) class DotkitTests(MockPackagesTest): + configuration_dotkit = { + 'enable': ['dotkit'], + 'dotkit': { + 'all': { + 'prerequisites': 'direct' + } + } + } + def setUp(self): super(DotkitTests, self).setUp() self.configuration_obj = spack.modules.CONFIGURATION @@ -343,7 +487,7 @@ class DotkitTests(MockPackagesTest): return content def test_dotkit(self): - spack.modules.CONFIGURATION = configuration_dotkit + spack.modules.CONFIGURATION = self.configuration_dotkit spec = spack.spec.Spec('mpileaks arch=x86-linux') content = self.get_modulefile_content(spec) self.assertTrue('#c spack' in content) diff --git a/lib/spack/spack/test/spec_dag.py b/lib/spack/spack/test/spec_dag.py index 5c2731041c..40cdb02966 100644 --- a/lib/spack/spack/test/spec_dag.py +++ b/lib/spack/spack/test/spec_dag.py @@ -241,15 +241,15 @@ class SpecDagTest(MockPackagesTest): def test_invalid_dep(self): spec = Spec('libelf ^mpich') - self.assertRaises(spack.spec.InvalidDependencyException, + self.assertRaises(spack.spec.InvalidDependencyError, spec.normalize) spec = Spec('libelf ^libdwarf') - self.assertRaises(spack.spec.InvalidDependencyException, + self.assertRaises(spack.spec.InvalidDependencyError, spec.normalize) spec = Spec('mpich ^dyninst ^libelf') - self.assertRaises(spack.spec.InvalidDependencyException, + self.assertRaises(spack.spec.InvalidDependencyError, spec.normalize) def test_equal(self): diff --git a/lib/spack/spack/test/spec_syntax.py b/lib/spack/spack/test/spec_syntax.py index 3079288c77..d4eb9e057f 100644 --- a/lib/spack/spack/test/spec_syntax.py +++ b/lib/spack/spack/test/spec_syntax.py @@ -24,34 +24,34 @@ ############################################################################## import unittest -import spack.spec +import spack.spec as sp from spack.parse import Token from spack.spec import * # Sample output for a complex lexing. -complex_lex = [Token(ID, 'mvapich_foo'), - Token(DEP), - Token(ID, '_openmpi'), - Token(AT), - Token(ID, '1.2'), - Token(COLON), - Token(ID, '1.4'), - Token(COMMA), - Token(ID, '1.6'), - Token(PCT), - Token(ID, 'intel'), - Token(AT), - Token(ID, '12.1'), - Token(COLON), - Token(ID, '12.6'), - Token(ON), - Token(ID, 'debug'), - Token(OFF), - Token(ID, 'qt_4'), - Token(DEP), - Token(ID, 'stackwalker'), - Token(AT), - Token(ID, '8.1_1e')] +complex_lex = [Token(sp.ID, 'mvapich_foo'), + Token(sp.DEP), + Token(sp.ID, '_openmpi'), + Token(sp.AT), + Token(sp.ID, '1.2'), + Token(sp.COLON), + Token(sp.ID, '1.4'), + Token(sp.COMMA), + Token(sp.ID, '1.6'), + Token(sp.PCT), + Token(sp.ID, 'intel'), + Token(sp.AT), + Token(sp.ID, '12.1'), + Token(sp.COLON), + Token(sp.ID, '12.6'), + Token(sp.ON), + Token(sp.ID, 'debug'), + Token(sp.OFF), + Token(sp.ID, 'qt_4'), + Token(sp.DEP), + Token(sp.ID, 'stackwalker'), + Token(sp.AT), + Token(sp.ID, '8.1_1e')] class SpecSyntaxTest(unittest.TestCase): @@ -74,16 +74,16 @@ class SpecSyntaxTest(unittest.TestCase): """ if spec is None: spec = expected - output = spack.spec.parse(spec) + output = sp.parse(spec) parsed = (" ".join(str(spec) for spec in output)) self.assertEqual(expected, parsed) def check_lex(self, tokens, spec): """Check that the provided spec parses to the provided token list.""" - lex_output = SpecLexer().lex(spec) + lex_output = sp.SpecLexer().lex(spec) for tok, spec_tok in zip(tokens, lex_output): - if tok.type == ID: + if tok.type == sp.ID: self.assertEqual(tok, spec_tok) else: # Only check the type for non-identifiers. diff --git a/share/spack/qa/changed_files b/share/spack/qa/changed_files index 9c60b3b20b..c1fa55c053 100755 --- a/share/spack/qa/changed_files +++ b/share/spack/qa/changed_files @@ -18,11 +18,11 @@ SPACK_ROOT="$(dirname "$0")/../../.." cd "$SPACK_ROOT" # Add changed files that have been committed since branching off of develop -changed=($(git diff --name-only --find-renames develop... -- "$@")) +changed=($(git diff --name-only --diff-filter=ACMR develop... -- "$@")) # Add changed files that have been staged but not yet committed -changed+=($(git diff --name-only --find-renames --cached -- "$@")) +changed+=($(git diff --name-only --diff-filter=ACMR --cached -- "$@")) # Add changed files that are unstaged -changed+=($(git diff --name-only --find-renames -- "$@")) +changed+=($(git diff --name-only --diff-filter=ACMR -- "$@")) # Add new files that are untracked changed+=($(git ls-files --exclude-standard --other -- "$@")) diff --git a/share/spack/qa/check_dependencies b/share/spack/qa/check_dependencies index 08fad9cdc9..cf3d204f48 100755 --- a/share/spack/qa/check_dependencies +++ b/share/spack/qa/check_dependencies @@ -27,6 +27,9 @@ for dep in "$@"; do spack_package=py-flake8 pip_package=flake8 ;; + dot) + spack_package=graphviz + ;; git) spack_package=git ;; diff --git a/share/spack/qa/run-doc-tests b/share/spack/qa/run-doc-tests index 96b76a216e..dbf46c71aa 100755 --- a/share/spack/qa/run-doc-tests +++ b/share/spack/qa/run-doc-tests @@ -9,7 +9,7 @@ # run-doc-tests # # Notes: -# Requires sphinx, git, mercurial, and subversion. +# Requires sphinx, graphviz, git, mercurial, and subversion. # QA_DIR="$(dirname "$0")" @@ -20,6 +20,7 @@ DOC_DIR="$SPACK_ROOT/lib/spack/docs" deps=( sphinx-apidoc sphinx-build + dot git hg svn @@ -35,9 +36,7 @@ export PATH="$SPACK_ROOT/bin:$PATH" # Allows script to be run from anywhere cd "$DOC_DIR" -# Cleanup temporary files upon exit or when script is killed -trap 'make clean --silent' EXIT SIGINT SIGTERM - # Treat warnings as fatal errors +make clean --silent make SPHINXOPTS=-W diff --git a/var/spack/repos/builtin/packages/R/package.py b/var/spack/repos/builtin/packages/R/package.py index e880a3aa66..a0899084d0 100644 --- a/var/spack/repos/builtin/packages/R/package.py +++ b/var/spack/repos/builtin/packages/R/package.py @@ -58,7 +58,7 @@ class R(Package): # Concrete dependencies depends_on('readline') depends_on('ncurses') - depends_on('icu') + depends_on('icu4c') depends_on('glib') depends_on('zlib') depends_on('bzip2') diff --git a/var/spack/repos/builtin/packages/adios/adios_1100.patch b/var/spack/repos/builtin/packages/adios/adios_1100.patch new file mode 100644 index 0000000000..7a9f857c32 --- /dev/null +++ b/var/spack/repos/builtin/packages/adios/adios_1100.patch @@ -0,0 +1,29 @@ +From 3b21a8a4150962c6938baeceacd04f619cea2fbc Mon Sep 17 00:00:00 2001 +From: Norbert Podhorszki <pnorbert@ornl.gov> +Date: Thu, 1 Sep 2016 16:26:23 -0400 +Subject: [PATCH] ifdef around 'bool' type. hdf5 1.10 defines bool and breaks + compiling bp2h5.c + +--- + utils/bp2h5/bp2h5.c | 8 +++++--- + 1 file changed, 5 insertions(+), 3 deletions(-) + +diff --git a/utils/bp2h5/bp2h5.c b/utils/bp2h5/bp2h5.c +index 9c500c7..fa746bd 100644 +--- a/utils/bp2h5/bp2h5.c ++++ b/utils/bp2h5/bp2h5.c +@@ -43,9 +43,11 @@ + #include "dmalloc.h" + #endif + +-typedef int bool; +-#define false 0 +-#define true 1 ++#ifndef bool ++ typedef int bool; ++# define false 0 ++# define true 1 ++#endif + + bool noindex = false; // do no print array indices with data + bool printByteAsChar = false; // print 8 bit integer arrays as string diff --git a/var/spack/repos/builtin/packages/adios/package.py b/var/spack/repos/builtin/packages/adios/package.py index 01834383b8..e240ce0858 100644 --- a/var/spack/repos/builtin/packages/adios/package.py +++ b/var/spack/repos/builtin/packages/adios/package.py @@ -36,6 +36,8 @@ class Adios(Package): homepage = "http://www.olcf.ornl.gov/center-projects/adios/" url = "https://github.com/ornladios/ADIOS/archive/v1.10.0.tar.gz" + version('develop', git='https://github.com/ornladios/ADIOS.git', + branch='master') version('1.10.0', 'eff450a4c0130479417cfd63186957f3') version('1.9.0', '310ff02388bbaa2b1c1710ee970b5678') @@ -48,14 +50,14 @@ class Adios(Package): variant('mpi', default=True, description='Enable MPI support') variant('infiniband', default=False, description='Enable infiniband support') + # transforms variant('zlib', default=True, description='Enable szip transform support') variant('szip', default=False, description='Enable szip transform support') - variant('hdf5', default=False, description='Enable HDF5 transport support') - variant('netcdf', default=False, description='Enable NetCDF transport support') + # transports and serial file converters + variant('hdf5', default=False, description='Enable parallel HDF5 transport and serial bp2h5 converter') # Lots of setting up here for this package # module swap PrgEnv-intel PrgEnv-$COMP - # module load cray-netcdf/4.3.3.1 # module load cray-hdf5/1.8.14 # module load python/2.7.10 @@ -69,9 +71,13 @@ class Adios(Package): # optional transformations depends_on('zlib', when='+zlib') depends_on('szip', when='+szip') - # optional transports - depends_on('hdf5', when='+hdf5') - depends_on('netcdf', when='+netcdf') + # optional transports & file converters + depends_on('hdf5@1.8:+mpi', when='+hdf5') + + # Fix ADIOS <=1.10.0 compile error on HDF5 1.10+ + # https://github.com/ornladios/ADIOS/commit/3b21a8a41509 + # https://github.com/LLNL/spack/issues/1683 + patch('adios_1100.patch', when='@:1.10.0^hdf5@1.10:') def validate(self, spec): """ @@ -114,9 +120,7 @@ class Adios(Package): if '+szip' in spec: extra_args.append('--with-szip=%s' % spec['szip'].prefix) if '+hdf5' in spec: - extra_args.append('--with-hdf5=%s' % spec['hdf5'].prefix) - if '+netcdf' in spec: - extra_args.append('--with-netcdf=%s' % spec['netcdf'].prefix) + extra_args.append('--with-phdf5=%s' % spec['hdf5'].prefix) sh = which('sh') sh('./autogen.sh') diff --git a/var/spack/repos/builtin/packages/armadillo/package.py b/var/spack/repos/builtin/packages/armadillo/package.py index 4356f60aca..fdd682f5e5 100644 --- a/var/spack/repos/builtin/packages/armadillo/package.py +++ b/var/spack/repos/builtin/packages/armadillo/package.py @@ -46,18 +46,20 @@ class Armadillo(Package): depends_on('hdf5', when='+hdf5') def install(self, spec, prefix): + arpack = find_libraries(['libarpack'], root=spec[ + 'arpack-ng'].prefix.lib, shared=True) + superlu = find_libraries(['libsuperlu'], root=spec[ + 'superlu'].prefix, shared=False, recurse=True) cmake_args = [ # ARPACK support - '-DARPACK_LIBRARY={0}/libarpack.{1}'.format( - spec['arpack-ng'].prefix.lib, dso_suffix), + '-DARPACK_LIBRARY={0}'.format(arpack.joined()), # BLAS support - '-DBLAS_LIBRARY={0}'.format(spec['blas'].blas_shared_lib), + '-DBLAS_LIBRARY={0}'.format(spec['blas'].blas_libs.joined()), # LAPACK support - '-DLAPACK_LIBRARY={0}'.format(spec['lapack'].lapack_shared_lib), + '-DLAPACK_LIBRARY={0}'.format(spec['lapack'].lapack_libs.joined()), # SuperLU support '-DSuperLU_INCLUDE_DIR={0}'.format(spec['superlu'].prefix.include), - '-DSuperLU_LIBRARY={0}/libsuperlu.a'.format( - spec['superlu'].prefix.lib64), + '-DSuperLU_LIBRARY={0}'.format(superlu.joined()), # HDF5 support '-DDETECT_HDF5={0}'.format('ON' if '+hdf5' in spec else 'OFF') ] diff --git a/var/spack/repos/builtin/packages/arpack-ng/package.py b/var/spack/repos/builtin/packages/arpack-ng/package.py index 0e71125d41..87ab2bbaac 100644 --- a/var/spack/repos/builtin/packages/arpack-ng/package.py +++ b/var/spack/repos/builtin/packages/arpack-ng/package.py @@ -88,17 +88,16 @@ class ArpackNg(Package): options.append('-DCMAKE_INSTALL_NAME_DIR:PATH=%s/lib' % prefix) # Make sure we use Spack's blas/lapack: + lapack_libs = spec['lapack'].lapack_libs.joined(';') + blas_libs = spec['blas'].blas_libs.joined(';') + 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), + '-DLAPACK_INCLUDE_DIRS={0}'.format(spec['lapack'].prefix.include), + '-DLAPACK_LIBRARIES={0}'.format(lapack_libs), '-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) + '-DBLAS_INCLUDE_DIRS={0}'.format(spec['blas'].prefix.include), + '-DBLAS_LIBRARIES={0}'.format(blas_libs) ]) if '+mpi' in spec: @@ -129,19 +128,12 @@ class ArpackNg(Package): 'F77=%s' % spec['mpi'].mpif77 ]) - 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' - ]) + options.extend([ + '--with-blas={0}'.format(spec['blas'].blas_libs.ld_flags), + '--with-lapack={0}'.format(spec['lapack'].lapack_libs.ld_flags) + ]) + if '+shared' not in spec: + options.append('--enable-shared=no') bootstrap() configure(*options) diff --git a/var/spack/repos/builtin/packages/atlas/package.py b/var/spack/repos/builtin/packages/atlas/package.py index f9d5da6166..b31e365336 100644 --- a/var/spack/repos/builtin/packages/atlas/package.py +++ b/var/spack/repos/builtin/packages/atlas/package.py @@ -51,6 +51,7 @@ class Atlas(Package): url='http://sourceforge.net/projects/math-atlas/files/Developer%20%28unstable%29/3.11.34/atlas3.11.34.tar.bz2') variant('shared', default=True, description='Builds shared library') + variant('pthread', default=False, description='Use multithreaded libraries') provides('blas') provides('lapack') @@ -107,18 +108,32 @@ class Atlas(Package): make("install") self.install_test() - def setup_dependent_package(self, module, dspec): + @property + def blas_libs(self): # libsatlas.[so,dylib,dll ] contains all serial APIs (serial lapack, # serial BLAS), and all ATLAS symbols needed to support them. Whereas # libtatlas.[so,dylib,dll ] is parallel (multithreaded) version. - name = 'libsatlas.%s' % dso_suffix - libdir = find_library_path(name, - self.prefix.lib64, - self.prefix.lib) - + is_threaded = '+pthread' in self.spec if '+shared' in self.spec: - self.spec.blas_shared_lib = join_path(libdir, name) - self.spec.lapack_shared_lib = self.spec.blas_shared_lib + to_find = ['libtatlas'] if is_threaded else ['libsatlas'] + shared = True + else: + interfaces = [ + 'libptcblas', + 'libptf77blas' + ] if is_threaded else [ + 'libcblas', + 'libf77blas' + ] + to_find = ['liblapack'] + interfaces + ['libatlas'] + shared = False + return find_libraries( + to_find, root=self.prefix, shared=shared, recurse=True + ) + + @property + def lapack_libs(self): + return self.blas_libs def install_test(self): source_file = join_path(os.path.dirname(self.module.__file__), @@ -126,9 +141,8 @@ class Atlas(Package): blessed_file = join_path(os.path.dirname(self.module.__file__), 'test_cblas_dgemm.output') - include_flags = ["-I%s" % join_path(self.spec.prefix, "include")] - link_flags = ["-L%s" % join_path(self.spec.prefix, "lib"), - "-lsatlas"] + include_flags = ["-I%s" % self.spec.prefix.include] + link_flags = self.lapack_libs.ld_flags.split() output = compile_c_and_execute(source_file, include_flags, link_flags) compare_output_file(output, blessed_file) diff --git a/var/spack/repos/builtin/packages/bamtools/package.py b/var/spack/repos/builtin/packages/bamtools/package.py new file mode 100644 index 0000000000..7bb1985003 --- /dev/null +++ b/var/spack/repos/builtin/packages/bamtools/package.py @@ -0,0 +1,45 @@ +############################################################################## +# 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 Bamtools(Package): + """C++ API & command-line toolkit for working with BAM data.""" + + homepage = "https://github.com/pezmaster31/bamtools" + url = "https://github.com/pezmaster31/bamtools/archive/v2.4.0.tar.gz" + + version('2.4.0', '6139d00c1b1fe88fe15d094d8a74d8b9') + version('2.3.0', 'd327df4ba037d6eb8beef65d7da75ebc') + version('2.2.3', '6eccd3e45e4ba12a68daa3298998e76d') + + depends_on('cmake', type='build') + + def install(self, spec, prefix): + with working_dir('spack-build', create=True): + cmake('..', *std_cmake_args) + + make() + make('install') diff --git a/var/spack/repos/builtin/packages/bash-completion/package.py b/var/spack/repos/builtin/packages/bash-completion/package.py new file mode 100644 index 0000000000..666a1bef13 --- /dev/null +++ b/var/spack/repos/builtin/packages/bash-completion/package.py @@ -0,0 +1,64 @@ +############################################################################## +# 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 BashCompletion(Package): + """Programmable completion functions for bash.""" + homepage = "https://github.com/scop/bash-completion" + url = "https://github.com/scop/bash-completion/archive/2.3.tar.gz" + + version('2.3', '67e50f5f3c804350b43f2b664c33dde811d24292') + version('develop', git='https://github.com/scop/bash-completion.git') + + # Build dependencies + depends_on('automake', type='build') + depends_on('autoconf', type='build') + depends_on('libtool', type='build') + + # Other dependencies + depends_on('bash@4.1:', type='run') + + def install(self, spec, prefix): + make_args = ['--prefix=%s' % prefix] + + autoreconf('-i') + configure(*make_args) + make() + # make("check") # optional, requires dejagnu and tcllib + make("install", + parallel=False) + + # Guidelines for individual user as provided by the author at + # https://github.com/scop/bash-completion + print('=====================================================') + print('Bash completion has been installed. To use it, please') + print('include the following lines in your ~/.bash_profile :') + print('') + print('# Use bash-completion, if available') + print('[[ $PS1 && -f %s/share/bash-completion/bash_completion ]] && \ ' % prefix) # NOQA: ignore=E501 + print(' . %s/share/bash-completion/bash_completion' % prefix) + print('') + print('=====================================================') diff --git a/var/spack/repos/builtin/packages/bedtools2/package.py b/var/spack/repos/builtin/packages/bedtools2/package.py new file mode 100644 index 0000000000..46f3185154 --- /dev/null +++ b/var/spack/repos/builtin/packages/bedtools2/package.py @@ -0,0 +1,43 @@ +############################################################################## +# 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 Bedtools2(Package): + """Collectively, the bedtools utilities are a swiss-army knife of + tools for a wide-range of genomics analysis tasks. The most + widely-used tools enable genome arithmetic: that is, set theory + on the genome.""" + + homepage = "https://github.com/arq5x/bedtools2" + url = "https://github.com/arq5x/bedtools2/archive/v2.26.0.tar.gz" + + version('2.26.0', '52227e7efa6627f0f95d7d734973233d') + version('2.25.0', '534fb4a7bf0d0c3f05be52a0160d8e3d') + + depends_on('zlib') + + def install(self, spec, prefix): + make("prefix=%s" % prefix, "install") diff --git a/var/spack/repos/builtin/packages/binutils/package.py b/var/spack/repos/builtin/packages/binutils/package.py index e329e6fd7a..bf49ca9405 100644 --- a/var/spack/repos/builtin/packages/binutils/package.py +++ b/var/spack/repos/builtin/packages/binutils/package.py @@ -31,9 +31,9 @@ class Binutils(Package): homepage = "http://www.gnu.org/software/binutils/" url = "https://ftp.gnu.org/gnu/binutils/binutils-2.25.tar.bz2" - # 2.26 is incompatible with py-pillow build for some reason. + version('2.27', '2869c9bf3e60ee97c74ac2a6bf4e9d68') version('2.26', '64146a0faa3b411ba774f47d41de239f') - version('2.25', 'd9f3303f802a5b6b0bb73a335ab89d66', preferred=True) + version('2.25', 'd9f3303f802a5b6b0bb73a335ab89d66') version('2.24', 'e0f71a7b2ddab0f8612336ac81d9636b') version('2.23.2', '4f8fa651e35ef262edc01d60fb45702e') version('2.20.1', '2b9dc8f2b7dbd5ec5992c6e29de0b764') diff --git a/var/spack/repos/builtin/packages/boost/package.py b/var/spack/repos/builtin/packages/boost/package.py index 0d4ccc7ea3..22351a2c3a 100644 --- a/var/spack/repos/builtin/packages/boost/package.py +++ b/var/spack/repos/builtin/packages/boost/package.py @@ -41,6 +41,7 @@ class Boost(Package): list_url = "http://sourceforge.net/projects/boost/files/boost/" list_depth = 2 + version('1.62.0', '5fb94629535c19e48703bdb2b2e9490f') version('1.61.0', '6095876341956f65f9d35939ccea1a9f') version('1.60.0', '65a840e1a0b13a558ff19eeb2c4f0cbe') version('1.59.0', '6aa9a5c6a4ca1016edd0ed1178e3cb87') @@ -111,12 +112,12 @@ class Boost(Package): description="Build multi-threaded versions of libraries") variant('singlethreaded', default=True, description="Build single-threaded versions of libraries") - variant('icu_support', default=False, - description="Include ICU support (for regex/locale libraries)") + variant('icu', default=False, + description="Build with Unicode and ICU suport") variant('graph', default=False, description="Build the Boost Graph library") - depends_on('icu', when='+icu_support') + depends_on('icu4c', when='+icu') depends_on('python', when='+python') depends_on('mpi', when='+mpi') depends_on('bzip2', when='+iostreams') @@ -138,15 +139,13 @@ class Boost(Package): def determine_toolset(self, spec): if spec.satisfies("platform=darwin"): return 'darwin' - else: - platform = 'linux' toolsets = {'g++': 'gcc', 'icpc': 'intel', 'clang++': 'clang'} if spec.satisfies('@1.47:'): - toolsets['icpc'] += '-' + platform + toolsets['icpc'] += '-linux' for cc, toolset in toolsets.iteritems(): if cc in self.compiler.cxx_names: return toolset @@ -164,6 +163,16 @@ class Boost(Package): join_path(spec['python'].prefix.bin, 'python')) with open('user-config.jam', 'w') as f: + # Boost may end up using gcc even though clang+gfortran is set in + # compilers.yaml. Make sure this does not happen: + if not spec.satisfies('%intel'): + # using intel-linux : : spack_cxx in user-config.jam leads to + # error: at project-config.jam:12 + # error: duplicate initialization of intel-linux with the following parameters: # noqa + # error: version = <unspecified> + # error: previous initialization at ./user-config.jam:1 + f.write("using {0} : : {1} ;\n".format(boostToolsetId, + spack_cxx)) if '+mpi' in spec: f.write('using mpi : %s ;\n' % @@ -204,7 +213,13 @@ class Boost(Package): options.extend([ 'link=%s' % ','.join(linkTypes), - '--layout=tagged']) + '--layout=tagged' + ]) + + if not spec.satisfies('%intel'): + options.extend([ + 'toolset=%s' % self.determine_toolset(spec) + ]) return threadingOpts diff --git a/var/spack/repos/builtin/packages/bpp-suite/package.py b/var/spack/repos/builtin/packages/bpp-suite/package.py index ef7f25a7ce..d15030622e 100644 --- a/var/spack/repos/builtin/packages/bpp-suite/package.py +++ b/var/spack/repos/builtin/packages/bpp-suite/package.py @@ -34,7 +34,6 @@ class BppSuite(Package): version('2.2.0', 'd8b29ad7ccf5bd3a7beb701350c9e2a4') - # FIXME: Add dependencies if required. depends_on('cmake', type='build') depends_on('texinfo', type='build') depends_on('bpp-core') diff --git a/var/spack/repos/builtin/packages/cantera/package.py b/var/spack/repos/builtin/packages/cantera/package.py index 9c9c035325..9a9bc5bdbd 100644 --- a/var/spack/repos/builtin/packages/cantera/package.py +++ b/var/spack/repos/builtin/packages/cantera/package.py @@ -85,8 +85,9 @@ class Cantera(Package): # BLAS/LAPACK support if '+lapack' in spec: + lapack_blas = spec['lapack'].lapack_libs + spec['blas'].blas_libs options.extend([ - 'blas_lapack_libs=lapack,blas', + 'blas_lapack_libs={0}'.format(','.join(lapack_blas.names)), 'blas_lapack_dir={0}'.format(spec['lapack'].prefix.lib) ]) diff --git a/var/spack/repos/builtin/packages/cdo/package.py b/var/spack/repos/builtin/packages/cdo/package.py index a2f04e5b35..775dc31cf3 100644 --- a/var/spack/repos/builtin/packages/cdo/package.py +++ b/var/spack/repos/builtin/packages/cdo/package.py @@ -30,17 +30,88 @@ class Cdo(Package): Climate and NWP model Data. """ homepage = "https://code.zmaw.de/projects/cdo" - url = "https://code.zmaw.de/attachments/download/10198/cdo-1.6.9.tar.gz" - version('1.6.9', 'bf0997bf20e812f35e10188a930e24e2') + version('1.7.2', 'f08e4ce8739a4f2b63fc81a24db3ee31', url='https://code.zmaw.de/attachments/download/12760/cdo-1.7.2.tar.gz') + version('1.6.9', 'bf0997bf20e812f35e10188a930e24e2', url='https://code.zmaw.de/attachments/download/10198/cdo-1.6.9.tar.gz') - variant('mpi', default=True) + variant('szip', default=True, description='Enable szip compression for GRIB1') + variant('hdf5', default=False, description='Enable HDF5 support') + variant('netcdf', default=True, description='Enable NetCDF support') + variant('udunits2', default=True, description='Enable UDUNITS2 support') + variant('grib', default=True, description='Enable GRIB_API support') + variant('libxml2', default=True, description='Enable libxml2 support') + variant('proj', default=True, description='Enable PROJ library for cartographic projections') + variant('curl', default=True, description='Enable curl support') + variant('fftw', default=True, description='Enable support for fftw3') + variant('magics', default=True, description='Enable Magics library support') - depends_on('netcdf') - depends_on('netcdf+mpi', when='+mpi') - depends_on('netcdf~mpi', when='~mpi') + depends_on('szip', when='+szip') + depends_on('netcdf', when='+netcdf') + depends_on('hdf5+threadsafe', when='+hdf5') + depends_on('udunits2', when='+udunits2') + depends_on('grib-api', when='+grib') + depends_on('libxml2', when='+libxml2') + depends_on('proj', when='+proj') + depends_on('curl', when='+curl') + depends_on('fftw', when='+fftw') + depends_on('magics', when='+magics') def install(self, spec, prefix): - configure('--prefix={0}'.format(prefix)) + config_args = ["--prefix=" + prefix, + "--enable-shared", + "--enable-static"] + + if '+szip' in spec: + config_args.append('--with-szlib=' + spec['szip'].prefix) + else: + config_args.append('--without-szlib') + + if '+hdf5' in spec: + config_args.append('--with-hdf5=' + spec['hdf5'].prefix) + else: + config_args.append('--without-hdf5') + + if '+netcdf' in spec: + config_args.append('--with-netcdf=' + spec['netcdf'].prefix) + else: + config_args.append('--without-netcdf') + + if '+udunits2' in spec: + config_args.append('--with-udunits2=' + spec['udunits2'].prefix) + else: + config_args.append('--without-udunits2') + + if '+grib' in spec: + config_args.append('--with-grib_api=' + spec['grib-api'].prefix) + else: + config_args.append('--without-grib_api') + + if '+libxml2' in spec: + config_args.append('--with-libxml2=' + spec['libxml2'].prefix) + else: + config_args.append('--without-libxml2') + + if '+proj' in spec: + config_args.append('--with-proj=' + spec['proj'].prefix) + else: + config_args.append('--without-proj') + + if '+curl' in spec: + config_args.append('--with-curl=' + spec['curl'].prefix) + else: + config_args.append('--without-curl') + + if '+fftw' in spec: + config_args.append('--with-fftw3') + else: + config_args.append('--without-fftw3') + + if '+magics' in spec: + config_args.append('--with-magics=' + spec['magics'].prefix) + else: + config_args.append('--without-magics') + + configure(*config_args) + make() make('install') diff --git a/var/spack/repos/builtin/packages/cereal/package.py b/var/spack/repos/builtin/packages/cereal/package.py index 716e0103d1..0ce6ec593c 100644 --- a/var/spack/repos/builtin/packages/cereal/package.py +++ b/var/spack/repos/builtin/packages/cereal/package.py @@ -39,6 +39,7 @@ class Cereal(Package): homepage = "http://uscilab.github.io/cereal/" url = "https://github.com/USCiLab/cereal/archive/v1.1.2.tar.gz" + version('1.2.1', '64476ed74c19068ee543b53ad3992261') version('1.2.0', 'e372c9814696481dbdb7d500e1410d2b') version('1.1.2', '34d4ad174acbff005c36d4d10e48cbb9') version('1.1.1', '0ceff308c38f37d5b5f6df3927451c27') diff --git a/var/spack/repos/builtin/packages/cgal/package.py b/var/spack/repos/builtin/packages/cgal/package.py index e522b4a5a0..d986f77487 100644 --- a/var/spack/repos/builtin/packages/cgal/package.py +++ b/var/spack/repos/builtin/packages/cgal/package.py @@ -22,44 +22,57 @@ # 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 Cgal(Package): - """CGAL is a software project that provides easy access to efficient and - reliable geometric algorithms in the form of a C++ library. CGAL - is used in various areas needing geometric computation, such as - geographic information systems, computer aided design, molecular - biology, medical imaging, computer graphics, and robotics. - + """The Computational Geometry Algorithms Library (CGAL) is a C++ library + that aims to provide easy access to efficient and reliable algorithms in + computational geometry. CGAL is used in various areas needing geometric + computation, such as geographic information systems, computer aided design, + molecular biology, medical imaging, computer graphics, and robotics. """ homepage = 'http://www.cgal.org/' url = 'https://github.com/CGAL/cgal/archive/releases/CGAL-4.7.tar.gz' + version('4.9', '7b628db3e5614347f776c046b7666089') version('4.7', '4826714810f3b4c65cac96b90fb03b67') version('4.6.3', 'e8ee2ecc8d2b09b94a121c09257b576d') - # Installation instructions : - # http://doc.cgal.org/latest/Manual/installation.html variant('shared', default=True, description='Enables the build of shared libraries') variant('debug', default=False, description='Builds a debug version of the libraries') + # Essential Third Party Libraries depends_on('boost') - depends_on('mpfr') depends_on('gmp') + depends_on('mpfr') depends_on('zlib') - depends_on('cmake', type='build') + # depends_on('opengl') + depends_on('qt@5:') - # FIXME : Qt5 dependency missing (needs Qt5 and OpenGL) - # FIXME : Optional third party libraries missing + # Optional Third Party Libraries + # depends_on('leda') + # depends_on('mpfi') + # depends_on('rs') + # depends_on('rs3') + # depends_on('ntl') + # depends_on('eigen') + # depends_on('libqglviewer') + # depends_on('esbtl') + # depends_on('intel-tbb') + + # Build dependencies + depends_on('cmake', type='build') def install(self, spec, prefix): + # Installation instructions: + # http://doc.cgal.org/latest/Manual/installation.html options = [] options.extend(std_cmake_args) + # CGAL supports only Release and Debug build type. Any other build type # will raise an error at configure time if '+debug' in spec: @@ -72,9 +85,7 @@ class Cgal(Package): else: options.append('-DBUILD_SHARED_LIBS:BOOL=OFF') - build_directory = join_path(self.stage.path, 'spack-build') - source_directory = self.stage.source_path - with working_dir(build_directory, create=True): - cmake(source_directory, *options) - make() - make("install") + cmake('.', *options) + + make() + make('install') diff --git a/var/spack/repos/builtin/packages/charm/mpi.patch b/var/spack/repos/builtin/packages/charm/mpi.patch new file mode 100644 index 0000000000..e909d5f876 --- /dev/null +++ b/var/spack/repos/builtin/packages/charm/mpi.patch @@ -0,0 +1,19 @@ +--- old/src/scripts/configure ++++ new/src/scripts/configure +@@ -3293,10 +3293,16 @@ + test_link "whether -lmpi" "ok" "no" "-lmpi" + if test $pass -eq 1 + then + add_flag CMK_SYSLIBS='"$CMK_SYSLIBS -lmpi"' "mpi lib" + else ++ test_link "whether -lmpi -lmpi_cxx" "ok" "no" "-lmpi -lmpi_cxx" ++ if test $pass -eq 1 ++ then ++ add_flag CMK_SYSLIBS='"$CMK_SYSLIBS -lmpi -lmpi_cxx"' "mpi lib" ++ else + echo "Error: can not find mpi library" + test_finish 1 ++ fi + fi + fi + else diff --git a/var/spack/repos/builtin/packages/charm/package.py b/var/spack/repos/builtin/packages/charm/package.py new file mode 100644 index 0000000000..d67ac80de1 --- /dev/null +++ b/var/spack/repos/builtin/packages/charm/package.py @@ -0,0 +1,172 @@ +############################################################################## +# 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 +############################################################################## + +import platform +import shutil +import sys +from spack import * + + +class Charm(Package): + """Charm++ is a parallel programming framework in C++ supported by + an adaptive runtime system, which enhances user productivity and + allows programs to run portably from small multicore computers + (your laptop) to the largest supercomputers.""" + + homepage = "http://charmplusplus.org" + url = "http://charm.cs.illinois.edu/distrib/charm-6.7.1.tar.gz" + + version("6.7.1", "a8e20cf85e9c8721158f5bbd0ade48d9") + version("6.7.0", "35a39a7975f1954a7db2d76736158231") + version("6.6.1", "9554230f741e2599deaaac4d9d93d7ab") + version("6.6.0", "31e95901b3f7324d52107e6ad000fcc8") + version("6.5.1", "034d99458474a3ab96d8bede8a691a5d") + + # Support OpenMPI; see + # <https://charm.cs.illinois.edu/redmine/issues/1206> + patch("mpi.patch") + + # Communication mechanisms (choose exactly one) + # TODO: Support Blue Gene/Q PAMI, Cray GNI, Cray shmem, CUDA + variant("mpi", default=False, + description="Use MPI as communication mechanism") + variant("multicore", default=False, + description="Disable inter-node communication") + variant("net", default=False, + description="Use net communication mechanism") + variant("netlrts", default=True, + description="Use netlrts communication mechanism") + variant("verbs", default=False, + description="Use Infiniband as communication mechanism") + + # Other options + # Something is off with PAPI -- there are build errors. Maybe + # Charm++ expects a particular version? + variant("papi", default=False, description="Enable PAPI integration") + variant("smp", default=True, + description=( + "Enable SMP parallelism (does not work with +multicore)")) + variant("tcp", default=False, + description="Use TCP as transport mechanism (requires +net)") + + # Note: We could add variants for AMPI, LIBS, bigemulator, msa, Tau + # Note: We could support shared libraries + + depends_on("mpi", when="+mpi") + depends_on("papi", when="+papi") + + def install(self, spec, prefix): + target = "charm++" + + # Note: Turn this into a multi-valued variant, once these + # exist in Spack + if sum(["+mpi" in spec, + "+multicore" in spec, + "+net" in spec, + "+netlrts" in spec, + "+verbs" in spec]) != 1: + raise InstallError( + "Exactly one communication mechanism " + "(+mpi, +multicore, +net, +netlrts, or +verbs) " + "must be enabled") + if "+mpi" in spec: + comm = "mpi" + if "+multicore" in spec: + comm = "multicore" + if "+net" in spec: + comm = "net" + if "+netlrts" in spec: + comm = "netlrts" + if "+verbs" in spec: + comm = "verbs" + + plat = sys.platform + if plat.startswith("linux"): + plat = "linux" + mach = platform.machine() + + # Define Charm++ version names for various (plat, mach, comm) + # combinations. Note that not all combinations are supported. + versions = { + ("darwin", "i386", "multicore"): "multicore-darwin-x86", + ("darwin", "i386", "net"): "net-darwin-x86", + ("darwin", "x86_64", "mpi"): "mpi-darwin-x86_64", + ("darwin", "x86_64", "multicore"): "multicore-darwin-x86_64", + ("darwin", "x86_64", "net"): "net-darwin-x86_64", + ("darwin", "x86_64", "netlrts"): "netlrts-darwin-x86_64", + ("linux", "i386", "mpi"): "mpi-linux", + ("linux", "i386", "multicore"): "multicore-linux32", + ("linux", "i386", "net"): "net-linux", + ("linux", "i386", "netlrts"): "netlrts-linux", + ("linux", "x86_64", "mpi"): "mpi-linux-x86_64", + ("linux", "x86_64", "multicore"): "multicore-linux64", + ("linux", "x86_64", "net"): "net-linux-x86_64", + ("linux", "x86_64", "netlrts"): "netlrts-linux-x86_64", + ("linux", "x86_64", "verbs"): "verbs-linux-x86_64", + } + if (plat, mach, comm) not in versions: + raise InstallError( + "The communication mechanism %s is not supported " + "on a %s platform with a %s CPU" % + (comm, plat, mach)) + version = versions[(plat, mach, comm)] + + # We assume that Spack's compiler wrappers make this work. If + # not, then we need to query the compiler vendor from Spack + # here. + compiler = "gcc" + + options = [compiler, + "--with-production", # Note: turn this into a variant + "-j%d" % make_jobs, + "--destination=%s" % prefix] + if "+mpi" in spec: + options.append("--basedir=%s" % spec["mpi"].prefix) + if "+papi" in spec: + options.extend(["papi", "--basedir=%s" % spec["papi"].prefix]) + if "+smp" in spec: + if "+multicore" in spec: + # This is a Charm++ limitation; it would lead to a + # build error + raise InstallError("Cannot combine +smp with +multicore") + options.append("smp") + if "+tcp" in spec: + if "+net" not in spec: + # This is a Charm++ limitation; it would lead to a + # build error + raise InstallError( + "The +tcp variant requires " + "the +net communication mechanism") + options.append("tcp") + + # Call "make" via the build script + # Note: This builds Charm++ in the "tmp" subdirectory of the + # install directory. Maybe we could set up a symbolic link + # back to the build tree to prevent this? Alternatively, we + # could dissect the build script; the build instructions say + # this wouldn't be difficult. + build = Executable(join_path(".", "build")) + build(target, version, *options) + shutil.rmtree(join_path(prefix, "tmp")) diff --git a/var/spack/repos/builtin/packages/clhep/darwin/CLHEP.patch b/var/spack/repos/builtin/packages/clhep/darwin/CLHEP.patch new file mode 100644 index 0000000000..ca1d96574a --- /dev/null +++ b/var/spack/repos/builtin/packages/clhep/darwin/CLHEP.patch @@ -0,0 +1,11 @@ +--- CLHEP/CMakeLists.txt 2016-06-20 14:41:12.000000000 -0500 ++++ CLHEP/CMakeLists.txt 2016-06-20 14:40:57.000000000 -0500 +@@ -37,7 +37,7 @@ + # If Policy CMP0042 exists, use OLD to prefer the use of install names + # instead of the new @rpath default. + if(POLICY CMP0042) +- cmake_policy(SET CMP0042 NEW) ++ cmake_policy(SET CMP0042 OLD) + endif() + + set(CMAKE_MODULE_PATH diff --git a/var/spack/repos/builtin/packages/clhep/package.py b/var/spack/repos/builtin/packages/clhep/package.py new file mode 100644 index 0000000000..02a9da9e27 --- /dev/null +++ b/var/spack/repos/builtin/packages/clhep/package.py @@ -0,0 +1,81 @@ +############################################################################## +# 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 Clhep(Package): + """CLHEP is a C++ Class Library for High Energy Physics. """ + homepage = "http://proj-clhep.web.cern.ch/proj-clhep/" + url = "http://proj-clhep.web.cern.ch/proj-clhep/DISTRIBUTION/tarFiles/clhep-2.2.0.5.tgz" + list_url = "https://proj-clhep.web.cern.ch/proj-clhep/DISTRIBUTION/" + + version('2.3.2.2', '567b304b0fa017e1e9fbf199f456ebe9') + version('2.3.1.1', '16efca7641bc118c9d217cc96fe90bf5') + version('2.3.1.0', 'b084934fc26a4182a08c09c292e19161') + version('2.3.0.0', 'a00399a2ca867f2be902c22fc71d7e2e') + version('2.2.0.8', '5a23ed3af785ac100a25f6cb791846af') + version('2.2.0.5', '1584e8ce6ebf395821aed377df315c7c') + version('2.2.0.4', '71d2c7c2e39d86a0262e555148de01c1') + + variant('debug', default=False, description="Switch to the debug version of CLHEP.") + variant('cxx11', default=True, description="Compile using c++11 dialect.") + variant('cxx14', default=False, description="Compile using c++14 dialect.") + + depends_on('cmake@2.8.12.2:', when='@2.2.0.4:2.3.0.0', type='build') + depends_on('cmake@3.2:', when='@2.3.0.1:', type='build') + + def patch(self): + filter_file('SET CMP0042 OLD', + 'SET CMP0042 NEW', + '%s/%s/CLHEP/CMakeLists.txt' + % (self.stage.path, self.spec.version)) + + def install(self, spec, prefix): + # Handle debug + # Pull out the BUILD_TYPE so we can change it (Release is default) + cmake_args = [arg for arg in std_cmake_args if 'BUILD_TYPE' not in arg] + build_type = 'Debug' if '+debug' in spec else 'MinSizeRel' + cmake_args.extend(['-DCMAKE_BUILD_TYPE=' + build_type]) + + if '+cxx11' in spec: + env['CXXFLAGS'] = self.compiler.cxx11_flag + cmake_args.append('-DCLHEP_BUILD_CXXSTD=' + + self.compiler.cxx11_flag) + + if '+cxx14' in spec: + env['CXXFLAGS'] = self.compiler.cxx14_flag + cmake_args.append('-DCLHEP_BUILD_CXXSTD=' + + self.compiler.cxx14_flag) + + # Note that the tar file is unusual in that there's a + # CLHEP directory (addtional layer) + cmake_args.append("../CLHEP") + + # Run cmake in a build directory + with working_dir('build', create=True): + cmake(*cmake_args) + make() + make("install") diff --git a/var/spack/repos/builtin/packages/cmake/package.py b/var/spack/repos/builtin/packages/cmake/package.py index 0c16adcef7..83a68fda07 100644 --- a/var/spack/repos/builtin/packages/cmake/package.py +++ b/var/spack/repos/builtin/packages/cmake/package.py @@ -88,11 +88,13 @@ class Cmake(Package): options = [ '--prefix={0}'.format(prefix), - '--parallel={0}'.format(make_jobs), - # jsoncpp requires CMake to build - # use CMake-provided library to avoid circular dependency - '--no-system-jsoncpp' - ] + '--parallel={0}'.format(make_jobs)] + if spec.satisfies("@3:"): + options.append( + # jsoncpp requires CMake to build + # use CMake-provided library to avoid circular dependency + '--no-system-jsoncpp' + ) if '+ownlibs' in spec: # Build and link to the CMake-provided third-party libraries diff --git a/var/spack/repos/builtin/packages/cp2k/package.py b/var/spack/repos/builtin/packages/cp2k/package.py index 052c7a971c..3a175ea1a2 100644 --- a/var/spack/repos/builtin/packages/cp2k/package.py +++ b/var/spack/repos/builtin/packages/cp2k/package.py @@ -47,19 +47,18 @@ class Cp2k(Package): depends_on('lapack') depends_on('blas') depends_on('fftw') + depends_on('libint@:1.2', when='@3.0') depends_on('mpi', when='+mpi') depends_on('scalapack', when='+mpi') depends_on('plumed+shared+mpi', when='+plumed+mpi') depends_on('plumed+shared~mpi', when='+plumed~mpi') depends_on('pexsi', when='+mpi') + depends_on('wannier90', when='+mpi') + depends_on('elpa', when='+mpi') - # TODO : add dependency on libint # TODO : add dependency on libsmm, libxsmm - # TODO : add dependency on elpa # TODO : add dependency on CUDA - # TODO : add dependency on QUIP - # TODO : add dependency on libwannier90 parallel = False @@ -88,15 +87,20 @@ class Cp2k(Package): } cppflags = [ '-D__FFTW3', - '-D__LIBPEXSI', + '-D__LIBINT', '-I' + spec['fftw'].prefix.include ] fcflags = copy.deepcopy(optflags[self.spec.compiler.name]) fcflags.extend([ '-I' + spec['fftw'].prefix.include ]) - ldflags = ['-L' + spec['fftw'].prefix.lib] - libs = [] + fftw = find_libraries(['libfftw3'], root=spec['fftw'].prefix.lib) + ldflags = [fftw.search_flags] + libs = [ + join_path(spec['libint'].prefix.lib, 'libint.so'), + join_path(spec['libint'].prefix.lib, 'libderiv.so'), + join_path(spec['libint'].prefix.lib, 'libr12.so') + ] if '+plumed' in self.spec: # Include Plumed.inc in the Makefile mkf.write('include {0}\n'.format( @@ -109,7 +113,8 @@ class Cp2k(Package): # Add required macro cppflags.extend(['-D__PLUMED2']) libs.extend([ - join_path(self.spec['plumed'].prefix.lib, 'libplumed.so') + join_path(self.spec['plumed'].prefix.lib, + 'libplumed.{0}'.format(dso_suffix)) ]) mkf.write('CC = {0.compiler.cc}\n'.format(self)) @@ -143,15 +148,26 @@ class Cp2k(Package): if '+mpi' in self.spec: cppflags.extend([ '-D__parallel', + '-D__LIBPEXSI', + '-D__WANNIER90', + '-D__ELPA3', '-D__SCALAPACK' ]) fcflags.extend([ + '-I' + join_path( + spec['elpa'].prefix, + 'include', + 'elpa-{0}'.format(str(spec['elpa'].version)), + 'modules' + ), '-I' + join_path(spec['pexsi'].prefix, 'fortran') ]) - ldflags.extend([ - '-L' + spec['scalapack'].prefix.lib - ]) + scalapack = spec['scalapack'].scalapack_libs + ldflags.append(scalapack.search_flags) libs.extend([ + join_path(spec['elpa'].prefix.lib, + 'libelpa.{0}'.format(dso_suffix)), + join_path(spec['wannier90'].prefix.lib, 'libwannier.a'), join_path(spec['pexsi'].prefix.lib, 'libpexsi.a'), join_path(spec['superlu-dist'].prefix.lib, 'libsuperlu_dist.a'), @@ -164,19 +180,15 @@ class Cp2k(Package): 'libmetis.{0}'.format(dso_suffix) ), ]) - libs.extend(spec['scalapack'].scalapack_shared_libs) + libs.extend(scalapack) libs.extend(self.spec['mpi'].mpicxx_shared_libs) libs.extend(self.compiler.stdcxx_libs) # LAPACK / BLAS - ldflags.extend([ - '-L' + spec['lapack'].prefix.lib, - '-L' + spec['blas'].prefix.lib - ]) - libs.extend([ - join_path(spec['fftw'].prefix.lib, 'libfftw3.so'), - spec['lapack'].lapack_shared_lib, - spec['blas'].blas_shared_lib - ]) + lapack = spec['lapack'].lapack_libs + blas = spec['blas'].blas_libs + + ldflags.append((lapack + blas).search_flags) + libs.extend([str(x) for x in (fftw, lapack, blas)]) # Write compiler flags to file mkf.write('CPPFLAGS = {0}\n'.format(' '.join(cppflags))) diff --git a/var/spack/repos/builtin/packages/cube/package.py b/var/spack/repos/builtin/packages/cube/package.py index 8c835b3886..9cea3c40e8 100644 --- a/var/spack/repos/builtin/packages/cube/package.py +++ b/var/spack/repos/builtin/packages/cube/package.py @@ -43,14 +43,19 @@ class Cube(Package): version('4.2.3', '8f95b9531f5a8f8134f279c2767c9b20', url="http://apps.fz-juelich.de/scalasca/releases/cube/4.2/dist/cube-4.2.3.tar.gz") - # TODO : add variant that builds GUI on top of Qt + variant('gui', default=False, description='Build CUBE GUI') depends_on('zlib') + depends_on('qt@4.6:', when='+gui') def install(self, spec, prefix): configure_args = ["--prefix=%s" % prefix, - "--without-paraver", - "--without-gui"] + "--without-paraver"] + + # TODO : need to handle cross compiling build + if '+gui' not in spec: + configure_args.append('--without-gui') + configure(*configure_args) - make(parallel=False) + make() make("install", parallel=False) diff --git a/var/spack/repos/builtin/packages/cuda/package.py b/var/spack/repos/builtin/packages/cuda/package.py index 558535bec6..36cf3058d7 100644 --- a/var/spack/repos/builtin/packages/cuda/package.py +++ b/var/spack/repos/builtin/packages/cuda/package.py @@ -39,7 +39,7 @@ class Cuda(Package): Type, select runfile and click Download. Spack will search your current directory for this file. Alternatively, add this file to a mirror so that Spack can find it. For instructions on how to set up a - mirror, see http://software.llnl.gov/spack/mirrors.html + mirror, see http://spack.readthedocs.io/en/latest/mirrors.html. Note: This package does not currently install the drivers necessary to run CUDA. These will need to be installed manually. See: diff --git a/var/spack/repos/builtin/packages/curl/package.py b/var/spack/repos/builtin/packages/curl/package.py index 4954e435c0..a22ac52714 100644 --- a/var/spack/repos/builtin/packages/curl/package.py +++ b/var/spack/repos/builtin/packages/curl/package.py @@ -32,6 +32,8 @@ class Curl(Package): homepage = "http://curl.haxx.se" url = "http://curl.haxx.se/download/curl-7.46.0.tar.bz2" + version('7.50.3', 'bd177fd6deecce00cfa7b5916d831c5e') + version('7.50.2', '6e161179f7af4b9f8b6ea21420132719') version('7.50.1', '015f6a0217ca6f2c5442ca406476920b') version('7.49.1', '6bb1f7af5b58b30e4e6414b8c1abccab') version('7.47.1', '9ea3123449439bbd960cd25cf98796fb') diff --git a/var/spack/repos/builtin/packages/daal/package.py b/var/spack/repos/builtin/packages/daal/package.py index e13dd80e19..35cb6cbce8 100644 --- a/var/spack/repos/builtin/packages/daal/package.py +++ b/var/spack/repos/builtin/packages/daal/package.py @@ -9,7 +9,7 @@ class Daal(IntelInstaller): Note: You will have to add the download file to a mirror so that Spack can find it. For instructions on how to set up a - mirror, see http://software.llnl.gov/spack/mirrors.html""" + mirror, see http://spack.readthedocs.io/en/latest/mirrors.html""" homepage = "https://software.intel.com/en-us/daal" diff --git a/var/spack/repos/builtin/packages/darshan-runtime/package.py b/var/spack/repos/builtin/packages/darshan-runtime/package.py new file mode 100644 index 0000000000..640573fdc1 --- /dev/null +++ b/var/spack/repos/builtin/packages/darshan-runtime/package.py @@ -0,0 +1,65 @@ +# +# 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 DarshanRuntime(Package): + """Darshan (runtime) is a scalable HPC I/O characterization tool + designed to capture an accurate picture of application I/O behavior, + including properties such as patterns of access within files, with + minimum overhead. DarshanRuntime package should be installed on + systems where you intend to instrument MPI applications.""" + + homepage = "http://www.mcs.anl.gov/research/projects/darshan/" + url = "ftp://ftp.mcs.anl.gov/pub/darshan/releases/darshan-3.1.0.tar.gz" + + version('3.1.0', '439d717323e6265b2612ed127886ae52') + version('3.0.0', '732577fe94238936268d74d7d74ebd08') + + depends_on('mpi') + depends_on('zlib') + + variant('slurm', default=False, description='Use Slurm Job ID') + variant('cobalt', default=False, description='Use Coblat Job Id') + variant('pbs', default=False, description='Use PBS Job Id') + + def install(self, spec, prefix): + + job_id = 'NONE' + if '+slurm' in spec: + job_id = 'SLURM_JOBID' + if '+cobalt' in spec: + job_id = 'COBALT_JOBID' + if '+pbs' in spec: + job_id = 'PBS_JOBID' + + # TODO: BG-Q and other platform configure options + options = ['CC=%s' % spec['mpi'].mpicc, + '--with-mem-align=8', + '--with-log-path-by-env=DARSHAN_LOG_DIR_PATH', + '--with-jobid-env=%s' % job_id, + '--with-zlib=%s' % spec['zlib'].prefix] + + with working_dir('spack-build', create=True): + configure = Executable('../darshan-runtime/configure') + configure('--prefix=%s' % prefix, *options) + make() + make('install') + + def setup_environment(self, spack_env, run_env): + # default path for log file, could be user or site specific setting + darshan_log_dir = '%s' % os.environ['HOME'] + run_env.set('DARSHAN_LOG_DIR_PATH', darshan_log_dir) diff --git a/var/spack/repos/builtin/packages/darshan-util/package.py b/var/spack/repos/builtin/packages/darshan-util/package.py new file mode 100644 index 0000000000..3446104a83 --- /dev/null +++ b/var/spack/repos/builtin/packages/darshan-util/package.py @@ -0,0 +1,41 @@ +# +# 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 DarshanUtil(Package): + """Darshan (util) is collection of tools for parsing and summarizing log + files produced by Darshan (runtime) instrumentation. This package is + typically installed on systems (front-end) where you intend to analyze + log files produced by Darshan (runtime).""" + + homepage = "http://www.mcs.anl.gov/research/projects/darshan/" + url = "ftp://ftp.mcs.anl.gov/pub/darshan/releases/darshan-3.1.0.tar.gz" + + version('3.1.0', '439d717323e6265b2612ed127886ae52') + version('3.0.0', '732577fe94238936268d74d7d74ebd08') + + depends_on('zlib') + + def install(self, spec, prefix): + + options = ['CC=%s' % self.compiler.cc, + '--with-zlib=%s' % spec['zlib'].prefix] + + with working_dir('spack-build', create=True): + configure = Executable('../darshan-util/configure') + configure('--prefix=%s' % prefix, *options) + make() + make('install') diff --git a/var/spack/repos/builtin/packages/dealii/package.py b/var/spack/repos/builtin/packages/dealii/package.py index 939d8fc013..0d293e5d92 100644 --- a/var/spack/repos/builtin/packages/dealii/package.py +++ b/var/spack/repos/builtin/packages/dealii/package.py @@ -32,6 +32,7 @@ class Dealii(Package): homepage = "https://www.dealii.org" url = "https://github.com/dealii/dealii/releases/download/v8.4.1/dealii-8.4.1.tar.gz" + version('8.4.2', '84c6bd3f250d3e0681b645d24cb987a7') version('8.4.1', 'efbaf16f9ad59cfccad62302f36c3c1d') version('8.4.0', 'ac5dbf676096ff61e092ce98c80c2b00') version('8.3.0', 'fc6cdcb16309ef4bea338a4f014de6fa') @@ -67,11 +68,11 @@ class Dealii(Package): # Boost 1.58 is blacklisted, see # https://github.com/dealii/dealii/issues/1591 # Require at least 1.59 - # +python won't affect @:8.4.1 + # +python won't affect @:8.4.2 depends_on("boost@1.59.0:+thread+system+serialization+iostreams", - when='@:8.4.1~mpi') + when='@:8.4.2~mpi') depends_on("boost@1.59.0:+thread+system+serialization+iostreams+mpi", - when='@:8.4.1+mpi') + when='@:8.4.2+mpi') # since @8.5.0: (and @develop) python bindings are introduced: depends_on("boost@1.59.0:+thread+system+serialization+iostreams", when='@8.5.0:~mpi~python') @@ -102,8 +103,9 @@ class Dealii(Package): depends_on("netcdf-cxx", when='+netcdf+mpi') depends_on("oce", when='+oce') depends_on("p4est", when='+p4est+mpi') - depends_on("petsc+mpi", when='@8.5.0:+petsc+mpi') - depends_on("slepc", when='@8.5.0:+slepc+petsc+mpi') + depends_on("petsc+mpi", when='@8.4.2:+petsc+mpi') + depends_on('python', when='@8.5.0:+python') + depends_on("slepc", when='@8.4.2:+slepc+petsc+mpi') depends_on("petsc@:3.6.4+mpi", when='@:8.4.1+petsc+mpi') depends_on("slepc@:3.6.3", when='@:8.4.1+slepc+petsc+mpi') depends_on("trilinos", when='+trilinos+mpi') @@ -122,6 +124,7 @@ class Dealii(Package): options.remove(word) dsuf = 'dylib' if sys.platform == 'darwin' else 'so' + lapack_blas = spec['lapack'].lapack_libs + spec['blas'].blas_libs options.extend([ '-DCMAKE_BUILD_TYPE=DebugRelease', '-DDEAL_II_COMPONENT_EXAMPLES=ON', @@ -134,9 +137,7 @@ class Dealii(Package): '-DLAPACK_FOUND=true', '-DLAPACK_INCLUDE_DIRS=%s;%s' % ( spec['lapack'].prefix.include, spec['blas'].prefix.include), - '-DLAPACK_LIBRARIES=%s;%s' % ( - spec['lapack'].lapack_shared_lib, - spec['blas'].blas_shared_lib), + '-DLAPACK_LIBRARIES=%s' % lapack_blas.joined(';'), '-DMUPARSER_DIR=%s' % spec['muparser'].prefix, '-DUMFPACK_DIR=%s' % spec['suite-sparse'].prefix, '-DTBB_DIR=%s' % spec['tbb'].prefix, diff --git a/var/spack/repos/builtin/packages/elk/package.py b/var/spack/repos/builtin/packages/elk/package.py index b089e585dd..acaf863935 100644 --- a/var/spack/repos/builtin/packages/elk/package.py +++ b/var/spack/repos/builtin/packages/elk/package.py @@ -87,12 +87,12 @@ class Elk(Package): # BLAS/LAPACK support # Note: BLAS/LAPACK must be compiled with OpenMP support # if the +openmp variant is chosen - blas = 'blas.a' + blas = 'blas.a' lapack = 'lapack.a' if '+blas' in spec: - blas = spec['blas'].blas_shared_lib + blas = spec['blas'].blas_libs.joined() if '+lapack' in spec: - lapack = spec['lapack'].lapack_shared_lib + lapack = spec['lapack'].lapack_libs.joined() # lapack must come before blas config['LIB_LPK'] = ' '.join([lapack, blas]) diff --git a/var/spack/repos/builtin/packages/elpa/package.py b/var/spack/repos/builtin/packages/elpa/package.py index f28d63f6c3..b433bf40b0 100644 --- a/var/spack/repos/builtin/packages/elpa/package.py +++ b/var/spack/repos/builtin/packages/elpa/package.py @@ -34,8 +34,16 @@ class Elpa(Package): homepage = 'http://elpa.mpcdf.mpg.de/' url = 'http://elpa.mpcdf.mpg.de/elpa-2015.11.001.tar.gz' - version('2015.11.001', 'de0f35b7ee7c971fd0dca35c900b87e6', - url='http://elpa.mpcdf.mpg.de/elpa-2015.11.001.tar.gz') + version( + '2016.05.003', + '88a9f3f3bfb63e16509dd1be089dcf2c', + url='http://elpa.mpcdf.mpg.de/html/Releases/2016.05.003/elpa-2016.05.003.tar.gz' + ) + version( + '2015.11.001', + 'de0f35b7ee7c971fd0dca35c900b87e6', + url='http://elpa.mpcdf.mpg.de/elpa-2015.11.001.tar.gz' + ) variant('openmp', default=False, description='Activates OpenMP support') @@ -46,7 +54,24 @@ class Elpa(Package): def install(self, spec, prefix): - options = ["--prefix=%s" % prefix] + options = [ + 'CC={0}'.format(self.spec['mpi'].mpicc), + 'FC={0}'.format(self.spec['mpi'].mpifc), + 'CXX={0}'.format(self.spec['mpi'].mpicxx), + 'FCFLAGS={0}'.format( + spec['lapack'].lapack_libs.joined() + ), + 'LDFLAGS={0}'.format( + spec['lapack'].lapack_libs.joined() + ), + 'SCALAPACK_FCFLAGS={0}'.format( + spec['scalapack'].scalapack_libs.joined() + ), + 'SCALAPACK_LDFLAGS={0}'.format( + spec['scalapack'].scalapack_libs.joined() + ), + '--prefix={0}'.format(self.prefix) + ] if '+openmp' in spec: options.append("--enable-openmp") diff --git a/var/spack/repos/builtin/packages/espresso/package.py b/var/spack/repos/builtin/packages/espresso/package.py index 3dca1ba187..d2c825513c 100644 --- a/var/spack/repos/builtin/packages/espresso/package.py +++ b/var/spack/repos/builtin/packages/espresso/package.py @@ -88,7 +88,7 @@ class Espresso(Package): # Add a list of directories to search search_list = [] - for name, dependency_spec in spec.dependencies.iteritems(): + for dependency_spec in spec.dependencies(): search_list.extend([dependency_spec.prefix.lib, dependency_spec.prefix.lib64]) diff --git a/var/spack/repos/builtin/packages/extrae/package.py b/var/spack/repos/builtin/packages/extrae/package.py index 72bfbe6326..cb20a8109e 100644 --- a/var/spack/repos/builtin/packages/extrae/package.py +++ b/var/spack/repos/builtin/packages/extrae/package.py @@ -53,8 +53,8 @@ class Extrae(Package): programming models either alone or in conjunction with MPI : OpenMP, CUDA, OpenCL, pthread, OmpSs""" homepage = "http://www.bsc.es/computer-sciences/extrae" - url = "http://www.bsc.es/ssl/apps/performanceTools/files/extrae-3.0.1.tar.bz2" - version('3.0.1', 'a6a8ca96cd877723cd8cc5df6bdb922b') + url = "http://www.bsc.es/ssl/apps/performanceTools/files/extrae-3.3.0.tar.bz2" + version('3.3.0', 'f46e3f1a6086b5b3ac41c9585b42952d') depends_on("mpi") depends_on("dyninst") @@ -62,6 +62,9 @@ class Extrae(Package): depends_on("boost") depends_on("libdwarf") depends_on("papi") + depends_on("libelf") + depends_on("libxml2") + depends_on("binutils+libiberty") def install(self, spec, prefix): if 'openmpi' in spec: @@ -80,6 +83,9 @@ class Extrae(Package): "--with-papi=%s" % spec['papi'].prefix, "--with-dyninst-headers=%s" % spec[ 'dyninst'].prefix.include, + "--with-elf=%s" % spec['libelf'].prefix, + "--with-xml-prefix=%s" % spec['libxml2'].prefix, + "--with-binutils=%s" % spec['binutils'].prefix, "--with-dyninst-libs=%s" % spec['dyninst'].prefix.lib) make() diff --git a/var/spack/repos/builtin/packages/fenics/hdf5~cxx-detection.patch b/var/spack/repos/builtin/packages/fenics/hdf5~cxx-detection.patch new file mode 100644 index 0000000000..52e36ab00b --- /dev/null +++ b/var/spack/repos/builtin/packages/fenics/hdf5~cxx-detection.patch @@ -0,0 +1,11 @@ +--- a/CMakeLists.txt 2016-08-16 02:30:13.466078087 +0200 ++++ b/CMakeLists.txt 2016-08-16 02:30:36.879586772 +0200 +@@ -553,7 +553,7 @@ + set(ENV{HDF5_ROOT} "$ENV{HDF5_DIR}") + endif() + set(HDF5_PREFER_PARALLEL TRUE) +- find_package(HDF5) ++ find_package(HDF5 COMPONENTS C) + set_package_properties(HDF5 PROPERTIES TYPE OPTIONAL + DESCRIPTION "Hierarchical Data Format 5 (HDF5)" + URL "https://www.hdfgroup.org/HDF5") diff --git a/var/spack/repos/builtin/packages/fenics/package.py b/var/spack/repos/builtin/packages/fenics/package.py index eeeefc540d..fd9a37df1b 100644 --- a/var/spack/repos/builtin/packages/fenics/package.py +++ b/var/spack/repos/builtin/packages/fenics/package.py @@ -62,17 +62,15 @@ class Fenics(Package): # variant('slepc4py', default=True, description='Uses SLEPc4py') # variant('pastix', default=True, description='Compile with Pastix') - patch('petsc-3.7.patch', when='^petsc@3.7:') + patch('petsc-3.7.patch', when='@1.6.1^petsc@3.7:') patch('petsc-version-detection.patch', when='@:1.6.1') + patch('hdf5~cxx-detection.patch') extends('python') - depends_on('py-numpy') - depends_on('py-ply') - depends_on('py-six') - depends_on('py-sphinx@1.0.1:', when='+doc') - depends_on('eigen@3.2.0:') - depends_on('boost') + depends_on('eigen@3.2.0:', type='build') + depends_on('boost+filesystem+program_options+system+iostreams+timer+regex+chrono') + depends_on('mpi', when='+mpi') depends_on('hdf5', when='+hdf5') depends_on('parmetis@4.0.2:^metis+real64', when='+parmetis') @@ -85,13 +83,28 @@ class Fenics(Package): depends_on('suite-sparse', when='+suite-sparse') depends_on('qt', when='+qt') - # This are the build dependencies - depends_on('py-setuptools') - depends_on('cmake@2.8.12:') - depends_on('swig@3.0.3:') + depends_on('py-ply', type=nolink) + depends_on('py-six', type=nolink) + depends_on('py-numpy', type=nolink) + depends_on('py-sympy', type=nolink) + depends_on('swig@3.0.3:', type=nolink) + depends_on('cmake@2.8.12:', type=nolink) + + depends_on('py-setuptools', type='build') + depends_on('py-sphinx@1.0.1:', when='+doc', type='build') releases = [ { + 'version': '2016.1.0', + 'md5': '92e8d00f6487a575987201f0b0d19173', + 'resources': { + 'ffc': '35457ae164e481ba5c9189ebae060a47', + 'fiat': 'ac0c49942831ee434301228842bcc280', + 'instant': '0e3dbb464c4d90d691f31f0fdd63d4f6', + 'ufl': '37433336e5c9b58d1d5ab4acca9104a7', + } + }, + { 'version': '1.6.0', 'md5': '35cb4baf7ab4152a40fb7310b34d5800', 'resources': { diff --git a/var/spack/repos/builtin/packages/fontconfig/package.py b/var/spack/repos/builtin/packages/fontconfig/package.py index 0d7e47f228..311156378a 100644 --- a/var/spack/repos/builtin/packages/fontconfig/package.py +++ b/var/spack/repos/builtin/packages/fontconfig/package.py @@ -34,9 +34,12 @@ class Fontconfig(Package): depends_on('freetype') depends_on('libxml2') + depends_on('pkg-config', type='build') def install(self, spec, prefix): - configure("--prefix=%s" % prefix, "--enable-libxml2") + configure("--prefix=%s" % prefix, + "--enable-libxml2", + "--disable-docs") make() make("install") diff --git a/var/spack/repos/builtin/packages/gcc/package.py b/var/spack/repos/builtin/packages/gcc/package.py index 3be3948b59..d152ce61c7 100644 --- a/var/spack/repos/builtin/packages/gcc/package.py +++ b/var/spack/repos/builtin/packages/gcc/package.py @@ -3,6 +3,7 @@ from spack import * from contextlib import closing from glob import glob import sys +from os.path import isfile class Gcc(Package): @@ -68,6 +69,19 @@ class Gcc(Package): if spec.satisfies("@4.7.1:") and sys.platform != 'darwin': enabled_languages.add('go') + # Fix a standard header file for OS X Yosemite that + # is GCC incompatible by replacing non-GCC compliant macros + if 'yosemite' in spec.architecture: + if isfile(r'/usr/include/dispatch/object.h'): + new_dispatch_dir = join_path(prefix, 'include', 'dispatch') + mkdirp(new_dispatch_dir) + cp = which('cp') + new_header = join_path(new_dispatch_dir, 'object.h') + cp(r'/usr/include/dispatch/object.h', new_header) + filter_file(r'typedef void \(\^dispatch_block_t\)\(void\)', + 'typedef void* dispatch_block_t', + new_header) + # Generic options to compile GCC options = ["--prefix=%s" % prefix, "--libdir=%s/lib64" % prefix, "--disable-multilib", diff --git a/var/spack/repos/builtin/packages/gdb/package.py b/var/spack/repos/builtin/packages/gdb/package.py index a14e166ed4..f90e4e7ff0 100644 --- a/var/spack/repos/builtin/packages/gdb/package.py +++ b/var/spack/repos/builtin/packages/gdb/package.py @@ -41,9 +41,18 @@ class Gdb(Package): version('7.9', '8f8ced422fe462a00e0135a643544f17') version('7.8.2', '8b0ea8b3559d3d90b3ff4952f0aeafbc') + variant('python', default=True, description='Compile with Python support') + + # Required dependency depends_on('texinfo', type='build') + # Optional dependency + depends_on('python', when='+python') + def install(self, spec, prefix): - configure('--prefix=%s' % prefix) + options = ['--prefix=%s' % prefix] + if '+python' in spec: + options.extend(['--with-python']) + configure(*options) make() make("install") diff --git a/var/spack/repos/builtin/packages/geant4/package.py b/var/spack/repos/builtin/packages/geant4/package.py new file mode 100644 index 0000000000..239ef6d586 --- /dev/null +++ b/var/spack/repos/builtin/packages/geant4/package.py @@ -0,0 +1,85 @@ +############################################################################## +# 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 Geant4(Package): + """Geant4 is a toolkit for the simulation of the passage of particles + through matter. Its areas of application include high energy, nuclear + and accelerator physics, as well as studies in medical and space + science.""" + + homepage = "http://geant4.cern.ch/" + url = "http://geant4.cern.ch/support/source/geant4.10.01.p03.tar.gz" + + version('10.02.p01', 'b81f7082a15f6a34b720b6f15c6289cfe4ddbbbdcef0dc52719f71fac95f7f1c') + version('10.01.p03', '4fb4175cc0dabcd517443fbdccd97439') + + variant('qt', default=False, description='Enable Qt support') + + depends_on('cmake@3.5:', type='build') + + depends_on("clhep@2.3.1.1~cxx11+cxx14", when="@10.02.p01") + depends_on("clhep@2.2.0.4~cxx11+cxx14", when="@10.01.p03") + depends_on("expat") + depends_on("zlib") + depends_on("xerces-c") + depends_on("qt@4.8:", when="+qt") + + def install(self, spec, prefix): + cmake_args = list(std_cmake_args) + cmake_args.append('-DXERCESC_ROOT_DIR:STRING=%s' % + spec['xerces-c'].prefix) + cmake_args.append('-DGEANT4_BUILD_CXXSTD=c++14') + + cmake_args += ['-DGEANT4_USE_GDML=ON', + '-DGEANT4_USE_SYSTEM_EXPAT=ON', + '-DGEANT4_USE_SYSTEM_ZLIB=ON', + '-DGEANT4_USE_SYSTEM_CLHEP=ON'] + + # fixme: turn off data for now and maybe each data set should + # go into a separate package to cut down on disk usage between + # different code versions using the same data versions. + cmake_args.append('-DGEANT4_INSTALL_DATA=OFF') + + # http://geant4.web.cern.ch/geant4/UserDocumentation/UsersGuides/InstallationGuide/html/ch02s03.html + # fixme: likely things that need addressing: + # -DGEANT4_USE_OPENGL_X11=ON + + if '+qt' in spec: + cmake_args.append('-DGEANT4_USE_QT=ON') + + build_directory = join_path(self.stage.path, 'spack-build') + source_directory = self.stage.source_path + + with working_dir(build_directory, create=True): + cmake(source_directory, *cmake_args) + make() + make("install") + + def url_for_version(self, version): + """Handle Geant4's unusual version string.""" + return "http://geant4.cern.ch/support/source/geant4.%s.tar.gz" % version diff --git a/var/spack/repos/builtin/packages/git-lfs/package.py b/var/spack/repos/builtin/packages/git-lfs/package.py index a080660721..25e440ff6d 100644 --- a/var/spack/repos/builtin/packages/git-lfs/package.py +++ b/var/spack/repos/builtin/packages/git-lfs/package.py @@ -26,17 +26,28 @@ from spack import * class GitLfs(Package): - """Tool for managing large files with Git.""" + """Git LFS is a system for managing and versioning large files in + association with a Git repository. Instead of storing the large files + within the Git repository as blobs, Git LFS stores special "pointer + files" in the repository, while storing the actual file contents on a + Git LFS server.""" homepage = "https://git-lfs.github.com" - url = "https://github.com/github/git-lfs/archive/v1.4.1.tar.gz" + git_url = "https://github.com/github/git-lfs.git" - version('1.4.1', 'c62a314d96d3a30af4d98fa3305ad317') + version('1.4.1', git=git_url, tag='v1.4.1') + version('1.3.1', git=git_url, tag='v1.3.1') + + # TODO: Implement this by following the instructions at this location: + # https://github.com/github/git-lfs/blob/master/CONTRIBUTING.md#building + # variant('test', default=True, description='Build and run tests as part of the build.') # NOQA: E501 depends_on('go@1.5:', type='build') depends_on('git@1.8.2:', type='run') def install(self, spec, prefix): - bootstrap = Executable('./scripts/bootstrap') - bootstrap() - install('bin/git-lfs', prefix.bin) + bootstrap_script = Executable(join_path('script', 'bootstrap')) + bootstrap_script() + + mkdirp(prefix.bin) + install(join_path('bin', 'git-lfs'), prefix.bin) diff --git a/var/spack/repos/builtin/packages/git/package.py b/var/spack/repos/builtin/packages/git/package.py index ed058e0a68..ac97ad392b 100644 --- a/var/spack/repos/builtin/packages/git/package.py +++ b/var/spack/repos/builtin/packages/git/package.py @@ -22,6 +22,7 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## +import sys from spack import * @@ -54,28 +55,33 @@ class Git(Package): # version('2.5.4', '3eca2390cf1fa698b48e2a233563a76b') # version('2.2.1', 'ff41fdb094eed1ec430aed8ee9b9849c') - depends_on("openssl") depends_on("autoconf", type='build') depends_on("curl") depends_on("expat") depends_on("gettext") - depends_on("zlib") + depends_on("libiconv") + depends_on("openssl") depends_on("pcre") depends_on("perl") + depends_on("zlib") def install(self, spec, prefix): env['LDFLAGS'] = "-L%s" % spec['gettext'].prefix.lib + " -lintl" configure_args = [ "--prefix=%s" % prefix, - "--with-libpcre=%s" % spec['pcre'].prefix, - "--with-openssl=%s" % spec['openssl'].prefix, - "--with-zlib=%s" % spec['zlib'].prefix, "--with-curl=%s" % spec['curl'].prefix, "--with-expat=%s" % spec['expat'].prefix, + "--with-iconv=%s" % spec['libiconv'].prefix, + "--with-libpcre=%s" % spec['pcre'].prefix, + "--with-openssl=%s" % spec['openssl'].prefix, "--with-perl=%s" % join_path(spec['perl'].prefix.bin, 'perl'), + "--with-zlib=%s" % spec['zlib'].prefix, ] which('autoreconf')('-i') configure(*configure_args) + if sys.platform == "darwin": + # Don't link with -lrt; the system has no (and needs no) librt + filter_file(r' -lrt$', '', 'Makefile') make() make("install") diff --git a/var/spack/repos/builtin/packages/glib/no-Werror=format-security.patch b/var/spack/repos/builtin/packages/glib/no-Werror=format-security.patch new file mode 100644 index 0000000000..cfcfe424be --- /dev/null +++ b/var/spack/repos/builtin/packages/glib/no-Werror=format-security.patch @@ -0,0 +1,16 @@ +--- a/configure.ac 2016-08-16 11:57:34.000000000 -0400 ++++ b/configure.ac 2016-08-16 11:57:36.000000000 -0400 +@@ -3357,11 +3357,11 @@ + enable_compile_warnings=yes) + AS_IF([test "x$enable_compile_warnings" = xyes], [ + CC_CHECK_FLAGS_APPEND([GLIB_WARN_CFLAGS], [CFLAGS], [\ + -Wall -Wstrict-prototypes -Werror=declaration-after-statement \ + -Werror=missing-prototypes -Werror=implicit-function-declaration \ +- -Werror=pointer-arith -Werror=init-self -Werror=format-security \ +- -Werror=format=2 -Werror=missing-include-dirs]) ++ -Werror=pointer-arith -Werror=init-self \ ++ -Werror=missing-include-dirs]) + ]) + AC_SUBST(GLIB_WARN_CFLAGS) + + # diff --git a/var/spack/repos/builtin/packages/glib/package.py b/var/spack/repos/builtin/packages/glib/package.py index 94ef95e7ab..3e687ccd95 100644 --- a/var/spack/repos/builtin/packages/glib/package.py +++ b/var/spack/repos/builtin/packages/glib/package.py @@ -23,6 +23,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from spack import * +import os class Glib(Package): @@ -38,14 +39,20 @@ class Glib(Package): version('2.48.1', '67bd3b75c9f6d5587b457dc01cdcd5bb') version('2.42.1', '89c4119e50e767d3532158605ee9121a') + depends_on('autoconf', type='build') + depends_on('automake', type='build') + depends_on('libtool', type='build') + depends_on('pkg-config', type='build') depends_on('libffi') depends_on('zlib') - depends_on('pkg-config', type='build') depends_on('gettext') depends_on('pcre+utf', when='@2.48:') # The following patch is needed for gcc-6.1 patch('g_date_strftime.patch', when='@2.42.1') + # Clang doesn't seem to acknowledge the pragma lines to disable the -Werror + # around a legitimate usage. + patch('no-Werror=format-security.patch') def url_for_version(self, version): """Handle glib's version-based custom URLs.""" @@ -53,6 +60,16 @@ class Glib(Package): return url + '/%s/glib-%s.tar.xz' % (version.up_to(2), version) def install(self, spec, prefix): + autoreconf = which("autoreconf") + autoreconf("--install", "--verbose", "--force", + "-I", "config", + "-I", os.path.join(spec['pkg-config'].prefix, + "share", "aclocal"), + "-I", os.path.join(spec['automake'].prefix, + "share", "aclocal"), + "-I", os.path.join(spec['libtool'].prefix, + "share", "aclocal"), + ) configure("--prefix=%s" % prefix) make() make("install", parallel=False) diff --git a/var/spack/repos/builtin/packages/gmake/package.py b/var/spack/repos/builtin/packages/gmake/package.py new file mode 100644 index 0000000000..ca296350a4 --- /dev/null +++ b/var/spack/repos/builtin/packages/gmake/package.py @@ -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 Gmake(Package): + """GNU Make.""" + + homepage = "http://gnu.org/gnu/make" + url = "ftp://ftp.gnu.org/gnu/make/make-4.0.tar.gz" + + version('4.0', 'b5e558f981326d9ca1bfdb841640721a') + + def install(self, spec, prefix): + configure('--prefix={0}'.format(prefix)) + + make() + make('install') + with working_dir(prefix.bin): + symlink('make', 'gmake') diff --git a/var/spack/repos/builtin/packages/gmp/package.py b/var/spack/repos/builtin/packages/gmp/package.py index bd1f653bd7..ddc2dbb935 100644 --- a/var/spack/repos/builtin/packages/gmp/package.py +++ b/var/spack/repos/builtin/packages/gmp/package.py @@ -37,4 +37,7 @@ class Gmp(AutotoolsPackage): version('6.0.0a', 'b7ff2d88cae7f8085bd5006096eed470') version('6.0.0', '6ef5869ae735db9995619135bd856b84') - depends_on("m4", type='build') + depends_on('m4', type='build') + + def configure_args(self): + return ['--enable-cxx'] diff --git a/var/spack/repos/builtin/packages/gmsh/package.py b/var/spack/repos/builtin/packages/gmsh/package.py index 1d375f2186..dd142866e5 100644 --- a/var/spack/repos/builtin/packages/gmsh/package.py +++ b/var/spack/repos/builtin/packages/gmsh/package.py @@ -87,9 +87,9 @@ class Gmsh(Package): options.append('-DENABLE_OS_SPECIFIC_INSTALL=OFF') # Make sure GMSH picks up correct BlasLapack by providing linker flags - options.append('-DBLAS_LAPACK_LIBRARIES=%s %s' % - (to_link_flags(spec['lapack'].lapack_shared_lib), - to_link_flags(spec['blas'].blas_shared_lib))) + blas_lapack = spec['lapack'].lapack_libs + spec['blas'].blas_libs + options.append( + '-DBLAS_LAPACK_LIBRARIES={0}'.format(blas_lapack.ld_flags)) # Gmsh does not have an option to compile against external metis. # Its own Metis, however, fails to build diff --git a/var/spack/repos/builtin/packages/go-bootstrap/package.py b/var/spack/repos/builtin/packages/go-bootstrap/package.py index b0e2109fd3..d48c7c9756 100644 --- a/var/spack/repos/builtin/packages/go-bootstrap/package.py +++ b/var/spack/repos/builtin/packages/go-bootstrap/package.py @@ -1,3 +1,27 @@ +############################################################################## +# 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 +############################################################################## import os import shutil import glob @@ -17,25 +41,37 @@ class GoBootstrap(Package): extendable = True - # temporary fix until tags are pulled correctly + # NOTE: Go@1.4.2 is the only supported bootstrapping compiler because all + # later versions require a Go compiler to build. + # See: https://golang.org/doc/install/source version('1.4.2', git='https://go.googlesource.com/go', tag='go1.4.2') - variant('test', - default=True, - description="Run tests as part of build, a good idea but quite" - " time consuming") + variant('test', default=True, description='Build and run tests as part of the build.') provides('golang@:1.4.2') - depends_on('git') + depends_on('git', type='alldeps') + + # NOTE: Older versions of Go attempt to download external files that have + # since been moved while running the test suite. This patch modifies the + # test files so that these tests don't cause false failures. + # See: https://github.com/golang/go/issues/15694 + @when('@:1.4.3') + def patch(self): + test_suite_file = FileFilter(join_path('src', 'run.bash')) + test_suite_file.filter( + r'^(.*)(\$GOROOT/src/cmd/api/run.go)(.*)$', + r'# \1\2\3', + ) + + @when('@1.5.0:') + def patch(self): + pass def install(self, spec, prefix): bash = which('bash') with working_dir('src'): - if '+test' in spec: - bash('all.bash') - else: - bash('make.bash') + bash('{0}.bash'.format('all' if '+test' in spec else 'make')) try: os.makedirs(prefix) diff --git a/var/spack/repos/builtin/packages/go/package.py b/var/spack/repos/builtin/packages/go/package.py index 259498c145..5fa3017ab5 100644 --- a/var/spack/repos/builtin/packages/go/package.py +++ b/var/spack/repos/builtin/packages/go/package.py @@ -1,3 +1,27 @@ +############################################################################## +# 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 +############################################################################## import os import shutil import glob @@ -12,28 +36,39 @@ class Go(Package): extendable = True - version('1.5.4', git='https://go.googlesource.com/go', tag='go1.5.4') version('1.6.2', git='https://go.googlesource.com/go', tag='go1.6.2') + version('1.5.4', git='https://go.googlesource.com/go', tag='go1.5.4') + version('1.4.2', git='https://go.googlesource.com/go', tag='go1.4.2') - variant('test', - default=True, - description="Run tests as part of build, a good idea but quite" - " time consuming") + variant('test', default=True, description='Build and run tests as part of the build.') provides('golang') - # to-do, make non-c self-hosting compilers feasible without backflips + depends_on('git', type='alldeps') + # TODO: Make non-c self-hosting compilers feasible without backflips # should be a dep on external go compiler depends_on('go-bootstrap', type='build') - depends_on('git', type='alldeps') + + # NOTE: Older versions of Go attempt to download external files that have + # since been moved while running the test suite. This patch modifies the + # test files so that these tests don't cause false failures. + # See: https://github.com/golang/go/issues/15694 + @when('@:1.4.3') + def patch(self): + test_suite_file = FileFilter(join_path('src', 'run.bash')) + test_suite_file.filter( + r'^(.*)(\$GOROOT/src/cmd/api/run.go)(.*)$', + r'# \1\2\3', + ) + + @when('@1.5.0:') + def patch(self): + pass def install(self, spec, prefix): bash = which('bash') with working_dir('src'): - if '+test' in spec: - bash('all.bash') - else: - bash('make.bash') + bash('{0}.bash'.format('all' if '+test' in spec else 'make')) try: os.makedirs(prefix) diff --git a/var/spack/repos/builtin/packages/grackle/Make.mach.template b/var/spack/repos/builtin/packages/grackle/Make.mach.template new file mode 100644 index 0000000000..83abaa26d1 --- /dev/null +++ b/var/spack/repos/builtin/packages/grackle/Make.mach.template @@ -0,0 +1,71 @@ +MACH_TEXT = Generic Linux +MACH_VALID = 1 +MACH_FILE = Make.mach.@ARCHITECTURE + +#----------------------------------------------------------------------- +# Install paths (local variables) +#----------------------------------------------------------------------- + +LOCAL_HDF5_INSTALL = @HDF5_ROOT + +#----------------------------------------------------------------------- +# Compiler settings +#----------------------------------------------------------------------- + +MACH_CC_NOMPI = @CC # C compiler +MACH_CXX_NOMPI = @CXX # C++ compiler +MACH_FC_NOMPI = @F77 # Fortran 77 +MACH_F90_NOMPI = @FC # Fortran 90 +MACH_LD_NOMPI = @FC # Linker +@LINK_VARIABLES_DEFINITION + +#----------------------------------------------------------------------- +# Machine-dependent defines +#----------------------------------------------------------------------- + +MACH_DEFINES = -DLINUX -DH5_USE_16_API -fPIC + +#----------------------------------------------------------------------- +# Compiler flag settings +#----------------------------------------------------------------------- + +MACH_CPPFLAGS = -P -traditional +MACH_CFLAGS = +MACH_CXXFLAGS = +MACH_FFLAGS = -fno-second-underscore -ffixed-line-length-132 +MACH_F90FLAGS = -fno-second-underscore +MACH_LDFLAGS = @STDCXX_LIB + +#----------------------------------------------------------------------- +# Optimization flags +#----------------------------------------------------------------------- + +MACH_OPT_WARN = -Wall -g +MACH_OPT_DEBUG = -g +MACH_OPT_HIGH = -O2 +MACH_OPT_AGGRESSIVE = -O3 -g + +#----------------------------------------------------------------------- +# Includes +#----------------------------------------------------------------------- + +LOCAL_INCLUDES_HDF5 = -I@HDF5_ROOT/include # HDF5 includes + +MACH_INCLUDES = $(LOCAL_INCLUDES_HDF5) + +#----------------------------------------------------------------------- +# Libraries +#----------------------------------------------------------------------- + +LOCAL_LIBS_HDF5 = -L@HDF5_ROOT/lib -lhdf5 # HDF5 libraries +LOCAL_LIBS_MACH = # Machine-dependent libraries + +MACH_LIBS = $(LOCAL_LIBS_HDF5) $(LOCAL_LIBS_MACH) + +#----------------------------------------------------------------------- +# Installation +#----------------------------------------------------------------------- + +MACH_INSTALL_PREFIX = @PREFIX +MACH_INSTALL_LIB_DIR = +MACH_INSTALL_INCLUDE_DIR = diff --git a/var/spack/repos/builtin/packages/grackle/package.py b/var/spack/repos/builtin/packages/grackle/package.py new file mode 100644 index 0000000000..7e3777158f --- /dev/null +++ b/var/spack/repos/builtin/packages/grackle/package.py @@ -0,0 +1,89 @@ +############################################################################## +# 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 +############################################################################## +import os.path +import shutil +import inspect + +from spack import * + + +class Grackle(Package): + """Grackle is a chemistry and radiative cooling library for astrophysical + simulations with interfaces for C, C++, and Fortran codes. It is a + generalized and trimmed down version of the chemistry network of the Enzo + simulation code + """ + homepage = 'http://grackle.readthedocs.io/en/grackle-2.2/' + url = 'https://bitbucket.org/grackle/grackle/get/grackle-2.0.1.tar.bz2' + + version('2.2', 'ec49ed1db5a42db21f478285150c2ba3') + version('2.0.1', 'a9624ad13a60c592c1a0a4ea8e1ae86d') + + depends_on('libtool', when='@2.2') + + depends_on('mpi') + depends_on('hdf5+mpi') + + parallel = False + + def install(self, spec, prefix): + template_name = '{0.architecture}-{0.compiler.name}' + grackle_architecture = template_name.format(spec) + link_variables = 'MACH_AR = ar' if spec.version < Version(2.2) else 'MACH_LIBTOOL = libtool' # NOQA: ignore=E501 + substitutions = { + '@ARCHITECTURE': grackle_architecture, + '@CC': spec['mpi'].mpicc, + '@CXX': spec['mpi'].mpicxx, + '@FC': spec['mpi'].mpifc, + '@F77': spec['mpi'].mpif77, + '@STDCXX_LIB': ' '.join(self.compiler.stdcxx_libs), + '@HDF5_ROOT': spec['hdf5'].prefix, + '@PREFIX': prefix, + '@LINK_VARIABLES_DEFINITION': link_variables + } + + template = join_path( + os.path.dirname(inspect.getmodule(self).__file__), + 'Make.mach.template' + ) + makefile = join_path( + self.stage.source_path, + 'src', + 'clib', + 'Make.mach.{0}'.format(grackle_architecture) + ) + shutil.copy(template, makefile) + for key, value in substitutions.items(): + filter_file(key, value, makefile) + + configure() + with working_dir('src/clib'): + make('clean') + make('machine-{0}'.format(grackle_architecture)) + make('opt-high') + make('show-config') + make() + mkdirp(prefix.lib) + make('install') diff --git a/var/spack/repos/builtin/packages/grib-api/package.py b/var/spack/repos/builtin/packages/grib-api/package.py new file mode 100644 index 0000000000..8b81e14a27 --- /dev/null +++ b/var/spack/repos/builtin/packages/grib-api/package.py @@ -0,0 +1,80 @@ +############################################################################## +# 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 GribApi(Package): + """The ECMWF GRIB API is an application program interface accessible from + C, FORTRAN and Python programs developed for encoding and decoding WMO + FM-92 GRIB edition 1 and edition 2 messages.""" + + homepage = "https://software.ecmwf.int/wiki/display/GRIB/Home" + url = "https://software.ecmwf.int/wiki/download/attachments/3473437/grib_api-1.17.0-Source.tar.gz" + + version('1.17.0', 'bca7114d2c3100501a08190a146818d2') + version('1.16.0', '8c7fdee03344e4379d400ae20976a460') + + variant('netcdf', default=False, description='Enable netcdf encoding/decoding using netcdf library') + variant('jpeg', default=True, description='Enable jpeg 2000 for grib 2 decoding/encoding') + variant('png', default=False, description='Enable png for decoding/encoding') + + depends_on('cmake', type='build') + depends_on('libpng', when='+png') + depends_on('netcdf', when='+netcdf') + depends_on('jasper', when='+jpeg') + + def install(self, spec, prefix): + options = [] + options.extend(std_cmake_args) + options.append('-DBUILD_SHARED_LIBS=BOTH') + + # We will add python support later. + options.append('-DENABLE_PYTHON=OFF') + + # Disable FORTRAN interface if we don't have it. + if (self.compiler.f77 is None) or (self.compiler.fc is None): + options.append('-DENABLE_FORTRAN=OFF') + + if '+netcdf' in spec: + options.append('-DENABLE_NETCDF=ON') + options.append('-DNETCDF_PATH=%s' % spec['netcdf'].prefix) + else: + options.append('-DENABLE_NETCDF=OFF') + + if '+jpeg' in spec: + options.append('-DENABLE_JPG=ON') + options.append('-DJASPER_PATH=%s' % spec['jasper'].prefix) + else: + options.append('-DENABLE_JPG=OFF') + + if '+png' in spec: + options.append('-DENABLE_PNG=ON') + else: + options.append('-DENABLE_PNG=OFF') + + with working_dir('spack-build', create=True): + cmake('..', *options) + make() + make('install') diff --git a/var/spack/repos/builtin/packages/h5hut/package.py b/var/spack/repos/builtin/packages/h5hut/package.py new file mode 100644 index 0000000000..1501384493 --- /dev/null +++ b/var/spack/repos/builtin/packages/h5hut/package.py @@ -0,0 +1,70 @@ +############################################################################## +# 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 H5hut(Package): + """H5hut (HDF5 Utility Toolkit) + High-Performance I/O Library for Particle-based Simulations + """ + + homepage = "https://amas.psi.ch/H5hut/" + url = "https://amas.psi.ch/H5hut/raw-attachment/wiki/DownloadSources/H5hut-1.99.13.tar.gz" + + version("1.99.13", "2a07a449afe50534de006ac6954a421a") + + variant("fortran", default=True, description="Enable Fortran support") + variant("mpi", default=False, description="Enable MPI support") + + depends_on("autoconf @2.60:", type="build") + depends_on("automake", type="build") + depends_on("hdf5 +mpi", when="+mpi") + depends_on("hdf5 @1.8:") + # h5hut +mpi uses the obsolete function H5Pset_fapl_mpiposix: + depends_on("hdf5 @:1.8.12", when="+mpi") + depends_on("libtool", type="build") + depends_on("mpi", when="+mpi") + + def install(self, spec, prefix): + autogen = Executable("./autogen.sh") + autogen() + configopts = ["--prefix={0}".format(prefix)] + if "+fortran" in spec: + if not self.compiler.fc: + raise RuntimeError( + "Cannot build Fortran variant without a Fortran compiler") + configopts.append("--enable-fortran") + if "+mpi" in spec: + configopts.extend([ + "--enable-parallel", + "CC=%s" % spec["mpi"].mpicc, + "CXX=%s" % spec["mpi"].mpicxx]) + if "+fortran" in spec: + configopts.append("FC=%s" % spec["mpi"].mpifc) + configure(*configopts) + + make() + make("install") diff --git a/var/spack/repos/builtin/packages/hadoop/package.py b/var/spack/repos/builtin/packages/hadoop/package.py new file mode 100644 index 0000000000..fdcac10335 --- /dev/null +++ b/var/spack/repos/builtin/packages/hadoop/package.py @@ -0,0 +1,53 @@ +############################################################################## +# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Created by Alfredo Gimenez, gimenez1@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 Hadoop(Package): + """The Apache Hadoop software library is a framework that + allows for the distributed processing of large data sets + across clusters of computers using simple programming models. + """ + + homepage = "http://hadoop.apache.org/" + url = "http://mirrors.ocf.berkeley.edu/apache/hadoop/common/hadoop-2.6.4/hadoop-2.6.4.tar.gz" + + version('2.6.4', '37019f13d7dcd819727be158440b9442') + + depends_on('jdk', type='run') + + def install(self, spec, prefix): + + def install_dir(dirname): + install_tree(dirname, join_path(prefix, dirname)) + + install_dir('bin') + install_dir('etc') + install_dir('include') + install_dir('lib') + install_dir('libexec') + install_dir('sbin') + install_dir('share') diff --git a/var/spack/repos/builtin/packages/harfbuzz/package.py b/var/spack/repos/builtin/packages/harfbuzz/package.py index f8d73d651b..7c98c2a96a 100644 --- a/var/spack/repos/builtin/packages/harfbuzz/package.py +++ b/var/spack/repos/builtin/packages/harfbuzz/package.py @@ -32,8 +32,9 @@ class Harfbuzz(Package): version('0.9.37', 'bfe733250e34629a188d82e3b971bc1e') + depends_on("pkg-config", type="build") depends_on("glib") - depends_on("icu") + depends_on("icu4c") depends_on("freetype") depends_on("cairo") depends_on("zlib") diff --git a/var/spack/repos/builtin/packages/hdf/package.py b/var/spack/repos/builtin/packages/hdf/package.py index aafb345be6..9a44184256 100644 --- a/var/spack/repos/builtin/packages/hdf/package.py +++ b/var/spack/repos/builtin/packages/hdf/package.py @@ -38,13 +38,12 @@ class Hdf(Package): variant('szip', default=False, description="Enable szip support") - depends_on("jpeg") - depends_on("szip", when='+szip') - depends_on("zlib") + depends_on('jpeg') + depends_on('szip', when='+szip') + depends_on('zlib') - def url_for_version(self, version): - return "https://www.hdfgroup.org/ftp/HDF/releases/HDF" + str( - version) + "/src/hdf-" + str(version) + ".tar.gz" + depends_on('bison', type='build') + depends_on('flex', type='build') def install(self, spec, prefix): config_args = [ @@ -66,4 +65,5 @@ class Hdf(Package): configure(*config_args) make() - make("install") + make('check') + make('install') diff --git a/var/spack/repos/builtin/packages/hdf5/package.py b/var/spack/repos/builtin/packages/hdf5/package.py index 601e3278e5..b5a7a65083 100644 --- a/var/spack/repos/builtin/packages/hdf5/package.py +++ b/var/spack/repos/builtin/packages/hdf5/package.py @@ -43,6 +43,7 @@ class Hdf5(AutotoolsPackage): version('1.8.16', 'b8ed9a36ae142317f88b0c7ef4b9c618') version('1.8.15', '03cccb5b33dbe975fdcd8ae9dc021f24') version('1.8.13', 'c03426e9e77d7766944654280b467289') + version('1.8.12', 'd804802feb99b87fc668a90e6fa34411') variant('debug', default=False, description='Builds a debug version of the library') @@ -52,7 +53,7 @@ class Hdf5(AutotoolsPackage): variant('cxx', default=True, description='Enable C++ support') variant('fortran', default=True, description='Enable Fortran support') - variant('mpi', default=False, description='Enable MPI support') + variant('mpi', default=True, description='Enable MPI support') variant('szip', default=False, description='Enable szip support') variant('threadsafe', default=False, description='Enable thread-safe capabilities') diff --git a/var/spack/repos/builtin/packages/hepmc/package.py b/var/spack/repos/builtin/packages/hepmc/package.py new file mode 100644 index 0000000000..ab80dcf6ba --- /dev/null +++ b/var/spack/repos/builtin/packages/hepmc/package.py @@ -0,0 +1,55 @@ +############################################################################## +# 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 Hepmc(Package): + """The HepMC package is an object oriented, C++ event record for + High Energy Physics Monte Carlo generators and simulation.""" + + homepage = "http://hepmc.web.cern.ch/hepmc/" + url = "http://hepmc.web.cern.ch/hepmc/releases/hepmc2.06.09.tgz" + + version('2.06.09', 'c47627ced4255b40e731b8666848b087') + version('2.06.08', 'a2e889114cafc4f60742029d69abd907') + version('2.06.07', '11d7035dccb0650b331f51520c6172e7') + version('2.06.06', '102e5503537a3ecd6ea6f466aa5bc4ae') + version('2.06.05', '2a4a2a945adf26474b8bdccf4f881d9c') + + depends_on("cmake", type='build') + + def install(self, spec, prefix): + build_directory = join_path(self.stage.path, 'spack-build') + source_directory = self.stage.source_path + options = [source_directory] + options.append('-Dmomentum:STRING=GEV') + options.append('-Dlength:STRING=MM') + options.extend(std_cmake_args) + + with working_dir(build_directory, create=True): + cmake(*options) + make() + make('install') diff --git a/var/spack/repos/builtin/packages/heppdt/package.py b/var/spack/repos/builtin/packages/heppdt/package.py new file mode 100644 index 0000000000..54c846ae33 --- /dev/null +++ b/var/spack/repos/builtin/packages/heppdt/package.py @@ -0,0 +1,48 @@ +############################################################################## +# 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 Heppdt(Package): + """The HepPID library contains translation methods for particle ID's + to and from various Monte Carlo generators and the PDG standard + numbering scheme. We realize that the generators adhere closely + to the standard, but there are occasional differences.""" + homepage = "http://lcgapp.cern.ch/project/simu/HepPDT/" + url = "http://lcgapp.cern.ch/project/simu/HepPDT/download/HepPDT-2.06.01.tar.gz" + + version('3.04.01', 'a8e93c7603d844266b62d6f189f0ac7e') + version('3.04.00', '2d2cd7552d3e9539148febacc6287db2') + version('3.03.02', '0b85f1809bb8b0b28a46f23c718b2773') + version('3.03.01', 'd411f3bfdf9c4350d802241ba2629cc2') + version('3.03.00', 'cd84d0a0454be982dcd8c285e060a7b3') + version('2.06.01', '5688b4bdbd84b48ed5dd2545a3dc33c0') + + def install(self, spec, prefix): + configure('--prefix=%s' % prefix) + + make() + make("install") diff --git a/var/spack/repos/builtin/packages/hpctoolkit-externals/package.py b/var/spack/repos/builtin/packages/hpctoolkit-externals/package.py new file mode 100644 index 0000000000..64b5d17851 --- /dev/null +++ b/var/spack/repos/builtin/packages/hpctoolkit-externals/package.py @@ -0,0 +1,39 @@ +# +# 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 HpctoolkitExternals(Package): + """HPCToolkit performance analysis tool has many prerequisites and + HpctoolkitExternals package provides all these prerequisites.""" + + homepage = "http://hpctoolkit.org" + + # Note: No precise release tags/branches provided + version('5.4', + git='https://github.com/HPCToolkit/hpctoolkit-externals.git', + commit='3d2953623357bb06e9a4b51eca90a4b039c2710e') + + parallel = False + + def install(self, spec, prefix): + + options = ['CC=%s' % self.compiler.cc, + 'CXX=%s' % self.compiler.cxx] + + with working_dir('spack-build', create=True): + configure = Executable('../configure') + configure('--prefix=%s' % prefix, *options) + make('install') diff --git a/var/spack/repos/builtin/packages/hpctoolkit/package.py b/var/spack/repos/builtin/packages/hpctoolkit/package.py new file mode 100644 index 0000000000..aac22ef829 --- /dev/null +++ b/var/spack/repos/builtin/packages/hpctoolkit/package.py @@ -0,0 +1,55 @@ +# +# 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 Hpctoolkit(Package): + """HPCToolkit is an integrated suite of tools for measurement and analysis + of program performance on computers ranging from multicore desktop systems + to the nation's largest supercomputers. By using statistical sampling of + timers and hardware performance counters, HPCToolkit collects accurate + measurements of a program's work, resource consumption, and inefficiency + and attributes them to the full calling context in which they occur.""" + + homepage = "http://hpctoolkit.org" + + # Note: No precise release tags/branches provided + version('5.4', git='https://github.com/HPCToolkit/hpctoolkit.git', + commit='d9ca2112762e5a06ea31b5295d793e4a83272d19') + + variant('mpi', default=True, description='Enable MPI supoort') + variant('papi', default=True, description='Enable PAPI counter support') + + depends_on('hpctoolkit-externals') + depends_on('papi', when='+papi') + depends_on('mpi', when='+mpi') + + def install(self, spec, prefix): + + options = ['CC=%s' % self.compiler.cc, + 'CXX=%s' % self.compiler.cxx, + '--with-externals=%s' % spec['hpctoolkit-externals'].prefix] + + if '+mpi' in spec: + options.extend(['MPICXX=%s' % spec['mpi'].mpicxx]) + + if '+papi' in spec: + options.extend(['--with-papi=%s' % spec['papi'].prefix]) + + # TODO: BG-Q configure option + with working_dir('spack-build', create=True): + configure = Executable('../configure') + configure('--prefix=%s' % prefix, *options) + make('install') diff --git a/var/spack/repos/builtin/packages/hpl/package.py b/var/spack/repos/builtin/packages/hpl/package.py index efd5c8bb1d..fa0013de17 100644 --- a/var/spack/repos/builtin/packages/hpl/package.py +++ b/var/spack/repos/builtin/packages/hpl/package.py @@ -78,7 +78,7 @@ class Hpl(Package): 'MPlib = -L{0}'.format(spec['mpi'].prefix.lib), # Linear Algebra library (BLAS or VSIPL) 'LAinc = {0}'.format(spec['blas'].prefix.include), - 'LAlib = {0}'.format(spec['blas'].blas_shared_lib), + 'LAlib = {0}'.format(spec['blas'].blas_libs.joined()), # F77 / C interface 'F2CDEFS = -DAdd_ -DF77_INTEGER=int -DStringSunStyle', # HPL includes / libraries / specifics diff --git a/var/spack/repos/builtin/packages/hwloc/package.py b/var/spack/repos/builtin/packages/hwloc/package.py index c163628840..111c424b22 100644 --- a/var/spack/repos/builtin/packages/hwloc/package.py +++ b/var/spack/repos/builtin/packages/hwloc/package.py @@ -42,6 +42,7 @@ class Hwloc(Package): list_url = "http://www.open-mpi.org/software/hwloc/" list_depth = 3 + version('1.11.4', 'b6f23eb59074fd09fdd84905d50b103d') version('1.11.3', 'c1d36a9de6028eac1d18ea4782ef958f') version('1.11.2', 'e4ca55c2a5c5656da4a4e37c8fc51b23') version('1.11.1', 'feb4e416a1b25963ed565d8b42252fdc') diff --git a/var/spack/repos/builtin/packages/hypre/package.py b/var/spack/repos/builtin/packages/hypre/package.py index fdc236dcf4..f22303a864 100644 --- a/var/spack/repos/builtin/packages/hypre/package.py +++ b/var/spack/repos/builtin/packages/hypre/package.py @@ -54,19 +54,15 @@ class Hypre(Package): 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 + lapack = spec['lapack'].lapack_libs + blas = spec['blas'].blas_libs + configure_args = [ '--prefix=%s' % prefix, - '--with-lapack-libs=%s' % to_lib_name( - spec['lapack'].lapack_shared_lib), + '--with-lapack-libs=%s' % ' '.join(lapack.names), '--with-lapack-lib-dirs=%s' % spec['lapack'].prefix.lib, - '--with-blas-libs=%s' % to_lib_name( - spec['blas'].blas_shared_lib), + '--with-blas-libs=%s' % ' '.join(blas.names), '--with-blas-lib-dirs=%s' % spec['blas'].prefix.lib ] diff --git a/var/spack/repos/builtin/packages/icu4c/package.py b/var/spack/repos/builtin/packages/icu4c/package.py index 2bcf86cd13..848ebfdeac 100644 --- a/var/spack/repos/builtin/packages/icu4c/package.py +++ b/var/spack/repos/builtin/packages/icu4c/package.py @@ -27,18 +27,23 @@ from spack import * class Icu4c(Package): """ICU is a mature, widely used set of C/C++ and Java libraries providing - Unicode and Globalization support for software applications. - - """ + Unicode and Globalization support for software applications. ICU4C is the + C/C++ interface.""" homepage = "http://site.icu-project.org/" - url = "http://downloads.sourceforge.net/project/icu/ICU4C/54.1/icu4c-54_1-src.tgz" + url = "http://download.icu-project.org/files/icu4c/57.1/icu4c-57_1-src.tgz" + + version('57.1', '976734806026a4ef8bdd17937c8898b9') - version('54_1', 'e844caed8f2ca24c088505b0d6271bc0') + def url_for_version(self, version): + base_url = "http://download.icu-project.org/files/icu4c" + return "{0}/{1}/icu4c-{2}-src.tgz".format( + base_url, version, version.underscored) def install(self, spec, prefix): - cd("source") - configure("--prefix=%s" % prefix) + with working_dir('source'): + configure('--prefix={0}'.format(prefix)) - make() - make("install") + make() + make('check') + make('install') diff --git a/var/spack/repos/builtin/packages/intel-parallel-studio/package.py b/var/spack/repos/builtin/packages/intel-parallel-studio/package.py index 65db3351a1..efa30f9305 100644 --- a/var/spack/repos/builtin/packages/intel-parallel-studio/package.py +++ b/var/spack/repos/builtin/packages/intel-parallel-studio/package.py @@ -11,7 +11,7 @@ class IntelParallelStudio(IntelInstaller): Note: You will have to add the download file to a mirror so that Spack can find it. For instructions on how to set up a - mirror, see http://software.llnl.gov/spack/mirrors.html""" + mirror, see http://spack.readthedocs.io/en/latest/mirrors.html""" homepage = "https://software.intel.com/en-us/intel-parallel-studio-xe" @@ -45,6 +45,10 @@ class IntelParallelStudio(IntelInstaller): variant('tools', default=True, description="Install the Intel Advisor, " "VTune Amplifier, and Inspector tools") + variant('shared', default=True, description='Builds shared library') + variant('ilp64', default=False, description='64 bit integers') + variant('openmp', default=False, description='OpenMP multithreading layer') + provides('mpi', when='@cluster:+mpi') provides('mkl', when='+mkl') provides('daal', when='+daal') @@ -55,6 +59,31 @@ class IntelParallelStudio(IntelInstaller): provides('lapack', when='+mkl') # TODO: MKL also provides implementation of Scalapack. + @property + def blas_libs(self): + shared = True if '+shared' in self.spec else False + suffix = dso_suffix if '+shared' in self.spec else 'a' + mkl_integer = ['libmkl_intel_ilp64'] if '+ilp64' in self.spec else ['libmkl_intel_lp64'] # NOQA: ignore=E501 + mkl_threading = ['libmkl_sequential'] + if '+openmp' in self.spec: + mkl_threading = ['libmkl_intel_thread', 'libiomp5'] if '%intel' in self.spec else ['libmkl_gnu_thread'] # NOQA: ignore=E501 + # TODO: TBB threading: ['libmkl_tbb_thread', 'libtbb', 'libstdc++'] + mkl_libs = find_libraries( + mkl_integer + ['libmkl_core'] + mkl_threading, + root=join_path(self.prefix.lib, 'intel64'), + shared=shared + ) + system_libs = [ + 'libpthread.{0}'.format(suffix), + 'libm.{0}'.format(suffix), + 'libdl.{0}'.format(suffix) + ] + return mkl_libs + system_libs + + @property + def lapack_libs(self): + return self.blas_libs + def check_variants(self, spec): error_message = '\t{variant} can not be turned off if "+all" is set' @@ -171,24 +200,6 @@ class IntelParallelStudio(IntelInstaller): os.symlink(os.path.join(self.prefix.man, "common", "man1"), os.path.join(self.prefix.man, "man1")) - def setup_dependent_package(self, module, dspec): - # For now use Single Dynamic Library: - # To set the threading layer at run time, use the - # mkl_set_threading_layer function or set MKL_THREADING_LAYER - # variable to one of the following values: INTEL, SEQUENTIAL, PGI. - # To set interface layer at run time, use the mkl_set_interface_layer - # function or set the MKL_INTERFACE_LAYER variable to LP64 or ILP64. - - # Otherwise one would need to specify several libraries - # (e.g. mkl_intel_lp64;mkl_sequential;mkl_core), which reflect - # different interface and threading layers. - - name = 'libmkl_rt.%s' % dso_suffix - libdir = find_library_path(name, self.prefix.lib64, self.prefix.lib) - - self.spec.blas_shared_lib = join_path(libdir, name) - self.spec.lapack_shared_lib = self.spec.blas_shared_lib - def setup_environment(self, spack_env, run_env): # TODO: Determine variables needed for the professional edition. diff --git a/var/spack/repos/builtin/packages/intel/package.py b/var/spack/repos/builtin/packages/intel/package.py index 26134a12ae..5b9c26df0e 100644 --- a/var/spack/repos/builtin/packages/intel/package.py +++ b/var/spack/repos/builtin/packages/intel/package.py @@ -77,7 +77,7 @@ class Intel(IntelInstaller): Note: You will have to add the download file to a mirror so that Spack can find it. For instructions on how to set up a - mirror, see http://software.llnl.gov/spack/mirrors.html""" + mirror, see http://spack.readthedocs.io/en/latest/mirrors.html""" homepage = "https://software.intel.com/en-us/intel-parallel-studio-xe" diff --git a/var/spack/repos/builtin/packages/ipopt/package.py b/var/spack/repos/builtin/packages/ipopt/package.py index d5981e9975..bd1e5f36ef 100644 --- a/var/spack/repos/builtin/packages/ipopt/package.py +++ b/var/spack/repos/builtin/packages/ipopt/package.py @@ -53,9 +53,8 @@ class Ipopt(Package): mumps_flags = "-ldmumps -lmumps_common -lpord -lmpiseq" mumps_libcmd = "-L%s " % mumps_dir.lib + mumps_flags - # By convention, spack links blas & lapack libs to libblas & liblapack - blas_lib = "-L%s" % blas_dir.lib + " -lblas" - lapack_lib = "-L%s" % lapack_dir.lib + " -llapack" + blas_lib = spec['blas'].blas_libs.ld_flags + lapack_lib = spec['lapack'].lapack_libs.ld_flags configure_args = [ "--prefix=%s" % prefix, diff --git a/var/spack/repos/builtin/packages/ipp/package.py b/var/spack/repos/builtin/packages/ipp/package.py index 2bd931d5bd..93c5284695 100644 --- a/var/spack/repos/builtin/packages/ipp/package.py +++ b/var/spack/repos/builtin/packages/ipp/package.py @@ -9,7 +9,7 @@ class Ipp(IntelInstaller): Note: You will have to add the download file to a mirror so that Spack can find it. For instructions on how to set up a - mirror, see http://software.llnl.gov/spack/mirrors.html""" + mirror, see http://spack.readthedocs.io/en/latest/mirrors.html""" homepage = "https://software.intel.com/en-us/intel-ipp" diff --git a/var/spack/repos/builtin/packages/itstool/package.py b/var/spack/repos/builtin/packages/itstool/package.py new file mode 100644 index 0000000000..b8b2b4459f --- /dev/null +++ b/var/spack/repos/builtin/packages/itstool/package.py @@ -0,0 +1,44 @@ +############################################################################## +# 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 Itstool(Package): + """ITS Tool allows you to translate your XML documents with PO files, using + rules from the W3C Internationalization Tag Set (ITS) to determine what + to translate and how to separate it into PO file messages.""" + + homepage = "http://itstool.org/" + url = "http://files.itstool.org/itstool/itstool-2.0.2.tar.bz2" + + version('2.0.2', 'd472d877a7bc49899a73d442085b2f93') + version('2.0.1', '40935cfb08228488bd45575e5f001a34') + version('2.0.0', 'd8c702c3e8961db83d04182c2aa4730b') + version('1.2.0', 'c0925f6869e33af8e7fe56848c129152') + + def install(self, spec, prefix): + configure("--prefix=%s" % prefix) + make() + make('install') diff --git a/var/spack/repos/builtin/packages/jdk/package.py b/var/spack/repos/builtin/packages/jdk/package.py index 63bf6514cb..bab0920434 100644 --- a/var/spack/repos/builtin/packages/jdk/package.py +++ b/var/spack/repos/builtin/packages/jdk/package.py @@ -68,3 +68,9 @@ class Jdk(Package): def install(self, spec, prefix): distutils.dir_util.copy_tree(".", prefix) + + def setup_environment(self, spack_env, run_env): + run_env.set('JAVA_HOME', self.spec.prefix) + + def setup_dependent_environment(self, spack_env, run_env, dependent_spec): + spack_env.set('JAVA_HOME', self.spec.prefix) diff --git a/var/spack/repos/builtin/packages/jemalloc/package.py b/var/spack/repos/builtin/packages/jemalloc/package.py index f5a983b7a9..e13d4292f8 100644 --- a/var/spack/repos/builtin/packages/jemalloc/package.py +++ b/var/spack/repos/builtin/packages/jemalloc/package.py @@ -31,6 +31,8 @@ class Jemalloc(Package): homepage = "http://www.canonware.com/jemalloc/" url = "https://github.com/jemalloc/jemalloc/releases/download/4.0.4/jemalloc-4.0.4.tar.bz2" + version('4.2.1', '094b0a7b8c77c464d0dc8f0643fd3901') + version('4.2.0', 'e6b5d5a1ea93a04207528d274efdd144') version('4.1.0', 'c4e53c947905a533d5899e5cc3da1f94') version('4.0.4', '687c5cc53b9a7ab711ccd680351ff988') diff --git a/var/spack/repos/builtin/packages/julia/package.py b/var/spack/repos/builtin/packages/julia/package.py index 6ccaa11c90..033e27fb64 100644 --- a/var/spack/repos/builtin/packages/julia/package.py +++ b/var/spack/repos/builtin/packages/julia/package.py @@ -37,9 +37,11 @@ class Julia(Package): git='https://github.com/JuliaLang/julia.git', branch='master') version('release-0.5', git='https://github.com/JuliaLang/julia.git', branch='release-0.5') + version('0.5.0', 'b61385671ba74767ab452363c43131fb', preferred=True) version('release-0.4', git='https://github.com/JuliaLang/julia.git', branch='release-0.4') - version('0.4.6', 'd88db18c579049c23ab8ef427ccedf5d', preferred=True) + version('0.4.7', '75a7a7dd882b7840829d8f165e9b9078') + version('0.4.6', 'd88db18c579049c23ab8ef427ccedf5d') version('0.4.5', '69141ff5aa6cee7c0ec8c85a34aa49a6') version('0.4.3', '8a4a59fd335b05090dd1ebefbbe5aaac') @@ -68,7 +70,8 @@ class Julia(Package): depends_on("binutils", when='+binutils') depends_on("cmake @2.8:") depends_on("curl") - depends_on("git") # I think Julia @0.5: doesn't use git any more + depends_on("git", when='@:0.4') + depends_on("git", when='@release-0.4') depends_on("openssl") depends_on("python @2.7:2.999") @@ -162,7 +165,7 @@ class Julia(Package): # Configure Julia with open(join_path(prefix, "etc", "julia", "juliarc.jl"), "a") as juliarc: - if "@master" in spec or "@release-0.5" in spec: + if "@master" in spec or "@release-0.5" in spec or "@0.5:" in spec: # This is required for versions @0.5: juliarc.write( '# Point package manager to working certificates\n') diff --git a/var/spack/repos/builtin/packages/libemos/package.py b/var/spack/repos/builtin/packages/libemos/package.py new file mode 100644 index 0000000000..0275c7ede9 --- /dev/null +++ b/var/spack/repos/builtin/packages/libemos/package.py @@ -0,0 +1,52 @@ +############################################################################## +# 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 Libemos(Package): + """The Interpolation library (EMOSLIB) includes Interpolation software and + BUFR & CREX encoding/decoding routines.""" + + homepage = "https://software.ecmwf.int/wiki/display/EMOS/Emoslib" + url = "https://software.ecmwf.int/wiki/download/attachments/3473472/libemos-4.4.2-Source.tar.gz" + + version('4.4.2', 'f15a9aff0f40861f3f046c9088197376') + + depends_on('cmake', type='build') + depends_on('grib-api') + + def install(self, spec, prefix): + options = [] + options.extend(std_cmake_args) + + options.append('-DGRIB_API_PATH=%s' % spec['grib_api'].prefix) + + # To support long pathnames that spack generates + options.append('-DCMAKE_Fortran_FLAGS=-ffree-line-length-none') + + with working_dir('spack-build', create=True): + cmake('..', *options) + make() + make('install') diff --git a/var/spack/repos/builtin/packages/libgd/package.py b/var/spack/repos/builtin/packages/libgd/package.py index acfdebb972..6329adf8f3 100644 --- a/var/spack/repos/builtin/packages/libgd/package.py +++ b/var/spack/repos/builtin/packages/libgd/package.py @@ -40,18 +40,33 @@ class Libgd(Package): homepage = "https://github.com/libgd/libgd" url = "https://github.com/libgd/libgd/archive/gd-2.1.1.tar.gz" + version('2.2.3', 'a67bd15fa33d4aac0a1c7904aed19f49') version('2.1.1', 'e91a1a99903e460e7ba00a794e72cc1e') + # Build dependencies + depends_on('autoconf', type='build') + depends_on('automake', type='build') + depends_on('libtool', type='build') + depends_on('m4', type='build') + depends_on('gettext', type='build') + depends_on('pkg-config', type='build') + depends_on('libpng') - depends_on('cmake', type='build') + depends_on('libtiff') + depends_on('fontconfig') def install(self, spec, prefix): - - with working_dir('spack-build', create=True): - cmake('..', - '-DENABLE_JPEG:BOOL=ON', - '-DENABLE_PNG:BOOL=ON', - '-DENABLE_TIFF:BOOL=ON', - *std_cmake_args) - make() - make("install") + autoreconf("--install", "--force", + "-I", "m4", + "-I", join_path(spec['gettext'].prefix, + "share", "aclocal"), + "-I", join_path(spec['pkg-config'].prefix, + "share", "aclocal"), + "-I", join_path(spec['automake'].prefix, + "share", "aclocal"), + "-I", join_path(spec['libtool'].prefix, + "share", "aclocal") + ) + configure('--prefix={0}'.format(prefix)) + make() + make("install") diff --git a/var/spack/repos/builtin/packages/libint/package.py b/var/spack/repos/builtin/packages/libint/package.py new file mode 100644 index 0000000000..2ad5e93191 --- /dev/null +++ b/var/spack/repos/builtin/packages/libint/package.py @@ -0,0 +1,104 @@ +############################################################################## +# 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 Libint(Package): + """Libint is a high-performance library for computing + Gaussian integrals in quantum mechanics.""" + + homepage = "https://github.com/evaleev/libint" + url = "https://github.com/evaleev/libint/archive/v2.1.0.tar.gz" + + version('2.1.0', 'd0dcb985fe32ddebc78fe571ce37e2d6') + version('1.1.6', '990f67b55f49ecc18f32c58da9240684') + version('1.1.5', '379b7d0718ff398715d6898807adf628') + + # Build dependencies + depends_on('autoconf@2.52:', type='build') + depends_on('automake', type='build') + depends_on('libtool', type='build') + + # Libint 2 dependencies + depends_on('boost', when='@2:') + depends_on('gmp', when='@2:') + + def url_for_version(self, version): + base_url = "https://github.com/evaleev/libint/archive" + if version == Version('1.0.0'): + return "{0}/LIBINT_1_00.tar.gz".format(base_url) + elif version < Version('2.1.0'): + return "{0}/release-{1}.tar.gz".format(base_url, version.dashed) + else: + return "{0}/v{1}.tar.gz".format(base_url, version) + + def install(self, spec, prefix): + # Generate configure + libtoolize() + aclocal('-I', 'lib/autoconf') + autoconf() + + config_args = [ + '--prefix={0}'.format(prefix), + '--enable-shared' + ] + + # Optimizations for the Intel compiler, suggested by CP2K + optflags = '-O2' + if self.compiler.name == 'intel': + optflags += ' -xAVX -axCORE-AVX2 -ipo' + if which('xiar'): + env['AR'] = 'xiar' + + env['CFLAGS'] = optflags + env['CXXFLAGS'] = optflags + + # Optimization flag names have changed in libint 2 + if self.version < Version('2.0.0'): + config_args.extend([ + '--with-cc-optflags={0}'.format(optflags), + '--with-cxx-optflags={0}'.format(optflags) + ]) + else: + config_args.extend([ + '--with-cxx-optflags={0}'.format(optflags), + '--with-cxxgen-optflags={0}'.format(optflags) + ]) + + # Options required by CP2K, removed in libint 2 + if self.version < Version('2.0.0'): + config_args.extend([ + '--with-libint-max-am=5', + '--with-libderiv-max-am1=4' + ]) + + configure(*config_args) + make() + + # Testing suite was added in libint 2 + if self.version >= Version('2.0.0'): + make('check') + + make('install') diff --git a/var/spack/repos/builtin/packages/libmesh/package.py b/var/spack/repos/builtin/packages/libmesh/package.py new file mode 100644 index 0000000000..ea81f5da73 --- /dev/null +++ b/var/spack/repos/builtin/packages/libmesh/package.py @@ -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 Libmesh(Package): + """The libMesh library provides a framework for the numerical simulation of + partial differential equations using arbitrary unstructured + discretizations on serial and parallel platforms.""" + + homepage = "http://libmesh.github.io/" + url = "https://github.com/libMesh/libmesh/releases/download/v1.0.0/libmesh-1.0.0.tar.bz2" + + version('1.0.0', 'cb464fc63ea0b71b1e69fa3f5d4f93a4') + + def install(self, spec, prefix): + configure('--prefix={0}'.format(prefix)) + + make() + make('install') diff --git a/var/spack/repos/builtin/packages/libpng/package.py b/var/spack/repos/builtin/packages/libpng/package.py index 1afe4911e6..c3a595d12d 100644 --- a/var/spack/repos/builtin/packages/libpng/package.py +++ b/var/spack/repos/builtin/packages/libpng/package.py @@ -30,6 +30,7 @@ class Libpng(Package): homepage = "http://www.libpng.org/pub/png/libpng.html" url = "http://download.sourceforge.net/libpng/libpng-1.6.16.tar.gz" + version('1.6.24', '65213080dd30a9b16193d9b83adc1ee9') version('1.6.16', '1a4ad377919ab15b54f6cb6a3ae2622d') version('1.6.15', '829a256f3de9307731d4f52dc071916d') version('1.6.14', '2101b3de1d5f348925990f9aa8405660') @@ -37,9 +38,10 @@ class Libpng(Package): version('1.4.19', '89bcbc4fc8b31f4a403906cf4f662330') version('1.2.56', '9508fc59d10a1ffadd9aae35116c19ee') - depends_on('zlib') + depends_on('zlib@1.0.4:') # 1.2.5 or later recommended def install(self, spec, prefix): configure("--prefix=%s" % prefix) make() + make("check") make("install") diff --git a/var/spack/repos/builtin/packages/libquo/package.py b/var/spack/repos/builtin/packages/libquo/package.py new file mode 100644 index 0000000000..8856913bb2 --- /dev/null +++ b/var/spack/repos/builtin/packages/libquo/package.py @@ -0,0 +1,68 @@ +############################################################################## +# 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 Libquo(Package): + """A high-level, easy to use programming interface tailored specifically + for MPI/MPI+X codes that may benefit from evolving process binding + policies during their execution. QUO allows for arbitrary process binding + policies to be enacted and reverted during the execution of an MPI/MPI+X + application as different computational phases are entered and exited, + respectively.""" + + homepage = "https://github.com/losalamos/libquo" + url = "https://github.com/losalamos/libquo/archive/v1.2.9.tar.gz" + + version('1.2.9', 'ca82ab33f13e2b89983f81e7c02e98c2') + + depends_on('mpi') + depends_on('autoconf', type='build') + depends_on('automake', type='build') + depends_on('libtool', type='build') + + def install(self, spec, prefix): + autoreconf_options = [ + '--install', + '--verbose', + '--force', + '-I', 'config', + '-I', os.path.join(spec['automake'].prefix, + 'share', 'aclocal'), + '-I', os.path.join(spec['libtool'].prefix, + 'share', 'aclocal') + ] + autoreconf(*autoreconf_options) + + configure_options = [ + '--prefix={0}'.format(prefix), + 'CC=%s' % join_path(spec['mpi'].prefix.bin, "mpicc"), + 'FC=%s' % join_path(spec['mpi'].prefix.bin, "mpif90") + ] + configure(*configure_options) + + make() + make('install') diff --git a/var/spack/repos/builtin/packages/libuuid/package.py b/var/spack/repos/builtin/packages/libuuid/package.py index 553f0dddb8..b8f6b1cc3a 100644 --- a/var/spack/repos/builtin/packages/libuuid/package.py +++ b/var/spack/repos/builtin/packages/libuuid/package.py @@ -27,7 +27,7 @@ from spack import * class Libuuid(Package): """Portable uuid C library""" - # FIXME: add a proper url for your package's homepage here. + homepage = "http://sourceforge.net/projects/libuuid/" url = "http://downloads.sourceforge.net/project/libuuid/libuuid-1.0.3.tar.gz?r=http%3A%2F%2Fsourceforge.net%2Fprojects%2Flibuuid%2F&ts=1433881396&use_mirror=iweb" @@ -36,6 +36,5 @@ class Libuuid(Package): def install(self, spec, prefix): configure("--prefix=%s" % prefix) - # FIXME: Add logic to build and install here make() make("install") diff --git a/var/spack/repos/builtin/packages/libxc/package.py b/var/spack/repos/builtin/packages/libxc/package.py index 9ea4d1c326..fe82613ce2 100644 --- a/var/spack/repos/builtin/packages/libxc/package.py +++ b/var/spack/repos/builtin/packages/libxc/package.py @@ -32,11 +32,27 @@ class Libxc(Package): homepage = "http://www.tddft.org/programs/octopus/wiki/index.php/Libxc" url = "http://www.tddft.org/programs/octopus/down.php?file=libxc/libxc-2.2.2.tar.gz" + version('3.0.0', '8227fa3053f8fc215bd9d7b0d36de03c') version('2.2.2', 'd9f90a0d6e36df6c1312b6422280f2ec') def install(self, spec, prefix): - configure('--prefix=%s' % prefix, + # Optimizations for the Intel compiler, suggested by CP2K + optflags = '-O2' + if self.compiler.name == 'intel': + optflags += ' -xAVX -axCORE-AVX2 -ipo' + if which('xiar'): + env['AR'] = 'xiar' + + env['CFLAGS'] = optflags + env['FCFLAGS'] = optflags + + configure('--prefix={0}'.format(prefix), '--enable-shared') make() - make("install") + + # libxc provides a testsuite, but many tests fail + # http://www.tddft.org/pipermail/libxc/2013-February/000032.html + # make('check') + + make('install') diff --git a/var/spack/repos/builtin/packages/libxstream/package.py b/var/spack/repos/builtin/packages/libxstream/package.py new file mode 100644 index 0000000000..3201b58620 --- /dev/null +++ b/var/spack/repos/builtin/packages/libxstream/package.py @@ -0,0 +1,50 @@ +############################################################################## +# 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 Libxstream(Package): + '''LIBXSTREAM is a library to work with streams, events, and code regions + that are able to run asynchronous while preserving the usual stream + conditions.''' + + homepage = 'https://github.com/hfp/libxstream' + url = 'https://github.com/hfp/libxstream.git' + + version('0.9.0', git='https://github.com/hfp/libxstream.git') + + def patch(self): + kwargs = {'ignore_absent': False, 'backup': True, 'string': True} + makefile = FileFilter('Makefile.inc') + + makefile.filter('CC =', 'CC ?=', **kwargs) + makefile.filter('CXX =', 'CXX ?=', **kwargs) + makefile.filter('FC =', 'FC ?=', **kwargs) + + def install(self, spec, prefix): + make() + install_tree('lib', prefix.lib) + install_tree('include', prefix.include) + install_tree('documentation', prefix.share + '/libxstream/doc/') diff --git a/var/spack/repos/builtin/packages/llvm/package.py b/var/spack/repos/builtin/packages/llvm/package.py index 61ea8daac4..06572ea312 100644 --- a/var/spack/repos/builtin/packages/llvm/package.py +++ b/var/spack/repos/builtin/packages/llvm/package.py @@ -22,9 +22,10 @@ # 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 +from spack import * + class Llvm(Package): """The LLVM Project is a collection of modular and reusable compiler and @@ -32,11 +33,13 @@ class Llvm(Package): with traditional virtual machines, though it does provide helpful libraries that can be used to build them. The name "LLVM" itself is not an acronym; it is the full name of the project. - """ + homepage = 'http://llvm.org/' url = 'http://llvm.org/releases/3.7.1/llvm-3.7.1.src.tar.xz' + family = 'compiler' # Used by lmod + # currently required by mesa package version('3.0', 'a8e5f5f1c1adebae7b4a654c376a6005', url='http://llvm.org/releases/3.0/llvm-3.0.tar.gz') @@ -111,7 +114,7 @@ class Llvm(Package): 'destination': 'projects', 'placement': 'libcxxabi', }, - 'clang': { + 'cfe': { 'url': base_url % {'pkg': 'cfe'}, 'destination': 'tools', 'placement': 'clang', @@ -141,63 +144,93 @@ class Llvm(Package): { 'version': 'trunk', 'repo': 'http://llvm.org/svn/llvm-project/llvm/trunk', - 'resources': { - 'compiler-rt': 'http://llvm.org/svn/llvm-project/compiler-rt/trunk', - 'openmp': 'http://llvm.org/svn/llvm-project/openmp/trunk', - 'polly': 'http://llvm.org/svn/llvm-project/polly/trunk', - 'libcxx': 'http://llvm.org/svn/llvm-project/libcxx/trunk', - 'libcxxabi': 'http://llvm.org/svn/llvm-project/libcxxabi/trunk', - 'clang': 'http://llvm.org/svn/llvm-project/cfe/trunk', - 'clang-tools-extra': 'http://llvm.org/svn/llvm-project/clang-tools-extra/trunk', - 'lldb': 'http://llvm.org/svn/llvm-project/lldb/trunk', - 'llvm-libunwind': 'http://llvm.org/svn/llvm-project/libunwind/trunk', - } - }, - { - 'version': '3.8.0', - 'md5': '07a7a74f3c6bd65de4702bf941b511a0', - 'resources': { - 'compiler-rt': 'd6fcbe14352ffb708e4d1ac2e48bb025', - 'openmp': '8fd7cc35d48051613cf1e750e9f22e40', - 'polly': '1b3b20f52d34a4024e21a4ea7112caa7', - 'libcxx': 'd6e0bdbbee39f7907ad74fd56d03b88a', - 'libcxxabi': 'bbe6b4d72c7c5978550d370af529bcf7', - 'clang': 'cc99e7019bb74e6459e80863606250c5', - 'clang-tools-extra': 'c2344f50e0eea0b402f0092a80ddc036', - 'lldb': 'a5da35ed9cc8c8817ee854e3dbfba00e', - 'llvm-libunwind': '162ade468607f153cca12be90b5194fa', - } - }, - { - 'version': '3.7.1', - 'md5': 'bf8b3a2c79e61212c5409041dfdbd319', - 'resources': { - 'compiler-rt': '1c6975daf30bb3b0473b53c3a1a6ff01', - 'openmp': 'b4ad08cda4e5c22e42b66062b140438e', - 'polly': '3a2a7367002740881637f4d47bca4dc3', - 'libcxx': 'f9c43fa552a10e14ff53b94d04bea140', - 'libcxxabi': '52d925afac9f97e9dcac90745255c169', - 'clang': '0acd026b5529164197563d135a8fd83e', - 'clang-tools-extra': '5d49ff745037f061a7c86aeb6a24c3d2', - 'lldb': 'a106d8a0d21fc84d76953822fbaf3398', - 'llvm-libunwind': '814bd52c9247c5d04629658fbcb3ab8c', - } - }, - { - 'version': '3.7.0', - 'md5': 'b98b9495e5655a672d6cb83e1a180f8e', 'resources': { - 'compiler-rt': '383c10affd513026f08936b5525523f5', - 'openmp': 'f482c86fdead50ba246a1a2b0bbf206f', - 'polly': '32f93ffc9cc7e042df22089761558f8b', - 'libcxx': '46aa5175cbe1ad42d6e9c995968e56dd', - 'libcxxabi': '5aa769e2fca79fa5335cfae8f6258772', - 'clang': '8f9d27335e7331cf0a4711e952f21f01', - 'clang-tools-extra': 'd5a87dacb65d981a427a536f6964642e', - 'lldb': 'e5931740400d1dc3e7db4c7ba2ceff68', - 'llvm-libunwind': '9a75392eb7eb8ed5c0840007e212baf5', - } - }, + 'compiler-rt': 'http://llvm.org/svn/llvm-project/compiler-rt/trunk', + 'openmp': 'http://llvm.org/svn/llvm-project/openmp/trunk', + 'polly': 'http://llvm.org/svn/llvm-project/polly/trunk', + 'libcxx': 'http://llvm.org/svn/llvm-project/libcxx/trunk', + 'libcxxabi': 'http://llvm.org/svn/llvm-project/libcxxabi/trunk', + 'cfe': 'http://llvm.org/svn/llvm-project/cfe/trunk', + 'clang-tools-extra': 'http://llvm.org/svn/llvm-project/clang-tools-extra/trunk', + 'lldb': 'http://llvm.org/svn/llvm-project/lldb/trunk', + 'llvm-libunwind': 'http://llvm.org/svn/llvm-project/libunwind/trunk', + } + }, + { + 'version': '3.9.0', + 'md5': 'f2093e98060532449eb7d2fcfd0bc6c6', + 'resources': { + 'compiler-rt': 'b7ea34c9d744da16ffc0217b6990d095', + 'openmp': '5390164f2374e1444e82393541ecf6c7', + 'polly': '1cf328cbae25267749b68cfa6f113674', + 'libcxx': '0a11efefd864ce6f321194e441f7e569', + 'libcxxabi': 'd02642308e22e614af6b061b9b4fedfa', + 'cfe': '29e1d86bee422ab5345f5e9fb808d2dc', + 'clang-tools-extra': 'f4f663068c77fc742113211841e94d5e', + 'lldb': '968d053c3c3d7297983589164c6999e9', + 'llvm-libunwind': '3e5c87c723a456be599727a444b1c166', + } + }, + { + 'version': '3.8.1', + 'md5': '538467e6028bbc9259b1e6e015d25845', + 'resources': { + 'compiler-rt': 'f140db073d2453f854fbe01cc46f3110', + 'openmp': '078b8d4c51ad437a4f8b5989f5ec4156', + 'polly': '8a40e697a4ba1c8b640b85d074bd6e25', + 'libcxx': '1bc60150302ff76a0d79d6f9db22332e', + 'libcxxabi': '3c63b03ba2f30a01279ca63384a67773', + 'cfe': '4ff2f8844a786edb0220f490f7896080', + 'clang-tools-extra': '6e49f285d0b366cc3cab782d8c92d382', + 'lldb': '9e4787b71be8e432fffd31e13ac87623', + 'llvm-libunwind': 'd66e2387e1d37a8a0c8fe6a0063a3bab', + } + }, + { + 'version': '3.8.0', + 'md5': '07a7a74f3c6bd65de4702bf941b511a0', + 'resources': { + 'compiler-rt': 'd6fcbe14352ffb708e4d1ac2e48bb025', + 'openmp': '8fd7cc35d48051613cf1e750e9f22e40', + 'polly': '1b3b20f52d34a4024e21a4ea7112caa7', + 'libcxx': 'd6e0bdbbee39f7907ad74fd56d03b88a', + 'libcxxabi': 'bbe6b4d72c7c5978550d370af529bcf7', + 'cfe': 'cc99e7019bb74e6459e80863606250c5', + 'clang-tools-extra': 'c2344f50e0eea0b402f0092a80ddc036', + 'lldb': 'a5da35ed9cc8c8817ee854e3dbfba00e', + 'llvm-libunwind': '162ade468607f153cca12be90b5194fa', + } + }, + { + 'version': '3.7.1', + 'md5': 'bf8b3a2c79e61212c5409041dfdbd319', + 'resources': { + 'compiler-rt': '1c6975daf30bb3b0473b53c3a1a6ff01', + 'openmp': 'b4ad08cda4e5c22e42b66062b140438e', + 'polly': '3a2a7367002740881637f4d47bca4dc3', + 'libcxx': 'f9c43fa552a10e14ff53b94d04bea140', + 'libcxxabi': '52d925afac9f97e9dcac90745255c169', + 'cfe': '0acd026b5529164197563d135a8fd83e', + 'clang-tools-extra': '5d49ff745037f061a7c86aeb6a24c3d2', + 'lldb': 'a106d8a0d21fc84d76953822fbaf3398', + 'llvm-libunwind': '814bd52c9247c5d04629658fbcb3ab8c', + } + }, + { + 'version': '3.7.0', + 'md5': 'b98b9495e5655a672d6cb83e1a180f8e', + 'resources': { + 'compiler-rt': '383c10affd513026f08936b5525523f5', + 'openmp': 'f482c86fdead50ba246a1a2b0bbf206f', + 'polly': '32f93ffc9cc7e042df22089761558f8b', + 'libcxx': '46aa5175cbe1ad42d6e9c995968e56dd', + 'libcxxabi': '5aa769e2fca79fa5335cfae8f6258772', + 'cfe': '8f9d27335e7331cf0a4711e952f21f01', + 'clang-tools-extra': 'd5a87dacb65d981a427a536f6964642e', + 'lldb': 'e5931740400d1dc3e7db4c7ba2ceff68', + 'llvm-libunwind': '9a75392eb7eb8ed5c0840007e212baf5', + } + }, { 'version': '3.6.2', 'md5': '0c1ee3597d75280dee603bae9cbf5cc2', @@ -206,7 +239,7 @@ class Llvm(Package): 'openmp': '65dd5863b9b270960a96817e9152b123', 'libcxx': '22214c90697636ef960a49aef7c1823a', 'libcxxabi': '17518e361e4e228f193dd91e8ef54ba2', - 'clang': 'ff862793682f714bb7862325b9c06e20', + 'cfe': 'ff862793682f714bb7862325b9c06e20', 'clang-tools-extra': '3ebc1dc41659fcec3db1b47d81575e06', 'lldb': '51e5eb552f777b950bb0ff326e60d5f0', } @@ -219,7 +252,7 @@ class Llvm(Package): 'openmp': '121ddb10167d7fc38b1f7e4b029cf059', 'libcxx': '406f09b1dab529f3f7879f4d548329d2', 'libcxxabi': 'b22c707e8d474a99865ad3c521c3d464', - 'clang': '93f9532f8f7e6f1d8e5c1116907051cb', + 'cfe': '93f9532f8f7e6f1d8e5c1116907051cb', 'clang-tools-extra': 'f13f31ed3038acadc6fa63fef812a246', 'lldb': 'cc5ea8a414c62c33e760517f8929a204', } diff --git a/var/spack/repos/builtin/packages/lulesh/package.py b/var/spack/repos/builtin/packages/lulesh/package.py new file mode 100644 index 0000000000..e880d4fa14 --- /dev/null +++ b/var/spack/repos/builtin/packages/lulesh/package.py @@ -0,0 +1,55 @@ +############################################################################## +# 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 Lulesh(Package): + """Livermore Unstructured Lagrangian Explicit Shock Hydrodynamics (LULESH) + """ + + homepage = "https://codesign.llnl.gov/lulesh.php" + url = "https://codesign.llnl.gov/lulesh/lulesh2.0.3.tgz" + + version("2.0.3", "336644a8750f71c7c6b9d2960976e7aa") + + patch("remove_defaults.patch") + + variant('mpip', default=False) + + depends_on("mpi", type="build") + depends_on("mpip", when="+mpip") + + def install(self, spec, prefix): + if '+mpip' in spec: + os.environ["LDFLAGS"] = " -lmpiP -ldwarf -lelf" + + if os.uname()[4] == "x86_64": + os.environ["LDFLAGS"] += " -lunwind" + + os.environ["CXX"] = spec['mpi'].mpicxx + " -DUSE_MPI=1" + os.environ["PREFIX"] = prefix + make() + make("install") diff --git a/var/spack/repos/builtin/packages/lulesh/remove_defaults.patch b/var/spack/repos/builtin/packages/lulesh/remove_defaults.patch new file mode 100644 index 0000000000..36cce25ba1 --- /dev/null +++ b/var/spack/repos/builtin/packages/lulesh/remove_defaults.patch @@ -0,0 +1,60 @@ +--- a/Makefile ++++ b/Makefile +@@ -1,17 +1,9 @@ + #default build suggestion of MPI + OPENMP with gcc on Livermore machines you might have to change the compiler name + +-SHELL = /bin/sh + .SUFFIXES: .cc .o + + LULESH_EXEC = lulesh2.0 + +-MPI_INC = /opt/local/include/openmpi +-MPI_LIB = /opt/local/lib +- +-SERCXX = g++ -DUSE_MPI=0 +-MPICXX = mpig++ -DUSE_MPI=1 +-CXX = $(MPICXX) +- + SOURCES2.0 = \ + lulesh.cc \ + lulesh-comm.cc \ +@@ -20,28 +12,6 @@ + lulesh-init.cc + OBJECTS2.0 = $(SOURCES2.0:.cc=.o) + +-#Default build suggestions with OpenMP for g++ +-CXXFLAGS = -g -O3 -fopenmp -I. -Wall +-LDFLAGS = -g -O3 -fopenmp +- +-#Below are reasonable default flags for a serial build +-#CXXFLAGS = -g -O3 -I. -Wall +-#LDFLAGS = -g -O3 +- +-#common places you might find silo on the Livermore machines. +-#SILO_INCDIR = /opt/local/include +-#SILO_LIBDIR = /opt/local/lib +-#SILO_INCDIR = ./silo/4.9/1.8.10.1/include +-#SILO_LIBDIR = ./silo/4.9/1.8.10.1/lib +- +-#If you do not have silo and visit you can get them at: +-#silo: https://wci.llnl.gov/codes/silo/downloads.html +-#visit: https://wci.llnl.gov/codes/visit/download.html +- +-#below is and example of how to make with silo, hdf5 to get vizulization by default all this is turned off. All paths are Livermore specific. +-#CXXFLAGS = -g -DVIZ_MESH -I${SILO_INCDIR} -Wall -Wno-pragmas +-#LDFLAGS = -g -L${SILO_LIBDIR} -Wl,-rpath -Wl,${SILO_LIBDIR} -lsiloh5 -lhdf5 +- + .cc.o: lulesh.h + @echo "Building $<" + $(CXX) -c $(CXXFLAGS) -o $@ $< +@@ -56,6 +26,7 @@ + /bin/rm -f *.o *~ $(OBJECTS) $(LULESH_EXEC) + /bin/rm -rf *.dSYM + +-tar: clean +- cd .. ; tar cvf lulesh-2.0.tar LULESH-2.0 ; mv lulesh-2.0.tar LULESH-2.0 +- ++install: lulesh2.0 ++ @echo "Installing" ++ mkdir -p $(PREFIX)/bin ++ install --mode=755 lulesh2.0 $(PREFIX)/bin/ diff --git a/var/spack/repos/builtin/packages/m4/package.py b/var/spack/repos/builtin/packages/m4/package.py index b3bb5e61ce..f7150727fe 100644 --- a/var/spack/repos/builtin/packages/m4/package.py +++ b/var/spack/repos/builtin/packages/m4/package.py @@ -23,6 +23,7 @@ # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## from spack import * +import sys class M4(Package): @@ -47,6 +48,11 @@ class M4(Package): else: configure_args.append('--without-libsigsegv-prefix') + # http://lists.gnu.org/archive/html/bug-m4/2016-09/msg00002.html + if (sys.platform == "darwin") and (spec.satisfies('%gcc')) and \ + (spec.architecture.platform_os.version == "10.12"): + configure_args.append('ac_cv_type_struct_sched_param=yes') + configure("--prefix=%s" % prefix, *configure_args) make() make("install") diff --git a/var/spack/repos/builtin/packages/magics/no_hardcoded_python.patch b/var/spack/repos/builtin/packages/magics/no_hardcoded_python.patch new file mode 100644 index 0000000000..e2e2a5d1ba --- /dev/null +++ b/var/spack/repos/builtin/packages/magics/no_hardcoded_python.patch @@ -0,0 +1,5 @@ +--- a/tools/xml2mv.py 2016-06-27 17:49:27.000000000 +0200 ++++ a/tools/xml2mv.py 2016-09-13 16:25:17.246960456 +0200 +@@ -1 +1 @@ +-#!/usr/bin/python ++#!/usr/bin/env python diff --git a/var/spack/repos/builtin/packages/magics/package.py b/var/spack/repos/builtin/packages/magics/package.py new file mode 100644 index 0000000000..cd793ae051 --- /dev/null +++ b/var/spack/repos/builtin/packages/magics/package.py @@ -0,0 +1,115 @@ +############################################################################## +# 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 Magics(Package): + """Magics is the latest generation of the ECMWF's Meteorological plotting + software MAGICS. Although completely redesigned in C++, it is intended + to be as backwards-compatible as possible with the Fortran interface.""" + + homepage = "https://software.ecmwf.int/wiki/display/MAGP/Magics" + url = "https://software.ecmwf.int/wiki/download/attachments/3473464/Magics-2.29.0-Source.tar.gz" + + # Maintainers of Magics do not keep tarballs of minor releases. Once the + # next minor released is published the previous one becomes unavailable. + # That is why the preferred version is the latest stable one. + version('2.29.4', '91c561f413316fb665b3bb563f3878d1') + version('2.29.0', 'db20a4d3c51a2da5657c31ae3de59709', preferred=True) + + # The patch changes the hardcoded path to python in shebang to enable the + # usage of the first python installation that appears in $PATH + patch('no_hardcoded_python.patch') + + # The patch reorders includes and adds namespaces where necessary to + # resolve ambiguity of invocations of isnan and isinf functions. The + # patch is not needed since the version 2.29.1 + patch('resolve_isnan_ambiguity.patch', when='@2.29.0') + + variant('bufr', default=False, description='Enable BUFR support') + variant('netcdf', default=False, description='Enable NetCDF support') + variant('cairo', default=True, description='Enable cairo support[png/jpeg]') + variant('metview', default=False, description='Enable metview support') + variant('qt', default=False, description='Enable metview support with qt') + + depends_on('cmake', type='build') + depends_on('pkg-config', type='build') + + # Currently python is only necessary to run + # building preprocessing scripts. + depends_on('python', type='build') + depends_on('grib-api') + depends_on('proj') + depends_on('boost') + depends_on('expat') + depends_on('pango', when='+cairo') + depends_on('netcdf-cxx', when='+netcdf') + depends_on('libemos', when='+bufr') + depends_on('qt', when='+metview+qt') + + def install(self, spec, prefix): + options = [] + options.extend(std_cmake_args) + options.append('-DENABLE_ODB=OFF') + options.append('-DENABLE_PYTHON=OFF') + options.append('-DBOOST_ROOT=%s' % spec['boost'].prefix) + options.append('-DPROJ4_PATH=%s' % spec['proj'].prefix) + options.append('-DGRIB_API_PATH=%s' % spec['grib-api'].prefix) + options.append('-DENABLE_TESTS=OFF') + + if '+bufr' in spec: + options.append('-DENABLE_BUFR=ON') + options.append('-DLIBEMOS_PATH=%s' % spec['libemos'].prefix) + else: + options.append('-DENABLE_BUFR=OFF') + + if '+netcdf' in spec: + options.append('-DENABLE_NETCDF=ON') + options.append('-DNETCDF_PATH=%s' % spec['netcdf-cxx'].prefix) + else: + options.append('-DENABLE_NETCDF=OFF') + + if '+cairo' in spec: + options.append('-DENABLE_CAIRO=ON') + else: + options.append('-DENABLE_CAIRO=OFF') + + if '+metview' in spec: + if '+qt' in spec: + options.append('-DENABLE_METVIEW=ON') + if spec['qt'].version.up_to(1) == '5': + options.append('-DENABLE_QT5=ON') + else: + options.append('-DENABLE_METVIEW_NO_QT=ON') + else: + options.append('-DENABLE_METVIEW=OFF') + + if (self.compiler.f77 is None) or (self.compiler.fc is None): + options.append('-DENABLE_FORTRAN=OFF') + + with working_dir('spack-build', create=True): + cmake('..', *options) + make() + make('install') diff --git a/var/spack/repos/builtin/packages/magics/resolve_isnan_ambiguity.patch b/var/spack/repos/builtin/packages/magics/resolve_isnan_ambiguity.patch new file mode 100644 index 0000000000..54b96ae88e --- /dev/null +++ b/var/spack/repos/builtin/packages/magics/resolve_isnan_ambiguity.patch @@ -0,0 +1,73 @@ +--- a/src/common/Polyline.cc 2016-04-28 14:38:09.000000000 +0200 ++++ b/src/common/Polyline.cc 2016-09-14 13:31:35.784617803 +0200 +@@ -31,2 +30,0 @@ +-#include "TeCoord2D.h" +-#include "TeGeometryAlgorithms.h" +--- a/src/decoders/GribRegularInterpretor.cc 2016-04-28 14:38:09.000000000 +0200 ++++ b/src/decoders/GribRegularInterpretor.cc 2016-09-14 13:43:41.673614590 +0200 +@@ -2083,2 +2083,2 @@ +- if (isnan(val1)) { +- if (isnan(val2)) { ++ if (std::isnan(val1)) { ++ if (std::isnan(val2)) { +@@ -2090 +2090 @@ +- if (isnan(val2)) { ++ if (std::isnan(val2)) { +@@ -2101 +2101 @@ +- if (isnan(val) || isinf(val) || isinf(-val)) { ++ if (std::isnan(val) || std::isinf(val) || std::isinf(-val)) { +@@ -2105 +2105 @@ +- if (isnan(val)) ++ if (std::isnan(val)) +--- a/src/decoders/GribSatelliteInterpretor.cc 2016-04-28 14:38:09.000000000 +0200 ++++ b/src/decoders/GribSatelliteInterpretor.cc 2016-09-14 13:48:55.243699910 +0200 +@@ -33,5 +32,0 @@ +-#include "TeProjection.h" +-#include "TeDataTypes.h" +-#include "TeRasterParams.h" +-#include "TeDecoderMemory.h" +-#include "TeRasterRemap.h" +--- a/src/decoders/NetcdfGeoMatrixInterpretor.cc 2016-04-28 14:38:09.000000000 +0200 ++++ b/src/decoders/NetcdfGeoMatrixInterpretor.cc 2016-09-14 13:52:37.481201085 +0200 +@@ -93 +93 @@ +- if ( !isnan(*d) ) { ++ if ( !std::isnan(*d) ) { +--- a/src/decoders/NetcdfOrcaInterpretor.cc 2016-04-28 14:38:09.000000000 +0200 ++++ b/src/decoders/NetcdfOrcaInterpretor.cc 2016-09-14 13:51:16.248650570 +0200 +@@ -210,2 +210,2 @@ +- if ( isnan(val1) ) { +- if ( isnan(val2) ) { ++ if ( std::isnan(val1) ) { ++ if ( std::isnan(val2) ) { +@@ -218 +218 @@ +- if ( isnan(val2) ) { ++ if ( std::isnan(val2) ) { +@@ -226 +226 @@ +- if (isnan(val) || isinf(val) || isinf(-val) ) { ++ if (std::isnan(val) || std::isinf(val) || std::isinf(-val) ) { +@@ -230 +230 @@ +- if (isnan(val) ) val = missing; ++ if (std::isnan(val) ) val = missing; +@@ -296 +296 @@ +- if (isnan(value) ) ++ if (std::isnan(value) ) +--- a/src/terralib/kernel/TeCentroid.cpp 2016-04-28 14:38:09.000000000 +0200 ++++ b/src/terralib/kernel/TeCentroid.cpp 2016-09-14 14:17:31.675996554 +0200 +@@ -23,0 +24,2 @@ ++#include "TeGeometryAlgorithms.h" ++ +@@ -30 +31,0 @@ +-#include "TeGeometryAlgorithms.h" +--- a/src/terralib/kernel/TeDatabase.h 2014-11-07 17:39:24.000000000 +0100 ++++ b/src/terralib/kernel/TeDatabase.h 2016-09-14 14:20:01.041100590 +0200 +@@ -33,0 +34 @@ ++#include "TeGeometry.h" +@@ -38 +38,0 @@ +-#include "TeGeometry.h" +--- a/src/terralib/kernel/TeOverlayUtils.h 2014-11-07 17:39:24.000000000 +0100 ++++ b/src/terralib/kernel/TeOverlayUtils.h 2016-09-14 14:21:51.649920405 +0200 +@@ -37,0 +38,2 @@ ++#include "TeGeometry.h"
++
+@@ -44 +45,0 @@ +-#include "TeGeometry.h"
diff --git a/var/spack/repos/builtin/packages/mbedtls/package.py b/var/spack/repos/builtin/packages/mbedtls/package.py index e1a42c0d9a..493ea59f0b 100644 --- a/var/spack/repos/builtin/packages/mbedtls/package.py +++ b/var/spack/repos/builtin/packages/mbedtls/package.py @@ -35,6 +35,7 @@ class Mbedtls(Package): homepage = "https://tls.mbed.org" url = "https://github.com/ARMmbed/mbedtls/archive/mbedtls-2.2.1.tar.gz" + version('2.3.0', '98158e1160a0825a3e8db38881a177a0') version('2.2.1', '73a38f96898d6d03e32f55dd9f9a67be') version('2.2.0', 'eaf4586c1ef93ae872e606b6c1203942') version('2.1.4', '40cdf67b6c6d92c9cbcfd552d39ea3ae') diff --git a/var/spack/repos/builtin/packages/mercurial/package.py b/var/spack/repos/builtin/packages/mercurial/package.py index e51069662f..ea77953f15 100644 --- a/var/spack/repos/builtin/packages/mercurial/package.py +++ b/var/spack/repos/builtin/packages/mercurial/package.py @@ -22,23 +22,48 @@ # 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 llnl.util.tty as tty +import os class Mercurial(Package): """Mercurial is a free, distributed source control management tool.""" + homepage = "https://www.mercurial-scm.org" url = "https://www.mercurial-scm.org/release/mercurial-3.9.tar.gz" - version('3.9' , 'e2b355da744e94747daae3a5339d28a0') + version('3.9.1', '3759dd10edb8c1a6dfb8ff0ce82658ce') + version('3.9', 'e2b355da744e94747daae3a5339d28a0') version('3.8.4', 'cec2c3db688cb87142809089c6ae13e9') version('3.8.3', '97aced7018614eeccc9621a3dea35fda') version('3.8.2', 'c38daa0cbe264fc621dc3bb05933b0b3') version('3.8.1', '172a8c588adca12308c2aca16608d7f4') - depends_on("python @2.6:2.7.999") - depends_on("py-docutils", type="build") + extends('python') + depends_on('python@2.6:2.8') + depends_on('py-docutils', type='build') def install(self, spec, prefix): - make('PREFIX=%s' % prefix, 'install') + make('install', 'PREFIX={0}'.format(prefix)) + + # Configuration of HTTPS certificate authorities + # https://www.mercurial-scm.org/wiki/CACertificates + hgrc_filename = join_path(prefix.etc, 'mercurial', 'hgrc') + mkdirp(os.path.dirname(hgrc_filename)) + + with open(hgrc_filename, 'w') as hgrc: + if os.path.exists('/etc/ssl/certs/ca-certificates.crt'): + # Debian/Ubuntu/Gentoo/Arch Linux + hgrc.write('[web]\ncacerts = /etc/ssl/certs/ca-certificates.crt') # noqa + elif os.path.exists('/etc/pki/tls/certs/ca-bundle.crt'): + # Fedora/RHEL/CentOS + hgrc.write('[web]\ncacerts = /etc/pki/tls/certs/ca-bundle.crt') + elif os.path.exists('/etc/ssl/ca-bundle.pem'): + # openSUSE/SLE + hgrc.write('[web]\ncacerts = /etc/ssl/ca-bundle.pem') + else: + tty.warn('CA certificate not found. You may not be able to ' + 'connect to an HTTPS server. If your CA certificate ' + 'is in a non-standard location, you should add it to ' + '{0}'.format(hgrc_filename)) diff --git a/var/spack/repos/builtin/packages/metis/package.py b/var/spack/repos/builtin/packages/metis/package.py index 9f8ed5c9e8..ca48a47817 100644 --- a/var/spack/repos/builtin/packages/metis/package.py +++ b/var/spack/repos/builtin/packages/metis/package.py @@ -43,16 +43,12 @@ class Metis(Package): version('5.0.2', 'acb521a4e8c2e6dd559a7f9abd0468c5') version('4.0.3', 'd3848b454532ef18dc83e4fb160d1e10') - variant('shared', default=True, - description='Enables the build of shared libraries') - variant('debug', default=False, - description='Builds the library in debug mode') - variant('gdb', default=False, description='Enables gdb support') + variant('shared', default=True, description='Enables the build of shared libraries.') + variant('debug', default=False, description='Builds the library in debug mode.') + variant('gdb', default=False, description='Enables gdb support.') - variant('idx64', default=False, - description='Use int64_t as default index type') - variant('real64', default=False, - description='Use double precision floating point types') + variant('idx64', default=False, description='Sets the bit width of METIS\'s index type to 64.') + variant('real64', default=False, description='Sets the bit width of METIS\'s real type to 64.') depends_on('cmake@2.8:', when='@5:', type='build') @@ -63,12 +59,37 @@ class Metis(Package): return '%s/%smetis-%s.tar.gz' % (Metis.base_url, verdir, version) @when('@:4') + def patch(self): + pass + + @when('@5:') + def patch(self): + source_path = self.stage.source_path + metis_header = FileFilter(join_path(source_path, 'include', 'metis.h')) + + metis_header.filter( + r'(\b)(IDXTYPEWIDTH )(\d+)(\b)', + r'\1\2{0}\4'.format('64' if '+idx64' in self.spec else '32'), + ) + metis_header.filter( + r'(\b)(REALTYPEWIDTH )(\d+)(\b)', + r'\1\2{0}\4'.format('64' if '+real64' in self.spec else '32'), + ) + + # Make clang 7.3 happy. + # Prevents "ld: section __DATA/__thread_bss extends beyond end of file" + # See upstream LLVM issue https://llvm.org/bugs/show_bug.cgi?id=27059 + # and https://github.com/Homebrew/homebrew-science/blob/master/metis.rb + if self.spec.satisfies('%clang@7.3.0'): + filter_file('#define MAX_JBUFS 128', '#define MAX_JBUFS 24', + join_path(source_path, 'GKlib', 'error.c')) + + @when('@:4') def install(self, spec, prefix): # Process library spec and options - unsupp_vars = [v for v in ('+gdb', '+idx64', '+real64') if v in spec] - if unsupp_vars: - msg = 'Given variants %s are unsupported by METIS 4!' % unsupp_vars - raise InstallError(msg) + if any('+{0}'.format(v) in spec for v in ['gdb', 'idx64', 'real64']): + raise InstallError('METIS@:4 does not support the following ' + 'variants: gdb, idx64, real64.') options = ['COPTIONS=-fPIC'] if '+debug' in spec: @@ -118,49 +139,48 @@ class Metis(Package): join_path('Programs', 'io.o'), join_path('Test', 'mtest.c'), '-o', '%s/mtest' % prefix.bin, '-lmetis', '-lm') - test_bin = lambda testname: join_path(prefix.bin, testname) - test_graph = lambda graphname: join_path(prefix.share, graphname) - - graph = test_graph('4elt.graph') - os.system('%s %s' % (test_bin('mtest'), graph)) - os.system('%s %s 40' % (test_bin('kmetis'), graph)) - os.system('%s %s' % (test_bin('onmetis'), graph)) - graph = test_graph('test.mgraph') - os.system('%s %s 2' % (test_bin('pmetis'), graph)) - os.system('%s %s 2' % (test_bin('kmetis'), graph)) - os.system('%s %s 5' % (test_bin('kmetis'), graph)) - graph = test_graph('metis.mesh') - os.system('%s %s 10' % (test_bin('partnmesh'), graph)) - os.system('%s %s 10' % (test_bin('partdmesh'), graph)) - os.system('%s %s' % (test_bin('mesh2dual'), graph)) - - # FIXME: The following code should replace the testing code in the - # block above since it causes installs to fail when one or more of the - # Metis tests fail, but it currently doesn't work because the 'mtest', - # 'onmetis', and 'partnmesh' tests return error codes that trigger - # false positives for failure. - """ - Executable(test_bin('mtest'))(test_graph('4elt.graph')) - Executable(test_bin('kmetis'))(test_graph('4elt.graph'), '40') - Executable(test_bin('onmetis'))(test_graph('4elt.graph')) - - Executable(test_bin('pmetis'))(test_graph('test.mgraph'), '2') - Executable(test_bin('kmetis'))(test_graph('test.mgraph'), '2') - Executable(test_bin('kmetis'))(test_graph('test.mgraph'), '5') - - Executable(test_bin('partnmesh'))(test_graph('metis.mesh'), '10') - Executable(test_bin('partdmesh'))(test_graph('metis.mesh'), '10') - Executable(test_bin('mesh2dual'))(test_graph('metis.mesh')) - """ + if self.run_tests: + test_bin = lambda testname: join_path(prefix.bin, testname) + test_graph = lambda graphname: join_path(prefix.share, graphname) + + graph = test_graph('4elt.graph') + os.system('%s %s' % (test_bin('mtest'), graph)) + os.system('%s %s 40' % (test_bin('kmetis'), graph)) + os.system('%s %s' % (test_bin('onmetis'), graph)) + graph = test_graph('test.mgraph') + os.system('%s %s 2' % (test_bin('pmetis'), graph)) + os.system('%s %s 2' % (test_bin('kmetis'), graph)) + os.system('%s %s 5' % (test_bin('kmetis'), graph)) + graph = test_graph('metis.mesh') + os.system('%s %s 10' % (test_bin('partnmesh'), graph)) + os.system('%s %s 10' % (test_bin('partdmesh'), graph)) + os.system('%s %s' % (test_bin('mesh2dual'), graph)) + + # FIXME: The following code should replace the testing code in the + # block above since it causes installs to fail when one or more of + # the Metis tests fail, but it currently doesn't work because the + # 'mtest', 'onmetis', and 'partnmesh' tests return error codes that + # trigger false positives for failure. + """ + Executable(test_bin('mtest'))(test_graph('4elt.graph')) + Executable(test_bin('kmetis'))(test_graph('4elt.graph'), '40') + Executable(test_bin('onmetis'))(test_graph('4elt.graph')) + + Executable(test_bin('pmetis'))(test_graph('test.mgraph'), '2') + Executable(test_bin('kmetis'))(test_graph('test.mgraph'), '2') + Executable(test_bin('kmetis'))(test_graph('test.mgraph'), '5') + + Executable(test_bin('partnmesh'))(test_graph('metis.mesh'), '10') + Executable(test_bin('partdmesh'))(test_graph('metis.mesh'), '10') + Executable(test_bin('mesh2dual'))(test_graph('metis.mesh')) + """ @when('@5:') def install(self, spec, prefix): - options = [] - options.extend(std_cmake_args) - - build_directory = join_path(self.stage.path, 'spack-build') source_directory = self.stage.source_path + build_directory = join_path(source_directory, 'build') + options = std_cmake_args[:] options.append('-DGKLIB_PATH:PATH=%s/GKlib' % source_directory) options.append('-DCMAKE_INSTALL_NAME_DIR:PATH=%s/lib' % prefix) @@ -172,26 +192,24 @@ class Metis(Package): if '+gdb' in spec: options.append('-DGDB:BOOL=ON') - metis_header = join_path(source_directory, 'include', 'metis.h') - if '+idx64' in spec: - filter_file('IDXTYPEWIDTH 32', 'IDXTYPEWIDTH 64', metis_header) - if '+real64' in spec: - filter_file('REALTYPEWIDTH 32', 'REALTYPEWIDTH 64', metis_header) - - # Make clang 7.3 happy. - # Prevents "ld: section __DATA/__thread_bss extends beyond end of file" - # See upstream LLVM issue https://llvm.org/bugs/show_bug.cgi?id=27059 - # and https://github.com/Homebrew/homebrew-science/blob/master/metis.rb - if spec.satisfies('%clang@7.3.0'): - filter_file('#define MAX_JBUFS 128', '#define MAX_JBUFS 24', - join_path(source_directory, 'GKlib', 'error.c')) - with working_dir(build_directory, create=True): cmake(source_directory, *options) make() make('install') - # now run some tests: + # install GKlib headers, which will be needed for ParMETIS + GKlib_dist = join_path(prefix.include, 'GKlib') + mkdirp(GKlib_dist) + hfiles = glob.glob(join_path(source_directory, 'GKlib', '*.h')) + for hfile in hfiles: + install(hfile, GKlib_dist) + + if self.run_tests: + # FIXME: On some systems, the installed binaries for METIS cannot + # be executed without first being read. + ls = which('ls') + ls('-a', '-l', prefix.bin) + for f in ['4elt', 'copter2', 'mdual']: graph = join_path(source_directory, 'graphs', '%s.graph' % f) Executable(join_path(prefix.bin, 'graphchk'))(graph) @@ -202,10 +220,3 @@ class Metis(Package): Executable(join_path(prefix.bin, 'gpmetis'))(graph, '2') graph = join_path(source_directory, 'graphs', 'metis.mesh') Executable(join_path(prefix.bin, 'mpmetis'))(graph, '2') - - # install GKlib headers, which will be needed for ParMETIS - GKlib_dist = join_path(prefix.include, 'GKlib') - mkdirp(GKlib_dist) - hfiles = glob.glob(join_path(source_directory, 'GKlib', '*.h')) - for hfile in hfiles: - install(hfile, GKlib_dist) diff --git a/var/spack/repos/builtin/packages/mfem/package.py b/var/spack/repos/builtin/packages/mfem/package.py index fd91f705eb..cbf9059f65 100644 --- a/var/spack/repos/builtin/packages/mfem/package.py +++ b/var/spack/repos/builtin/packages/mfem/package.py @@ -89,8 +89,7 @@ class Mfem(Package): options = ['PREFIX=%s' % prefix] if '+lapack' in spec: - lapack_lib = '-L{0} -llapack -L{1} -lblas'.format( - spec['lapack'].prefix.lib, spec['blas'].prefix.lib) + lapack_lib = (spec['lapack'].lapack_libs + spec['blas'].blas_libs).ld_flags # NOQA: ignore=E501 options.extend([ 'MFEM_USE_LAPACK=YES', 'LAPACK_OPT=-I%s' % spec['lapack'].prefix.include, diff --git a/var/spack/repos/builtin/packages/mkl/package.py b/var/spack/repos/builtin/packages/mkl/package.py index 71a233ff3e..8a31858bf5 100644 --- a/var/spack/repos/builtin/packages/mkl/package.py +++ b/var/spack/repos/builtin/packages/mkl/package.py @@ -9,7 +9,7 @@ class Mkl(IntelInstaller): Note: You will have to add the download file to a mirror so that Spack can find it. For instructions on how to set up a - mirror, see http://software.llnl.gov/spack/mirrors.html. + mirror, see http://spack.readthedocs.io/en/latest/mirrors.html. To set the threading layer at run time set MKL_THREADING_LAYER variable to one of the following values: INTEL (default), SEQUENTIAL, PGI. @@ -24,13 +24,41 @@ class Mkl(IntelInstaller): version('11.3.3.210', 'f72546df27f5ebb0941b5d21fd804e34', url="file://%s/l_mkl_11.3.3.210.tgz" % os.getcwd()) + variant('shared', default=True, description='Builds shared library') + variant('ilp64', default=False, description='64 bit integers') + variant('openmp', default=False, description='OpenMP multithreading layer') + # virtual dependency provides('blas') provides('lapack') # TODO: MKL also provides implementation of Scalapack. - def install(self, spec, prefix): + @property + def blas_libs(self): + shared = True if '+shared' in self.spec else False + suffix = dso_suffix if '+shared' in self.spec else 'a' + mkl_integer = ['libmkl_intel_ilp64'] if '+ilp64' in self.spec else ['libmkl_intel_lp64'] # NOQA: ignore=E501 + mkl_threading = ['libmkl_sequential'] + if '+openmp' in self.spec: + mkl_threading = ['libmkl_intel_thread', 'libiomp5'] if '%intel' in self.spec else ['libmkl_gnu_thread'] # NOQA: ignore=E501 + # TODO: TBB threading: ['libmkl_tbb_thread', 'libtbb', 'libstdc++'] + mkl_libs = find_libraries( + mkl_integer + ['libmkl_core'] + mkl_threading, + root=join_path(self.prefix.lib, 'intel64'), + shared=shared + ) + system_libs = [ + 'libpthread.{0}'.format(suffix), + 'libm.{0}'.format(suffix), + 'libdl.{0}'.format(suffix) + ] + return mkl_libs + system_libs + + @property + def lapack_libs(self): + return self.blas_libs + def install(self, spec, prefix): self.intel_prefix = os.path.join(prefix, "pkg") IntelInstaller.install(self, spec, prefix) @@ -45,25 +73,6 @@ class Mkl(IntelInstaller): os.symlink(os.path.join(mkl_lib_dir, f), os.path.join(self.prefix, "lib", f)) - def setup_dependent_package(self, module, dspec): - # For now use Single Dynamic Library: - # To set the threading layer at run time, use the - # mkl_set_threading_layer function or set MKL_THREADING_LAYER - # variable to one of the following values: INTEL, SEQUENTIAL, PGI. - # To set interface layer at run time, use the mkl_set_interface_layer - # function or set the MKL_INTERFACE_LAYER variable to LP64 or ILP64. - - # Otherwise one would need to specify several libraries - # (e.g. mkl_intel_lp64;mkl_sequential;mkl_core), which reflect - # different interface and threading layers. - - name = 'libmkl_rt.%s' % dso_suffix - libdir = find_library_path(name, self.prefix.lib64, self.prefix.lib) - - # Now set blas/lapack libs: - self.spec.blas_shared_lib = join_path(libdir, name) - self.spec.lapack_shared_lib = self.spec.blas_shared_lib - def setup_dependent_environment(self, spack_env, run_env, dependent_spec): # set up MKLROOT for everyone using MKL package spack_env.set('MKLROOT', self.prefix) diff --git a/var/spack/repos/builtin/packages/moab/package.py b/var/spack/repos/builtin/packages/moab/package.py index 893a543e97..4dfc5432d2 100644 --- a/var/spack/repos/builtin/packages/moab/package.py +++ b/var/spack/repos/builtin/packages/moab/package.py @@ -37,7 +37,7 @@ class Moab(Package): homepage = "https://bitbucket.org/fathomteam/moab" url = "http://ftp.mcs.anl.gov/pub/fathom/moab-4.6.3.tar.gz" - version('4.9.1', 'bcb8bee3e58c076c7f31884db119088e') + version('4.9.1', '19cc2189fa266181ad9109b18d0b2ab8') version('4.9.0', '40695d0a159040683cfa05586ad4a7c2') version('4.8.2', '1dddd10f162fce3cfffaedc48f6f467d') diff --git a/var/spack/repos/builtin/packages/mpip/package.py b/var/spack/repos/builtin/packages/mpip/package.py new file mode 100644 index 0000000000..78e1dca68a --- /dev/null +++ b/var/spack/repos/builtin/packages/mpip/package.py @@ -0,0 +1,44 @@ +############################################################################## +# 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 Mpip(Package): + """mpiP: Lightweight, Scalable MPI Profiling""" + homepage = "http://mpip.sourceforge.net/" + url = "http://downloads.sourceforge.net/project/mpip/mpiP/mpiP-3.4.1/mpiP-3.4.1.tar.gz" + + version("3.4.1", "1168adc83777ac31d6ebd385823aabbd") + + depends_on("libelf", type="build") + depends_on("libdwarf", type="build") + depends_on('libunwind', when=os.uname()[4] == "x86_64", type="build") + depends_on("mpi", type="build") + + def install(self, spec, prefix): + configure("--prefix=" + prefix, "--without-f77") + make() + make("install") diff --git a/var/spack/repos/builtin/packages/mumps/package.py b/var/spack/repos/builtin/packages/mumps/package.py index 32bc42a9c3..3466f091a0 100644 --- a/var/spack/repos/builtin/packages/mumps/package.py +++ b/var/spack/repos/builtin/packages/mumps/package.py @@ -75,9 +75,8 @@ class Mumps(Package): raise RuntimeError( 'You cannot use the variants parmetis or ptscotch without mpi') - makefile_conf = ["LIBBLAS = %s" % to_link_flags( - self.spec['blas'].blas_shared_lib) - ] + blas = self.spec['blas'].blas_libs + makefile_conf = ["LIBBLAS = %s" % blas.ld_flags] orderings = ['-Dpord'] @@ -136,11 +135,12 @@ class Mumps(Package): 'OPTC = %s -O ' % fpic]) if '+mpi' in self.spec: + scalapack = self.spec['scalapack'].scalapack_libs makefile_conf.extend( ["CC = %s" % join_path(self.spec['mpi'].prefix.bin, 'mpicc'), "FC = %s" % join_path(self.spec['mpi'].prefix.bin, 'mpif90'), "FL = %s" % join_path(self.spec['mpi'].prefix.bin, 'mpif90'), - "SCALAP = %s" % self.spec['scalapack'].fc_link, + "SCALAP = %s" % scalapack.ld_flags, "MUMPS_TYPE = par"]) else: makefile_conf.extend( diff --git a/var/spack/repos/builtin/packages/mvapich2/package.py b/var/spack/repos/builtin/packages/mvapich2/package.py index a123830185..06678bf08b 100644 --- a/var/spack/repos/builtin/packages/mvapich2/package.py +++ b/var/spack/repos/builtin/packages/mvapich2/package.py @@ -28,14 +28,12 @@ from spack import * class Mvapich2(Package): """MVAPICH2 is an MPI implementation for Infiniband networks.""" homepage = "http://mvapich.cse.ohio-state.edu/" - url = "http://mvapich.cse.ohio-state.edu/download/mvapich/mv2/mvapich2-2.2rc2.tar.gz" + url = "http://mvapich.cse.ohio-state.edu/download/mvapich/mv2/mvapich2-2.2.tar.gz" - version('2.2rc2', 'f9082ffc3b853ad1b908cf7f169aa878') - version('2.2b', '5651e8b7a72d7c77ca68da48f3a5d108') - version('2.2a', 'b8ceb4fc5f5a97add9b3ff1b9cbe39d2') - version('2.1', '0095ceecb19bbb7fb262131cb9c2cdd6') - version('2.0', '9fbb68a4111a8b6338e476dc657388b4') - version('1.9', '5dc58ed08fd3142c260b70fe297e127c') + version('2.2', '939b65ebe5b89a5bc822cdab0f31f96e') + version('2.1', '0095ceecb19bbb7fb262131cb9c2cdd6') + version('2.0', '9fbb68a4111a8b6338e476dc657388b4') + version('1.9', '5dc58ed08fd3142c260b70fe297e127c') patch('ad_lustre_rwcontig_open_source.patch', when='@1.9') @@ -95,6 +93,7 @@ class Mvapich2(Package): ########## # FIXME : CUDA support is missing + depends_on('bison') depends_on('libpciaccess') def url_for_version(self, version): diff --git a/var/spack/repos/builtin/packages/ncurses/package.py b/var/spack/repos/builtin/packages/ncurses/package.py index aaacbac7b1..e4fd5bf269 100644 --- a/var/spack/repos/builtin/packages/ncurses/package.py +++ b/var/spack/repos/builtin/packages/ncurses/package.py @@ -50,7 +50,10 @@ class Ncurses(Package): "--enable-widec", "--enable-overwrite", "--disable-lib-suffixes", - "--without-ada"] + "--without-ada", + "--enable-pc-files", + "--with-pkg-config-libdir={0}/lib/pkgconfig".format(prefix) + ] configure(*opts) make() make("install") diff --git a/var/spack/repos/builtin/packages/ncview/package.py b/var/spack/repos/builtin/packages/ncview/package.py index f61e6984b5..4abc09deb0 100644 --- a/var/spack/repos/builtin/packages/ncview/package.py +++ b/var/spack/repos/builtin/packages/ncview/package.py @@ -34,6 +34,7 @@ class Ncview(Package): depends_on("netcdf") depends_on("udunits2") + depends_on("libpng") # OS Dependencies # Ubuntu: apt-get install libxaw7-dev diff --git a/var/spack/repos/builtin/packages/netcdf/package.py b/var/spack/repos/builtin/packages/netcdf/package.py index ab40c14340..5dc686c907 100644 --- a/var/spack/repos/builtin/packages/netcdf/package.py +++ b/var/spack/repos/builtin/packages/netcdf/package.py @@ -50,12 +50,18 @@ class Netcdf(Package): # Required for NetCDF-4 support depends_on("zlib") - depends_on('hdf5@:1.8+mpi', when='@:4.4.0+mpi') - depends_on('hdf5+mpi', when='@4.4.1:+mpi') - depends_on('hdf5@:1.8~mpi', when='@:4.4.0~mpi') - depends_on('hdf5~mpi', when='@4.4.1:~mpi') + depends_on('hdf5') + + # NetCDF 4.4.0 and prior have compatibility issues with HDF5 1.10 and later + # https://github.com/Unidata/netcdf-c/issues/250 + depends_on('hdf5@:1.8', when='@:4.4.0') def install(self, spec, prefix): + # Workaround until variant forwarding works properly + if '+mpi' in spec and spec.satisfies('^hdf5~mpi'): + raise RuntimeError('Invalid spec. Package netcdf requires ' + 'hdf5+mpi, but spec asked for hdf5~mpi.') + # Environment variables CPPFLAGS = [] LDFLAGS = [] diff --git a/var/spack/repos/builtin/packages/netlib-lapack/package.py b/var/spack/repos/builtin/packages/netlib-lapack/package.py index 08c94a5c9b..874473ba9c 100644 --- a/var/spack/repos/builtin/packages/netlib-lapack/package.py +++ b/var/spack/repos/builtin/packages/netlib-lapack/package.py @@ -36,6 +36,7 @@ class NetlibLapack(Package): homepage = "http://www.netlib.org/lapack/" url = "http://www.netlib.org/lapack/lapack-3.5.0.tgz" + version('3.6.1', '421b2cb72e15f237e144428f9c460ee0') version('3.6.0', 'f2f6c67134e851fe189bb3ca1fbb5101') version('3.5.0', 'b1d3e3e425b2e44a06760ff173104bdf') version('3.4.2', '61bf1a8a4469d4bdb7604f5897179478') @@ -66,6 +67,20 @@ class NetlibLapack(Package): '${CMAKE_CURRENT_SOURCE_DIR}/cmake/', 'CBLAS/CMakeLists.txt', string=True) + @property + def blas_libs(self): + shared = True if '+shared' in self.spec else False + return find_libraries( + ['libblas'], root=self.prefix, shared=shared, recurse=True + ) + + @property + def lapack_libs(self): + shared = True if '+shared' in self.spec else False + return find_libraries( + ['liblapack'], root=self.prefix, shared=shared, recurse=True + ) + def install_one(self, spec, prefix, shared): cmake_args = [ '-DBUILD_SHARED_LIBS:BOOL=%s' % ('ON' if shared else 'OFF'), @@ -76,12 +91,9 @@ class NetlibLapack(Package): cmake_args.extend(['-DCBLAS=ON']) # always build CBLAS if '+external-blas' in spec: - # TODO : mechanism to specify the library should be more general, - # TODO : but this allows to have an hook to an external blas cmake_args.extend([ '-DUSE_OPTIMIZED_BLAS:BOOL=ON', - '-DBLAS_LIBRARIES:PATH=%s' % join_path( - spec['blas'].prefix.lib, 'libblas.a') + '-DBLAS_LIBRARIES:PATH=%s' % spec['blas'].blas_libs.joined(';') ]) cmake_args.extend(std_cmake_args) @@ -99,18 +111,3 @@ class NetlibLapack(Package): # Build shared libraries if requested. if '+shared' in spec: self.install_one(spec, prefix, True) - - def setup_dependent_package(self, module, dspec): - # This is WIP for a prototype interface for virtual packages. - # We can update this as more builds start depending on BLAS/LAPACK. - libdir = find_library_path( - 'libblas.a', self.prefix.lib64, self.prefix.lib) - - self.spec.blas_static_lib = join_path(libdir, 'libblas.a') - self.spec.lapack_static_lib = join_path(libdir, 'liblapack.a') - - if '+shared' in self.spec: - self.spec.blas_shared_lib = join_path( - libdir, 'libblas.%s' % dso_suffix) - self.spec.lapack_shared_lib = join_path( - libdir, 'liblapack.%s' % dso_suffix) diff --git a/var/spack/repos/builtin/packages/netlib-scalapack/package.py b/var/spack/repos/builtin/packages/netlib-scalapack/package.py index 49b8633209..578d2d8988 100644 --- a/var/spack/repos/builtin/packages/netlib-scalapack/package.py +++ b/var/spack/repos/builtin/packages/netlib-scalapack/package.py @@ -28,10 +28,11 @@ import sys class NetlibScalapack(Package): """ScaLAPACK is a library of high-performance linear algebra routines for - parallel distributed memory machines""" + parallel distributed memory machines + """ homepage = "http://www.netlib.org/scalapack/" - url = "http://www.netlib.org/scalapack/scalapack-2.0.2.tgz" + url = "http://www.netlib.org/scalapack/scalapack-2.0.2.tgz" version('2.0.2', '2f75e600a2ba155ed9ce974a1c4b536f') version('2.0.1', '17b8cde589ea0423afe1ec43e7499161') @@ -39,33 +40,47 @@ class NetlibScalapack(Package): # versions before 2.0.0 are not using cmake and requires blacs as # a separated package - variant('shared', default=True, - description='Build the shared library version') - variant('fpic', default=False, description="Build with -fpic compiler option") + variant( + 'shared', + default=True, + description='Build the shared library version' + ) + variant( + 'fpic', + default=False, + description='Build with -fpic compiler option' + ) provides('scalapack') depends_on('mpi') depends_on('lapack') + depends_on('blas') depends_on('cmake', when='@2.0.0:', type='build') + @property + def scalapack_libs(self): + shared = True if '+shared' in self.spec else False + return find_libraries( + ['libscalapack'], root=self.prefix, shared=shared, recurse=True + ) + def install(self, spec, prefix): options = [ "-DBUILD_SHARED_LIBS:BOOL=%s" % ('ON' if '+shared' in spec else 'OFF'), "-DBUILD_STATIC_LIBS:BOOL=%s" % ('OFF' if '+shared' in spec else - 'ON'), - # forces scalapack to use find_package(LAPACK): - "-DUSE_OPTIMIZED_LAPACK_BLAS:BOOL=ON", + 'ON') ] # Make sure we use Spack's Lapack: + blas = spec['blas'].blas_libs + lapack = spec['lapack'].lapack_libs 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), + '-DLAPACK_LIBRARIES=%s' % (lapack.joined(';')), + '-DBLAS_LIBRARIES=%s' % (blas.joined(';')) ]) if '+fpic' in spec: @@ -84,12 +99,3 @@ class NetlibScalapack(Package): # The shared libraries are not installed correctly on Darwin: if (sys.platform == 'darwin') and ('+shared' in spec): fix_darwin_install_name(prefix.lib) - - def setup_dependent_package(self, module, dependent_spec): - spec = self.spec - lib_suffix = dso_suffix if '+shared' in spec else 'a' - - spec.fc_link = '-L%s -lscalapack' % spec.prefix.lib - spec.cc_link = spec.fc_link - spec.libraries = [join_path(spec.prefix.lib, - 'libscalapack.%s' % lib_suffix)] diff --git a/var/spack/repos/builtin/packages/nwchem/package.py b/var/spack/repos/builtin/packages/nwchem/package.py index 13c710a35a..b15c1c02fd 100644 --- a/var/spack/repos/builtin/packages/nwchem/package.py +++ b/var/spack/repos/builtin/packages/nwchem/package.py @@ -66,6 +66,9 @@ class Nwchem(Package): patch('Gcc6_macs_optfix.patch', when='@6.6', level=0) def install(self, spec, prefix): + scalapack = spec['scalapack'].scalapack_libs + lapack = spec['lapack'].lapack_libs + blas = spec['blas'].blas_libs # see http://www.nwchem-sw.org/index.php/Compiling_NWChem args = [] args.extend([ @@ -79,13 +82,11 @@ class Nwchem(Package): 'USE_PYTHONCONFIG=y', 'PYTHONVERSION=%s' % spec['python'].version.up_to(2), 'PYTHONHOME=%s' % spec['python'].prefix, - 'BLASOPT=%s %s' % ( - to_link_flags(spec['lapack'].lapack_shared_lib), - to_link_flags(spec['blas'].blas_shared_lib)), - 'BLAS_LIB=%s' % to_link_flags(spec['blas'].blas_shared_lib), - 'LAPACK_LIB=%s' % to_link_flags(spec['lapack'].lapack_shared_lib), + 'BLASOPT=%s' % ((lapack + blas).ld_flags), + 'BLAS_LIB=%s' % blas.ld_flags, + 'LAPACK_LIB=%s' % lapack.ld_flags, 'USE_SCALAPACK=y', - 'SCALAPACK=%s' % spec['scalapack'].fc_link, + 'SCALAPACK=%s' % scalapack.ld_flags, 'NWCHEM_MODULES=all python', 'NWCHEM_LONG_PATHS=Y' # by default NWCHEM_TOP is 64 char max ]) diff --git a/var/spack/repos/builtin/packages/octopus/package.py b/var/spack/repos/builtin/packages/octopus/package.py index ff4a106940..adb760f06d 100644 --- a/var/spack/repos/builtin/packages/octopus/package.py +++ b/var/spack/repos/builtin/packages/octopus/package.py @@ -46,13 +46,13 @@ class Octopus(Package): # FEAST, Libfm, PFFT, ISF, PNFFT def install(self, spec, prefix): + lapack = spec['lapack'].lapack_libs + blas = spec['blas'].blas_libs args = [] args.extend([ '--prefix=%s' % prefix, - '--with-blas=%s' % to_link_flags( - spec['blas'].blas_shared_lib), - '--with-lapack=%s' % to_link_flags( - spec['lapack'].lapack_shared_lib), + '--with-blas=%s' % blas.ld_flags, + '--with-lapack=%s' % lapack.ld_flags, '--with-gsl-prefix=%s' % spec['gsl'].prefix, '--with-libxc-prefix=%s' % spec['libxc'].prefix, 'CC=%s' % spec['mpi'].mpicc, diff --git a/var/spack/repos/builtin/packages/openblas/package.py b/var/spack/repos/builtin/packages/openblas/package.py index 37f7a7005d..1f6dd0e013 100644 --- a/var/spack/repos/builtin/packages/openblas/package.py +++ b/var/spack/repos/builtin/packages/openblas/package.py @@ -30,8 +30,9 @@ import os class Openblas(Package): """OpenBLAS: An optimized BLAS library""" homepage = "http://www.openblas.net" - url = "http://github.com/xianyi/OpenBLAS/archive/v0.2.15.tar.gz" + url = "http://github.com/xianyi/OpenBLAS/archive/v0.2.15.tar.gz" + version('0.2.19', '28c998054fd377279741c6f0b9ea7941') version('0.2.18', '805e7f660877d588ea7e3792cda2ee65') version('0.2.17', '664a12807f2a2a7cda4781e3ab2ae0e1') version('0.2.16', 'fef46ab92463bdbb1479dcec594ef6dc') @@ -50,6 +51,17 @@ class Openblas(Package): patch('make.patch') + @property + def blas_libs(self): + shared = True if '+shared' in self.spec else False + return find_libraries( + ['libopenblas'], root=self.prefix, shared=shared, recurse=True + ) + + @property + def lapack_libs(self): + return self.blas_libs + def install(self, spec, prefix): # As of 06/2016 there is no mechanism to specify that packages which # depends on Blas/Lapack need C or/and Fortran symbols. For now @@ -99,41 +111,11 @@ class Openblas(Package): # no quotes around prefix (spack doesn't use a shell) make('install', "PREFIX=%s" % prefix, *make_defs) - # Blas virtual package should provide blas.a and libblas.a - with working_dir(prefix.lib): - symlink('libopenblas.a', 'blas.a') - symlink('libopenblas.a', 'libblas.a') - if '+shared' in spec: - symlink('libopenblas.%s' % dso_suffix, - 'libblas.%s' % dso_suffix) - - # Lapack virtual package should provide liblapack.a - with working_dir(prefix.lib): - symlink('libopenblas.a', 'liblapack.a') - if '+shared' in spec: - symlink('libopenblas.%s' % dso_suffix, - 'liblapack.%s' % dso_suffix) - # Openblas may pass its own test but still fail to compile Lapack # symbols. To make sure we get working Blas and Lapack, do a small # test. self.check_install(spec) - def setup_dependent_package(self, module, dspec): - # This is WIP for a prototype interface for virtual packages. - # We can update this as more builds start depending on BLAS/LAPACK. - libdir = find_library_path('libopenblas.a', - self.prefix.lib64, - self.prefix.lib) - - self.spec.blas_static_lib = join_path(libdir, 'libopenblas.a') - self.spec.lapack_static_lib = self.spec.blas_static_lib - - if '+shared' in self.spec: - self.spec.blas_shared_lib = join_path(libdir, 'libopenblas.%s' % - dso_suffix) - self.spec.lapack_shared_lib = self.spec.blas_shared_lib - def check_install(self, spec): source_file = join_path(os.path.dirname(self.module.__file__), 'test_cblas_dgemm.c') @@ -141,10 +123,8 @@ class Openblas(Package): 'test_cblas_dgemm.output') include_flags = ["-I%s" % join_path(spec.prefix, "include")] - link_flags = ["-L%s" % join_path(spec.prefix, "lib"), - "-llapack", - "-lblas", - "-lpthread"] + link_flags = self.lapack_libs.ld_flags.split() + link_flags.extend(["-lpthread"]) if '+openmp' in spec: link_flags.extend([self.compiler.openmp_flag]) diff --git a/var/spack/repos/builtin/packages/openmpi/package.py b/var/spack/repos/builtin/packages/openmpi/package.py index ca6bd473f1..bb356aaccc 100644 --- a/var/spack/repos/builtin/packages/openmpi/package.py +++ b/var/spack/repos/builtin/packages/openmpi/package.py @@ -65,6 +65,7 @@ class Openmpi(Package): list_url = "http://www.open-mpi.org/software/ompi/" list_depth = 3 + version('2.0.1', '6f78155bd7203039d2448390f3b51c96') version('2.0.0', 'cdacc800cb4ce690c1f1273cb6366674') version('1.10.3', 'e2fe4513200e2aaa1500b762342c674b') version('1.10.2', 'b2f43d9635d2d52826e5ef9feb97fd4c') @@ -165,6 +166,10 @@ class Openmpi(Package): "--enable-shared", "--enable-static"] + # for Open-MPI 2.0:, C++ bindings are disabled by default. + if self.spec.satisfies('@2.0:'): + config_args.extend(['--enable-mpi-cxx']) + if getattr(self, 'config_extra', None) is not None: config_args.extend(self.config_extra) diff --git a/var/spack/repos/builtin/packages/openssl/package.py b/var/spack/repos/builtin/packages/openssl/package.py index 8d9049a8f7..12b5ed9c52 100644 --- a/var/spack/repos/builtin/packages/openssl/package.py +++ b/var/spack/repos/builtin/packages/openssl/package.py @@ -36,24 +36,21 @@ class Openssl(Package): homepage = "http://www.openssl.org" url = "ftp://openssl.org/source/openssl-1.0.1h.tar.gz" - version('1.0.1h', '8d6d684a9430d5cc98a62a5d8fbda8cf') - version('1.0.1r', '1abd905e079542ccae948af37e393d28') - version('1.0.1t', '9837746fcf8a6727d46d22ca35953da1') - version('1.0.2d', '38dd619b2e77cbac69b99f52a053d25a') - version('1.0.2e', '5262bfa25b60ed9de9f28d5d52d77fc5') - version('1.0.2f', 'b3bf73f507172be9292ea2a8c28b659d') - version('1.0.2g', 'f3c710c045cdee5fd114feb69feba7aa') + version('1.0.2j', '96322138f0b69e61b7212bc53d5e912b') + version('1.0.2i', '678374e63f8df456a697d3e5e5a931fb') version('1.0.2h', '9392e65072ce4b614c1392eefc1f23d0') + version('1.0.2g', 'f3c710c045cdee5fd114feb69feba7aa') + version('1.0.2f', 'b3bf73f507172be9292ea2a8c28b659d') + version('1.0.2e', '5262bfa25b60ed9de9f28d5d52d77fc5') + version('1.0.2d', '38dd619b2e77cbac69b99f52a053d25a') + version('1.0.1u', '130bb19745db2a5a09f22ccbbf7e69d0') + version('1.0.1t', '9837746fcf8a6727d46d22ca35953da1') + version('1.0.1r', '1abd905e079542ccae948af37e393d28') + version('1.0.1h', '8d6d684a9430d5cc98a62a5d8fbda8cf') depends_on("zlib") parallel = False - def url_for_version(self, version): - if '@system' in self.spec: - return '@system (reserved version for system openssl)' - else: - return super(Openssl, self).url_for_version(self.version) - def handle_fetch_error(self, error): tty.warn("Fetching OpenSSL failed. This may indicate that OpenSSL has " "been updated, and the version in your instance of Spack is " diff --git a/var/spack/repos/builtin/packages/opium/package.py b/var/spack/repos/builtin/packages/opium/package.py index 2c81d92cc0..521f917230 100644 --- a/var/spack/repos/builtin/packages/opium/package.py +++ b/var/spack/repos/builtin/packages/opium/package.py @@ -29,7 +29,7 @@ class Opium(Package): """DFT pseudopotential generation project""" homepage = "https://opium.sourceforge.net/index.html" - url = "https://downloads.sourceforge.net/project/opium/opium/opium-v3.8/opium-v3.8-src.tgz" + url = "https://downloads.sourceforge.net/project/opium/opium/opium-v3.8/opium-v3.8-src.tgz" version('3.8', 'f710c0f869e70352b4a510c31e13bf9f') @@ -37,12 +37,8 @@ class Opium(Package): depends_on('lapack') def install(self, spec, prefix): - options = [ - 'LDFLAGS=%s %s' % ( - to_link_flags(spec['lapack'].lapack_shared_lib), - to_link_flags(spec['blas'].blas_shared_lib) - ) - ] + libs = spec['lapack'].lapack_libs + spec['blas'].blas_libs + options = ['LDFLAGS=%s' % libs.ld_flags] configure(*options) with working_dir("src", create=False): diff --git a/var/spack/repos/builtin/packages/pango/package.py b/var/spack/repos/builtin/packages/pango/package.py index 2da20e9dc2..75c4ac807d 100644 --- a/var/spack/repos/builtin/packages/pango/package.py +++ b/var/spack/repos/builtin/packages/pango/package.py @@ -38,6 +38,7 @@ class Pango(Package): version('1.36.8', '217a9a753006275215fa9fa127760ece') version('1.40.1', '6fc88c6529890d6c8e03074d57a3eceb') + depends_on("pkg-config", type="build") depends_on("harfbuzz") depends_on("cairo") diff --git a/var/spack/repos/builtin/packages/papi/package.py b/var/spack/repos/builtin/packages/papi/package.py index 5c4abe1730..90a7490e75 100644 --- a/var/spack/repos/builtin/packages/papi/package.py +++ b/var/spack/repos/builtin/packages/papi/package.py @@ -41,6 +41,7 @@ class Papi(Package): homepage = "http://icl.cs.utk.edu/papi/index.html" url = "http://icl.cs.utk.edu/projects/papi/downloads/papi-5.4.1.tar.gz" + version('5.5.0', '5e1244a04ca031d4cc29b46ce3dd05b5') version('5.4.3', '3211b5a5bb389fe692370f5cf4cc2412') version('5.4.1', '9134a99219c79767a11463a76b0b01a2') version('5.3.0', '367961dd0ab426e5ae367c2713924ffb') diff --git a/var/spack/repos/builtin/packages/parmetis/package.py b/var/spack/repos/builtin/packages/parmetis/package.py index 8afae91af1..74e00cc9e0 100644 --- a/var/spack/repos/builtin/packages/parmetis/package.py +++ b/var/spack/repos/builtin/packages/parmetis/package.py @@ -38,11 +38,9 @@ class Parmetis(Package): version('4.0.3', 'f69c479586bf6bb7aff6a9bc0c739628') version('4.0.2', '0912a953da5bb9b5e5e10542298ffdce') - variant('shared', default=True, - description='Enables the build of shared libraries') - variant('debug', default=False, - description='Builds the library in debug mode') - variant('gdb', default=False, description='Enables gdb support') + variant('shared', default=True, description='Enables the build of shared libraries.') + variant('debug', default=False, description='Builds the library in debug mode.') + variant('gdb', default=False, description='Enables gdb support.') depends_on('cmake@2.8:', type='build') depends_on('mpi') @@ -50,9 +48,9 @@ class Parmetis(Package): patch('enable_external_metis.patch') # bug fixes from PETSc developers - # https://bitbucket.org/petsc/pkg-parmetis/commits/1c1a9fd0f408dc4d42c57f5c3ee6ace411eb222b/raw/ + # https://bitbucket.org/petsc/pkg-parmetis/commits/1c1a9fd0f408dc4d42c57f5c3ee6ace411eb222b/raw/ # NOQA: E501 patch('pkg-parmetis-1c1a9fd0f408dc4d42c57f5c3ee6ace411eb222b.patch') - # https://bitbucket.org/petsc/pkg-parmetis/commits/82409d68aa1d6cbc70740d0f35024aae17f7d5cb/raw/ + # https://bitbucket.org/petsc/pkg-parmetis/commits/82409d68aa1d6cbc70740d0f35024aae17f7d5cb/raw/ # NOQA: E501 patch('pkg-parmetis-82409d68aa1d6cbc70740d0f35024aae17f7d5cb.patch') def url_for_version(self, version): @@ -60,12 +58,10 @@ class Parmetis(Package): return '%s/%sparmetis-%s.tar.gz' % (Parmetis.base_url, verdir, version) def install(self, spec, prefix): - options = [] - options.extend(std_cmake_args) - - build_directory = join_path(self.stage.path, 'spack-build') source_directory = self.stage.source_path + build_directory = join_path(source_directory, 'build') + options = std_cmake_args[:] options.extend([ '-DGKLIB_PATH:PATH=%s/GKlib' % spec['metis'].prefix.include, '-DMETIS_PATH:PATH=%s' % spec['metis'].prefix, diff --git a/var/spack/repos/builtin/packages/pdt/package.py b/var/spack/repos/builtin/packages/pdt/package.py index 648b2fab98..bed01aeefb 100644 --- a/var/spack/repos/builtin/packages/pdt/package.py +++ b/var/spack/repos/builtin/packages/pdt/package.py @@ -35,13 +35,14 @@ class Pdt(Package): """ homepage = "https://www.cs.uoregon.edu/research/pdt/home.php" - url = "http://www.cs.uoregon.edu/research/paracomp/pdtoolkit/Download/pdt-3.22.1.tar.gz" + url = "http://www.cs.uoregon.edu/research/paracomp/pdtoolkit/Download/pdtoolkit-3.22.1.tar.gz" - version('3.22.1', 'be6fac0b1edb3e3287b0cb78741a24b6') - version('3.22', 'e6c7879fc49ac5ff67a76ce31ef9e251') - version('3.21', '8df94298b71703decf680709a4ddf68f') - version('3.19', 'ba5591994998771fdab216699e362228') - version('3.18.1', '05281b5c82a4754df936df99ad7eec0f') + version('3.22.1', 'b56b9b3e621161c7fd9e4908b944840d') + version('3.22', '982d667617802962a1f7fe6c4c31184f') + version('3.21', '3092ca0d8833b69992c17e63ae66c263') + version('3.20', 'c3edabe202926abe04552e33cd39672d') + version('3.19', '5c5e1e6607086aa13bf4b1b9befc5864') + version('3.18.1', 'e401534f5c476c3e77f05b7f73b6c4f2') def install(self, spec, prefix): configure('-prefix=%s' % prefix) diff --git a/var/spack/repos/builtin/packages/petsc/package.py b/var/spack/repos/builtin/packages/petsc/package.py index 73091bb182..7ee2d29f4d 100644 --- a/var/spack/repos/builtin/packages/petsc/package.py +++ b/var/spack/repos/builtin/packages/petsc/package.py @@ -22,7 +22,9 @@ # License along with this program; if not, write to the Free Software # Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA ############################################################################## + import os +import sys from spack import * @@ -114,6 +116,11 @@ class Petsc(Package): '--with-mpi=1', '--with-mpi-dir=%s' % self.spec['mpi'].prefix, ] + if sys.platform != "darwin": + compiler_opts.extend([ + '--with-cpp=cpp', + '--with-cxxcpp=cpp', + ]) return compiler_opts def install(self, spec, prefix): @@ -125,9 +132,15 @@ class Petsc(Package): '--with-scalar-type=%s' % ( 'complex' if '+complex' in spec else 'real'), '--with-shared-libraries=%s' % ('1' if '+shared' in spec else '0'), - '--with-debugging=%s' % ('1' if '+debug' in spec else '0'), - '--with-blas-lapack-dir=%s' % spec['lapack'].prefix + '--with-debugging=%s' % ('1' if '+debug' in spec else '0') ]) + # Make sure we use exactly the same Blas/Lapack libraries + # across the DAG. To that end list them explicitly + lapack_blas = spec['lapack'].lapack_libs + spec['blas'].blas_libs + options.extend([ + '--with-blas-lapack-lib=%s' % lapack_blas.joined() + ]) + # Activates library support if needed for library in ('metis', 'boost', 'hdf5', 'hypre', 'parmetis', 'mumps', 'scalapack'): diff --git a/var/spack/repos/builtin/packages/pexsi/package.py b/var/spack/repos/builtin/packages/pexsi/package.py index e74ad6df01..9fc71d4c52 100644 --- a/var/spack/repos/builtin/packages/pexsi/package.py +++ b/var/spack/repos/builtin/packages/pexsi/package.py @@ -67,8 +67,8 @@ class Pexsi(Package): '@PARMETIS_PREFIX': self.spec['parmetis'].prefix, '@LAPACK_PREFIX': self.spec['lapack'].prefix, '@BLAS_PREFIX': self.spec['blas'].prefix, - '@LAPACK_LIBS': self.spec['lapack'].lapack_shared_lib, - '@BLAS_LIBS': self.spec['lapack'].blas_shared_lib, + '@LAPACK_LIBS': self.spec['lapack'].lapack_libs.joined(), + '@BLAS_LIBS': self.spec['lapack'].blas_libs.joined(), '@STDCXX_LIB': ' '.join(self.compiler.stdcxx_libs) } diff --git a/var/spack/repos/builtin/packages/pgi/package.py b/var/spack/repos/builtin/packages/pgi/package.py index c58d563682..6fa8457dc9 100644 --- a/var/spack/repos/builtin/packages/pgi/package.py +++ b/var/spack/repos/builtin/packages/pgi/package.py @@ -36,7 +36,7 @@ class Pgi(Package): architecture) to the format: pgi-<version>.tar.gz. Spack will search your current directory for a file of this format. Alternatively, add this file to a mirror so that Spack can find it. For instructions on how to - set up a mirror, see http://software.llnl.gov/spack/mirrors.html""" + set up a mirror, see http://spack.readthedocs.io/en/latest/mirrors.html""" homepage = "http://www.pgroup.com/" url = "file://%s/pgi-16.3.tar.gz" % os.getcwd() diff --git a/var/spack/repos/builtin/packages/pixman/package.py b/var/spack/repos/builtin/packages/pixman/package.py index 39041587f5..41aad0c90a 100644 --- a/var/spack/repos/builtin/packages/pixman/package.py +++ b/var/spack/repos/builtin/packages/pixman/package.py @@ -39,6 +39,7 @@ class Pixman(Package): def install(self, spec, prefix): configure("--prefix=%s" % prefix, + "--disable-mmx", "--disable-gtk") make() make("install") diff --git a/var/spack/repos/builtin/packages/plumed/package.py b/var/spack/repos/builtin/packages/plumed/package.py index 79632abf38..60dfdf7405 100644 --- a/var/spack/repos/builtin/packages/plumed/package.py +++ b/var/spack/repos/builtin/packages/plumed/package.py @@ -66,6 +66,8 @@ class Plumed(Package): depends_on('mpi', when='+mpi') depends_on('gsl', when='+gsl') + depends_on('autoconf', type='build') + # Dictionary mapping PLUMED versions to the patches it provides # interactively plumed_patches = { @@ -98,6 +100,12 @@ class Plumed(Package): module.plumed = Executable(join_path(self.spec.prefix.bin, 'plumed')) def install(self, spec, prefix): + # This part is needed to avoid linking with gsl cblas + # interface which will mask the cblas interface + # provided by optimized libraries due to linking order + filter_file('-lgslcblas', '', 'configure.ac') + autoreconf('-ivf') + # From plumed docs : # Also consider that this is different with respect to what some other # configure script does in that variables such as MPICXX are diff --git a/var/spack/repos/builtin/packages/psi4/package.py b/var/spack/repos/builtin/packages/psi4/package.py index 6296d0cee6..566aa50f44 100644 --- a/var/spack/repos/builtin/packages/psi4/package.py +++ b/var/spack/repos/builtin/packages/psi4/package.py @@ -32,7 +32,7 @@ class Psi4(Package): a variety of molecular properties.""" homepage = "http://www.psicode.org/" - url = "https://github.com/psi4/psi4/archive/0.5.tar.gz" + url = "https://github.com/psi4/psi4/archive/0.5.tar.gz" version('0.5', '53041b8a9be3958384171d0d22f9fdd0') @@ -62,9 +62,10 @@ class Psi4(Package): def install(self, spec, prefix): cmake_args = [ '-DBLAS_TYPE={0}'.format(spec['blas'].name.upper()), - '-DBLAS_LIBRARIES={0}'.format(spec['blas'].blas_shared_lib), + '-DBLAS_LIBRARIES={0}'.format(spec['blas'].blas_libs.joined()), '-DLAPACK_TYPE={0}'.format(spec['lapack'].name.upper()), - '-DLAPACK_LIBRARIES={0}'.format(spec['lapack'].lapack_shared_lib), + '-DLAPACK_LIBRARIES={0}'.format( + spec['lapack'].lapack_libs.joined()), '-DBOOST_INCLUDEDIR={0}'.format(spec['boost'].prefix.include), '-DBOOST_LIBRARYDIR={0}'.format(spec['boost'].prefix.lib), '-DENABLE_CHEMPS2=OFF' @@ -90,9 +91,9 @@ class Psi4(Package): kwargs = {'ignore_absent': True, 'backup': False, 'string': True} - cc_files = ['bin/psi4-config'] + cc_files = ['bin/psi4-config'] cxx_files = ['bin/psi4-config', 'include/psi4/psiconfig.h'] - template = 'share/psi4/plugin/Makefile.template' + template = 'share/psi4/plugin/Makefile.template' for filename in cc_files: filter_file(os.environ['CC'], self.compiler.cc, diff --git a/var/spack/repos/builtin/packages/py-beautifulsoup4/package.py b/var/spack/repos/builtin/packages/py-beautifulsoup4/package.py index 64368fe70d..d3a260bd7f 100644 --- a/var/spack/repos/builtin/packages/py-beautifulsoup4/package.py +++ b/var/spack/repos/builtin/packages/py-beautifulsoup4/package.py @@ -37,5 +37,7 @@ class PyBeautifulsoup4(Package): extends('python') + depends_on('py-setuptools', type='build') + def install(self, spec, prefix): python('setup.py', 'install', '--prefix={0}'.format(prefix)) diff --git a/var/spack/repos/builtin/packages/py-numpy/package.py b/var/spack/repos/builtin/packages/py-numpy/package.py index f800b5e834..0d68a892f2 100644 --- a/var/spack/repos/builtin/packages/py-numpy/package.py +++ b/var/spack/repos/builtin/packages/py-numpy/package.py @@ -32,9 +32,12 @@ class PyNumpy(Package): sophisticated (broadcasting) functions, tools for integrating C/C++ and Fortran code, and useful linear algebra, Fourier transform, and random number capabilities""" + homepage = "http://www.numpy.org/" url = "https://pypi.python.org/packages/source/n/numpy/numpy-1.9.1.tar.gz" + version('1.11.1', '2f44a895a8104ffac140c3a70edbd450', + url="https://pypi.python.org/packages/e0/4c/515d7c4ac424ff38cc919f7099bf293dd064ba9a600e1e3835b3edefdb18/numpy-1.11.1.tar.gz") version('1.11.0', 'bc56fb9fc2895aa4961802ffbdb31d0b') version('1.10.4', 'aed294de0aa1ac7bd3f9745f4f1968ad') version('1.9.2', 'a1ed53432dbcd256398898d35bc8e645') @@ -44,6 +47,7 @@ class PyNumpy(Package): variant('lapack', default=True) extends('python') + depends_on('python@2.6:2.8,3.2:') depends_on('py-nose', type='build') depends_on('py-setuptools', type='build') depends_on('blas', when='+blas') @@ -79,4 +83,4 @@ class PyNumpy(Package): f.write('library_dirs=%s\n' % ':'.join(library_dirs)) f.write('rpath=%s\n' % ':'.join(library_dirs)) - python('setup.py', 'install', '--prefix=%s' % prefix) + setup_py('install', '--prefix={0}'.format(prefix)) diff --git a/var/spack/repos/builtin/packages/py-pil/package.py b/var/spack/repos/builtin/packages/py-pil/package.py index 2b3cce26d3..29a86d1e85 100644 --- a/var/spack/repos/builtin/packages/py-pil/package.py +++ b/var/spack/repos/builtin/packages/py-pil/package.py @@ -37,7 +37,10 @@ class PyPil(Package): provides('pil') + # py-pil currently only works with Python2. + # If you are using Python 3, try using py-pillow instead. extends('python') + depends_on('python@1.5.2:2.8') def install(self, spec, prefix): python('setup.py', 'install', '--prefix=%s' % prefix) diff --git a/var/spack/repos/builtin/packages/py-pillow/package.py b/var/spack/repos/builtin/packages/py-pillow/package.py index 1d8b3faa6f..211e3b4199 100644 --- a/var/spack/repos/builtin/packages/py-pillow/package.py +++ b/var/spack/repos/builtin/packages/py-pillow/package.py @@ -32,7 +32,7 @@ class PyPillow(Package): capabilities.""" homepage = "https://python-pillow.org/" - url = "https://pypi.python.org/packages/source/P/Pillow/Pillow-3.0.0.tar.gz" + url = "https://pypi.python.org/packages/source/P/Pillow/Pillow-3.0.0.tar.gz" # TODO: This version should be deleted once the next release comes out. # TODO: It fixes a bug that prevented us from linking to Tk/Tcl. diff --git a/var/spack/repos/builtin/packages/py-proj/package.py b/var/spack/repos/builtin/packages/py-proj/package.py new file mode 100644 index 0000000000..2835bfcca8 --- /dev/null +++ b/var/spack/repos/builtin/packages/py-proj/package.py @@ -0,0 +1,52 @@ +############################################################################## +# Copyright (c) 2016, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Written by David Beckingsale, david@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 General Public License (as published by +# the Free Software Foundation) version 2.1 dated 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 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 PyProj(Package): + """Python interface to the PROJ.4 Library.""" + homepage = "http://jswhit.github.io/pyproj/" + url = "https://github.com/jswhit/pyproj/tarball/v1.9.5.1rel" + + # This is not a tagged release of pyproj. + # The changes in this "version" fix some bugs, especially with Python3 use. + version('1.9.5.1.1', 'd035e4bc704d136db79b43ab371b27d2', + url='https://www.github.com/jswhit/pyproj/tarball/0be612cc9f972e38b50a90c946a9b353e2ab140f') + + version('1.9.5.1', 'a4b80d7170fc82aee363d7f980279835') + + extends('python') + + depends_on('py-cython', type='build') + depends_on('py-setuptools', type='build') + + # NOTE: py-proj does NOT depends_on('proj'). + # The py-proj git repo actually includes the correct version of PROJ.4, + # which is built internally as part of the py-proj build. + # Adding depends_on('proj') will cause mysterious build errors. + + def install(self, spec, prefix): + setup_py('install', '--prefix=%s' % prefix) diff --git a/var/spack/repos/builtin/packages/py-py2neo/package.py b/var/spack/repos/builtin/packages/py-py2neo/package.py index a79c2e477b..97632493af 100644 --- a/var/spack/repos/builtin/packages/py-py2neo/package.py +++ b/var/spack/repos/builtin/packages/py-py2neo/package.py @@ -27,9 +27,10 @@ from spack import Package class PyPy2neo(Package): - """FIXME: put a proper description of your package here.""" - # FIXME: add a proper url for your package's homepage here. - homepage = "http://www.example.com" + """Py2neo is a client library and toolkit for working with Neo4j from + within Python applications and from the command line.""" + + homepage = "http://py2neo.org/" url = "https://github.com/nigelsmall/py2neo/archive/py2neo-2.0.8.tar.gz" version('2.0.8', 'e3ec5172a9e006515ef4155688a05a55') diff --git a/var/spack/repos/builtin/packages/py-scipy/package.py b/var/spack/repos/builtin/packages/py-scipy/package.py index cab516e1df..abb843f8ee 100644 --- a/var/spack/repos/builtin/packages/py-scipy/package.py +++ b/var/spack/repos/builtin/packages/py-scipy/package.py @@ -26,17 +26,25 @@ from spack import * class PyScipy(Package): - """Scientific Library for Python.""" + """SciPy (pronounced "Sigh Pie") is a Scientific Library for Python. + It provides many user-friendly and efficient numerical routines such + as routines for numerical integration and optimization.""" + homepage = "http://www.scipy.org/" - url = "https://pypi.python.org/packages/source/s/scipy/scipy-0.15.0.tar.gz" + url = "https://pypi.python.org/packages/source/s/scipy/scipy-0.15.0.tar.gz" + version('0.18.1', '5fb5fb7ccb113ab3a039702b6c2f3327', + url="https://pypi.python.org/packages/22/41/b1538a75309ae4913cdbbdc8d1cc54cae6d37981d2759532c1aa37a41121/scipy-0.18.1.tar.gz") version('0.17.0', '5ff2971e1ce90e762c59d2cd84837224') version('0.15.1', 'be56cd8e60591d6332aac792a5880110') version('0.15.0', '639112f077f0aeb6d80718dc5019dc7a') extends('python') + depends_on('python@2.6:2.8,3.2:') depends_on('py-nose', type='build') - depends_on('py-numpy+blas+lapack', type=nolink) + # Known not to work with 2.23, 2.25 + depends_on('binutils@2.26:', type='build') + depends_on('py-numpy@1.7.1:+blas+lapack', type=nolink) def install(self, spec, prefix): if 'atlas' in spec: @@ -45,7 +53,7 @@ class PyScipy(Package): env['ATLAS'] = join_path( spec['atlas'].prefix.lib, 'libatlas.' + dso_suffix) else: - env['BLAS'] = spec['blas'].blas_shared_lib - env['LAPACK'] = spec['lapack'].lapack_shared_lib + env['BLAS'] = spec['blas'].blas_libs.joined() + env['LAPACK'] = spec['lapack'].lapack_libs.joined() - python('setup.py', 'install', '--prefix=%s' % prefix) + setup_py('install', '--prefix={0}'.format(prefix)) diff --git a/var/spack/repos/builtin/packages/py-yt/package.py b/var/spack/repos/builtin/packages/py-yt/package.py new file mode 100644 index 0000000000..646bd4db2f --- /dev/null +++ b/var/spack/repos/builtin/packages/py-yt/package.py @@ -0,0 +1,78 @@ +############################################################################## +# 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 PyYt(Package): + """Volumetric Data Analysis + + yt is a python package for analyzing and visualizing + volumetric, multi-resolution data from astrophysical + simulations, radio telescopes, and a burgeoning + interdisciplinary community. + """ + homepage = "http://yt-project.org" + url = "https://bitbucket.org/yt_analysis/yt" + + version("3.3.1", hg="https://bitbucket.org/yt_analysis/yt", + tag="yt-3.3.1", commit="9bc3d0e9b750c923d44d73c447df64fc431f5838") + version("3.2.3", hg="https://bitbucket.org/yt_analysis/yt", + tag="yt-3.2.3", commit="83d2c1e9313e7d83eb5b96888451ff2646fd8ff3") + version("3.1.0", hg="https://bitbucket.org/yt_analysis/yt", + tag="yt-3.1.0", commit="fd7cdc4836188a3badf81adb477bcc1b9632e485") + version("3.0.2", hg="https://bitbucket.org/yt_analysis/yt", + tag="yt-3.0.2", commit="511887af4c995a78fe606e58ce8162c88380ecdc") + version("2.6.3", hg="https://bitbucket.org/yt_analysis/yt", + tag="yt-2.6.3", commit="816186f16396a16853810ac9ebcde5057d8d5b1a") + version("development", hg="https://bitbucket.org/yt_analysis/yt", + branch="yt") + + variant("astropy", default=True, description="enable astropy support") + variant("h5py", default=True, description="enable h5py support") + variant("scipy", default=True, description="enable scipy support") + + extends("python") + + depends_on("py-astropy", type="nolink", when="+astropy") + depends_on("py-cython", type="nolink") + depends_on("py-h5py", type="nolink", when="+h5py") + depends_on("py-ipython", type="nolink") + depends_on("py-matplotlib", type="nolink") + depends_on("py-numpy", type="nolink") + depends_on("py-scipy", type="nolink", when="+scipy") + depends_on("py-setuptools", type="build") + depends_on("py-sympy", type="nolink") + depends_on("python @2.7:2.999,3.4:") + + def install(self, spec, prefix): + setup_py("install", "--prefix=%s" % prefix) + self.check_install(spec, prefix) + + def check_install(self, spec, prefix): + # The Python interpreter path can be too long for this + # yt = Executable(join_path(prefix.bin, "yt")) + # yt("--help") + python(join_path(prefix.bin, "yt"), "--help") diff --git a/var/spack/repos/builtin/packages/python/ncurses.patch b/var/spack/repos/builtin/packages/python/ncurses.patch new file mode 100644 index 0000000000..9054c03e7b --- /dev/null +++ b/var/spack/repos/builtin/packages/python/ncurses.patch @@ -0,0 +1,11 @@ +--- a/setup.py 2016-08-30 15:39:59.334926574 -0500 ++++ b/setup.py 2016-08-30 15:46:57.227946339 -0500 +@@ -745,8 +745,6 @@ + # use the same library for the readline and curses modules. + if 'curses' in readline_termcap_library: + curses_library = readline_termcap_library +- elif self.compiler.find_library_file(lib_dirs, 'ncursesw'): +- curses_library = 'ncursesw' + elif self.compiler.find_library_file(lib_dirs, 'ncurses'): + curses_library = 'ncurses' + elif self.compiler.find_library_file(lib_dirs, 'curses'): diff --git a/var/spack/repos/builtin/packages/python/package.py b/var/spack/repos/builtin/packages/python/package.py index 57783b0542..f3380cf75d 100644 --- a/var/spack/repos/builtin/packages/python/package.py +++ b/var/spack/repos/builtin/packages/python/package.py @@ -74,6 +74,8 @@ class Python(Package): depends_on("tk", when="+tk") depends_on("tcl", when="+tk") + patch('ncurses.patch') + @when('@2.7,3.4:') def patch(self): # NOTE: Python's default installation procedure makes it possible for a @@ -110,6 +112,8 @@ class Python(Package): 'CPPFLAGS=-I{0}'.format(' -I'.join(dp.include for dp in dep_pfxs)), 'LDFLAGS=-L{0}'.format(' -L'.join(dp.lib for dp in dep_pfxs)), ] + if spec.satisfies("platform=darwin") and ('%gcc' in spec): + config_args.append('--disable-toolbox-glue') if '+ucs4' in spec: if spec.satisfies('@:2.7'): diff --git a/var/spack/repos/builtin/packages/qt/package.py b/var/spack/repos/builtin/packages/qt/package.py index 436702fa4e..2dba05ce13 100644 --- a/var/spack/repos/builtin/packages/qt/package.py +++ b/var/spack/repos/builtin/packages/qt/package.py @@ -6,7 +6,7 @@ # Created by Todd Gamblin, tgamblin@llnl.gov, All rights reserved. # LLNL-CODE-647188 # -# For details, see https://github.com/llnl/spack +# For details, see https://github.com/llnl/spack # NOQA: ignore=E501 # Please also see the LICENSE file for our notice and the LGPL. # # This program is free software; you can redistribute it and/or modify @@ -24,13 +24,14 @@ ############################################################################## from spack import * import os +import sys class Qt(Package): """Qt is a comprehensive cross-platform C++ application framework.""" - homepage = 'http://qt.io' - url = 'http://download.qt.io/archive/qt/5.7/5.7.0/single/qt-everywhere-opensource-src-5.7.0.tar.gz' - list_url = 'http://download.qt.io/archive/qt/' + homepage = 'http://qt.io' # NOQA: ignore=E501 + url = 'http://download.qt.io/archive/qt/5.7/5.7.0/single/qt-everywhere-opensource-src-5.7.0.tar.gz' # NOQA: ignore=E501 + list_url = 'http://download.qt.io/archive/qt/' # NOQA: ignore=E501 list_depth = 4 version('5.7.0', '9a46cce61fc64c20c3ac0a0e0fa41b42') @@ -47,19 +48,25 @@ class Qt(Package): variant('krellpatch', default=False, description="Build with openspeedshop based patch.") variant('mesa', default=False, description="Depend on mesa.") variant('gtk', default=False, description="Build with gtkplus.") + variant('examples', default=False, description="Build examples.") + variant('dbus', default=False, description="Build with D-Bus support.") patch('qt3krell.patch', when='@3.3.8b+krellpatch') - # https://github.com/xboxdrv/xboxdrv/issues/188 + # https://github.com/xboxdrv/xboxdrv/issues/188 # NOQA: ignore=E501 patch('btn_trigger_happy.patch', when='@5.7.0:') + patch('qt4-corewlan-new-osx.patch', when='@4') + patch('qt4-pcre-include-conflict.patch', when='@4') + patch('qt4-el-capitan.patch', when='@4') + # Use system openssl for security. - # depends_on("openssl") + depends_on("openssl") depends_on("gtkplus", when='+gtk') depends_on("libxml2") depends_on("zlib") - depends_on("dbus", when='@4:') + depends_on("dbus", when='@4:+dbus') depends_on("libtiff") depends_on("libpng@1.2.56", when='@3') depends_on("libpng", when='@4:') @@ -71,11 +78,11 @@ class Qt(Package): # depends_on("flex", type='build') # depends_on("bison", type='build') # depends_on("ruby", type='build') - # depends_on("icu4c") + depends_on("icu4c") # OpenGL hardware acceleration depends_on("mesa", when='@4:+mesa') - depends_on("libxcb") + depends_on("libxcb", when=sys.platform != 'darwin') def url_for_version(self, version): # URL keeps getting more complicated with every release @@ -123,7 +130,7 @@ class Qt(Package): 'mkspecs/common/g++-base.conf') # Necessary to build with GCC 6 and other modern compilers - # http://stackoverflow.com/questions/10354371/ + # http://stackoverflow.com/questions/10354371/ # NOQA: ignore=E501 filter_file('(^QMAKE_CXXFLAGS .*)', r'\1 -std=gnu++98', 'mkspecs/common/gcc-base.conf') @@ -143,7 +150,7 @@ class Qt(Package): @property def common_config_args(self): - return [ + config_args = [ '-prefix', self.prefix, '-v', '-opensource', @@ -152,7 +159,6 @@ class Qt(Package): '-shared', '-confirm-license', '-openssl-linked', - '-dbus-linked', '-optimized-qmake', '-no-openvg', '-no-pch', @@ -160,10 +166,53 @@ class Qt(Package): '-no-nis' ] + if '~examples' in self.spec: + config_args.extend(['-nomake', 'examples']) + + if '@4' in self.spec: + config_args.append('-no-phonon') + + if '+dbus' in self.spec: + config_args.append('-dbus-linked') + else: + config_args.append('-no-dbus') + + if '@5:' in self.spec and sys.platform == 'darwin': + config_args.extend([ + '-no-xinput2', + '-no-xcb-xlib', + '-no-pulseaudio', + '-no-alsa', + '-no-gtkstyle', + ]) + + if '@4' in self.spec and sys.platform == 'darwin': + sdkpath = which('xcrun')('--show-sdk-path', + # XXX(macos): 10.11 SDK fails to configure + '--sdk', 'macosx10.9', + output=str) + config_args.extend([ + '-sdk', sdkpath.strip(), + ]) + use_clang_platform = False + if self.spec.compiler.name == 'clang' and \ + str(self.spec.compiler.version).endwith('-apple'): + use_clang_platform = True + # No one uses gcc-4.2.1 anymore; this is clang. + if self.spec.compiler.name == 'gcc' and \ + str(self.spec.compiler.version) == '4.2.1': + use_clang_platform = True + if use_clang_platform: + config_args.extend([ + '-platform', 'unsupported/macx-clang', + ]) + + return config_args + # Don't disable all the database drivers, but should # really get them into spack at some point. - @when('@3') + @when('@3') # NOQA: ignore=F811 def configure(self): # A user reported that this was necessary to link Qt3 on ubuntu os.environ['LD_LIBRARY_PATH'] = os.getcwd() + '/lib' @@ -174,30 +223,36 @@ class Qt(Package): '-release', '-fast') - @when('@4') + @when('@4') # NOQA: ignore=F811 def configure(self): configure('-fast', '-no-webkit', '{0}-gtkstyle'.format('' if '+gtk' in self.spec else '-no'), + '-arch', str(self.spec.architecture.target), *self.common_config_args) - @when('@5.0:5.6') + @when('@5.0:5.6') # NOQA: ignore=F811 def configure(self): configure('-no-eglfs', '-no-directfb', - '-qt-xcb', '{0}-gtkstyle'.format('' if '+gtk' in self.spec else '-no'), '-skip', 'qtwebkit', *self.common_config_args) - @when('@5.7:') + @when('@5.7:') # NOQA: ignore=F811 def configure(self): + args = self.common_config_args + + if not sys.platform == 'darwin': + args.extend([ + '-qt-xcb', + ]) + configure('-no-eglfs', '-no-directfb', - '-qt-xcb', '{0}-gtk'.format('' if '+gtk' in self.spec else '-no'), '-skip', 'webengine', - *self.common_config_args) + *args) def install(self, spec, prefix): self.configure() diff --git a/var/spack/repos/builtin/packages/qt/qt4-corewlan-new-osx.patch b/var/spack/repos/builtin/packages/qt/qt4-corewlan-new-osx.patch new file mode 100644 index 0000000000..370edf7fa5 --- /dev/null +++ b/var/spack/repos/builtin/packages/qt/qt4-corewlan-new-osx.patch @@ -0,0 +1,16 @@ +diff -Nr -U5 qt-everywhere-opensource-src-4.8.6/src/plugins/bearer/corewlan/corewlan.pro qt-everywhere-opensource-src-4.8.6.corewlan-new-osx/src/plugins/bearer/corewlan/corewlan.pro +--- qt-everywhere-opensource-src-4.8.6/src/plugins/bearer/corewlan/corewlan.pro 2014-04-10 14:37:12.000000000 -0400 ++++ qt-everywhere-opensource-src-4.8.6.corewlan-new-osx/src/plugins/bearer/corewlan/corewlan.pro 2015-12-02 12:21:34.608585392 -0500 +@@ -3,11 +3,11 @@ + + QT = core network + LIBS += -framework Foundation -framework SystemConfiguration + + contains(QT_CONFIG, corewlan) { +- isEmpty(QMAKE_MAC_SDK)|contains(QMAKE_MAC_SDK, "/Developer/SDKs/MacOSX10\.[67]\.sdk") { ++ isEmpty(QMAKE_MAC_SDK)|contains(QMAKE_MAC_SDK, ".*MacOSX10\.([6789]|1[01])\.sdk") { + LIBS += -framework CoreWLAN -framework Security + } + } + + HEADERS += qcorewlanengine.h \ diff --git a/var/spack/repos/builtin/packages/qt/qt4-el-capitan.patch b/var/spack/repos/builtin/packages/qt/qt4-el-capitan.patch new file mode 100644 index 0000000000..35f154d3b0 --- /dev/null +++ b/var/spack/repos/builtin/packages/qt/qt4-el-capitan.patch @@ -0,0 +1,31 @@ +From 27aa46933bb32a88c310fe5918a49a3f34d65dfe Mon Sep 17 00:00:00 2001 +From: Mike McQuaid <mike@mikemcquaid.com> +Date: Sun, 13 Sep 2015 11:55:59 +0100 +Subject: [PATCH] Fix El Capitan build. + +--- + src/gui/painting/qpaintengine_mac.cpp | 8 +------- + 1 file changed, 1 insertion(+), 7 deletions(-) + +diff --git a/src/gui/painting/qpaintengine_mac.cpp b/src/gui/painting/qpaintengine_mac.cpp +index 4aa0668..63b646d 100644 +--- a/src/gui/painting/qpaintengine_mac.cpp ++++ b/src/gui/painting/qpaintengine_mac.cpp +@@ -340,13 +340,7 @@ CGColorSpaceRef QCoreGraphicsPaintEngine::macDisplayColorSpace(const QWidget *wi + } + + // Get the color space from the display profile. +- CGColorSpaceRef colorSpace = 0; +- CMProfileRef displayProfile = 0; +- CMError err = CMGetProfileByAVID((CMDisplayIDType)displayID, &displayProfile); +- if (err == noErr) { +- colorSpace = CGColorSpaceCreateWithPlatformColorSpace(displayProfile); +- CMCloseProfile(displayProfile); +- } ++ CGColorSpaceRef colorSpace = CGDisplayCopyColorSpace(displayID); + + // Fallback: use generic DeviceRGB + if (colorSpace == 0) +-- +2.3.8 (Apple Git-58) + diff --git a/var/spack/repos/builtin/packages/qt/qt4-pcre-include-conflict.patch b/var/spack/repos/builtin/packages/qt/qt4-pcre-include-conflict.patch new file mode 100644 index 0000000000..854e564bfb --- /dev/null +++ b/var/spack/repos/builtin/packages/qt/qt4-pcre-include-conflict.patch @@ -0,0 +1,16 @@ +diff -U5 -Nru qt-everywhere-opensource-src-4.8.6/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.h qt-everywhere-opensource-src-4.8.6.pcre/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.h +--- qt-everywhere-opensource-src-4.8.6/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.h 2014-04-10 14:37:12.000000000 -0400 ++++ qt-everywhere-opensource-src-4.8.6.pcre/src/3rdparty/javascriptcore/JavaScriptCore/yarr/RegexJIT.h 2016-08-29 15:30:02.216546252 -0400 +@@ -32,11 +32,11 @@ + + #include "MacroAssembler.h" + #include "RegexPattern.h" + #include <UString.h> + +-#include <pcre.h> ++#include <pcre/pcre.h> + struct JSRegExp; // temporary, remove when fallback is removed. + + #if CPU(X86) && !COMPILER(MSVC) + #define YARR_CALL __attribute__ ((regparm (3))) + #else diff --git a/var/spack/repos/builtin/packages/qthreads/ldflags.patch b/var/spack/repos/builtin/packages/qthreads/ldflags.patch deleted file mode 100644 index 0c15eab386..0000000000 --- a/var/spack/repos/builtin/packages/qthreads/ldflags.patch +++ /dev/null @@ -1,11 +0,0 @@ ---- a/configure -+++ b/configure -@@ -40456,7 +40456,7 @@ - hwloc_saved_LDFLAGS="$LDFLAGS" - if test "x$with_hwloc" != x; then - CPPFLAGS="-I$with_hwloc/include $CPPFLAGS" -- LDFLAGS="-L$with_hwloc/lib $CPPFLAGS" -+ LDFLAGS="-L$with_hwloc/lib $LDFLAGS" - fi - - diff --git a/var/spack/repos/builtin/packages/qthreads/package.py b/var/spack/repos/builtin/packages/qthreads/package.py index 8d5cc87062..aa2f0ac67a 100644 --- a/var/spack/repos/builtin/packages/qthreads/package.py +++ b/var/spack/repos/builtin/packages/qthreads/package.py @@ -38,28 +38,16 @@ class Qthreads(Package): attain either state.""" homepage = "http://www.cs.sandia.gov/qthreads/" - # Google Code has stopped serving tarballs - # We assume the tarballs will soon be available on Github instead - # url = "https://qthreads.googlecode.com/files/qthread-1.10.tar.bz2" - # version('1.10', '5af8c8bbe88c2a6d45361643780d1671') + url = "https://github.com/Qthreads/qthreads/releases/download/1.10/qthread-1.10.tar.bz2" + version("1.11", "68b5f9a41cfd1a2ac112cc4db0612326") + version("1.10", "d1cf3cf3f30586921359f7840171e551") - # Temporarily install from a git branch - url = "https://github.com/Qthreads/qthreads" - version("1.10", - git="https://github.com/Qthreads/qthreads", - branch="release-1.10") + patch("restrict.patch", when="@:1.10") + patch("trap.patch", when="@:1.10") - # patch("ldflags.patch") - patch("restrict.patch") - patch("trap.patch") - - depends_on("autoconf", type="build") - depends_on("automake", type="build") depends_on("hwloc") def install(self, spec, prefix): - autogen = Executable("./autogen.sh") - autogen() configure("--prefix=%s" % prefix, "--enable-guard-pages", "--with-topology=hwloc", diff --git a/var/spack/repos/builtin/packages/r-stringi/package.py b/var/spack/repos/builtin/packages/r-stringi/package.py index 22774dedec..cc57caf8cd 100644 --- a/var/spack/repos/builtin/packages/r-stringi/package.py +++ b/var/spack/repos/builtin/packages/r-stringi/package.py @@ -44,7 +44,7 @@ class RStringi(Package): extends('R') - depends_on('icu') + depends_on('icu4c') def install(self, spec, prefix): R('CMD', 'INSTALL', '--library={0}'.format(self.module.r_lib_dir), diff --git a/var/spack/repos/builtin/packages/root/math_uint.patch b/var/spack/repos/builtin/packages/root/math_uint.patch new file mode 100644 index 0000000000..ff4a38b91c --- /dev/null +++ b/var/spack/repos/builtin/packages/root/math_uint.patch @@ -0,0 +1,115 @@ +From 5f3faffdd869bce5e254ae70f69290e4651a061d Mon Sep 17 00:00:00 2001 +From: Lorenzo Moneta <Lorenzo.Moneta@cern.ch> +Date: Mon, 4 Jan 2016 15:38:23 +0100 +Subject: [PATCH] Fix ROOT-7886. Use unsigned int instead of uint + +--- + math/mathcore/inc/Math/Delaunay2D.h | 2 +- + math/mathcore/src/Delaunay2D.cxx | 30 +++++++++++++++--------------- + 2 files changed, 16 insertions(+), 16 deletions(-) + +diff --git a/math/mathcore/inc/Math/Delaunay2D.h b/math/mathcore/inc/Math/Delaunay2D.h +index 6255e78..472bded 100644 +--- a/math/mathcore/inc/Math/Delaunay2D.h ++++ b/math/mathcore/inc/Math/Delaunay2D.h +@@ -273,7 +273,7 @@ class Delaunay2D { + double fYCellStep; //! inverse denominator to calculate X cell = fNCells / (fYNmax - fYNmin) + std::set<UInt_t> fCells[(fNCells+1)*(fNCells+1)]; //! grid cells with containing triangles + +- inline unsigned int Cell(uint x, uint y) const { ++ inline unsigned int Cell(UInt_t x, UInt_t y) const { + return x*(fNCells+1) + y; + } + +diff --git a/math/mathcore/src/Delaunay2D.cxx b/math/mathcore/src/Delaunay2D.cxx +index c4d4680..9a82858 100644 +--- a/math/mathcore/src/Delaunay2D.cxx ++++ b/math/mathcore/src/Delaunay2D.cxx +@@ -190,7 +190,7 @@ void Delaunay2D::DoFindTriangles() { + + Triangle tri; + +- auto transform = [&] (const uint i) { ++ auto transform = [&] (const unsigned int i) { + tri.x[i] = face.vertex(i)->point().x(); + tri.y[i] = face.vertex(i)->point().y(); + tri.idx[i] = face.vertex(i)->info(); +@@ -326,7 +326,7 @@ void Delaunay2D::DoFindTriangles() { + for(int t = 0; t < out.numberoftriangles; ++t){ + Triangle tri; + +- auto transform = [&] (const uint v) { ++ auto transform = [&] (const unsigned int v) { + //each triangle as numberofcorners vertices ( = 3) + tri.idx[v] = out.trianglelist[t*out.numberofcorners + v]; + +@@ -354,14 +354,14 @@ void Delaunay2D::DoFindTriangles() { + auto bx = std::minmax({tri.x[0], tri.x[1], tri.x[2]}); + auto by = std::minmax({tri.y[0], tri.y[1], tri.y[2]}); + +- uint cellXmin = CellX(bx.first); +- uint cellXmax = CellX(bx.second); ++ unsigned int cellXmin = CellX(bx.first); ++ unsigned int cellXmax = CellX(bx.second); + +- uint cellYmin = CellY(by.first); +- uint cellYmax = CellY(by.second); ++ unsigned int cellYmin = CellY(by.first); ++ unsigned int cellYmax = CellY(by.second); + +- for(uint i = cellXmin; i <= cellXmax; ++i) +- for(uint j = cellYmin; j <= cellYmax; ++j){ ++ for(unsigned int i = cellXmin; i <= cellXmax; ++i) ++ for(unsigned int j = cellYmin; j <= cellYmax; ++j){ + //printf("(%u,%u) = %u\n", i, j, Cell(i,j)); + fCells[Cell(i,j)].insert(t); + } +@@ -382,7 +382,7 @@ double Delaunay2D::DoInterpolateNormalized(double xx, double yy) + /// FindAllTriangles(); + + //see comment in header for CGAL fallback section +- auto bayCoords = [&] (const uint t) -> std::tuple<double, double, double> { ++ auto bayCoords = [&] (const unsigned int t) -> std::tuple<double, double, double> { + double la = ( (fTriangles[t].y[1] - fTriangles[t].y[2])*(xx - fTriangles[t].x[2]) + + (fTriangles[t].x[2] - fTriangles[t].x[1])*(yy - fTriangles[t].y[2]) ) * fTriangles[t].invDenom; + double lb = ( (fTriangles[t].y[2] - fTriangles[t].y[0])*(xx - fTriangles[t].x[2]) +@@ -401,7 +401,7 @@ double Delaunay2D::DoInterpolateNormalized(double xx, double yy) + if(cX < 0 || cX > fNCells || cY < 0 || cY > fNCells) + return fZout; //TODO some more fancy interpolation here + +- for(uint t : fCells[Cell(cX, cY)]){ ++ for(unsigned int t : fCells[Cell(cX, cY)]){ + auto coords = bayCoords(t); + + if(inTriangle(coords)){ +@@ -415,7 +415,7 @@ double Delaunay2D::DoInterpolateNormalized(double xx, double yy) + + //debugging + +- /*for(uint t = 0; t < fNdt; ++t){ ++ /*for(unsigned int t = 0; t < fNdt; ++t){ + auto coords = bayCoords(t); + + if(inTriangle(coords)){ +@@ -423,17 +423,17 @@ double Delaunay2D::DoInterpolateNormalized(double xx, double yy) + //brute force found a triangle -> grid not + printf("Found triangle %u for (%f,%f) -> (%u,%u)\n", t, xx,yy, cX, cY); + printf("Triangles in grid cell: "); +- for(uint x : fCells[Cell(cX, cY)]) ++ for(unsigned int x : fCells[Cell(cX, cY)]) + printf("%u ", x); + printf("\n"); + + printf("Triangle %u is in cells: ", t); +- for(uint i = 0; i <= fNCells; ++i) +- for(uint j = 0; j <= fNCells; ++j) ++ for(unsigned int i = 0; i <= fNCells; ++i) ++ for(unsigned int j = 0; j <= fNCells; ++j) + if(fCells[Cell(i,j)].count(t)) + printf("(%u,%u) ", i, j); + printf("\n"); +- for(uint i = 0; i < 3; ++i) ++ for(unsigned int i = 0; i < 3; ++i) + printf("\tpoint %u (%u): (%f,%f) -> (%u,%u)\n", i, fTriangles[t].idx[i], fTriangles[t].x[i], fTriangles[t].y[i], CellX(fTriangles[t].x[i]), CellY(fTriangles[t].y[i])); + + //we found the triangle -> interpolate using the barycentric interpolation diff --git a/var/spack/repos/builtin/packages/root/package.py b/var/spack/repos/builtin/packages/root/package.py new file mode 100644 index 0000000000..0f66dcebaa --- /dev/null +++ b/var/spack/repos/builtin/packages/root/package.py @@ -0,0 +1,89 @@ +############################################################################## +# 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 sys + + +class Root(Package): + """ROOT is a data analysis framework.""" + homepage = "https://root.cern.ch" + url = "https://root.cern.ch/download/root_v6.07.02.source.tar.gz" + + version('6.06.06', '4308449892210c8d36e36924261fea26') + version('6.06.04', '55a2f98dd4cea79c9c4e32407c2d6d17') + version('6.06.02', 'e9b8b86838f65b0a78d8d02c66c2ec55') + + if sys.platform == 'darwin': + patch('math_uint.patch', when='@6.06.02') + patch('root6-60606-mathmore.patch', when='@6.06.06') + + variant('graphviz', default=False, description='Enable graphviz support') + + depends_on("cmake", type='build') + depends_on("pcre") + depends_on("fftw") + depends_on("graphviz", when="+graphviz") + depends_on("python") + depends_on("gsl") + depends_on("libxml2+python") + depends_on("jpeg") + if sys.platform != 'darwin': + depends_on("libpng") + depends_on("openssl") + depends_on("freetype") + + def install(self, spec, prefix): + build_directory = join_path(self.stage.path, 'spack-build') + source_directory = self.stage.source_path + options = [source_directory] + if '+debug' in spec: + options.append('-DCMAKE_BUILD_TYPE:STRING=Debug') + else: + options.append('-DCMAKE_BUILD_TYPE:STRING=Release') + options.append('-Dcxx14=on') + options.append('-Dcocoa=off') + options.append('-Dbonjour=off') + options.append('-Dx11=on') + options.extend(std_cmake_args) + if sys.platform == 'darwin': + darwin_options = [ + '-Dcastor=OFF', + '-Drfio=OFF', + '-Ddcache=OFF'] + options.extend(darwin_options) + with working_dir(build_directory, create=True): + cmake(*options) + make() + make("install") + + def setup_dependent_environment(self, spack_env, run_env, dspec): + spack_env.set('ROOTSYS', self.prefix) + spack_env.set('ROOT_VERSION', 'v6') + spack_env.prepend_path('PYTHONPATH', self.prefix.lib) + + def url_for_version(self, version): + """Handle ROOT's unusual version string.""" + return "https://root.cern.ch/download/root_v%s.source.tar.gz" % version diff --git a/var/spack/repos/builtin/packages/root/root6-60606-mathmore.patch b/var/spack/repos/builtin/packages/root/root6-60606-mathmore.patch new file mode 100644 index 0000000000..d009a5af0d --- /dev/null +++ b/var/spack/repos/builtin/packages/root/root6-60606-mathmore.patch @@ -0,0 +1,29 @@ +diff --git a/math/mathmore/inc/Math/QuantFuncMathMore.h b/math/mathmore/inc/Math/QuantFuncMathMore.h +index fd6679c..03ccc03 100644 +--- a/math/mathmore/inc/Math/QuantFuncMathMore.h ++++ b/math/mathmore/inc/Math/QuantFuncMathMore.h +@@ -25,17 +25,6 @@ + **********************************************************************/ + + +-#if defined(__CINT__) && !defined(__MAKECINT__) +-// avoid to include header file when using CINT +-#ifndef _WIN32 +-#include "../lib/libMathMore.so" +-#else +-#include "../bin/libMathMore.dll" +-#endif +- +-#else +- +- + #ifndef ROOT_Math_QuantFuncMathMore + #define ROOT_Math_QuantFuncMathMore + +@@ -190,5 +179,3 @@ namespace MathMore { + + + #endif // ROOT_Math_QuantFuncMathMore +- +-#endif // if defined (__CINT__) && !defined(__MAKECINT__) + diff --git a/var/spack/repos/builtin/packages/samtools/package.py b/var/spack/repos/builtin/packages/samtools/package.py index 6b0b224785..b82a7e55d6 100644 --- a/var/spack/repos/builtin/packages/samtools/package.py +++ b/var/spack/repos/builtin/packages/samtools/package.py @@ -42,7 +42,8 @@ class Samtools(Package): def install(self, spec, prefix): if self.spec.version >= Version('1.3.1'): - configure('--prefix={0}'.format(prefix), '--with-ncurses') + configure('--prefix={0}'.format(prefix), '--with-ncurses', + 'CURSES_LIB=-lncurses') make() make('install') else: diff --git a/var/spack/repos/builtin/packages/silo/package.py b/var/spack/repos/builtin/packages/silo/package.py index 5113c88bdf..691d53a9f1 100644 --- a/var/spack/repos/builtin/packages/silo/package.py +++ b/var/spack/repos/builtin/packages/silo/package.py @@ -41,7 +41,8 @@ class Silo(Package): variant('silex', default=False, description='Builds Silex, a GUI for viewing Silo files') - depends_on('hdf5') + # silo uses the obsolete function H5Pset_fapl_mpiposix: + depends_on("hdf5 @:1.8.12") depends_on('qt', when='+silex') def install(self, spec, prefix): diff --git a/var/spack/repos/builtin/packages/spark/package.py b/var/spack/repos/builtin/packages/spark/package.py new file mode 100644 index 0000000000..10b0ebed7f --- /dev/null +++ b/var/spack/repos/builtin/packages/spark/package.py @@ -0,0 +1,75 @@ +############################################################################## +# Copyright (c) 2013-2016, Lawrence Livermore National Security, LLC. +# Produced at the Lawrence Livermore National Laboratory. +# +# This file is part of Spack. +# Created by Alfredo Gimenez, gimenez1@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 shutil + + +class Spark(Package): + """Apache Spark is a fast and general engine + for large-scale data processing. + """ + + homepage = "http://spark.apache.org" + url = "http://mirrors.ocf.berkeley.edu/apache/spark/spark-2.0.0/spark-2.0.0-bin-without-hadoop.tgz" + + variant('hadoop', default=False, + description='Build with Hadoop') + + depends_on('jdk', type=('build', 'run')) + depends_on('hadoop', when='+hadoop', type=('build', 'run')) + + version('2.0.0', '8a5307d973da6949a385aefb6ff747bb') + version('1.6.2', '304394fbe2899211217f0cd9e9b2b5d9') + version('1.6.1', 'fcf4961649f15af1fea78c882e65b001') + + def install(self, spec, prefix): + + def install_dir(dirname): + install_tree(dirname, join_path(prefix, dirname)) + + install_dir('bin') + install_dir('conf') + install_dir('jars') + install_dir('python') + install_dir('R') + install_dir('sbin') + install_dir('yarn') + + # required for spark to recognize binary distribution + shutil.copy('RELEASE', prefix) + + @when('+hadoop') + def setup_environment(self, spack_env, run_env): + + env['JAVA_HOME'] = self.spec['jdk'].prefix + # spack_env.set('JAVA_HOME', self.spec['jdk'].prefix) + + hadoop_bin_path = join_path(self.spec['hadoop'].prefix.bin, 'hadoop') + hadoop_bin = Executable(hadoop_bin_path) + hadoop_classpath = hadoop_bin('classpath', return_output=True) + + run_env.set('SPARK_DIST_CLASSPATH', hadoop_classpath) diff --git a/var/spack/repos/builtin/packages/stat/package.py b/var/spack/repos/builtin/packages/stat/package.py index 8c4663c524..eae4971ace 100644 --- a/var/spack/repos/builtin/packages/stat/package.py +++ b/var/spack/repos/builtin/packages/stat/package.py @@ -34,8 +34,8 @@ class Stat(Package): version('2.2.0', '26bd69dd57a15afdd5d0ebdb0b7fb6fc') version('2.1.0', 'ece26beaf057aa9134d62adcdda1ba91') version('2.0.0', 'c7494210b0ba26b577171b92838e1a9b') - version('3.0.0b', '8851912ba40e31cf7be6dde3be8e702c', - url='https://github.com/LLNL/STAT/files/427762/STAT-3.0.0b.tar.gz') + version('3.0.0', 'a97cb235c266371c4a26329112de48a2', + url='https://github.com/LLNL/STAT/releases/download/v3.0.0/STAT-3.0.0.tar.gz') # TODO: dysect requires Dyninst patch for version 3.0.0b variant('dysect', default=False, description="enable DySectAPI") diff --git a/var/spack/repos/builtin/packages/subversion/package.py b/var/spack/repos/builtin/packages/subversion/package.py index 26d143e4aa..02b7d96378 100644 --- a/var/spack/repos/builtin/packages/subversion/package.py +++ b/var/spack/repos/builtin/packages/subversion/package.py @@ -46,6 +46,9 @@ class Subversion(Package): # depends_on('perl') # depends_on('ruby') + # Installation has race cases. + parallel = False + def install(self, spec, prefix): # configure, build, install: diff --git a/var/spack/repos/builtin/packages/suite-sparse/package.py b/var/spack/repos/builtin/packages/suite-sparse/package.py index a71bfd8bd4..d6d8f71313 100644 --- a/var/spack/repos/builtin/packages/suite-sparse/package.py +++ b/var/spack/repos/builtin/packages/suite-sparse/package.py @@ -36,6 +36,7 @@ class SuiteSparse(Package): version('4.5.1', 'f0ea9aad8d2d1ffec66a5b6bfeff5319') variant('tbb', default=True, description='Build with Intel TBB') + variant('fpic', default=True, description='Build position independent code (required to link with shared libraries)') depends_on('blas') depends_on('lapack') @@ -63,6 +64,8 @@ class SuiteSparse(Package): 'CXX=c++', 'F77=f77', ]) + if '+fpic' in spec: + make_args.extend(['CFLAGS=-fPIC', 'FFLAGS=-fPIC']) # use Spack's metis in CHOLMOD/Partition module, # otherwise internal Metis will be compiled @@ -80,8 +83,8 @@ class SuiteSparse(Package): # Make sure Spack's Blas/Lapack is used. Otherwise System's # Blas/Lapack might be picked up. - blas = to_link_flags(spec['blas'].blas_shared_lib) - lapack = to_link_flags(spec['lapack'].lapack_shared_lib) + blas = spec['blas'].blas_libs.ld_flags + lapack = spec['lapack'].lapack_libs.ld_flags if '@4.5.1' in spec: # adding -lstdc++ is clearly an ugly way to do this, but it follows # with the TCOV path of SparseSuite 4.5.1's Suitesparse_config.mk diff --git a/var/spack/repos/builtin/packages/sundials/package.py b/var/spack/repos/builtin/packages/sundials/package.py index 7582954ab1..6ee247b7ea 100644 --- a/var/spack/repos/builtin/packages/sundials/package.py +++ b/var/spack/repos/builtin/packages/sundials/package.py @@ -31,7 +31,7 @@ class Sundials(Package): Solvers)""" homepage = "http://computation.llnl.gov/casc/sundials/" - url = "http://computation.llnl.gov/projects/sundials-suite-nonlinear-differential-algebraic-equation-solvers/download/sundials-2.6.2.tar.gz" + url = "http://computation.llnl.gov/projects/sundials-suite-nonlinear-differential-algebraic-equation-solvers/download/sundials-2.6.2.tar.gz" version('2.6.2', '3deeb0ede9f514184c6bd83ecab77d95') @@ -79,9 +79,9 @@ class Sundials(Package): 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 + '-DLAPACK_LIBRARIES={0}'.format( + (spec['lapack'].lapack_libs + + spec['blas'].blas_libs).joined(';') ) ]) else: @@ -113,7 +113,7 @@ class Sundials(Package): elif '+pthread' in spec: cmake_args.append('-DSUPERLUMT_THREAD_TYPE=Pthread') else: - msg = 'You must choose either +openmp or +pthread when ' + msg = 'You must choose either +openmp or +pthread when ' msg += 'building with SuperLU_MT' raise RuntimeError(msg) else: diff --git a/var/spack/repos/builtin/packages/superlu-dist/package.py b/var/spack/repos/builtin/packages/superlu-dist/package.py index 85b7f689d0..a29b74bf08 100644 --- a/var/spack/repos/builtin/packages/superlu-dist/package.py +++ b/var/spack/repos/builtin/packages/superlu-dist/package.py @@ -46,15 +46,14 @@ class SuperluDist(Package): depends_on('metis@5:') def install(self, spec, prefix): + lapack_blas = spec['lapack'].lapack_libs + spec['blas'].blas_libs makefile_inc = [] makefile_inc.extend([ 'PLAT = _mac_x', 'DSuperLUroot = %s' % self.stage.source_path, 'DSUPERLULIB = $(DSuperLUroot)/lib/libsuperlu_dist.a', 'BLASDEF = -DUSE_VENDOR_BLAS', - 'BLASLIB = %s %s' % - (to_link_flags(spec['lapack'].lapack_shared_lib), - to_link_flags(spec['blas'].blas_shared_lib)), + 'BLASLIB = %s' % lapack_blas.ld_flags, 'METISLIB = -L%s -lmetis' % spec['metis'].prefix.lib, 'PARMETISLIB = -L%s -lparmetis' % spec['parmetis'].prefix.lib, 'FLIBS =', diff --git a/var/spack/repos/builtin/packages/superlu-mt/package.py b/var/spack/repos/builtin/packages/superlu-mt/package.py index e849273e08..ea94c2d4c5 100644 --- a/var/spack/repos/builtin/packages/superlu-mt/package.py +++ b/var/spack/repos/builtin/packages/superlu-mt/package.py @@ -86,7 +86,7 @@ class SuperluMt(Package): if '+blas' in spec: config.extend([ 'BLASDEF = -DUSE_VENDOR_BLAS', - 'BLASLIB = -L{0} -lblas'.format(spec['blas'].prefix.lib) + 'BLASLIB = {0}'.format(spec['blas'].blas_libs.ld_flags) ]) else: config.append('BLASLIB = ../lib/libblas$(PLAT).a') diff --git a/var/spack/repos/builtin/packages/superlu/package.py b/var/spack/repos/builtin/packages/superlu/package.py index c634c1d1ba..d9cff650b6 100644 --- a/var/spack/repos/builtin/packages/superlu/package.py +++ b/var/spack/repos/builtin/packages/superlu/package.py @@ -42,7 +42,7 @@ class Superlu(Package): '-DCMAKE_POSITION_INDEPENDENT_CODE=ON', # BLAS support '-Denable_blaslib=OFF', - '-DBLAS_blas_LIBRARY={0}'.format(spec['blas'].blas_shared_lib) + '-DBLAS_blas_LIBRARY={0}'.format(spec['blas'].blas_libs.joined()) ] cmake_args.extend(std_cmake_args) diff --git a/var/spack/repos/builtin/packages/tmux/package.py b/var/spack/repos/builtin/packages/tmux/package.py index 573ee38a79..89c9751486 100644 --- a/var/spack/repos/builtin/packages/tmux/package.py +++ b/var/spack/repos/builtin/packages/tmux/package.py @@ -35,9 +35,10 @@ class Tmux(Package): homepage = "http://tmux.github.io" url = "https://github.com/tmux/tmux/releases/download/2.2/tmux-2.2.tar.gz" - version('1.9a', 'b07601711f96f1d260b390513b509a2d') - version('2.1', '74a2855695bccb51b6e301383ad4818c') + version('2.3', 'fcfd1611d705d8b31df3c26ebc93bd3e') version('2.2', 'bd95ee7205e489c62c616bb7af040099') + version('2.1', '74a2855695bccb51b6e301383ad4818c') + version('1.9a', 'b07601711f96f1d260b390513b509a2d') depends_on('libevent') depends_on('ncurses') diff --git a/var/spack/repos/builtin/packages/trilinos/package.py b/var/spack/repos/builtin/packages/trilinos/package.py index 3a88f67340..203e1502d6 100644 --- a/var/spack/repos/builtin/packages/trilinos/package.py +++ b/var/spack/repos/builtin/packages/trilinos/package.py @@ -45,6 +45,7 @@ class Trilinos(Package): homepage = "https://trilinos.org/" base_url = "https://github.com/trilinos/Trilinos/archive" + version('12.8.1', '01c0026f1e2050842857db941060ecd5') version('12.6.4', 'c2ea7b5aa0d10bcabdb9b9a6e3bac3ea') version('12.6.3', '8de5cc00981a0ca0defea6199b2fe4c1') version('12.6.2', 'dc7f9924872778798149ecadd81605a5') @@ -132,6 +133,8 @@ class Trilinos(Package): mpi_bin = spec['mpi'].prefix.bin # Note: -DXYZ_LIBRARY_NAMES= needs semicolon separated list of names + blas = spec['blas'].blas_libs + lapack = spec['lapack'].lapack_libs options.extend([ '-DTrilinos_ENABLE_ALL_PACKAGES:BOOL=ON', '-DTrilinos_ENABLE_ALL_OPTIONAL_PACKAGES:BOOL=ON', @@ -145,12 +148,10 @@ class Trilinos(Package): '-DTPL_ENABLE_MPI:BOOL=ON', '-DMPI_BASE_DIR:PATH=%s' % spec['mpi'].prefix, '-DTPL_ENABLE_BLAS=ON', - '-DBLAS_LIBRARY_NAMES=%s' % to_lib_name( - spec['blas'].blas_shared_lib), + '-DBLAS_LIBRARY_NAMES=%s' % ';'.join(blas.names), '-DBLAS_LIBRARY_DIRS=%s' % spec['blas'].prefix.lib, '-DTPL_ENABLE_LAPACK=ON', - '-DLAPACK_LIBRARY_NAMES=%s' % to_lib_name( - spec['lapack'].lapack_shared_lib), + '-DLAPACK_LIBRARY_NAMES=%s' % ';'.join(lapack.names), '-DLAPACK_LIBRARY_DIRS=%s' % spec['lapack'].prefix.lib, '-DTrilinos_ENABLE_EXPLICIT_INSTANTIATION:BOOL=ON', '-DTrilinos_ENABLE_CXX11:BOOL=ON', @@ -177,6 +178,15 @@ class Trilinos(Package): else: options.extend(['-DTPL_ENABLE_Boost:BOOL=OFF']) + if '+hdf5' in spec: + options.extend([ + '-DTPL_ENABLE_HDF5:BOOL=ON', + '-DHDF5_INCLUDE_DIRS:PATH=%s' % spec['hdf5'].prefix.include, + '-DHDF5_LIBRARY_DIRS:PATH=%s' % spec['hdf5'].prefix.lib + ]) + else: + options.extend(['-DTPL_ENABLE_HDF5:BOOL=OFF']) + # Fortran lib libgfortran = os.path.dirname(os.popen( '%s --print-file-name libgfortran.a' % diff --git a/var/spack/repos/builtin/packages/turbomole/package.py b/var/spack/repos/builtin/packages/turbomole/package.py index 6ccce23f97..b2d7e90057 100644 --- a/var/spack/repos/builtin/packages/turbomole/package.py +++ b/var/spack/repos/builtin/packages/turbomole/package.py @@ -29,14 +29,14 @@ import subprocess class Turbomole(Package): """TURBOMOLE: Program Package for ab initio Electronic Structure - Calculations. NB: Requires a license to download.""" - - # NOTE: Turbomole requires purchase of a license to download. Go to the - # NOTE: Turbomole home page, http://www.turbomole-gmbh.com, for details. - # NOTE: Spack will search the current directory for this file. It is - # NOTE: probably best to add this file to a Spack mirror so that it can be - # NOTE: found from anywhere. For information on setting up a Spack mirror - # NOTE: see http://software.llnl.gov/spack/mirrors.html + Calculations. + + Note: Turbomole requires purchase of a license to download. Go to the + Turbomole home page, http://www.turbomole-gmbh.com, for details. + Spack will search the current directory for this file. It is + probably best to add this file to a Spack mirror so that it can be + found from anywhere. For information on setting up a Spack mirror + see http://spack.readthedocs.io/en/latest/mirrors.html""" homepage = "http://www.turbomole-gmbh.com/" diff --git a/var/spack/repos/builtin/packages/uberftp/package.py b/var/spack/repos/builtin/packages/uberftp/package.py new file mode 100644 index 0000000000..b1b7dada6f --- /dev/null +++ b/var/spack/repos/builtin/packages/uberftp/package.py @@ -0,0 +1,44 @@ +############################################################################## +# 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 Uberftp(Package): + """UberFTP is an interactive (text-based) client for GridFTP""" + + homepage = "http://toolkit.globus.org/grid_software/data/uberftp.php" + url = "https://github.com/JasonAlt/UberFTP/archive/Version_2_8.tar.gz" + + version('2_8', 'bc7a159955a9c4b9f5f42f3d2b8fc830') + version('2_7', 'faaea2d6e1958c1105cfc9147824e03c') + version('2_6', '784210976f259f9d19c0798c19778d34') + + depends_on('globus_toolkit') + + def install(self, spec, prefix): + configure('--prefix={0}'.format(prefix)) + + make() + make('install') diff --git a/var/spack/repos/builtin/packages/vim/package.py b/var/spack/repos/builtin/packages/vim/package.py index 5f2e5e19d9..26aeb4aad9 100644 --- a/var/spack/repos/builtin/packages/vim/package.py +++ b/var/spack/repos/builtin/packages/vim/package.py @@ -38,6 +38,7 @@ class Vim(Package): url = "ftp://ftp.vim.org/pub/vim/unix/vim-7.4.tar.bz2" list_url = "http://ftp.vim.org/pub/vim/unix/" + version('8.0', '808d2ebdab521e18bc5e0eaede0db867') version('7.4', '607e135c559be642f210094ad023dc65') version('7.3', '5b9510a17074e2b37d8bb38ae09edbf2') version('7.2', 'f0901284b338e448bfd79ccca0041254') @@ -66,6 +67,8 @@ class Vim(Package): variant('gui', default=False, description="build with gui (gvim)") # virtual dependency? + depends_on('ncurses', when="@8.0:") + def install(self, spec, prefix): feature_set = None for fs in self.feature_sets: diff --git a/var/spack/repos/builtin/packages/visit/package.py b/var/spack/repos/builtin/packages/visit/package.py index d88caeb00a..5d2ab24cc5 100644 --- a/var/spack/repos/builtin/packages/visit/package.py +++ b/var/spack/repos/builtin/packages/visit/package.py @@ -31,13 +31,15 @@ class Visit(Package): homepage = "https://wci.llnl.gov/simulation/computer-codes/visit/" url = "http://portal.nersc.gov/project/visit/releases/2.10.1/visit2.10.1.tar.gz" - version('2.10.1', '3cbca162fdb0249f17c4456605c4211e') + version('2.10.3', 'a1082a6f6dab3e2dcb58993603456c2b') version('2.10.2', '253de0837a9d69fb689befc98ea4d068') + version('2.10.1', '3cbca162fdb0249f17c4456605c4211e') depends_on("vtk@6.1.0~opengl2") depends_on("qt@4.8.6") depends_on("python") depends_on("silo+shared") + depends_on("hdf5~mpi") def install(self, spec, prefix): with working_dir('spack-build', create=True): @@ -46,6 +48,7 @@ class Visit(Package): feature_args.extend([ "-DVTK_MAJOR_VERSION=6", "-DVTK_MINOR_VERSION=1", + "-DVISIT_USE_GLEW=OFF", "-DVISIT_LOC_QMAKE_EXE:FILEPATH=%s/qmake-qt4" % spec[ 'qt'].prefix.bin, "-DPYTHON_EXECUTABLE:FILEPATH=%s/python" % spec[ diff --git a/var/spack/repos/builtin/packages/vtk/gcc.patch b/var/spack/repos/builtin/packages/vtk/gcc.patch new file mode 100644 index 0000000000..37ba5ac45a --- /dev/null +++ b/var/spack/repos/builtin/packages/vtk/gcc.patch @@ -0,0 +1,21 @@ +--- old/CMake/vtkCompilerExtras.cmake ++++ new/CMake/vtkCompilerExtras.cmake +@@ -26,6 +26,8 @@ + execute_process(COMMAND ${CMAKE_C_COMPILER} --version + OUTPUT_VARIABLE _gcc_version_info + ERROR_VARIABLE _gcc_version_info) ++ ++ string (REPLACE ";" "" _gcc_version_info "${_gcc_version_info}") + + string (REGEX MATCH "[345]\\.[0-9]\\.[0-9]" + _gcc_version "${_gcc_version_info}") +--- old/CMake/GenerateExportHeader.cmake ++++ new/CMake/GenerateExportHeader.cmake +@@ -166,6 +166,7 @@ + execute_process(COMMAND ${CMAKE_C_COMPILER} --version + OUTPUT_VARIABLE _gcc_version_info + ERROR_VARIABLE _gcc_version_info) ++ string (REPLACE ";" "" _gcc_version_info "${_gcc_version_info}") + string(REGEX MATCH "[345]\\.[0-9]\\.[0-9]" + _gcc_version "${_gcc_version_info}") + # gcc on mac just reports: "gcc (GCC) 3.3 20030304 ..." without the diff --git a/var/spack/repos/builtin/packages/vtk/package.py b/var/spack/repos/builtin/packages/vtk/package.py index 087c0e93eb..f7015904b0 100644 --- a/var/spack/repos/builtin/packages/vtk/package.py +++ b/var/spack/repos/builtin/packages/vtk/package.py @@ -40,6 +40,8 @@ class Vtk(Package): version('6.1.0', '25e4dfb3bad778722dcaec80cd5dab7d') + patch("gcc.patch") + depends_on('cmake', type='build') depends_on("qt") diff --git a/var/spack/repos/builtin/packages/wannier90/make.sys b/var/spack/repos/builtin/packages/wannier90/make.sys new file mode 100644 index 0000000000..f96fa23fb2 --- /dev/null +++ b/var/spack/repos/builtin/packages/wannier90/make.sys @@ -0,0 +1,7 @@ +F90 = @F90 +COMMS=mpi +MPIF90=@MPIF90 +FCOPTS=-O2 -fpic +LDOPTS=-O2 -fpic + +LIBS = @LIBS diff --git a/var/spack/repos/builtin/packages/wannier90/package.py b/var/spack/repos/builtin/packages/wannier90/package.py new file mode 100644 index 0000000000..119d2cf769 --- /dev/null +++ b/var/spack/repos/builtin/packages/wannier90/package.py @@ -0,0 +1,116 @@ +############################################################################## +# 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 +############################################################################## +import inspect +import os.path +import shutil + +from spack import * + + +class Wannier90(Package): + """Wannier90 calculates maximally-localised Wannier functions (MLWFs). + + Wannier90 is released under the GNU General Public License. + """ + homepage = 'http://wannier.org' + url = 'http://wannier.org/code/wannier90-2.0.1.tar.gz' + + version('2.0.1', '4edd742506eaba93317249d33261fb22') + + depends_on('mpi') + depends_on('lapack') + depends_on('blas') + + parallel = False + + def install(self, spec, prefix): + + lapack = self.spec['lapack'].lapack_libs + blas = self.spec['blas'].blas_libs + substitutions = { + '@F90': spack_fc, + '@MPIF90': self.spec['mpi'].mpifc, + '@LIBS': (lapack + blas).joined() + } + ####### + # TODO : this part is replicated in PEXSI + # TODO : and may be a common pattern for Editable Makefiles + # TODO : see #1186 + template = join_path( + os.path.dirname(inspect.getmodule(self).__file__), + 'make.sys' + ) + makefile = join_path( + self.stage.source_path, + 'make.sys' + ) + + shutil.copy(template, makefile) + for key, value in substitutions.items(): + filter_file(key, value, makefile) + ###### + + make('wannier') + mkdirp(self.prefix.bin) + install( + join_path(self.stage.source_path, 'wannier90.x'), + join_path(self.prefix.bin, 'wannier90.x') + ) + + make('post') + install( + join_path(self.stage.source_path, 'postw90.x'), + join_path(self.prefix.bin, 'postw90.x') + ) + + make('lib') + mkdirp(self.prefix.lib) + install( + join_path(self.stage.source_path, 'libwannier.a'), + join_path(self.prefix.lib, 'libwannier.a') + ) + + make('w90chk2chk') + install( + join_path(self.stage.source_path, 'w90chk2chk.x'), + join_path(self.prefix.bin, 'w90chk2chk.x') + ) + + make('w90vdw') + install( + join_path(self.stage.source_path, 'utility', 'w90vdw', 'w90vdw.x'), + join_path(self.prefix.bin, 'w90vdw.x') + ) + + make('w90pov') + install( + join_path(self.stage.source_path, 'utility', 'w90pov', 'w90pov'), + join_path(self.prefix.bin, 'w90pov') + ) + + install_tree( + join_path(self.stage.source_path, 'pseudo'), + join_path(self.prefix.bin, 'pseudo') + ) diff --git a/var/spack/repos/builtin/packages/xorg-util-macros/package.py b/var/spack/repos/builtin/packages/xorg-util-macros/package.py index cd50d46826..3cfc4c2408 100644 --- a/var/spack/repos/builtin/packages/xorg-util-macros/package.py +++ b/var/spack/repos/builtin/packages/xorg-util-macros/package.py @@ -28,7 +28,7 @@ from spack import * class XorgUtilMacros(Package): """The m4 macros used by all of the Xorg packages.""" - homepage = "http://www.example.com" + homepage = "https://cgit.freedesktop.org/xorg/util/macros/" url = "http://ftp.x.org/pub/individual/util/util-macros-1.19.0.tar.bz2" version('1.19.0', '1cf984125e75f8204938d998a8b6c1e1') diff --git a/var/spack/repos/builtin/packages/icu/package.py b/var/spack/repos/builtin/packages/xrootd/package.py index b8d366b905..db076dbc56 100644 --- a/var/spack/repos/builtin/packages/icu/package.py +++ b/var/spack/repos/builtin/packages/xrootd/package.py @@ -22,27 +22,31 @@ # 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 Icu(Package): - """The International Components for Unicode (ICU) package is a - mature, widely used set of C/C++ libraries providing Unicode and - Globalization support for software applications. ICU is widely - portable and gives applications the same results on all - platforms.""" - # FIXME: add a proper url for your package's homepage here. - homepage = "http://www.example.com" - url = "http://download.icu-project.org/files/icu4c/54.1/icu4c-54_1-src.tgz" +class Xrootd(Package): + """The XROOTD project aims at giving high performance, scalable fault + tolerant access to data repositories of many kinds.""" + homepage = "http://xrootd.org" + url = "http://xrootd.org/download/v4.3.0/xrootd-4.3.0.tar.gz" - version('54.1', 'e844caed8f2ca24c088505b0d6271bc0') + version('4.3.0', '39c2fab9f632f35e12ff607ccaf9e16c') - def url_for_version(self, version): - return "http://download.icu-project.org/files/icu4c/%s/icu4c-%s-src.tgz" % ( - version, str(version).replace('.', '_')) + depends_on('cmake', type='build') def install(self, spec, prefix): - with working_dir("source"): - configure("--prefix=%s" % prefix) + options = [] + options.extend(std_cmake_args) + + build_directory = join_path(self.stage.path, 'spack-build') + source_directory = self.stage.source_path + + if '+debug' in spec: + options.append('-DCMAKE_BUILD_TYPE:STRING=Debug') + + with working_dir(build_directory, create=True): + cmake(source_directory, *options) make() make("install") diff --git a/var/spack/repos/builtin/packages/zoltan/package.py b/var/spack/repos/builtin/packages/zoltan/package.py index 0094395968..8d4dd321b0 100644 --- a/var/spack/repos/builtin/packages/zoltan/package.py +++ b/var/spack/repos/builtin/packages/zoltan/package.py @@ -22,10 +22,11 @@ # 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 re import os import glob -from spack import * class Zoltan(Package): @@ -47,23 +48,28 @@ class Zoltan(Package): version('3.6', '9cce794f7241ecd8dbea36c3d7a880f9') version('3.3', '5eb8f00bda634b25ceefa0122bd18d65') - variant('debug', default=False, - description='Builds a debug version of the library') - variant('shared', default=True, - description='Builds a shared version of the library') + variant('debug', default=False, description='Builds a debug version of the library.') + variant('shared', default=True, description='Builds a shared version of the library.') - variant('fortran', default=True, description='Enable Fortran support') - variant('mpi', default=False, description='Enable MPI support') + variant('fortran', default=True, description='Enable Fortran support.') + variant('mpi', default=True, description='Enable MPI support.') depends_on('mpi', when='+mpi') + def url_for_version(self, version): + return '%s/zoltan_distrib_v%s.tar.gz' % (Zoltan.base_url, version) + def install(self, spec, prefix): - config_args = [ - '--enable-f90interface' - if '+fortan' in spec else '--disable-f90interface', + # FIXME: The older Zoltan versions fail to compile the F90 MPI wrappers + # because of some complicated generic type problem. + if spec.satisfies('@:3.6+fortran+mpi'): + raise RuntimeError(('Cannot build Zoltan v{0} with +fortran and ' + '+mpi; please disable one of these features ' + 'or upgrade versions.').format(self.version)) - '--enable-mpi' - if '+mpi' in spec else '--disable-mpi', + config_args = [ + self.get_config_flag('f90interface', 'fortran'), + self.get_config_flag('mpi', 'mpi'), ] config_cflags = [ '-O0' if '+debug' in spec else '-O3', @@ -71,49 +77,70 @@ class Zoltan(Package): ] if '+shared' in spec: - config_args.append('--with-ar=$(CXX) -shared $(LDFLAGS) -o') config_args.append('RANLIB=echo') + config_args.append('--with-ar=$(CXX) -shared $(LDFLAGS) -o') config_cflags.append('-fPIC') + if spec.satisfies('%gcc'): + config_args.append('--with-libs={0}'.format('-lgfortran')) if '+mpi' in spec: - config_args.append('CC=%s/mpicc' % spec['mpi'].prefix.bin) - config_args.append('CXX=%s/mpicxx' % spec['mpi'].prefix.bin) - config_args.append('--with-mpi=%s' % spec['mpi'].prefix) - config_args.append('--with-mpi-compilers=%s' % - spec['mpi'].prefix.bin) + config_args.append('CC={0}'.format(spec['mpi'].mpicc)) + config_args.append('CXX={0}'.format(spec['mpi'].mpicxx)) + config_args.append('FC={0}'.format(spec['mpi'].mpifc)) + + mpi_libs = ' -l'.join(self.get_mpi_libs()) + config_args.append('--with-mpi={0}'.format(spec['mpi'].prefix)) + config_args.append('--with-mpi-libs=-l{0}'.format(mpi_libs)) # NOTE: Early versions of Zoltan come packaged with a few embedded # library packages (e.g. ParMETIS, Scotch), which messes with Spack's # ability to descend directly into the package's source directory. + source_directory = self.stage.source_path if spec.satisfies('@:3.6'): - cd('Zoltan_v%s' % self.version) - - mkdirp('build') - cd('build') - - config_zoltan = Executable('../configure') - config_zoltan( - '--prefix=%s' % pwd(), - '--with-cflags=%s' % ' '.join(config_cflags), - '--with-cxxflags=%s' % ' '.join(config_cflags), - *config_args) - - make() - make('install') + zoltan_directory = 'Zoltan_v{0}'.format(self.version) + source_directory = join_path(source_directory, zoltan_directory) + + build_directory = join_path(source_directory, 'build') + with working_dir(build_directory, create=True): + config = Executable(join_path(source_directory, 'configure')) + config( + '--prefix={0}'.format(prefix), + '--with-cflags={0}'.format(' '.join(config_cflags)), + '--with-cxxflags={0}'.format(' '.join(config_cflags)), + '--with-fcflags={0}'.format(' '.join(config_cflags)), + *config_args + ) + + # NOTE: Earlier versions of Zoltan cannot be built in parallel + # because they contain nested Makefile dependency bugs. + make(parallel=not spec.satisfies('@:3.6+fortran')) + make('install') # NOTE: Unfortunately, Zoltan doesn't provide any configuration # options for the extension of the output library files, so this # script must change these extensions as a post-processing step. if '+shared' in spec: - for libpath in glob.glob('lib/*.a'): - libdir, libname = (os.path.dirname(libpath), - os.path.basename(libpath)) - move(libpath, os.path.join( - libdir, re.sub(r'\.a$', '.so', libname))) - - mkdirp(prefix) - move('include', prefix) - move('lib', prefix) - - def url_for_version(self, version): - return '%s/zoltan_distrib_v%s.tar.gz' % (Zoltan.base_url, version) + for lib_path in glob.glob(join_path(prefix, 'lib', '*.a')): + lib_static_name = os.path.basename(lib_path) + lib_shared_name = re.sub(r'\.a$', '.{0}'.format(dso_suffix), + lib_static_name) + move(lib_path, join_path(prefix, 'lib', lib_shared_name)) + + def get_config_flag(self, flag_name, flag_variant): + flag_pre = 'en' if '+{0}'.format(flag_variant) in self.spec else 'dis' + return '--{0}able-{1}'.format(flag_pre, flag_name) + + # NOTE: Zoltan assumes that it's linking against an MPI library that can + # be found with '-lmpi,' which isn't the case for many MPI packages. This + # function finds the names of the actual libraries for Zoltan's MPI dep. + def get_mpi_libs(self): + mpi_libs = set() + + for lib_path in glob.glob(join_path(self.spec['mpi'].prefix.lib, '*')): + mpi_lib_match = re.match( + r'^(lib)((\w*)mpi(\w*))\.((a)|({0}))$'.format(dso_suffix), + os.path.basename(lib_path)) + if mpi_lib_match: + mpi_libs.add(mpi_lib_match.group(2)) + + return list(mpi_libs) |