merge from develop
This commit is contained in:
commit
9eb314fcaa
@ -59,7 +59,8 @@ can join it here:
|
||||
|
||||
At the moment, contributing to Spack is relatively simple. Just send us
|
||||
a [pull request](https://help.github.com/articles/using-pull-requests/).
|
||||
When you send your request, make ``develop`` the destination branch.
|
||||
When you send your request, make ``develop`` the destination branch on the
|
||||
[Spack repository](https://github.com/LLNL/spack).
|
||||
|
||||
Spack is using a rough approximation of the [Git
|
||||
Flow](http://nvie.com/posts/a-successful-git-branching-model/)
|
||||
|
8
etc/spack/modules.yaml
Normal file
8
etc/spack/modules.yaml
Normal file
@ -0,0 +1,8 @@
|
||||
# -------------------------------------------------------------------------
|
||||
# This is the default spack module files generation configuration.
|
||||
#
|
||||
# Changes to this file will affect all users of this spack install,
|
||||
# although users can override these settings in their ~/.spack/modules.yaml.
|
||||
# -------------------------------------------------------------------------
|
||||
modules:
|
||||
enable: ['tcl', 'dotkit']
|
@ -1844,6 +1844,20 @@ dedicated process.
|
||||
|
||||
.. _prefix-objects:
|
||||
|
||||
|
||||
Failing the build
|
||||
----------------------
|
||||
|
||||
Sometimes you don't want a package to successfully install unless some
|
||||
condition is true. You can explicitly cause the build to fail from
|
||||
``install()`` by raising an ``InstallError``, for example:
|
||||
|
||||
.. code-block:: python
|
||||
|
||||
if spec.architecture.startswith('darwin'):
|
||||
raise InstallError('This package does not build on Mac OS X!')
|
||||
|
||||
|
||||
Prefix objects
|
||||
----------------------
|
||||
|
||||
|
231
lib/spack/env/cc
vendored
231
lib/spack/env/cc
vendored
@ -65,7 +65,7 @@ function die {
|
||||
}
|
||||
|
||||
for param in $parameters; do
|
||||
if [ -z "${!param}" ]; then
|
||||
if [[ -z ${!param} ]]; then
|
||||
die "Spack compiler must be run from spack! Input $param was missing!"
|
||||
fi
|
||||
done
|
||||
@ -78,12 +78,17 @@ done
|
||||
# 'command' is set based on the input command to $SPACK_[CC|CXX|F77|F90]
|
||||
#
|
||||
# 'mode' is set to one of:
|
||||
# cpp preprocess
|
||||
# cc compile
|
||||
# as assemble
|
||||
# ld link
|
||||
# ccld compile & link
|
||||
# cpp preprocessor
|
||||
# vcheck version check
|
||||
#
|
||||
# Depending on the mode, we may or may not add extra rpaths.
|
||||
# This variable controls whether they are added.
|
||||
add_rpaths=true
|
||||
|
||||
command=$(basename "$0")
|
||||
case "$command" in
|
||||
cc|c89|c99|gcc|clang|icc|pgcc|xlc)
|
||||
@ -107,13 +112,26 @@ case "$command" in
|
||||
;;
|
||||
ld)
|
||||
mode=ld
|
||||
|
||||
# Darwin's linker has a -r argument that merges object files
|
||||
# together. It doesn't work with -rpath.
|
||||
if [[ $OSTYPE = darwin* ]]; then
|
||||
for arg in "$@"; do
|
||||
if [ "$arg" = -r ]; then
|
||||
add_rpaths=false
|
||||
break
|
||||
fi
|
||||
done
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
die "Unkown compiler: $command"
|
||||
;;
|
||||
esac
|
||||
|
||||
# If any of the arguments below is present then the mode is vcheck. In vcheck mode nothing is added in terms of extra search paths or libraries
|
||||
# If any of the arguments below is present then the mode is vcheck. In
|
||||
# vcheck mode nothing is added in terms of extra search paths or
|
||||
# libraries
|
||||
if [ -z "$mode" ]; then
|
||||
for arg in "$@"; do
|
||||
if [ "$arg" = -v -o "$arg" = -V -o "$arg" = --version -o "$arg" = -dumpversion ]; then
|
||||
@ -124,13 +142,15 @@ if [ -z "$mode" ]; then
|
||||
fi
|
||||
|
||||
# Finish setting up the mode.
|
||||
|
||||
if [ -z "$mode" ]; then
|
||||
mode=ccld
|
||||
for arg in "$@"; do
|
||||
if [ "$arg" = -E ]; then
|
||||
mode=cpp
|
||||
break
|
||||
elif [ "$arg" = -S ]; then
|
||||
mode=as
|
||||
break
|
||||
elif [ "$arg" = -c ]; then
|
||||
mode=cc
|
||||
break
|
||||
@ -146,168 +166,56 @@ fi
|
||||
|
||||
# Check that at least one of the real commands was actually selected,
|
||||
# otherwise we don't know what to execute.
|
||||
if [ -z "$command" ]; then
|
||||
if [[ -z $command ]]; then
|
||||
die "ERROR: Compiler '$SPACK_COMPILER_SPEC' does not support compiling $language programs."
|
||||
fi
|
||||
|
||||
# Save original command for debug logging
|
||||
input_command="$@"
|
||||
|
||||
if [ "$mode" == vcheck ] ; then
|
||||
exec ${command} "$@"
|
||||
fi
|
||||
|
||||
#
|
||||
# Now do real parsing of the command line args, trying hard to keep
|
||||
# non-rpath linker arguments in the proper order w.r.t. other command
|
||||
# line arguments. This is important for things like groups.
|
||||
#
|
||||
includes=()
|
||||
libraries=()
|
||||
libs=()
|
||||
rpaths=()
|
||||
other_args=()
|
||||
|
||||
while [ -n "$1" ]; do
|
||||
case "$1" in
|
||||
-I*)
|
||||
arg="${1#-I}"
|
||||
if [ -z "$arg" ]; then shift; arg="$1"; fi
|
||||
includes+=("$arg")
|
||||
;;
|
||||
-L*)
|
||||
arg="${1#-L}"
|
||||
if [ -z "$arg" ]; then shift; arg="$1"; fi
|
||||
libraries+=("$arg")
|
||||
;;
|
||||
-l*)
|
||||
arg="${1#-l}"
|
||||
if [ -z "$arg" ]; then shift; arg="$1"; fi
|
||||
libs+=("$arg")
|
||||
;;
|
||||
-Wl,*)
|
||||
arg="${1#-Wl,}"
|
||||
# TODO: Handle multiple -Wl, continuations of -Wl,-rpath
|
||||
if [[ $arg == -rpath=* ]]; then
|
||||
arg="${arg#-rpath=}"
|
||||
for rpath in ${arg//,/ }; do
|
||||
rpaths+=("$rpath")
|
||||
done
|
||||
elif [[ $arg == -rpath,* ]]; then
|
||||
arg="${arg#-rpath,}"
|
||||
for rpath in ${arg//,/ }; do
|
||||
rpaths+=("$rpath")
|
||||
done
|
||||
elif [[ $arg == -rpath ]]; then
|
||||
shift; arg="$1"
|
||||
if [[ $arg != '-Wl,'* ]]; then
|
||||
die "-Wl,-rpath was not followed by -Wl,*"
|
||||
fi
|
||||
arg="${arg#-Wl,}"
|
||||
for rpath in ${arg//,/ }; do
|
||||
rpaths+=("$rpath")
|
||||
done
|
||||
else
|
||||
other_args+=("-Wl,$arg")
|
||||
fi
|
||||
;;
|
||||
-Xlinker)
|
||||
shift; arg="$1";
|
||||
if [[ $arg = -rpath=* ]]; then
|
||||
rpaths+=("${arg#-rpath=}")
|
||||
elif [[ $arg = -rpath ]]; then
|
||||
shift; arg="$1"
|
||||
if [[ $arg != -Xlinker ]]; then
|
||||
die "-Xlinker -rpath was not followed by -Xlinker <arg>"
|
||||
fi
|
||||
shift; arg="$1"
|
||||
rpaths+=("$arg")
|
||||
else
|
||||
other_args+=("-Xlinker")
|
||||
other_args+=("$arg")
|
||||
fi
|
||||
;;
|
||||
*)
|
||||
other_args+=("$1")
|
||||
;;
|
||||
esac
|
||||
shift
|
||||
done
|
||||
|
||||
# Dump parsed values for unit testing if asked for
|
||||
if [ -n "$SPACK_TEST_COMMAND" ]; then
|
||||
IFS=$'\n'
|
||||
case "$SPACK_TEST_COMMAND" in
|
||||
dump-includes) echo "${includes[*]}";;
|
||||
dump-libraries) echo "${libraries[*]}";;
|
||||
dump-libs) echo "${libs[*]}";;
|
||||
dump-rpaths) echo "${rpaths[*]}";;
|
||||
dump-other-args) echo "${other_args[*]}";;
|
||||
dump-all)
|
||||
echo "INCLUDES:"
|
||||
echo "${includes[*]}"
|
||||
echo
|
||||
echo "LIBRARIES:"
|
||||
echo "${libraries[*]}"
|
||||
echo
|
||||
echo "LIBS:"
|
||||
echo "${libs[*]}"
|
||||
echo
|
||||
echo "RPATHS:"
|
||||
echo "${rpaths[*]}"
|
||||
echo
|
||||
echo "ARGS:"
|
||||
echo "${other_args[*]}"
|
||||
;;
|
||||
*)
|
||||
echo "ERROR: Unknown test command"
|
||||
exit 1 ;;
|
||||
esac
|
||||
exit
|
||||
fi
|
||||
# Save original command for debug logging
|
||||
input_command="$@"
|
||||
args=("$@")
|
||||
|
||||
# Read spack dependencies from the path environment variable
|
||||
IFS=':' read -ra deps <<< "$SPACK_DEPENDENCIES"
|
||||
for dep in "${deps[@]}"; do
|
||||
if [ -d "$dep/include" ]; then
|
||||
includes+=("$dep/include")
|
||||
# Prepend include directories
|
||||
if [[ -d $dep/include ]]; then
|
||||
if [[ $mode = cpp || $mode = cc || $mode = as || $mode = ccld ]]; then
|
||||
args=("-I$dep/include" "${args[@]}")
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d "$dep/lib" ]; then
|
||||
libraries+=("$dep/lib")
|
||||
rpaths+=("$dep/lib")
|
||||
# Prepend lib and RPATH directories
|
||||
if [[ -d $dep/lib ]]; then
|
||||
if [[ $mode = ccld ]]; then
|
||||
$add_rpaths && args=("-Wl,-rpath,$dep/lib" "${args[@]}")
|
||||
args=("-L$dep/lib" "${args[@]}")
|
||||
elif [[ $mode = ld ]]; then
|
||||
$add_rpaths && args=("-rpath" "$dep/lib" "${args[@]}")
|
||||
args=("-L$dep/lib" "${args[@]}")
|
||||
fi
|
||||
fi
|
||||
|
||||
if [ -d "$dep/lib64" ]; then
|
||||
libraries+=("$dep/lib64")
|
||||
rpaths+=("$dep/lib64")
|
||||
# Prepend lib64 and RPATH directories
|
||||
if [[ -d $dep/lib64 ]]; then
|
||||
if [[ $mode = ccld ]]; then
|
||||
$add_rpaths && args=("-Wl,-rpath,$dep/lib64" "${args[@]}")
|
||||
args=("-L$dep/lib64" "${args[@]}")
|
||||
elif [[ $mode = ld ]]; then
|
||||
$add_rpaths && args=("-rpath" "$dep/lib64" "${args[@]}")
|
||||
args=("-L$dep/lib64" "${args[@]}")
|
||||
fi
|
||||
fi
|
||||
done
|
||||
|
||||
# Include all -L's and prefix/whatever dirs in rpath
|
||||
for dir in "${libraries[@]}"; do
|
||||
[[ dir = $SPACK_INSTALL* ]] && rpaths+=("$dir")
|
||||
done
|
||||
rpaths+=("$SPACK_PREFIX/lib")
|
||||
rpaths+=("$SPACK_PREFIX/lib64")
|
||||
|
||||
# Put the arguments together
|
||||
args=()
|
||||
for dir in "${includes[@]}"; do args+=("-I$dir"); done
|
||||
args+=("${other_args[@]}")
|
||||
for dir in "${libraries[@]}"; do args+=("-L$dir"); done
|
||||
for lib in "${libs[@]}"; do args+=("-l$lib"); done
|
||||
|
||||
if [ "$mode" = ccld ]; then
|
||||
for dir in "${rpaths[@]}"; do
|
||||
args+=("-Wl,-rpath")
|
||||
args+=("-Wl,$dir");
|
||||
done
|
||||
elif [ "$mode" = ld ]; then
|
||||
for dir in "${rpaths[@]}"; do
|
||||
args+=("-rpath")
|
||||
args+=("$dir");
|
||||
done
|
||||
if [[ $mode = ccld ]]; then
|
||||
$add_rpaths && args=("-Wl,-rpath,$SPACK_PREFIX/lib" "-Wl,-rpath,$SPACK_PREFIX/lib64" "${args[@]}")
|
||||
elif [[ $mode = ld ]]; then
|
||||
$add_rpaths && args=("-rpath" "$SPACK_PREFIX/lib" "-rpath" "$SPACK_PREFIX/lib64" "${args[@]}")
|
||||
fi
|
||||
|
||||
#
|
||||
@ -323,34 +231,37 @@ unset DYLD_LIBRARY_PATH
|
||||
#
|
||||
IFS=':' read -ra env_path <<< "$PATH"
|
||||
IFS=':' read -ra spack_env_dirs <<< "$SPACK_ENV_PATH"
|
||||
spack_env_dirs+=(".")
|
||||
spack_env_dirs+=("" ".")
|
||||
PATH=""
|
||||
for dir in "${env_path[@]}"; do
|
||||
remove=""
|
||||
for rm_dir in "${spack_env_dirs[@]}"; do
|
||||
if [ "$dir" = "$rm_dir" ]; then remove=True; fi
|
||||
if [[ $dir = $rm_dir ]]; then remove=True; fi
|
||||
done
|
||||
if [ -z "$remove" ]; then
|
||||
if [ -z "$PATH" ]; then
|
||||
PATH="$dir"
|
||||
else
|
||||
PATH="$PATH:$dir"
|
||||
fi
|
||||
if [[ -z $remove ]]; then
|
||||
PATH="${PATH:+$PATH:}$dir"
|
||||
fi
|
||||
done
|
||||
export PATH
|
||||
|
||||
full_command=("$command")
|
||||
full_command+=("${args[@]}")
|
||||
full_command=("$command" "${args[@]}")
|
||||
|
||||
# In test command mode, write out full command for Spack tests.
|
||||
if [[ $SPACK_TEST_COMMAND = dump-args ]]; then
|
||||
echo "${full_command[@]}"
|
||||
exit
|
||||
elif [[ -n $SPACK_TEST_COMMAND ]]; then
|
||||
die "ERROR: Unknown test command"
|
||||
fi
|
||||
|
||||
#
|
||||
# Write the input and output commands to debug logs if it's asked for.
|
||||
#
|
||||
if [ "$SPACK_DEBUG" = "TRUE" ]; then
|
||||
if [[ $SPACK_DEBUG = TRUE ]]; then
|
||||
input_log="$SPACK_DEBUG_LOG_DIR/spack-cc-$SPACK_SHORT_SPEC.in.log"
|
||||
output_log="$SPACK_DEBUG_LOG_DIR/spack-cc-$SPACK_SHORT_SPEC.out.log"
|
||||
echo "$input_command" >> $input_log
|
||||
echo "$mode ${full_command[@]}" >> $output_log
|
||||
echo "[$mode] $command $input_command" >> $input_log
|
||||
echo "[$mode] ${full_command[@]}" >> $output_log
|
||||
fi
|
||||
|
||||
exec "${full_command[@]}"
|
||||
|
@ -27,9 +27,11 @@
|
||||
'force_remove', 'join_path', 'ancestor', 'can_access', 'filter_file',
|
||||
'FileFilter', 'change_sed_delimiter', 'is_exe', 'force_symlink',
|
||||
'set_executable', 'copy_mode', 'unset_executable_mode',
|
||||
'remove_dead_links', 'remove_linked_tree']
|
||||
'remove_dead_links', 'remove_linked_tree', 'find_library_path',
|
||||
'fix_darwin_install_name']
|
||||
|
||||
import os
|
||||
import glob
|
||||
import sys
|
||||
import re
|
||||
import shutil
|
||||
@ -38,6 +40,7 @@
|
||||
import getpass
|
||||
from contextlib import contextmanager, closing
|
||||
from tempfile import NamedTemporaryFile
|
||||
import subprocess
|
||||
|
||||
import llnl.util.tty as tty
|
||||
from spack.util.compression import ALLOWED_ARCHIVE_TYPES
|
||||
@ -392,3 +395,44 @@ def remove_linked_tree(path):
|
||||
os.unlink(path)
|
||||
else:
|
||||
shutil.rmtree(path, True)
|
||||
|
||||
|
||||
def fix_darwin_install_name(path):
|
||||
"""
|
||||
Fix install name of dynamic libraries on Darwin to have full path.
|
||||
There are two parts of this task:
|
||||
(i) use install_name('-id',...) to change install name of a single lib;
|
||||
(ii) use install_name('-change',...) to change the cross linking between libs.
|
||||
The function assumes that all libraries are in one folder and currently won't
|
||||
follow subfolders.
|
||||
|
||||
Args:
|
||||
path: directory in which .dylib files are alocated
|
||||
|
||||
"""
|
||||
libs = glob.glob(join_path(path,"*.dylib"))
|
||||
for lib in libs:
|
||||
# fix install name first:
|
||||
subprocess.Popen(["install_name_tool", "-id",lib,lib], stdout=subprocess.PIPE).communicate()[0]
|
||||
long_deps = subprocess.Popen(["otool", "-L",lib], stdout=subprocess.PIPE).communicate()[0].split('\n')
|
||||
deps = [dep.partition(' ')[0][1::] for dep in long_deps[2:-1]]
|
||||
# fix all dependencies:
|
||||
for dep in deps:
|
||||
for loc in libs:
|
||||
if dep == os.path.basename(loc):
|
||||
subprocess.Popen(["install_name_tool", "-change",dep,loc,lib], stdout=subprocess.PIPE).communicate()[0]
|
||||
break
|
||||
|
||||
|
||||
def find_library_path(libname, *paths):
|
||||
"""Searches for a file called <libname> in each path.
|
||||
|
||||
Return:
|
||||
directory where the library was found, if found. None otherwise.
|
||||
|
||||
"""
|
||||
for path in paths:
|
||||
library = join_path(path, libname)
|
||||
if os.path.exists(library):
|
||||
return path
|
||||
return None
|
||||
|
@ -117,7 +117,8 @@ def caller_locals():
|
||||
scope. Yes, this is some black magic, and yes it's useful
|
||||
for implementing things like depends_on and provides.
|
||||
"""
|
||||
stack = inspect.stack()
|
||||
# Passing zero here skips line context for speed.
|
||||
stack = inspect.stack(0)
|
||||
try:
|
||||
return stack[2][0].f_locals
|
||||
finally:
|
||||
@ -128,7 +129,8 @@ def get_calling_module_name():
|
||||
"""Make sure that the caller is a class definition, and return the
|
||||
enclosing module's name.
|
||||
"""
|
||||
stack = inspect.stack()
|
||||
# Passing zero here skips line context for speed.
|
||||
stack = inspect.stack(0)
|
||||
try:
|
||||
# Make sure locals contain __module__
|
||||
caller_locals = stack[2][0].f_locals
|
||||
|
@ -193,5 +193,9 @@
|
||||
from spack.util.executable import *
|
||||
__all__ += spack.util.executable.__all__
|
||||
|
||||
from spack.package import install_dependency_symlinks, flatten_dependencies, DependencyConflictError
|
||||
__all__ += ['install_dependency_symlinks', 'flatten_dependencies', 'DependencyConflictError']
|
||||
from spack.package import \
|
||||
install_dependency_symlinks, flatten_dependencies, DependencyConflictError, \
|
||||
InstallError, ExternalPackageError
|
||||
__all__ += [
|
||||
'install_dependency_symlinks', 'flatten_dependencies', 'DependencyConflictError',
|
||||
'InstallError', 'ExternalPackageError']
|
||||
|
@ -3,7 +3,7 @@
|
||||
build environment. All of this is set up by package.py just before
|
||||
install() is called.
|
||||
|
||||
There are two parts to the bulid environment:
|
||||
There are two parts to the build environment:
|
||||
|
||||
1. Python build environment (i.e. install() method)
|
||||
|
||||
@ -13,7 +13,7 @@
|
||||
the package's module scope. Ths allows package writers to call
|
||||
them all directly in Package.install() without writing 'self.'
|
||||
everywhere. No, this isn't Pythonic. Yes, it makes the code more
|
||||
readable and more like the shell script from whcih someone is
|
||||
readable and more like the shell script from which someone is
|
||||
likely porting.
|
||||
|
||||
2. Build execution environment
|
||||
@ -27,17 +27,18 @@
|
||||
Skimming this module is a nice way to get acquainted with the types of
|
||||
calls you can make from within the install() function.
|
||||
"""
|
||||
import os
|
||||
import sys
|
||||
import shutil
|
||||
import multiprocessing
|
||||
import os
|
||||
import platform
|
||||
from llnl.util.filesystem import *
|
||||
import shutil
|
||||
import sys
|
||||
|
||||
import spack
|
||||
import spack.compilers as compilers
|
||||
from spack.util.executable import Executable, which
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.filesystem import *
|
||||
from spack.environment import EnvironmentModifications, validate
|
||||
from spack.util.environment import *
|
||||
from spack.util.executable import Executable, which
|
||||
|
||||
#
|
||||
# This can be set by the user to globally disable parallel builds.
|
||||
@ -58,6 +59,11 @@
|
||||
SPACK_DEBUG_LOG_DIR = 'SPACK_DEBUG_LOG_DIR'
|
||||
|
||||
|
||||
# Platform-specific library suffix.
|
||||
dso_suffix = 'dylib' if sys.platform == 'darwin' else 'so'
|
||||
|
||||
|
||||
|
||||
class MakeExecutable(Executable):
|
||||
"""Special callable executable object for make so the user can
|
||||
specify parallel or not on a per-invocation basis. Using
|
||||
@ -83,85 +89,88 @@ def __call__(self, *args, **kwargs):
|
||||
return super(MakeExecutable, self).__call__(*args, **kwargs)
|
||||
|
||||
|
||||
def set_compiler_environment_variables(pkg):
|
||||
assert(pkg.spec.concrete)
|
||||
compiler = pkg.compiler
|
||||
|
||||
def set_compiler_environment_variables(pkg, env):
|
||||
assert pkg.spec.concrete
|
||||
# Set compiler variables used by CMake and autotools
|
||||
assert all(key in pkg.compiler.link_paths
|
||||
for key in ('cc', 'cxx', 'f77', 'fc'))
|
||||
assert all(key in pkg.compiler.link_paths for key in ('cc', 'cxx', 'f77', 'fc'))
|
||||
|
||||
# Populate an object with the list of environment modifications
|
||||
# and return it
|
||||
# TODO : add additional kwargs for better diagnostics, like requestor, ttyout, ttyerr, etc.
|
||||
link_dir = spack.build_env_path
|
||||
os.environ['CC'] = join_path(link_dir, pkg.compiler.link_paths['cc'])
|
||||
os.environ['CXX'] = join_path(link_dir, pkg.compiler.link_paths['cxx'])
|
||||
os.environ['F77'] = join_path(link_dir, pkg.compiler.link_paths['f77'])
|
||||
os.environ['FC'] = join_path(link_dir, pkg.compiler.link_paths['fc'])
|
||||
env.set('CC', join_path(link_dir, pkg.compiler.link_paths['cc']))
|
||||
env.set('CXX', join_path(link_dir, pkg.compiler.link_paths['cxx']))
|
||||
env.set('F77', join_path(link_dir, pkg.compiler.link_paths['f77']))
|
||||
env.set('FC', join_path(link_dir, pkg.compiler.link_paths['fc']))
|
||||
|
||||
# Set SPACK compiler variables so that our wrapper knows what to call
|
||||
compiler = pkg.compiler
|
||||
if compiler.cc:
|
||||
os.environ['SPACK_CC'] = compiler.cc
|
||||
env.set('SPACK_CC', compiler.cc)
|
||||
if compiler.cxx:
|
||||
os.environ['SPACK_CXX'] = compiler.cxx
|
||||
env.set('SPACK_CXX', compiler.cxx)
|
||||
if compiler.f77:
|
||||
os.environ['SPACK_F77'] = compiler.f77
|
||||
env.set('SPACK_F77', compiler.f77)
|
||||
if compiler.fc:
|
||||
os.environ['SPACK_FC'] = compiler.fc
|
||||
env.set('SPACK_FC', compiler.fc)
|
||||
|
||||
os.environ['SPACK_COMPILER_SPEC'] = str(pkg.spec.compiler)
|
||||
env.set('SPACK_COMPILER_SPEC', str(pkg.spec.compiler))
|
||||
return env
|
||||
|
||||
|
||||
def set_build_environment_variables(pkg):
|
||||
"""This ensures a clean install environment when we build packages.
|
||||
def set_build_environment_variables(pkg, env):
|
||||
"""
|
||||
This ensures a clean install environment when we build packages
|
||||
"""
|
||||
# Add spack build environment path with compiler wrappers first in
|
||||
# the path. We add both spack.env_path, which includes default
|
||||
# wrappers (cc, c++, f77, f90), AND a subdirectory containing
|
||||
# compiler-specific symlinks. The latter ensures that builds that
|
||||
# are sensitive to the *name* of the compiler see the right name
|
||||
# when we're building wtih the wrappers.
|
||||
# when we're building with the wrappers.
|
||||
#
|
||||
# Conflicts on case-insensitive systems (like "CC" and "cc") are
|
||||
# handled by putting one in the <build_env_path>/case-insensitive
|
||||
# directory. Add that to the path too.
|
||||
env_paths = []
|
||||
def add_env_path(path):
|
||||
env_paths.append(path)
|
||||
ci = join_path(path, 'case-insensitive')
|
||||
if os.path.isdir(ci): env_paths.append(ci)
|
||||
add_env_path(spack.build_env_path)
|
||||
add_env_path(join_path(spack.build_env_path, pkg.compiler.name))
|
||||
for item in [spack.build_env_path, join_path(spack.build_env_path, pkg.compiler.name)]:
|
||||
env_paths.append(item)
|
||||
ci = join_path(item, 'case-insensitive')
|
||||
if os.path.isdir(ci):
|
||||
env_paths.append(ci)
|
||||
|
||||
path_put_first("PATH", env_paths)
|
||||
path_set(SPACK_ENV_PATH, env_paths)
|
||||
for item in reversed(env_paths):
|
||||
env.prepend_path('PATH', item)
|
||||
env.set_path(SPACK_ENV_PATH, env_paths)
|
||||
|
||||
# Prefixes of all of the package's dependencies go in
|
||||
# SPACK_DEPENDENCIES
|
||||
# Prefixes of all of the package's dependencies go in SPACK_DEPENDENCIES
|
||||
dep_prefixes = [d.prefix for d in pkg.spec.traverse(root=False)]
|
||||
path_set(SPACK_DEPENDENCIES, dep_prefixes)
|
||||
env.set_path(SPACK_DEPENDENCIES, dep_prefixes)
|
||||
env.set_path('CMAKE_PREFIX_PATH', dep_prefixes) # Add dependencies to CMAKE_PREFIX_PATH
|
||||
|
||||
# Install prefix
|
||||
os.environ[SPACK_PREFIX] = pkg.prefix
|
||||
env.set(SPACK_PREFIX, pkg.prefix)
|
||||
|
||||
# Install root prefix
|
||||
os.environ[SPACK_INSTALL] = spack.install_path
|
||||
env.set(SPACK_INSTALL, spack.install_path)
|
||||
|
||||
# Remove these vars from the environment during build because they
|
||||
# can affect how some packages find libraries. We want to make
|
||||
# sure that builds never pull in unintended external dependencies.
|
||||
pop_keys(os.environ, "LD_LIBRARY_PATH", "LD_RUN_PATH", "DYLD_LIBRARY_PATH")
|
||||
env.unset('LD_LIBRARY_PATH')
|
||||
env.unset('LD_RUN_PATH')
|
||||
env.unset('DYLD_LIBRARY_PATH')
|
||||
|
||||
# Add bin directories from dependencies to the PATH for the build.
|
||||
bin_dirs = ['%s/bin' % prefix for prefix in dep_prefixes]
|
||||
path_put_first('PATH', [bin for bin in bin_dirs if os.path.isdir(bin)])
|
||||
bin_dirs = reversed(filter(os.path.isdir, ['%s/bin' % prefix for prefix in dep_prefixes]))
|
||||
for item in bin_dirs:
|
||||
env.prepend_path('PATH', item)
|
||||
|
||||
# Working directory for the spack command itself, for debug logs.
|
||||
if spack.debug:
|
||||
os.environ[SPACK_DEBUG] = "TRUE"
|
||||
os.environ[SPACK_SHORT_SPEC] = pkg.spec.short_spec
|
||||
os.environ[SPACK_DEBUG_LOG_DIR] = spack.spack_working_dir
|
||||
|
||||
# Add dependencies to CMAKE_PREFIX_PATH
|
||||
path_set("CMAKE_PREFIX_PATH", dep_prefixes)
|
||||
env.set(SPACK_DEBUG, 'TRUE')
|
||||
env.set(SPACK_SHORT_SPEC, pkg.spec.short_spec)
|
||||
env.set(SPACK_DEBUG_LOG_DIR, spack.spack_working_dir)
|
||||
|
||||
# Add any pkgconfig directories to PKG_CONFIG_PATH
|
||||
pkg_config_dirs = []
|
||||
@ -170,10 +179,12 @@ def add_env_path(path):
|
||||
pcdir = join_path(p, libdir, 'pkgconfig')
|
||||
if os.path.isdir(pcdir):
|
||||
pkg_config_dirs.append(pcdir)
|
||||
path_set("PKG_CONFIG_PATH", pkg_config_dirs)
|
||||
env.set_path('PKG_CONFIG_PATH', pkg_config_dirs)
|
||||
|
||||
return env
|
||||
|
||||
|
||||
def set_module_variables_for_package(pkg, m):
|
||||
def set_module_variables_for_package(pkg, module):
|
||||
"""Populate the module scope of install() with some useful functions.
|
||||
This makes things easier for package writers.
|
||||
"""
|
||||
@ -183,6 +194,8 @@ def set_module_variables_for_package(pkg, m):
|
||||
jobs = 1
|
||||
elif pkg.make_jobs:
|
||||
jobs = pkg.make_jobs
|
||||
|
||||
m = module
|
||||
m.make_jobs = jobs
|
||||
|
||||
# TODO: make these build deps that can be installed if not found.
|
||||
@ -217,7 +230,7 @@ def set_module_variables_for_package(pkg, m):
|
||||
m.spack_cc = join_path(link_dir, pkg.compiler.link_paths['cc'])
|
||||
m.spack_cxx = join_path(link_dir, pkg.compiler.link_paths['cxx'])
|
||||
m.spack_f77 = join_path(link_dir, pkg.compiler.link_paths['f77'])
|
||||
m.spack_f90 = join_path(link_dir, pkg.compiler.link_paths['fc'])
|
||||
m.spack_fc = join_path(link_dir, pkg.compiler.link_paths['fc'])
|
||||
|
||||
# Emulate some shell commands for convenience
|
||||
m.pwd = os.getcwd
|
||||
@ -238,6 +251,9 @@ def set_module_variables_for_package(pkg, m):
|
||||
# a Prefix object.
|
||||
m.prefix = pkg.prefix
|
||||
|
||||
# Platform-specific library suffix.
|
||||
m.dso_suffix = dso_suffix
|
||||
|
||||
|
||||
def get_rpaths(pkg):
|
||||
"""Get a list of all the rpaths for a package."""
|
||||
@ -262,24 +278,63 @@ def parent_class_modules(cls):
|
||||
return result
|
||||
|
||||
|
||||
def setup_package(pkg):
|
||||
"""Execute all environment setup routines."""
|
||||
set_compiler_environment_variables(pkg)
|
||||
set_build_environment_variables(pkg)
|
||||
|
||||
def setup_module_variables_for_dag(pkg):
|
||||
"""Set module-scope variables for all packages in the DAG."""
|
||||
for spec in pkg.spec.traverse(order='post'):
|
||||
# If a user makes their own package repo, e.g.
|
||||
# spack.repos.mystuff.libelf.Libelf, and they inherit from
|
||||
# an existing class like spack.repos.original.libelf.Libelf,
|
||||
# then set the module variables for both classes so the
|
||||
# parent class can still use them if it gets called.
|
||||
modules = parent_class_modules(pkg.__class__)
|
||||
spkg = spec.package
|
||||
modules = parent_class_modules(spkg.__class__)
|
||||
for mod in modules:
|
||||
set_module_variables_for_package(pkg, mod)
|
||||
set_module_variables_for_package(spkg, mod)
|
||||
set_module_variables_for_package(spkg, spkg.module)
|
||||
|
||||
# Allow dependencies to set up environment as well.
|
||||
for dep_spec in pkg.spec.traverse(root=False):
|
||||
dep_spec.package.setup_dependent_environment(
|
||||
pkg.module, dep_spec, pkg.spec)
|
||||
|
||||
def setup_package(pkg):
|
||||
"""Execute all environment setup routines."""
|
||||
spack_env = EnvironmentModifications()
|
||||
run_env = EnvironmentModifications()
|
||||
|
||||
# Before proceeding, ensure that specs and packages are consistent
|
||||
#
|
||||
# This is a confusing behavior due to how packages are
|
||||
# constructed. `setup_dependent_package` may set attributes on
|
||||
# specs in the DAG for use by other packages' install
|
||||
# method. However, spec.package will look up a package via
|
||||
# spack.repo, which defensively copies specs into packages. This
|
||||
# code ensures that all packages in the DAG have pieces of the
|
||||
# same spec object at build time.
|
||||
#
|
||||
# This is safe for the build process, b/c the build process is a
|
||||
# throwaway environment, but it is kind of dirty.
|
||||
#
|
||||
# TODO: Think about how to avoid this fix and do something cleaner.
|
||||
for s in pkg.spec.traverse(): s.package.spec = s
|
||||
|
||||
set_compiler_environment_variables(pkg, spack_env)
|
||||
set_build_environment_variables(pkg, spack_env)
|
||||
setup_module_variables_for_dag(pkg)
|
||||
|
||||
# Allow dependencies to modify the module
|
||||
spec = pkg.spec
|
||||
for dependency_spec in spec.traverse(root=False):
|
||||
dpkg = dependency_spec.package
|
||||
dpkg.setup_dependent_package(pkg.module, spec)
|
||||
|
||||
# Allow dependencies to set up environment as well
|
||||
for dependency_spec in spec.traverse(root=False):
|
||||
dpkg = dependency_spec.package
|
||||
dpkg.setup_dependent_environment(spack_env, run_env, spec)
|
||||
|
||||
# Allow the package to apply some settings.
|
||||
pkg.setup_environment(spack_env, run_env)
|
||||
|
||||
# Make sure nothing's strange about the Spack environment.
|
||||
validate(spack_env, tty.warn)
|
||||
spack_env.apply_modifications()
|
||||
|
||||
|
||||
def fork(pkg, function):
|
||||
@ -296,9 +351,9 @@ def child_fun():
|
||||
# do stuff
|
||||
build_env.fork(pkg, child_fun)
|
||||
|
||||
Forked processes are run with the build environemnt set up by
|
||||
Forked processes are run with the build environment set up by
|
||||
spack.build_environment. This allows package authors to have
|
||||
full control over the environment, etc. without offecting
|
||||
full control over the environment, etc. without affecting
|
||||
other builds that might be executed in the same spack call.
|
||||
|
||||
If something goes wrong, the child process is expected to print
|
||||
@ -308,11 +363,11 @@ def child_fun():
|
||||
"""
|
||||
try:
|
||||
pid = os.fork()
|
||||
except OSError, e:
|
||||
except OSError as e:
|
||||
raise InstallError("Unable to fork build process: %s" % e)
|
||||
|
||||
if pid == 0:
|
||||
# Give the child process the package's build environemnt.
|
||||
# Give the child process the package's build environment.
|
||||
setup_package(pkg)
|
||||
|
||||
try:
|
||||
@ -323,7 +378,7 @@ def child_fun():
|
||||
# which interferes with unit tests.
|
||||
os._exit(0)
|
||||
|
||||
except spack.error.SpackError, e:
|
||||
except spack.error.SpackError as e:
|
||||
e.die()
|
||||
|
||||
except:
|
||||
@ -338,8 +393,7 @@ def child_fun():
|
||||
# message. Just make the parent exit with an error code.
|
||||
pid, returncode = os.waitpid(pid, 0)
|
||||
if returncode != 0:
|
||||
raise InstallError("Installation process had nonzero exit code."
|
||||
.format(str(returncode)))
|
||||
raise InstallError("Installation process had nonzero exit code.".format(str(returncode)))
|
||||
|
||||
|
||||
class InstallError(spack.error.SpackError):
|
||||
|
@ -80,7 +80,7 @@ def module_find(mtype, spec_array):
|
||||
if not os.path.isfile(mod.file_name):
|
||||
tty.die("No %s module is installed for %s" % (mtype, spec))
|
||||
|
||||
print mod.use_name
|
||||
print(mod.use_name)
|
||||
|
||||
|
||||
def module_refresh():
|
||||
|
@ -77,7 +77,8 @@ def get_git():
|
||||
|
||||
def list_packages(rev):
|
||||
git = get_git()
|
||||
relpath = spack.packages_path[len(spack.prefix + os.path.sep):] + os.path.sep
|
||||
pkgpath = os.path.join(spack.packages_path, 'packages')
|
||||
relpath = pkgpath[len(spack.prefix + os.path.sep):] + os.path.sep
|
||||
output = git('ls-tree', '--full-tree', '--name-only', rev, relpath,
|
||||
output=str)
|
||||
return sorted(line[len(relpath):] for line in output.split('\n') if line)
|
||||
|
@ -35,6 +35,9 @@ def setup_parser(subparser):
|
||||
subparser.add_argument(
|
||||
'-n', '--no-checksum', action='store_true', dest='no_checksum',
|
||||
help="Do not check downloaded packages against checksum")
|
||||
subparser.add_argument(
|
||||
'-p', '--path', dest='path',
|
||||
help="Path to stage package, does not add to spack tree")
|
||||
|
||||
subparser.add_argument(
|
||||
'specs', nargs=argparse.REMAINDER, help="specs of packages to stage")
|
||||
@ -50,4 +53,6 @@ def stage(parser, args):
|
||||
specs = spack.cmd.parse_specs(args.specs, concretize=True)
|
||||
for spec in specs:
|
||||
package = spack.repo.get(spec)
|
||||
if args.path:
|
||||
package.path = args.path
|
||||
package.do_stage()
|
||||
|
@ -22,6 +22,7 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
from __future__ import print_function
|
||||
import sys
|
||||
import argparse
|
||||
|
||||
@ -63,12 +64,12 @@ def uninstall(parser, args):
|
||||
matching_specs = spack.installed_db.query(spec)
|
||||
if not args.all and len(matching_specs) > 1:
|
||||
tty.error("%s matches multiple packages:" % spec)
|
||||
print
|
||||
print()
|
||||
display_specs(matching_specs, long=True)
|
||||
print
|
||||
print "You can either:"
|
||||
print " a) Use a more specific spec, or"
|
||||
print " b) use spack uninstall -a to uninstall ALL matching specs."
|
||||
print()
|
||||
print("You can either:")
|
||||
print(" a) Use a more specific spec, or")
|
||||
print(" b) use spack uninstall -a to uninstall ALL matching specs.")
|
||||
sys.exit(1)
|
||||
|
||||
if len(matching_specs) == 0:
|
||||
@ -79,7 +80,7 @@ def uninstall(parser, args):
|
||||
try:
|
||||
# should work if package is known to spack
|
||||
pkgs.append(s.package)
|
||||
except spack.repository.UnknownPackageError, e:
|
||||
except spack.repository.UnknownPackageError as e:
|
||||
# The package.py file has gone away -- but still
|
||||
# want to uninstall.
|
||||
spack.Package(s).do_uninstall(force=True)
|
||||
@ -94,11 +95,11 @@ def num_installed_deps(pkg):
|
||||
for pkg in pkgs:
|
||||
try:
|
||||
pkg.do_uninstall(force=args.force)
|
||||
except PackageStillNeededError, e:
|
||||
except PackageStillNeededError as e:
|
||||
tty.error("Will not uninstall %s" % e.spec.format("$_$@$%@$#", color=True))
|
||||
print
|
||||
print "The following packages depend on it:"
|
||||
print('')
|
||||
print("The following packages depend on it:")
|
||||
display_specs(e.dependents, long=True)
|
||||
print
|
||||
print "You can use spack uninstall -f to force this action."
|
||||
print('')
|
||||
print("You can use spack uninstall -f to force this action.")
|
||||
sys.exit(1)
|
||||
|
@ -159,6 +159,10 @@ def concretize_version(self, spec):
|
||||
if any(v.satisfies(sv) for sv in spec.versions)],
|
||||
cmp=cmp_versions)
|
||||
|
||||
def prefer_key(v):
|
||||
return pkg.versions.get(Version(v)).get('preferred', False)
|
||||
valid_versions.sort(key=prefer_key, reverse=True)
|
||||
|
||||
if valid_versions:
|
||||
spec.versions = ver([valid_versions[0]])
|
||||
else:
|
||||
@ -241,7 +245,7 @@ def concretize_compiler(self, spec):
|
||||
return False
|
||||
|
||||
#Find the another spec that has a compiler, or the root if none do
|
||||
other_spec = find_spec(spec, lambda(x) : x.compiler)
|
||||
other_spec = spec if spec.compiler else find_spec(spec, lambda(x) : x.compiler)
|
||||
if not other_spec:
|
||||
other_spec = spec.root
|
||||
other_compiler = other_spec.compiler
|
||||
@ -288,7 +292,7 @@ def find_spec(spec, condition):
|
||||
if condition(spec):
|
||||
return spec
|
||||
|
||||
return None # Nohting matched the condition.
|
||||
return None # Nothing matched the condition.
|
||||
|
||||
|
||||
def cmp_specs(lhs, rhs):
|
||||
|
@ -237,7 +237,29 @@
|
||||
'type' : 'object',
|
||||
'default' : {},
|
||||
}
|
||||
},},},},},}
|
||||
},},},},},},
|
||||
'modules': {
|
||||
'$schema': 'http://json-schema.org/schema#',
|
||||
'title': 'Spack module file configuration file schema',
|
||||
'type': 'object',
|
||||
'additionalProperties': False,
|
||||
'patternProperties': {
|
||||
r'modules:?': {
|
||||
'type': 'object',
|
||||
'default': {},
|
||||
'additionalProperties': False,
|
||||
'properties': {
|
||||
'enable': {
|
||||
'type': 'array',
|
||||
'default': [],
|
||||
'items': {
|
||||
'type': 'string'
|
||||
}
|
||||
}
|
||||
}
|
||||
},
|
||||
},
|
||||
},
|
||||
}
|
||||
|
||||
"""OrderedDict of config scopes keyed by name.
|
||||
@ -405,11 +427,11 @@ def _read_config_file(filename, schema):
|
||||
validate_section(data, schema)
|
||||
return data
|
||||
|
||||
except MarkedYAMLError, e:
|
||||
except MarkedYAMLError as e:
|
||||
raise ConfigFileError(
|
||||
"Error parsing yaml%s: %s" % (str(e.context_mark), e.problem))
|
||||
|
||||
except IOError, e:
|
||||
except IOError as e:
|
||||
raise ConfigFileError(
|
||||
"Error reading configuration file %s: %s" % (filename, str(e)))
|
||||
|
||||
|
@ -150,7 +150,7 @@ def remove_install_directory(self, spec):
|
||||
if os.path.exists(path):
|
||||
try:
|
||||
shutil.rmtree(path)
|
||||
except exceptions.OSError, e:
|
||||
except exceptions.OSError as e:
|
||||
raise RemoveFailedError(spec, path, e)
|
||||
|
||||
path = os.path.dirname(path)
|
||||
|
252
lib/spack/spack/environment.py
Normal file
252
lib/spack/spack/environment.py
Normal file
@ -0,0 +1,252 @@
|
||||
import os
|
||||
import os.path
|
||||
import collections
|
||||
import inspect
|
||||
|
||||
|
||||
class NameModifier(object):
|
||||
def __init__(self, name, **kwargs):
|
||||
self.name = name
|
||||
self.args = {'name': name}
|
||||
self.args.update(kwargs)
|
||||
|
||||
|
||||
class NameValueModifier(object):
|
||||
def __init__(self, name, value, **kwargs):
|
||||
self.name = name
|
||||
self.value = value
|
||||
self.args = {'name': name, 'value': value}
|
||||
self.args.update(kwargs)
|
||||
|
||||
|
||||
class SetEnv(NameValueModifier):
|
||||
def execute(self):
|
||||
os.environ[self.name] = str(self.value)
|
||||
|
||||
|
||||
class UnsetEnv(NameModifier):
|
||||
def execute(self):
|
||||
os.environ.pop(self.name, None) # Avoid throwing if the variable was not set
|
||||
|
||||
|
||||
class SetPath(NameValueModifier):
|
||||
def execute(self):
|
||||
string_path = concatenate_paths(self.value)
|
||||
os.environ[self.name] = string_path
|
||||
|
||||
|
||||
class AppendPath(NameValueModifier):
|
||||
def execute(self):
|
||||
environment_value = os.environ.get(self.name, '')
|
||||
directories = environment_value.split(':') if environment_value else []
|
||||
directories.append(os.path.normpath(self.value))
|
||||
os.environ[self.name] = ':'.join(directories)
|
||||
|
||||
|
||||
class PrependPath(NameValueModifier):
|
||||
def execute(self):
|
||||
environment_value = os.environ.get(self.name, '')
|
||||
directories = environment_value.split(':') if environment_value else []
|
||||
directories = [os.path.normpath(self.value)] + directories
|
||||
os.environ[self.name] = ':'.join(directories)
|
||||
|
||||
|
||||
class RemovePath(NameValueModifier):
|
||||
def execute(self):
|
||||
environment_value = os.environ.get(self.name, '')
|
||||
directories = environment_value.split(':') if environment_value else []
|
||||
directories = [os.path.normpath(x) for x in directories if x != os.path.normpath(self.value)]
|
||||
os.environ[self.name] = ':'.join(directories)
|
||||
|
||||
|
||||
class EnvironmentModifications(object):
|
||||
"""
|
||||
Keeps track of requests to modify the current environment.
|
||||
|
||||
Each call to a method to modify the environment stores the extra information on the caller in the request:
|
||||
- 'filename' : filename of the module where the caller is defined
|
||||
- 'lineno': line number where the request occurred
|
||||
- 'context' : line of code that issued the request that failed
|
||||
"""
|
||||
|
||||
def __init__(self, other=None):
|
||||
"""
|
||||
Initializes a new instance, copying commands from other if it is not None
|
||||
|
||||
Args:
|
||||
other: another instance of EnvironmentModifications from which (optional)
|
||||
"""
|
||||
self.env_modifications = []
|
||||
if other is not None:
|
||||
self.extend(other)
|
||||
|
||||
def __iter__(self):
|
||||
return iter(self.env_modifications)
|
||||
|
||||
def __len__(self):
|
||||
return len(self.env_modifications)
|
||||
|
||||
def extend(self, other):
|
||||
self._check_other(other)
|
||||
self.env_modifications.extend(other.env_modifications)
|
||||
|
||||
@staticmethod
|
||||
def _check_other(other):
|
||||
if not isinstance(other, EnvironmentModifications):
|
||||
raise TypeError('other must be an instance of EnvironmentModifications')
|
||||
|
||||
def _get_outside_caller_attributes(self):
|
||||
stack = inspect.stack()
|
||||
try:
|
||||
_, filename, lineno, _, context, index = stack[2]
|
||||
context = context[index].strip()
|
||||
except Exception:
|
||||
filename, lineno, context = 'unknown file', 'unknown line', 'unknown context'
|
||||
args = {
|
||||
'filename': filename,
|
||||
'lineno': lineno,
|
||||
'context': context
|
||||
}
|
||||
return args
|
||||
|
||||
def set(self, name, value, **kwargs):
|
||||
"""
|
||||
Stores in the current object a request to set an environment variable
|
||||
|
||||
Args:
|
||||
name: name of the environment variable to be set
|
||||
value: value of the environment variable
|
||||
"""
|
||||
kwargs.update(self._get_outside_caller_attributes())
|
||||
item = SetEnv(name, value, **kwargs)
|
||||
self.env_modifications.append(item)
|
||||
|
||||
def unset(self, name, **kwargs):
|
||||
"""
|
||||
Stores in the current object a request to unset an environment variable
|
||||
|
||||
Args:
|
||||
name: name of the environment variable to be set
|
||||
"""
|
||||
kwargs.update(self._get_outside_caller_attributes())
|
||||
item = UnsetEnv(name, **kwargs)
|
||||
self.env_modifications.append(item)
|
||||
|
||||
def set_path(self, name, elts, **kwargs):
|
||||
"""
|
||||
Stores a request to set a path generated from a list.
|
||||
|
||||
Args:
|
||||
name: name o the environment variable to be set.
|
||||
elts: elements of the path to set.
|
||||
"""
|
||||
kwargs.update(self._get_outside_caller_attributes())
|
||||
item = SetPath(name, elts, **kwargs)
|
||||
self.env_modifications.append(item)
|
||||
|
||||
def append_path(self, name, path, **kwargs):
|
||||
"""
|
||||
Stores in the current object a request to append a path to a path list
|
||||
|
||||
Args:
|
||||
name: name of the path list in the environment
|
||||
path: path to be appended
|
||||
"""
|
||||
kwargs.update(self._get_outside_caller_attributes())
|
||||
item = AppendPath(name, path, **kwargs)
|
||||
self.env_modifications.append(item)
|
||||
|
||||
def prepend_path(self, name, path, **kwargs):
|
||||
"""
|
||||
Same as `append_path`, but the path is pre-pended
|
||||
|
||||
Args:
|
||||
name: name of the path list in the environment
|
||||
path: path to be pre-pended
|
||||
"""
|
||||
kwargs.update(self._get_outside_caller_attributes())
|
||||
item = PrependPath(name, path, **kwargs)
|
||||
self.env_modifications.append(item)
|
||||
|
||||
def remove_path(self, name, path, **kwargs):
|
||||
"""
|
||||
Stores in the current object a request to remove a path from a path list
|
||||
|
||||
Args:
|
||||
name: name of the path list in the environment
|
||||
path: path to be removed
|
||||
"""
|
||||
kwargs.update(self._get_outside_caller_attributes())
|
||||
item = RemovePath(name, path, **kwargs)
|
||||
self.env_modifications.append(item)
|
||||
|
||||
def group_by_name(self):
|
||||
"""
|
||||
Returns a dict of the modifications grouped by variable name
|
||||
|
||||
Returns:
|
||||
dict mapping the environment variable name to the modifications to be done on it
|
||||
"""
|
||||
modifications = collections.defaultdict(list)
|
||||
for item in self:
|
||||
modifications[item.name].append(item)
|
||||
return modifications
|
||||
|
||||
def clear(self):
|
||||
"""
|
||||
Clears the current list of modifications
|
||||
"""
|
||||
self.env_modifications.clear()
|
||||
|
||||
def apply_modifications(self):
|
||||
"""
|
||||
Applies the modifications and clears the list
|
||||
"""
|
||||
modifications = self.group_by_name()
|
||||
# Apply the modifications to the environment variables one variable at a time
|
||||
for name, actions in sorted(modifications.items()):
|
||||
for x in actions:
|
||||
x.execute()
|
||||
|
||||
|
||||
def concatenate_paths(paths):
|
||||
"""
|
||||
Concatenates an iterable of paths into a string of column separated paths
|
||||
|
||||
Args:
|
||||
paths: iterable of paths
|
||||
|
||||
Returns:
|
||||
string
|
||||
"""
|
||||
return ':'.join(str(item) for item in paths)
|
||||
|
||||
|
||||
def set_or_unset_not_first(variable, changes, errstream):
|
||||
"""
|
||||
Check if we are going to set or unset something after other modifications have already been requested
|
||||
"""
|
||||
indexes = [ii for ii, item in enumerate(changes) if ii != 0 and type(item) in [SetEnv, UnsetEnv]]
|
||||
if indexes:
|
||||
good = '\t \t{context} at {filename}:{lineno}'
|
||||
nogood = '\t--->\t{context} at {filename}:{lineno}'
|
||||
errstream('Suspicious requests to set or unset the variable \'{var}\' found'.format(var=variable))
|
||||
for ii, item in enumerate(changes):
|
||||
print_format = nogood if ii in indexes else good
|
||||
errstream(print_format.format(**item.args))
|
||||
|
||||
|
||||
def validate(env, errstream):
|
||||
"""
|
||||
Validates the environment modifications to check for the presence of suspicious patterns. Prompts a warning for
|
||||
everything that was found
|
||||
|
||||
Current checks:
|
||||
- set or unset variables after other changes on the same variable
|
||||
|
||||
Args:
|
||||
env: list of environment modifications
|
||||
"""
|
||||
modifications = env.group_by_name()
|
||||
for variable, list_of_changes in sorted(modifications.items()):
|
||||
set_or_unset_not_first(variable, list_of_changes, errstream)
|
@ -289,8 +289,14 @@ def reset(self):
|
||||
if not self.archive_file:
|
||||
raise NoArchiveFileError("Tried to reset URLFetchStrategy before fetching",
|
||||
"Failed on reset() for URL %s" % self.url)
|
||||
if self.stage.source_path:
|
||||
shutil.rmtree(self.stage.source_path, ignore_errors=True)
|
||||
|
||||
# Remove everythigng but the archive from the stage
|
||||
for filename in os.listdir(self.stage.path):
|
||||
abspath = os.path.join(self.stage.path, filename)
|
||||
if abspath != self.archive_file:
|
||||
shutil.rmtree(abspath, ignore_errors=True)
|
||||
|
||||
# Expand the archive again
|
||||
self.expand()
|
||||
|
||||
def __repr__(self):
|
||||
|
@ -22,14 +22,12 @@
|
||||
# along with this program; if not, write to the Free Software Foundation,
|
||||
# Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
##############################################################################
|
||||
"""This module contains code for creating environment modules, which
|
||||
can include dotkits, tcl modules, lmod, and others.
|
||||
"""
|
||||
This module contains code for creating environment modules, which can include dotkits, tcl modules, lmod, and others.
|
||||
|
||||
The various types of modules are installed by post-install hooks and
|
||||
removed after an uninstall by post-uninstall hooks. This class
|
||||
consolidates the logic for creating an abstract description of the
|
||||
information that module systems need. Currently that includes a
|
||||
number of directories to be appended to paths in the user's environment:
|
||||
The various types of modules are installed by post-install hooks and removed after an uninstall by post-uninstall hooks.
|
||||
This class consolidates the logic for creating an abstract description of the information that module systems need.
|
||||
Currently that includes a number of directories to be appended to paths in the user's environment:
|
||||
|
||||
* /bin directories to be appended to PATH
|
||||
* /lib* directories for LD_LIBRARY_PATH
|
||||
@ -37,30 +35,30 @@
|
||||
* /man* and /share/man* directories for MANPATH
|
||||
* the package prefix for CMAKE_PREFIX_PATH
|
||||
|
||||
This module also includes logic for coming up with unique names for
|
||||
the module files so that they can be found by the various
|
||||
shell-support files in $SPACK/share/spack/setup-env.*.
|
||||
This module also includes logic for coming up with unique names for the module files so that they can be found by the
|
||||
various shell-support files in $SPACK/share/spack/setup-env.*.
|
||||
|
||||
Each hook in hooks/ implements the logic for writing its specific type
|
||||
of module file.
|
||||
Each hook in hooks/ implements the logic for writing its specific type of module file.
|
||||
"""
|
||||
__all__ = ['EnvModule', 'Dotkit', 'TclModule']
|
||||
|
||||
import os
|
||||
import os.path
|
||||
import re
|
||||
import textwrap
|
||||
import shutil
|
||||
from glob import glob
|
||||
import textwrap
|
||||
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.filesystem import join_path, mkdirp
|
||||
|
||||
import spack
|
||||
import spack.config
|
||||
from llnl.util.filesystem import join_path, mkdirp
|
||||
from spack.environment import *
|
||||
|
||||
"""Registry of all types of modules. Entries created by EnvModule's
|
||||
metaclass."""
|
||||
__all__ = ['EnvModule', 'Dotkit', 'TclModule']
|
||||
|
||||
# Registry of all types of modules. Entries created by EnvModule's metaclass
|
||||
module_types = {}
|
||||
|
||||
CONFIGURATION = spack.config.get_config('modules')
|
||||
|
||||
|
||||
def print_help():
|
||||
"""For use by commands to tell user how to activate shell support."""
|
||||
@ -79,75 +77,76 @@ def print_help():
|
||||
"")
|
||||
|
||||
|
||||
def inspect_path(prefix):
|
||||
"""
|
||||
Inspects the prefix of an installation to search for common layouts. Issues a request to modify the environment
|
||||
accordingly when an item is found.
|
||||
|
||||
Args:
|
||||
prefix: prefix of the installation
|
||||
|
||||
Returns:
|
||||
instance of EnvironmentModifications containing the requested modifications
|
||||
"""
|
||||
env = EnvironmentModifications()
|
||||
# Inspect the prefix to check for the existence of common directories
|
||||
prefix_inspections = {
|
||||
'bin': ('PATH',),
|
||||
'man': ('MANPATH',),
|
||||
'lib': ('LIBRARY_PATH', 'LD_LIBRARY_PATH'),
|
||||
'lib64': ('LIBRARY_PATH', 'LD_LIBRARY_PATH'),
|
||||
'include': ('CPATH',)
|
||||
}
|
||||
for attribute, variables in prefix_inspections.items():
|
||||
expected = getattr(prefix, attribute)
|
||||
if os.path.isdir(expected):
|
||||
for variable in variables:
|
||||
env.prepend_path(variable, expected)
|
||||
# PKGCONFIG
|
||||
for expected in (join_path(prefix.lib, 'pkgconfig'), join_path(prefix.lib64, 'pkgconfig')):
|
||||
if os.path.isdir(expected):
|
||||
env.prepend_path('PKG_CONFIG_PATH', expected)
|
||||
# CMake related variables
|
||||
env.prepend_path('CMAKE_PREFIX_PATH', prefix)
|
||||
return env
|
||||
|
||||
|
||||
class EnvModule(object):
|
||||
name = 'env_module'
|
||||
formats = {}
|
||||
|
||||
class __metaclass__(type):
|
||||
def __init__(cls, name, bases, dict):
|
||||
type.__init__(cls, name, bases, dict)
|
||||
if cls.name != 'env_module':
|
||||
if cls.name != 'env_module' and cls.name in CONFIGURATION['enable']:
|
||||
module_types[cls.name] = cls
|
||||
|
||||
|
||||
def __init__(self, spec=None):
|
||||
# category in the modules system
|
||||
# TODO: come up with smarter category names.
|
||||
self.category = "spack"
|
||||
|
||||
# Descriptions for the module system's UI
|
||||
self.short_description = ""
|
||||
self.long_description = ""
|
||||
|
||||
# dict pathname -> list of directories to be prepended to in
|
||||
# the module file.
|
||||
self._paths = None
|
||||
self.spec = spec
|
||||
self.pkg = spec.package # Just stored for convenience
|
||||
|
||||
|
||||
@property
|
||||
def paths(self):
|
||||
if self._paths is None:
|
||||
self._paths = {}
|
||||
|
||||
def add_path(path_name, directory):
|
||||
path = self._paths.setdefault(path_name, [])
|
||||
path.append(directory)
|
||||
|
||||
# Add paths if they exist.
|
||||
for var, directory in [
|
||||
('PATH', self.spec.prefix.bin),
|
||||
('MANPATH', self.spec.prefix.man),
|
||||
('MANPATH', self.spec.prefix.share_man),
|
||||
('LIBRARY_PATH', self.spec.prefix.lib),
|
||||
('LIBRARY_PATH', self.spec.prefix.lib64),
|
||||
('LD_LIBRARY_PATH', self.spec.prefix.lib),
|
||||
('LD_LIBRARY_PATH', self.spec.prefix.lib64),
|
||||
('CPATH', self.spec.prefix.include),
|
||||
('PKG_CONFIG_PATH', join_path(self.spec.prefix.lib, 'pkgconfig')),
|
||||
('PKG_CONFIG_PATH', join_path(self.spec.prefix.lib64, 'pkgconfig'))]:
|
||||
|
||||
if os.path.isdir(directory):
|
||||
add_path(var, directory)
|
||||
|
||||
# Add python path unless it's an actual python installation
|
||||
# TODO: is there a better way to do this?
|
||||
if self.spec.name != 'python':
|
||||
site_packages = glob(join_path(self.spec.prefix.lib, "python*/site-packages"))
|
||||
if site_packages:
|
||||
add_path('PYTHONPATH', site_packages[0])
|
||||
|
||||
if self.spec.package.extends(spack.spec.Spec('ruby')):
|
||||
add_path('GEM_PATH', self.spec.prefix)
|
||||
|
||||
# short description is just the package + version
|
||||
# TODO: maybe packages can optionally provide it.
|
||||
self.short_description = self.spec.format("$_ $@")
|
||||
# short description default is just the package + version
|
||||
# packages can provide this optional attribute
|
||||
self.short_description = spec.format("$_ $@")
|
||||
if hasattr(self.pkg, 'short_description'):
|
||||
self.short_description = self.pkg.short_description
|
||||
|
||||
# long description is the docstring with reduced whitespace.
|
||||
self.long_description = None
|
||||
if self.spec.package.__doc__:
|
||||
self.long_description = re.sub(r'\s+', ' ', self.spec.package.__doc__)
|
||||
|
||||
return self._paths
|
||||
|
||||
@property
|
||||
def category(self):
|
||||
# Anything defined at the package level takes precedence
|
||||
if hasattr(self.pkg, 'category'):
|
||||
return self.pkg.category
|
||||
# Extensions
|
||||
for extendee in self.pkg.extendees:
|
||||
return '{extendee} extension'.format(extendee=extendee)
|
||||
# Not very descriptive fallback
|
||||
return 'spack installed package'
|
||||
|
||||
|
||||
def write(self):
|
||||
@ -156,18 +155,41 @@ def write(self):
|
||||
if not os.path.exists(module_dir):
|
||||
mkdirp(module_dir)
|
||||
|
||||
# If there are no paths, no need for a dotkit.
|
||||
if not self.paths:
|
||||
# Environment modifications guessed by inspecting the
|
||||
# installation prefix
|
||||
env = inspect_path(self.spec.prefix)
|
||||
|
||||
# Let the extendee modify their extensions before asking for
|
||||
# package-specific modifications
|
||||
spack_env = EnvironmentModifications()
|
||||
for item in self.pkg.extendees:
|
||||
package = self.spec[item].package
|
||||
package.setup_dependent_package(self.pkg.module, self.spec)
|
||||
package.setup_dependent_environment(spack_env, env, self.spec)
|
||||
|
||||
# Package-specific environment modifications
|
||||
self.spec.package.setup_environment(spack_env, env)
|
||||
|
||||
# TODO : implement site-specific modifications and filters
|
||||
if not env:
|
||||
return
|
||||
|
||||
with open(self.file_name, 'w') as f:
|
||||
self._write(f)
|
||||
self.write_header(f)
|
||||
for line in self.process_environment_command(env):
|
||||
f.write(line)
|
||||
|
||||
|
||||
def _write(self, stream):
|
||||
"""To be implemented by subclasses."""
|
||||
def write_header(self, stream):
|
||||
raise NotImplementedError()
|
||||
|
||||
def process_environment_command(self, env):
|
||||
for command in env:
|
||||
try:
|
||||
yield self.formats[type(command)].format(**command.args)
|
||||
except KeyError:
|
||||
tty.warn('Cannot handle command of type {command} : skipping request'.format(command=type(command)))
|
||||
tty.warn('{context} at {filename}:{lineno}'.format(**command.args))
|
||||
|
||||
|
||||
@property
|
||||
def file_name(self):
|
||||
@ -175,14 +197,12 @@ def file_name(self):
|
||||
where this module lives."""
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
@property
|
||||
def use_name(self):
|
||||
"""Subclasses should implement this to return the name the
|
||||
module command uses to refer to the package."""
|
||||
raise NotImplementedError()
|
||||
|
||||
|
||||
def remove(self):
|
||||
mod_file = self.file_name
|
||||
if os.path.exists(mod_file):
|
||||
@ -193,10 +213,14 @@ class Dotkit(EnvModule):
|
||||
name = 'dotkit'
|
||||
path = join_path(spack.share_path, "dotkit")
|
||||
|
||||
formats = {
|
||||
PrependPath: 'dk_alter {name} {value}\n',
|
||||
SetEnv: 'dk_setenv {name} {value}\n'
|
||||
}
|
||||
|
||||
@property
|
||||
def file_name(self):
|
||||
return join_path(Dotkit.path, self.spec.architecture,
|
||||
'%s.dk' % self.use_name)
|
||||
return join_path(Dotkit.path, self.spec.architecture, '%s.dk' % self.use_name)
|
||||
|
||||
@property
|
||||
def use_name(self):
|
||||
@ -205,7 +229,7 @@ def use_name(self):
|
||||
self.spec.compiler.version,
|
||||
self.spec.dag_hash())
|
||||
|
||||
def _write(self, dk_file):
|
||||
def write_header(self, dk_file):
|
||||
# Category
|
||||
if self.category:
|
||||
dk_file.write('#c %s\n' % self.category)
|
||||
@ -219,24 +243,23 @@ def _write(self, dk_file):
|
||||
for line in textwrap.wrap(self.long_description, 72):
|
||||
dk_file.write("#h %s\n" % line)
|
||||
|
||||
# Path alterations
|
||||
for var, dirs in self.paths.items():
|
||||
for directory in dirs:
|
||||
dk_file.write("dk_alter %s %s\n" % (var, directory))
|
||||
|
||||
# Let CMake find this package.
|
||||
dk_file.write("dk_alter CMAKE_PREFIX_PATH %s\n" % self.spec.prefix)
|
||||
|
||||
|
||||
class TclModule(EnvModule):
|
||||
name = 'tcl'
|
||||
path = join_path(spack.share_path, "modules")
|
||||
|
||||
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'
|
||||
}
|
||||
|
||||
@property
|
||||
def file_name(self):
|
||||
return join_path(TclModule.path, self.spec.architecture, self.use_name)
|
||||
|
||||
|
||||
@property
|
||||
def use_name(self):
|
||||
return "%s-%s-%s-%s-%s" % (self.spec.name, self.spec.version,
|
||||
@ -244,25 +267,17 @@ def use_name(self):
|
||||
self.spec.compiler.version,
|
||||
self.spec.dag_hash())
|
||||
|
||||
|
||||
def _write(self, m_file):
|
||||
# TODO: cateogry?
|
||||
m_file.write('#%Module1.0\n')
|
||||
|
||||
def write_header(self, module_file):
|
||||
# TCL Modulefile header
|
||||
module_file.write('#%Module1.0\n')
|
||||
# TODO : category ?
|
||||
# Short description
|
||||
if self.short_description:
|
||||
m_file.write('module-whatis \"%s\"\n\n' % self.short_description)
|
||||
module_file.write('module-whatis \"%s\"\n\n' % self.short_description)
|
||||
|
||||
# Long description
|
||||
if self.long_description:
|
||||
m_file.write('proc ModulesHelp { } {\n')
|
||||
doc = re.sub(r'"', '\"', self.long_description)
|
||||
m_file.write("puts stderr \"%s\"\n" % doc)
|
||||
m_file.write('}\n\n')
|
||||
|
||||
# Path alterations
|
||||
for var, dirs in self.paths.items():
|
||||
for directory in dirs:
|
||||
m_file.write("prepend-path %s \"%s\"\n" % (var, directory))
|
||||
|
||||
m_file.write("prepend-path CMAKE_PREFIX_PATH \"%s\"\n" % self.spec.prefix)
|
||||
module_file.write('proc ModulesHelp { } {\n')
|
||||
for line in textwrap.wrap(self.long_description, 72):
|
||||
module_file.write("puts stderr \"%s\"\n" % line)
|
||||
module_file.write('}\n\n')
|
||||
|
@ -34,40 +34,34 @@
|
||||
README.
|
||||
"""
|
||||
import os
|
||||
import errno
|
||||
import re
|
||||
import shutil
|
||||
import time
|
||||
import itertools
|
||||
import subprocess
|
||||
import platform as py_platform
|
||||
import multiprocessing
|
||||
from urlparse import urlparse, urljoin
|
||||
import textwrap
|
||||
from StringIO import StringIO
|
||||
import time
|
||||
import glob
|
||||
|
||||
import llnl.util.tty as tty
|
||||
from llnl.util.tty.log import log_output
|
||||
from llnl.util.link_tree import LinkTree
|
||||
from llnl.util.filesystem import *
|
||||
from llnl.util.lang import *
|
||||
|
||||
import spack
|
||||
import spack.error
|
||||
import spack.compilers
|
||||
import spack.mirror
|
||||
import spack.hooks
|
||||
import spack.directives
|
||||
import spack.repository
|
||||
import spack.build_environment
|
||||
import spack.compilers
|
||||
import spack.directives
|
||||
import spack.error
|
||||
import spack.fetch_strategy as fs
|
||||
import spack.hooks
|
||||
import spack.mirror
|
||||
import spack.repository
|
||||
import spack.url
|
||||
import spack.util.web
|
||||
import spack.fetch_strategy as fs
|
||||
from spack.version import *
|
||||
from StringIO import StringIO
|
||||
from llnl.util.filesystem import *
|
||||
from llnl.util.lang import *
|
||||
from llnl.util.link_tree import LinkTree
|
||||
from llnl.util.tty.log import log_output
|
||||
from spack.stage import Stage, ResourceStage, StageComposite
|
||||
from spack.util.compression import allowed_archive, extension
|
||||
from spack.util.executable import ProcessError
|
||||
from spack.util.compression import allowed_archive
|
||||
from spack.util.environment import dump_environment
|
||||
from spack.util.executable import ProcessError
|
||||
from spack.version import *
|
||||
from urlparse import urlparse
|
||||
|
||||
"""Allowed URL schemes for spack packages."""
|
||||
_ALLOWED_URL_SCHEMES = ["http", "https", "ftp", "file", "git"]
|
||||
@ -341,6 +335,9 @@ def __init__(self, spec):
|
||||
if '.' in self.name:
|
||||
self.name = self.name[self.name.rindex('.') + 1:]
|
||||
|
||||
# Allow custom staging paths for packages
|
||||
self.path=None
|
||||
|
||||
# Sanity check attributes required by Spack directives.
|
||||
spack.directives.ensure_dicts(type(self))
|
||||
|
||||
@ -459,7 +456,8 @@ def _make_resource_stage(self, root_stage, fetcher, resource):
|
||||
resource_stage_folder = self._resource_stage(resource)
|
||||
resource_mirror = join_path(self.name, os.path.basename(fetcher.url))
|
||||
stage = ResourceStage(resource.fetcher, root=root_stage, resource=resource,
|
||||
name=resource_stage_folder, mirror_path=resource_mirror)
|
||||
name=resource_stage_folder, mirror_path=resource_mirror,
|
||||
path=self.path)
|
||||
return stage
|
||||
|
||||
def _make_root_stage(self, fetcher):
|
||||
@ -469,7 +467,7 @@ def _make_root_stage(self, fetcher):
|
||||
s = self.spec
|
||||
stage_name = "%s-%s-%s" % (s.name, s.version, s.dag_hash())
|
||||
# Build the composite stage
|
||||
stage = Stage(fetcher, mirror_path=mp, name=stage_name)
|
||||
stage = Stage(fetcher, mirror_path=mp, name=stage_name, path=self.path)
|
||||
return stage
|
||||
|
||||
def _make_stage(self):
|
||||
@ -942,6 +940,9 @@ def build_process():
|
||||
install(env_path, env_install_path)
|
||||
dump_packages(self.spec, packages_dir)
|
||||
|
||||
# Run post install hooks before build stage is removed.
|
||||
spack.hooks.post_install(self)
|
||||
|
||||
# Stop timer.
|
||||
self._total_time = time.time() - start_time
|
||||
build_time = self._total_time - self._fetch_time
|
||||
@ -970,9 +971,6 @@ def build_process():
|
||||
# the database, so that we don't need to re-read from file.
|
||||
spack.installed_db.add(self.spec, self.prefix)
|
||||
|
||||
# Once everything else is done, run post install hooks
|
||||
spack.hooks.post_install(self)
|
||||
|
||||
|
||||
def sanity_check_prefix(self):
|
||||
"""This function checks whether install succeeded."""
|
||||
@ -1018,38 +1016,127 @@ def module(self):
|
||||
return __import__(self.__class__.__module__,
|
||||
fromlist=[self.__class__.__name__])
|
||||
|
||||
def setup_environment(self, spack_env, run_env):
|
||||
"""Set up the compile and runtime environemnts for a package.
|
||||
|
||||
def setup_dependent_environment(self, module, spec, dependent_spec):
|
||||
"""Called before the install() method of dependents.
|
||||
`spack_env` and `run_env` are `EnvironmentModifications`
|
||||
objects. Package authors can call methods on them to alter
|
||||
the environment within Spack and at runtime.
|
||||
|
||||
Both `spack_env` and `run_env` are applied within the build
|
||||
process, before this package's `install()` method is called.
|
||||
|
||||
Modifications in `run_env` will *also* be added to the
|
||||
generated environment modules for this package.
|
||||
|
||||
Default implementation does nothing, but this can be
|
||||
overridden by an extendable package to set up the install
|
||||
environment for its extensions. This is useful if there are
|
||||
some common steps to installing all extensions for a
|
||||
certain package.
|
||||
overridden if the package needs a particular environment.
|
||||
|
||||
Some examples:
|
||||
Examples:
|
||||
|
||||
1. Installing python modules generally requires PYTHONPATH to
|
||||
point to the lib/pythonX.Y/site-packages directory in the
|
||||
module's install prefix. This could set that variable.
|
||||
1. Qt extensions need `QTDIR` set.
|
||||
|
||||
2. Extensions often need to invoke the 'python' interpreter
|
||||
from the Python installation being extended. This routine can
|
||||
put a 'python' Execuable object in the module scope for the
|
||||
extension package to simplify extension installs.
|
||||
Args:
|
||||
spack_env (EnvironmentModifications): list of
|
||||
modifications to be applied when this package is built
|
||||
within Spack.
|
||||
|
||||
3. A lot of Qt extensions need QTDIR set. This can be used to do that.
|
||||
run_env (EnvironmentModifications): list of environment
|
||||
changes to be applied when this package is run outside
|
||||
of Spack.
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
|
||||
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
|
||||
"""Set up the environment of packages that depend on this one.
|
||||
|
||||
This is similar to `setup_environment`, but it is used to
|
||||
modify the compile and runtime environments of packages that
|
||||
*depend* on this one. This gives packages like Python and
|
||||
others that follow the extension model a way to implement
|
||||
common environment or compile-time settings for dependencies.
|
||||
|
||||
By default, this delegates to self.setup_environment()
|
||||
|
||||
Example :
|
||||
|
||||
1. Installing python modules generally requires
|
||||
`PYTHONPATH` to point to the lib/pythonX.Y/site-packages
|
||||
directory in the module's install prefix. This could
|
||||
set that variable.
|
||||
|
||||
Args:
|
||||
|
||||
spack_env (EnvironmentModifications): list of
|
||||
modifications to be applied when the dependent package
|
||||
is bulit within Spack.
|
||||
|
||||
run_env (EnvironmentModifications): list of environment
|
||||
changes to be applied when the dependent package is
|
||||
run outside of Spack.
|
||||
|
||||
dependent_spec (Spec): The spec of the dependent package
|
||||
about to be built. This allows the extendee (self) to
|
||||
query the dependent's state. Note that *this*
|
||||
package's spec is available as `self.spec`.
|
||||
|
||||
This is useful if there are some common steps to installing
|
||||
all extensions for a certain package.
|
||||
|
||||
"""
|
||||
self.setup_environment(spack_env, run_env)
|
||||
|
||||
|
||||
def setup_dependent_package(self, module, dependent_spec):
|
||||
"""Set up Python module-scope variables for dependent packages.
|
||||
|
||||
Called before the install() method of dependents.
|
||||
|
||||
Default implementation does nothing, but this can be
|
||||
overridden by an extendable package to set up the module of
|
||||
its extensions. This is useful if there are some common steps
|
||||
to installing all extensions for a certain package.
|
||||
|
||||
Example :
|
||||
|
||||
1. Extensions often need to invoke the `python`
|
||||
interpreter from the Python installation being
|
||||
extended. This routine can put a 'python' Executable
|
||||
object in the module scope for the extension package to
|
||||
simplify extension installs.
|
||||
|
||||
2. MPI compilers could set some variables in the
|
||||
dependent's scope that point to `mpicc`, `mpicxx`,
|
||||
etc., allowing them to be called by common names
|
||||
regardless of which MPI is used.
|
||||
|
||||
3. BLAS/LAPACK implementations can set some variables
|
||||
indicating the path to their libraries, since these
|
||||
paths differ by BLAS/LAPACK implementation.
|
||||
|
||||
Args:
|
||||
|
||||
module (module): The Python `module` object of the
|
||||
dependent package. Packages can use this to set
|
||||
module-scope variables for the dependent to use.
|
||||
|
||||
dependent_spec (Spec): The spec of the dependent package
|
||||
about to be built. This allows the extendee (self) to
|
||||
query the dependent's state. Note that *this*
|
||||
package's spec is available as `self.spec`.
|
||||
|
||||
This is useful if there are some common steps to installing
|
||||
all extensions for a certain package.
|
||||
|
||||
"""
|
||||
pass
|
||||
|
||||
def install(self, spec, prefix):
|
||||
"""Package implementations override this with their own build configuration."""
|
||||
raise InstallError("Package %s provides no install method!" % self.name)
|
||||
|
||||
|
||||
def do_uninstall(self, force=False):
|
||||
if not self.installed:
|
||||
raise InstallError(str(self.spec) + " is not installed.")
|
||||
@ -1361,6 +1448,10 @@ def __init__(self, message, long_msg=None):
|
||||
super(InstallError, self).__init__(message, long_msg)
|
||||
|
||||
|
||||
class ExternalPackageError(InstallError):
|
||||
"""Raised by install() when a package is only for external use."""
|
||||
|
||||
|
||||
class PackageStillNeededError(InstallError):
|
||||
"""Raised when package is still needed by another on uninstall."""
|
||||
def __init__(self, spec, dependents):
|
||||
|
@ -89,7 +89,7 @@ class Stage(object):
|
||||
"""
|
||||
|
||||
def __init__(self, url_or_fetch_strategy,
|
||||
name=None, mirror_path=None, keep=False):
|
||||
name=None, mirror_path=None, keep=False, path=None):
|
||||
"""Create a stage object.
|
||||
Parameters:
|
||||
url_or_fetch_strategy
|
||||
@ -135,6 +135,9 @@ def __init__(self, url_or_fetch_strategy,
|
||||
|
||||
# Try to construct here a temporary name for the stage directory
|
||||
# If this is a named stage, then construct a named path.
|
||||
if path is not None:
|
||||
self.path = path
|
||||
else:
|
||||
self.path = join_path(spack.stage_path, self.name)
|
||||
|
||||
# Flag to decide whether to delete the stage folder on exit or not
|
||||
|
@ -66,7 +66,8 @@
|
||||
'database',
|
||||
'namespace_trie',
|
||||
'yaml',
|
||||
'sbang']
|
||||
'sbang',
|
||||
'environment']
|
||||
|
||||
|
||||
def list_tests():
|
||||
|
@ -28,6 +28,8 @@
|
||||
"""
|
||||
import os
|
||||
import unittest
|
||||
import tempfile
|
||||
import shutil
|
||||
|
||||
from llnl.util.filesystem import *
|
||||
import spack
|
||||
@ -55,13 +57,40 @@ def setUp(self):
|
||||
self.ld = Executable(join_path(spack.build_env_path, "ld"))
|
||||
self.cpp = Executable(join_path(spack.build_env_path, "cpp"))
|
||||
|
||||
os.environ['SPACK_CC'] = "/bin/mycc"
|
||||
os.environ['SPACK_PREFIX'] = "/usr"
|
||||
self.realcc = "/bin/mycc"
|
||||
self.prefix = "/spack-test-prefix"
|
||||
|
||||
os.environ['SPACK_CC'] = self.realcc
|
||||
os.environ['SPACK_PREFIX'] = self.prefix
|
||||
os.environ['SPACK_ENV_PATH']="test"
|
||||
os.environ['SPACK_DEBUG_LOG_DIR'] = "."
|
||||
os.environ['SPACK_COMPILER_SPEC'] = "gcc@4.4.7"
|
||||
os.environ['SPACK_SHORT_SPEC'] = "foo@1.2"
|
||||
|
||||
# Make some fake dependencies
|
||||
self.tmp_deps = tempfile.mkdtemp()
|
||||
self.dep1 = join_path(self.tmp_deps, 'dep1')
|
||||
self.dep2 = join_path(self.tmp_deps, 'dep2')
|
||||
self.dep3 = join_path(self.tmp_deps, 'dep3')
|
||||
self.dep4 = join_path(self.tmp_deps, 'dep4')
|
||||
|
||||
mkdirp(join_path(self.dep1, 'include'))
|
||||
mkdirp(join_path(self.dep1, 'lib'))
|
||||
|
||||
mkdirp(join_path(self.dep2, 'lib64'))
|
||||
|
||||
mkdirp(join_path(self.dep3, 'include'))
|
||||
mkdirp(join_path(self.dep3, 'lib64'))
|
||||
|
||||
mkdirp(join_path(self.dep4, 'include'))
|
||||
|
||||
if 'SPACK_DEPENDENCIES' in os.environ:
|
||||
del os.environ['SPACK_DEPENDENCIES']
|
||||
|
||||
|
||||
def tearDown(self):
|
||||
shutil.rmtree(self.tmp_deps, True)
|
||||
|
||||
|
||||
def check_cc(self, command, args, expected):
|
||||
os.environ['SPACK_TEST_COMMAND'] = command
|
||||
@ -92,6 +121,10 @@ def test_cpp_mode(self):
|
||||
self.check_cpp('dump-mode', [], "cpp")
|
||||
|
||||
|
||||
def test_as_mode(self):
|
||||
self.check_cc('dump-mode', ['-S'], "as")
|
||||
|
||||
|
||||
def test_ccld_mode(self):
|
||||
self.check_cc('dump-mode', [], "ccld")
|
||||
self.check_cc('dump-mode', ['foo.c', '-o', 'foo'], "ccld")
|
||||
@ -104,27 +137,85 @@ def test_ld_mode(self):
|
||||
self.check_ld('dump-mode', ['foo.o', 'bar.o', 'baz.o', '-o', 'foo', '-Wl,-rpath,foo'], "ld")
|
||||
|
||||
|
||||
def test_includes(self):
|
||||
self.check_cc('dump-includes', test_command,
|
||||
"\n".join(["/test/include", "/other/include"]))
|
||||
def test_dep_rpath(self):
|
||||
"""Ensure RPATHs for root package are added."""
|
||||
self.check_cc('dump-args', test_command,
|
||||
self.realcc + ' ' +
|
||||
'-Wl,-rpath,' + self.prefix + '/lib ' +
|
||||
'-Wl,-rpath,' + self.prefix + '/lib64 ' +
|
||||
' '.join(test_command))
|
||||
|
||||
|
||||
def test_libraries(self):
|
||||
self.check_cc('dump-libraries', test_command,
|
||||
"\n".join(["/test/lib", "/other/lib"]))
|
||||
def test_dep_include(self):
|
||||
"""Ensure a single dependency include directory is added."""
|
||||
os.environ['SPACK_DEPENDENCIES'] = self.dep4
|
||||
self.check_cc('dump-args', test_command,
|
||||
self.realcc + ' ' +
|
||||
'-Wl,-rpath,' + self.prefix + '/lib ' +
|
||||
'-Wl,-rpath,' + self.prefix + '/lib64 ' +
|
||||
'-I' + self.dep4 + '/include ' +
|
||||
' '.join(test_command))
|
||||
|
||||
|
||||
def test_libs(self):
|
||||
self.check_cc('dump-libs', test_command,
|
||||
"\n".join(["lib1", "lib2", "lib3", "lib4"]))
|
||||
def test_dep_lib(self):
|
||||
"""Ensure a single dependency RPATH is added."""
|
||||
os.environ['SPACK_DEPENDENCIES'] = self.dep2
|
||||
self.check_cc('dump-args', test_command,
|
||||
self.realcc + ' ' +
|
||||
'-Wl,-rpath,' + self.prefix + '/lib ' +
|
||||
'-Wl,-rpath,' + self.prefix + '/lib64 ' +
|
||||
'-L' + self.dep2 + '/lib64 ' +
|
||||
'-Wl,-rpath,' + self.dep2 + '/lib64 ' +
|
||||
' '.join(test_command))
|
||||
|
||||
|
||||
def test_rpaths(self):
|
||||
self.check_cc('dump-rpaths', test_command,
|
||||
"\n".join(["/first/rpath", "/second/rpath", "/third/rpath", "/fourth/rpath"]))
|
||||
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])
|
||||
|
||||
# This is probably more constrained than it needs to be; it
|
||||
# checks order within prepended args and doesn't strictly have
|
||||
# to. We could loosen that if it becomes necessary
|
||||
self.check_cc('dump-args', test_command,
|
||||
self.realcc + ' ' +
|
||||
'-Wl,-rpath,' + self.prefix + '/lib ' +
|
||||
'-Wl,-rpath,' + self.prefix + '/lib64 ' +
|
||||
|
||||
'-I' + self.dep4 + '/include ' +
|
||||
|
||||
'-L' + self.dep3 + '/lib64 ' +
|
||||
'-Wl,-rpath,' + self.dep3 + '/lib64 ' +
|
||||
'-I' + self.dep3 + '/include ' +
|
||||
|
||||
'-L' + self.dep2 + '/lib64 ' +
|
||||
'-Wl,-rpath,' + self.dep2 + '/lib64 ' +
|
||||
|
||||
'-L' + self.dep1 + '/lib ' +
|
||||
'-Wl,-rpath,' + self.dep1 + '/lib ' +
|
||||
'-I' + self.dep1 + '/include ' +
|
||||
|
||||
' '.join(test_command))
|
||||
|
||||
|
||||
def test_other_args(self):
|
||||
self.check_cc('dump-other-args', test_command,
|
||||
"\n".join(["arg1", "-Wl,--start-group", "arg2", "arg3", "arg4",
|
||||
"-Wl,--end-group", "arg5", "arg6"]))
|
||||
def test_ld_deps(self):
|
||||
"""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])
|
||||
|
||||
self.check_ld('dump-args', test_command,
|
||||
'ld ' +
|
||||
'-rpath ' + self.prefix + '/lib ' +
|
||||
'-rpath ' + self.prefix + '/lib64 ' +
|
||||
|
||||
'-L' + self.dep3 + '/lib64 ' +
|
||||
'-rpath ' + self.dep3 + '/lib64 ' +
|
||||
|
||||
'-L' + self.dep2 + '/lib64 ' +
|
||||
'-rpath ' + self.dep2 + '/lib64 ' +
|
||||
|
||||
'-L' + self.dep1 + '/lib ' +
|
||||
'-rpath ' + self.dep1 + '/lib ' +
|
||||
|
||||
' '.join(test_command))
|
||||
|
||||
|
@ -24,6 +24,7 @@
|
||||
##############################################################################
|
||||
import spack
|
||||
from spack.spec import Spec, CompilerSpec
|
||||
from spack.version import ver
|
||||
from spack.concretize import find_spec
|
||||
from spack.test.mock_packages_test import *
|
||||
|
||||
@ -77,6 +78,14 @@ def test_concretize_variant(self):
|
||||
self.check_concretize('mpich')
|
||||
|
||||
|
||||
def test_concretize_preferred_version(self):
|
||||
spec = self.check_concretize('python')
|
||||
self.assertEqual(spec.versions, ver('2.7.11'))
|
||||
|
||||
spec = self.check_concretize('python@3.5.1')
|
||||
self.assertEqual(spec.versions, ver('3.5.1'))
|
||||
|
||||
|
||||
def test_concretize_with_virtual(self):
|
||||
self.check_concretize('mpileaks ^mpi')
|
||||
self.check_concretize('mpileaks ^mpi@:1.1')
|
||||
@ -309,3 +318,10 @@ def test_find_spec_none(self):
|
||||
Spec('d')),
|
||||
Spec('e'))
|
||||
self.assertEqual(None, find_spec(s['b'], lambda s: '+foo' in s))
|
||||
|
||||
|
||||
def test_compiler_child(self):
|
||||
s = Spec('mpileaks%clang ^dyninst%gcc')
|
||||
s.concretize()
|
||||
self.assertTrue(s['mpileaks'].satisfies('%clang'))
|
||||
self.assertTrue(s['dyninst'].satisfies('%gcc'))
|
||||
|
@ -26,6 +26,7 @@
|
||||
These tests check the database is functioning properly,
|
||||
both in memory and in its file
|
||||
"""
|
||||
import os.path
|
||||
import multiprocessing
|
||||
import shutil
|
||||
import tempfile
|
||||
|
73
lib/spack/spack/test/environment.py
Normal file
73
lib/spack/spack/test/environment.py
Normal file
@ -0,0 +1,73 @@
|
||||
import unittest
|
||||
import os
|
||||
from spack.environment import EnvironmentModifications
|
||||
|
||||
|
||||
class EnvironmentTest(unittest.TestCase):
|
||||
def setUp(self):
|
||||
os.environ.clear()
|
||||
os.environ['UNSET_ME'] = 'foo'
|
||||
os.environ['EMPTY_PATH_LIST'] = ''
|
||||
os.environ['PATH_LIST'] = '/path/second:/path/third'
|
||||
os.environ['REMOVE_PATH_LIST'] = '/a/b:/duplicate:/a/c:/remove/this:/a/d:/duplicate/:/f/g'
|
||||
|
||||
def test_set(self):
|
||||
env = EnvironmentModifications()
|
||||
env.set('A', 'dummy value')
|
||||
env.set('B', 3)
|
||||
env.apply_modifications()
|
||||
self.assertEqual('dummy value', os.environ['A'])
|
||||
self.assertEqual(str(3), os.environ['B'])
|
||||
|
||||
def test_unset(self):
|
||||
env = EnvironmentModifications()
|
||||
self.assertEqual('foo', os.environ['UNSET_ME'])
|
||||
env.unset('UNSET_ME')
|
||||
env.apply_modifications()
|
||||
self.assertRaises(KeyError, os.environ.__getitem__, 'UNSET_ME')
|
||||
|
||||
def test_set_path(self):
|
||||
env = EnvironmentModifications()
|
||||
env.set_path('A', ['foo', 'bar', 'baz'])
|
||||
env.apply_modifications()
|
||||
self.assertEqual('foo:bar:baz', os.environ['A'])
|
||||
|
||||
def test_path_manipulation(self):
|
||||
env = EnvironmentModifications()
|
||||
|
||||
env.append_path('PATH_LIST', '/path/last')
|
||||
env.prepend_path('PATH_LIST', '/path/first')
|
||||
|
||||
env.append_path('EMPTY_PATH_LIST', '/path/middle')
|
||||
env.append_path('EMPTY_PATH_LIST', '/path/last')
|
||||
env.prepend_path('EMPTY_PATH_LIST', '/path/first')
|
||||
|
||||
env.append_path('NEWLY_CREATED_PATH_LIST', '/path/middle')
|
||||
env.append_path('NEWLY_CREATED_PATH_LIST', '/path/last')
|
||||
env.prepend_path('NEWLY_CREATED_PATH_LIST', '/path/first')
|
||||
|
||||
env.remove_path('REMOVE_PATH_LIST', '/remove/this')
|
||||
env.remove_path('REMOVE_PATH_LIST', '/duplicate/')
|
||||
|
||||
env.apply_modifications()
|
||||
self.assertEqual('/path/first:/path/second:/path/third:/path/last', os.environ['PATH_LIST'])
|
||||
self.assertEqual('/path/first:/path/middle:/path/last', os.environ['EMPTY_PATH_LIST'])
|
||||
self.assertEqual('/path/first:/path/middle:/path/last', os.environ['NEWLY_CREATED_PATH_LIST'])
|
||||
self.assertEqual('/a/b:/a/c:/a/d:/f/g', os.environ['REMOVE_PATH_LIST'])
|
||||
|
||||
def test_extra_arguments(self):
|
||||
env = EnvironmentModifications()
|
||||
env.set('A', 'dummy value', who='Pkg1')
|
||||
for x in env:
|
||||
assert 'who' in x.args
|
||||
env.apply_modifications()
|
||||
self.assertEqual('dummy value', os.environ['A'])
|
||||
|
||||
def test_extend(self):
|
||||
env = EnvironmentModifications()
|
||||
env.set('A', 'dummy value')
|
||||
env.set('B', 3)
|
||||
copy_construct = EnvironmentModifications(env)
|
||||
self.assertEqual(len(copy_construct), 2)
|
||||
for x, y in zip(env, copy_construct):
|
||||
assert x is y
|
@ -59,12 +59,6 @@ def path_put_first(var_name, directories):
|
||||
path_set(var_name, new_path)
|
||||
|
||||
|
||||
def pop_keys(dictionary, *keys):
|
||||
for key in keys:
|
||||
if key in dictionary:
|
||||
dictionary.pop(key)
|
||||
|
||||
|
||||
def dump_environment(path):
|
||||
"""Dump the current environment out to a file."""
|
||||
with open(path, 'w') as env_file:
|
||||
|
@ -141,7 +141,7 @@ function _spack_pathadd {
|
||||
fi
|
||||
|
||||
# Do the actual prepending here.
|
||||
eval "_pa_oldvalue=\$${_pa_varname}"
|
||||
eval "_pa_oldvalue=\${${_pa_varname}:-}"
|
||||
|
||||
if [ -d "$_pa_new_path" ] && [[ ":$_pa_oldvalue:" != *":$_pa_new_path:"* ]]; then
|
||||
if [ -n "$_pa_oldvalue" ]; then
|
||||
|
43
var/spack/repos/builtin.mock/packages/python/package.py
Normal file
43
var/spack/repos/builtin.mock/packages/python/package.py
Normal file
@ -0,0 +1,43 @@
|
||||
##############################################################################
|
||||
# Copyright (c) 2013-2015, 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://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 Python(Package):
|
||||
"""Dummy Python package to demonstrate preferred versions."""
|
||||
homepage = "http://www.python.org"
|
||||
url = "http://www.python.org/ftp/python/2.7.8/Python-2.7.8.tgz"
|
||||
|
||||
extendable = True
|
||||
|
||||
version('3.5.1', 'be78e48cdfc1a7ad90efff146dce6cfe')
|
||||
version('3.5.0', 'a56c0c0b45d75a0ec9c6dee933c41c36')
|
||||
version('2.7.11', '6b6076ec9e93f05dd63e47eb9c15728b', preferred=True)
|
||||
version('2.7.10', 'd7547558fd673bd9d38e2108c6b42521')
|
||||
version('2.7.9', '5eebcaa0030dc4061156d3429657fb83')
|
||||
version('2.7.8', 'd4bca0159acb0b44a781292b5231936f')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
pass
|
||||
|
44
var/spack/repos/builtin/packages/apr-util/package.py
Normal file
44
var/spack/repos/builtin/packages/apr-util/package.py
Normal file
@ -0,0 +1,44 @@
|
||||
##############################################################################
|
||||
# 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://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 AprUtil(Package):
|
||||
"""Apache Portable Runtime Utility"""
|
||||
homepage = 'https://apr.apache.org/'
|
||||
url = 'http://archive.apache.org/dist/apr/apr-util-1.5.4.tar.gz'
|
||||
|
||||
version('1.5.4', '866825c04da827c6e5f53daff5569f42')
|
||||
|
||||
depends_on('apr')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
|
||||
# configure, build, install:
|
||||
options = ['--prefix=%s' % prefix]
|
||||
options.append('--with-apr=%s' % spec['apr'].prefix)
|
||||
|
||||
configure(*options)
|
||||
make()
|
||||
make('install')
|
38
var/spack/repos/builtin/packages/apr/package.py
Normal file
38
var/spack/repos/builtin/packages/apr/package.py
Normal file
@ -0,0 +1,38 @@
|
||||
##############################################################################
|
||||
# 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://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 Apr(Package):
|
||||
"""Apache portable runtime."""
|
||||
homepage = 'https://apr.apache.org/'
|
||||
url = 'http://archive.apache.org/dist/apr/apr-1.5.2.tar.gz'
|
||||
|
||||
version('1.5.2', '98492e965963f852ab29f9e61b2ad700')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
options = ['--prefix=%s' % prefix]
|
||||
configure(*options)
|
||||
make()
|
||||
make('install')
|
@ -35,18 +35,32 @@ class ArpackNg(Package):
|
||||
variant('shared', default=True, description='Enables the build of shared libraries')
|
||||
variant('mpi', default=False, description='Activates MPI support')
|
||||
|
||||
# The function pdlamch10 does not set the return variable. This is fixed upstream
|
||||
# see https://github.com/opencollab/arpack-ng/issues/34
|
||||
patch('pdlamch10.patch', when='@3.3:')
|
||||
|
||||
depends_on('blas')
|
||||
depends_on('lapack')
|
||||
depends_on('automake')
|
||||
depends_on('autoconf')
|
||||
depends_on('libtool@2.4.2:')
|
||||
|
||||
depends_on('mpi', when='+mpi')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
# Apparently autotools are not bootstrapped
|
||||
# TODO: switch to use the CMake build in the next version
|
||||
# rather than bootstrapping.
|
||||
which('libtoolize')()
|
||||
bootstrap = Executable('./bootstrap')
|
||||
|
||||
options = ['--prefix=%s' % prefix]
|
||||
|
||||
if '+mpi' in spec:
|
||||
options.append('--enable-mpi')
|
||||
options.extend([
|
||||
'--enable-mpi',
|
||||
'F77=mpif77' #FIXME: avoid hardcoding MPI wrapper names
|
||||
])
|
||||
|
||||
if '~shared' in spec:
|
||||
options.append('--enable-shared=no')
|
||||
|
15
var/spack/repos/builtin/packages/arpack-ng/pdlamch10.patch
Normal file
15
var/spack/repos/builtin/packages/arpack-ng/pdlamch10.patch
Normal file
@ -0,0 +1,15 @@
|
||||
diff --git a/PARPACK/SRC/MPI/pdlamch10.f b/PARPACK/SRC/MPI/pdlamch10.f
|
||||
index 6571da9..2882c2e 100644
|
||||
--- a/PARPACK/SRC/MPI/pdlamch10.f
|
||||
+++ b/PARPACK/SRC/MPI/pdlamch10.f
|
||||
@@ -86,8 +86,8 @@
|
||||
TEMP = TEMP1
|
||||
END IF
|
||||
*
|
||||
- PDLAMCH = TEMP
|
||||
+ PDLAMCH10 = TEMP
|
||||
*
|
||||
-* End of PDLAMCH
|
||||
+* End of PDLAMCH10
|
||||
*
|
||||
END
|
17
var/spack/repos/builtin/packages/astyle/package.py
Normal file
17
var/spack/repos/builtin/packages/astyle/package.py
Normal file
@ -0,0 +1,17 @@
|
||||
from spack import *
|
||||
import os
|
||||
|
||||
class Astyle(Package):
|
||||
"""A Free, Fast, and Small Automatic Formatter for C, C++, C++/CLI, Objective-C, C#, and Java Source Code."""
|
||||
homepage = "http://astyle.sourceforge.net/"
|
||||
url = "http://downloads.sourceforge.net/project/astyle/astyle/astyle%202.04/astyle_2.04_linux.tar.gz"
|
||||
|
||||
version('2.04', '30b1193a758b0909d06e7ee8dd9627f6')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
|
||||
with working_dir('src'):
|
||||
make('-f',
|
||||
join_path(self.stage.source_path,'build','clang','Makefile'),
|
||||
parallel=False)
|
||||
install(join_path(self.stage.source_path, 'src','bin','astyle'), self.prefix.bin)
|
@ -1,31 +1,36 @@
|
||||
from spack import *
|
||||
from spack.util.executable import Executable
|
||||
import os
|
||||
import os.path
|
||||
|
||||
class Atlas(Package):
|
||||
"""
|
||||
Automatically Tuned Linear Algebra Software, generic shared
|
||||
ATLAS is an approach for the automatic generation and optimization of
|
||||
numerical software. Currently ATLAS supplies optimized versions for the
|
||||
complete set of linear algebra kernels known as the Basic Linear Algebra
|
||||
Subroutines (BLAS), and a subset of the linear algebra routines in the
|
||||
LAPACK library.
|
||||
Automatically Tuned Linear Algebra Software, generic shared ATLAS is an approach for the automatic generation and
|
||||
optimization of numerical software. Currently ATLAS supplies optimized versions for the complete set of linear
|
||||
algebra kernels known as the Basic Linear Algebra Subroutines (BLAS), and a subset of the linear algebra routines
|
||||
in the LAPACK library.
|
||||
"""
|
||||
homepage = "http://math-atlas.sourceforge.net/"
|
||||
|
||||
version('3.10.2', 'a4e21f343dec8f22e7415e339f09f6da',
|
||||
url='http://downloads.sourceforge.net/project/math-atlas/Stable/3.10.2/atlas3.10.2.tar.bz2', preferred=True)
|
||||
resource(name='lapack',
|
||||
url='http://www.netlib.org/lapack/lapack-3.5.0.tgz',
|
||||
md5='b1d3e3e425b2e44a06760ff173104bdf',
|
||||
destination='spack-resource-lapack',
|
||||
when='@3:')
|
||||
|
||||
version('3.11.34', '0b6c5389c095c4c8785fd0f724ec6825',
|
||||
url='http://sourceforge.net/projects/math-atlas/files/Developer%20%28unstable%29/3.11.34/atlas3.11.34.tar.bz2/download')
|
||||
version('3.10.2', 'a4e21f343dec8f22e7415e339f09f6da',
|
||||
url='http://downloads.sourceforge.net/project/math-atlas/Stable/3.10.2/atlas3.10.2.tar.bz2')
|
||||
|
||||
# TODO: make this provide BLAS once it works better. Create a way
|
||||
# TODO: to mark "beta" packages and require explicit invocation.
|
||||
variant('shared', default=True, description='Builds shared library')
|
||||
|
||||
# provides('blas')
|
||||
provides('blas')
|
||||
provides('lapack')
|
||||
|
||||
parallel = False
|
||||
|
||||
def patch(self):
|
||||
# Disable thraed check. LLNL's environment does not allow
|
||||
# Disable thread check. LLNL's environment does not allow
|
||||
# disabling of CPU throttling in a way that ATLAS actually
|
||||
# understands.
|
||||
filter_file(r'^\s+if \(thrchk\) exit\(1\);', 'if (0) exit(1);',
|
||||
@ -33,26 +38,21 @@ def patch(self):
|
||||
# TODO: investigate a better way to add the check back in
|
||||
# TODO: using, say, MSRs. Or move this to a variant.
|
||||
|
||||
@when('@:3.10')
|
||||
def install(self, spec, prefix):
|
||||
with working_dir('ATLAS-Build', create=True):
|
||||
|
||||
options = []
|
||||
if '+shared' in spec:
|
||||
options.append('--shared')
|
||||
|
||||
# Lapack resource
|
||||
lapack_stage = self.stage[1]
|
||||
lapack_tarfile = os.path.basename(lapack_stage.fetcher.url)
|
||||
lapack_tarfile_path = join_path(lapack_stage.path, lapack_tarfile)
|
||||
options.append('--with-netlib-lapack-tarfile=%s' % lapack_tarfile_path)
|
||||
|
||||
with working_dir('spack-build', create=True):
|
||||
configure = Executable('../configure')
|
||||
configure('--prefix=%s' % prefix, '-C', 'ic', 'cc', '-C', 'if', 'f77', "--dylibs")
|
||||
make()
|
||||
make('check')
|
||||
make('ptcheck')
|
||||
make('time')
|
||||
make("install")
|
||||
|
||||
|
||||
def install(self, spec, prefix):
|
||||
with working_dir('ATLAS-Build', create=True):
|
||||
configure = Executable('../configure')
|
||||
configure('--incdir=%s' % prefix.include,
|
||||
'--libdir=%s' % prefix.lib,
|
||||
'--cc=cc',
|
||||
"--shared")
|
||||
|
||||
configure('--prefix=%s' % prefix, *options)
|
||||
make()
|
||||
make('check')
|
||||
make('ptcheck')
|
||||
|
@ -1,5 +1,9 @@
|
||||
from spack import *
|
||||
import spack
|
||||
import sys
|
||||
|
||||
import os
|
||||
import sys
|
||||
|
||||
class Boost(Package):
|
||||
"""Boost provides free peer-reviewed portable C++ source
|
||||
@ -172,6 +176,16 @@ def determine_b2_options(self, spec, options):
|
||||
return threadingOpts
|
||||
|
||||
def install(self, spec, prefix):
|
||||
# On Darwin, Boost expects the Darwin libtool. However, one of the
|
||||
# dependencies may have pulled in Spack's GNU libtool, and these two are
|
||||
# not compatible. We thus create a symlink to Darwin's libtool and add
|
||||
# it at the beginning of PATH.
|
||||
if sys.platform == 'darwin':
|
||||
newdir = os.path.abspath('darwin-libtool')
|
||||
mkdirp(newdir)
|
||||
force_symlink('/usr/bin/libtool', join_path(newdir, 'libtool'))
|
||||
env['PATH'] = newdir + ':' + env['PATH']
|
||||
|
||||
withLibs = list()
|
||||
for lib in Boost.all_libs:
|
||||
if "+{0}".format(lib) in spec:
|
||||
@ -208,3 +222,6 @@ def install(self, spec, prefix):
|
||||
for threadingOpt in threadingOpts:
|
||||
b2('install', 'threading=%s' % threadingOpt, *b2_options)
|
||||
|
||||
# The shared libraries are not installed correctly on Darwin; correct this
|
||||
if (sys.platform == 'darwin') and ('+shared' in spec):
|
||||
fix_darwin_install_name(prefix.lib)
|
||||
|
@ -30,6 +30,7 @@ class Cmake(Package):
|
||||
homepage = 'https://www.cmake.org'
|
||||
url = 'https://cmake.org/files/v3.4/cmake-3.4.3.tar.gz'
|
||||
|
||||
version('3.5.1', 'ca051f4a66375c89d1a524e726da0296')
|
||||
version('3.5.0', '33c5d09d4c33d4ffcc63578a6ba8777e')
|
||||
version('3.4.3', '4cb3ff35b2472aae70f542116d616e63')
|
||||
version('3.4.0', 'cd3034e0a44256a0917e254167217fc8')
|
||||
@ -38,10 +39,12 @@ class Cmake(Package):
|
||||
version('2.8.10.2', '097278785da7182ec0aea8769d06860c')
|
||||
|
||||
variant('ncurses', default=True, description='Enables the build of the ncurses gui')
|
||||
variant('openssl', default=True, description="Enables CMake's OpenSSL features")
|
||||
variant('qt', default=False, description='Enables the build of cmake-gui')
|
||||
variant('doc', default=False, description='Enables the generation of html and man page documentation')
|
||||
|
||||
depends_on('ncurses', when='+ncurses')
|
||||
depends_on('openssl', when='+openssl')
|
||||
depends_on('qt', when='+qt')
|
||||
depends_on('python@2.7.11:', when='+doc')
|
||||
depends_on('py-sphinx', when='+doc')
|
||||
@ -77,6 +80,7 @@ def install(self, spec, prefix):
|
||||
options.append('--sphinx-html')
|
||||
options.append('--sphinx-man')
|
||||
|
||||
if '+openssl' in spec:
|
||||
options.append('--')
|
||||
options.append('-DCMAKE_USE_OPENSSL=ON')
|
||||
|
||||
|
@ -8,8 +8,8 @@ class Cryptopp(Package):
|
||||
public-key encryption (RSA, DSA), and a few obsolete/historical encryption
|
||||
algorithms (MD5, Panama)."""
|
||||
|
||||
homepage = "http://www.cryptopp.com/"
|
||||
url = "http://www.cryptopp.com/cryptopp563.zip"
|
||||
homepage = "http://www.cryptopp.com"
|
||||
base_url = "http://www.cryptopp.com"
|
||||
|
||||
version('5.6.3', '3c5b70e2ec98b7a24988734446242d07')
|
||||
version('5.6.2', '7ed022585698df48e65ce9218f6c6a67')
|
||||
@ -25,7 +25,5 @@ def install(self, spec, prefix):
|
||||
install('libcryptopp.a', prefix.lib)
|
||||
|
||||
def url_for_version(self, version):
|
||||
version_tuple = tuple(v for v in iter(version))
|
||||
version_string = reduce(lambda vs, nv: vs + str(nv), version_tuple, "")
|
||||
|
||||
return "%scryptopp%s.zip" % (Cryptopp.homepage, version_string)
|
||||
version_string = str(version).replace('.', '')
|
||||
return '%s/cryptopp%s.zip' % (Cryptopp.base_url, version_string)
|
||||
|
47
var/spack/repos/builtin/packages/cuda/package.py
Normal file
47
var/spack/repos/builtin/packages/cuda/package.py
Normal file
@ -0,0 +1,47 @@
|
||||
from spack import *
|
||||
from glob import glob
|
||||
import os
|
||||
|
||||
class Cuda(Package):
|
||||
"""CUDA is a parallel computing platform and programming model invented by
|
||||
NVIDIA. It enables dramatic increases in computing performance by harnessing
|
||||
the power of the graphics processing unit (GPU).
|
||||
|
||||
Note: NVIDIA does not provide a download URL for CUDA so you will need to
|
||||
download it yourself. Go to https://developer.nvidia.com/cuda-downloads
|
||||
and select your Operating System, Architecture, Distribution, and Version.
|
||||
For the Installer 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
|
||||
|
||||
Note: This package does not currently install the drivers necessary to run
|
||||
CUDA. These will need to be installed manually. See:
|
||||
http://docs.nvidia.com/cuda/cuda-getting-started-guide-for-linux for details."""
|
||||
|
||||
homepage = "http://www.nvidia.com/object/cuda_home_new.html"
|
||||
|
||||
version('7.5.18', '4b3bcecf0dfc35928a0898793cf3e4c6', expand=False,
|
||||
url="file://%s/cuda_7.5.18_linux.run" % os.getcwd())
|
||||
version('6.5.14', '90b1b8f77313600cc294d9271741f4da', expand=False,
|
||||
url="file://%s/cuda_6.5.14_linux_64.run" % os.getcwd())
|
||||
|
||||
|
||||
def install(self, spec, prefix):
|
||||
runfile = glob(os.path.join(self.stage.path, 'cuda*.run'))[0]
|
||||
chmod = which('chmod')
|
||||
chmod('+x', runfile)
|
||||
runfile = which(runfile)
|
||||
|
||||
# Note: NVIDIA does not officially support many newer versions of compilers.
|
||||
# For example, on CentOS 6, you must use GCC 4.4.7 or older. See:
|
||||
# http://docs.nvidia.com/cuda/cuda-installation-guide-linux/#system-requirements
|
||||
# for details.
|
||||
|
||||
runfile(
|
||||
'--silent', # disable interactive prompts
|
||||
'--verbose', # create verbose log file
|
||||
'--toolkit', # install CUDA Toolkit
|
||||
'--toolkitpath=%s' % prefix
|
||||
)
|
||||
|
@ -13,6 +13,7 @@ class Dbus(Package):
|
||||
homepage = "http://dbus.freedesktop.org/"
|
||||
url = "http://dbus.freedesktop.org/releases/dbus/dbus-1.8.8.tar.gz"
|
||||
|
||||
version('1.11.2', '957a07f066f3730d2bb3ea0932f0081b')
|
||||
version('1.9.0', 'ec6895a4d5c0637b01f0d0e7689e2b36')
|
||||
version('1.8.8', 'b9f4a18ee3faa1e07c04aa1d83239c43')
|
||||
version('1.8.6', '6a08ba555d340e9dfe2d623b83c0eea8')
|
||||
|
238
var/spack/repos/builtin/packages/dealii/package.py
Normal file
238
var/spack/repos/builtin/packages/dealii/package.py
Normal file
@ -0,0 +1,238 @@
|
||||
from spack import *
|
||||
import sys
|
||||
|
||||
class Dealii(Package):
|
||||
"""C++ software library providing well-documented tools to build finite element codes for a broad variety of PDEs."""
|
||||
homepage = "https://www.dealii.org"
|
||||
url = "https://github.com/dealii/dealii/releases/download/v8.4.0/dealii-8.4.0.tar.gz"
|
||||
|
||||
version('8.4.0', 'ac5dbf676096ff61e092ce98c80c2b00')
|
||||
version('dev', git='https://github.com/dealii/dealii.git')
|
||||
|
||||
variant('mpi', default=True, description='Compile with MPI')
|
||||
variant('arpack', default=True, description='Compile with Arpack and PArpack (only with MPI)')
|
||||
variant('doc', default=False, description='Compile with documentation')
|
||||
variant('hdf5', default=True, description='Compile with HDF5 (only with MPI)')
|
||||
variant('metis', default=True, description='Compile with Metis')
|
||||
variant('netcdf', default=True, description='Compile with Netcdf (only with MPI)')
|
||||
variant('oce', default=True, description='Compile with OCE')
|
||||
variant('p4est', default=True, description='Compile with P4est (only with MPI)')
|
||||
variant('petsc', default=True, description='Compile with Petsc (only with MPI)')
|
||||
variant('slepc', default=True, description='Compile with Slepc (only with Petsc and MPI)')
|
||||
variant('trilinos', default=True, description='Compile with Trilinos (only with MPI)')
|
||||
|
||||
# required dependencies, light version
|
||||
depends_on ("blas")
|
||||
depends_on ("boost", when='~mpi')
|
||||
depends_on ("boost+mpi", when='+mpi')
|
||||
depends_on ("bzip2")
|
||||
depends_on ("cmake")
|
||||
depends_on ("lapack")
|
||||
depends_on ("muparser")
|
||||
depends_on ("suite-sparse")
|
||||
depends_on ("tbb")
|
||||
depends_on ("zlib")
|
||||
|
||||
# optional dependencies
|
||||
depends_on ("mpi", when="+mpi")
|
||||
depends_on ("arpack-ng+mpi", when='+arpack+mpi')
|
||||
depends_on ("doxygen", when='+doc')
|
||||
depends_on ("hdf5+mpi~cxx", when='+hdf5+mpi') #FIXME NetCDF declares dependency with ~cxx, why?
|
||||
depends_on ("metis", when='+metis')
|
||||
depends_on ("netcdf+mpi", when="+netcdf+mpi")
|
||||
depends_on ("netcdf-cxx", when='+netcdf+mpi')
|
||||
depends_on ("oce", when='+oce')
|
||||
depends_on ("p4est", when='+p4est+mpi')
|
||||
depends_on ("petsc+mpi", when='+petsc+mpi')
|
||||
depends_on ("slepc", when='+slepc+petsc+mpi')
|
||||
depends_on ("trilinos", when='+trilinos+mpi')
|
||||
|
||||
# developer dependnecies
|
||||
#depends_on ("numdiff") #FIXME
|
||||
#depends_on ("astyle") #FIXME
|
||||
|
||||
def install(self, spec, prefix):
|
||||
options = []
|
||||
options.extend(std_cmake_args)
|
||||
|
||||
# CMAKE_BUILD_TYPE should be DebugRelease | Debug | Release
|
||||
for word in options[:]:
|
||||
if word.startswith('-DCMAKE_BUILD_TYPE'):
|
||||
options.remove(word)
|
||||
|
||||
dsuf = 'dylib' if sys.platform == 'darwin' else 'so'
|
||||
options.extend([
|
||||
'-DCMAKE_BUILD_TYPE=DebugRelease',
|
||||
'-DDEAL_II_COMPONENT_EXAMPLES=ON',
|
||||
'-DDEAL_II_WITH_THREADS:BOOL=ON',
|
||||
'-DBOOST_DIR=%s' % spec['boost'].prefix,
|
||||
'-DBZIP2_DIR=%s' % spec['bzip2'].prefix,
|
||||
# CMake's FindBlas/Lapack may pickup system's blas/lapack instead of Spack's.
|
||||
# Be more specific to avoid this.
|
||||
# Note that both lapack and blas are provided in -DLAPACK_XYZ variables
|
||||
'-DLAPACK_FOUND=true',
|
||||
'-DLAPACK_INCLUDE_DIRS=%s;%s' %
|
||||
(spec['lapack'].prefix.include,
|
||||
spec['blas'].prefix.include),
|
||||
'-DLAPACK_LIBRARIES=%s;%s' %
|
||||
(join_path(spec['lapack'].prefix.lib,'liblapack.%s' % dsuf), # FIXME don't hardcode names
|
||||
join_path(spec['blas'].prefix.lib,'libblas.%s' % dsuf)), # FIXME don't hardcode names
|
||||
'-DMUPARSER_DIR=%s ' % spec['muparser'].prefix,
|
||||
'-DP4EST_DIR=%s' % spec['p4est'].prefix,
|
||||
'-DUMFPACK_DIR=%s' % spec['suite-sparse'].prefix,
|
||||
'-DTBB_DIR=%s' % spec['tbb'].prefix,
|
||||
'-DZLIB_DIR=%s' % spec['zlib'].prefix
|
||||
])
|
||||
|
||||
# MPI
|
||||
if '+mpi' in spec:
|
||||
options.extend([
|
||||
'-DDEAL_II_WITH_MPI:BOOL=ON',
|
||||
'-DCMAKE_C_COMPILER=%s' % join_path(self.spec['mpi'].prefix.bin, 'mpicc'), # FIXME: avoid hardcoding mpi wrappers names
|
||||
'-DCMAKE_CXX_COMPILER=%s' % join_path(self.spec['mpi'].prefix.bin, 'mpic++'),
|
||||
'-DCMAKE_Fortran_COMPILER=%s' % join_path(self.spec['mpi'].prefix.bin, 'mpif90'),
|
||||
])
|
||||
else:
|
||||
options.extend([
|
||||
'-DDEAL_II_WITH_MPI:BOOL=OFF',
|
||||
])
|
||||
|
||||
# Optional dependencies for which librariy names are the same as CMake variables
|
||||
for library in ('hdf5', 'p4est','petsc', 'slepc','trilinos','metis'):
|
||||
if library in spec:
|
||||
options.extend([
|
||||
'-D{library}_DIR={value}'.format(library=library.upper(), value=spec[library].prefix),
|
||||
'-DDEAL_II_WITH_{library}:BOOL=ON'.format(library=library.upper())
|
||||
])
|
||||
else:
|
||||
options.extend([
|
||||
'-DDEAL_II_WITH_{library}:BOOL=OFF'.format(library=library.upper())
|
||||
])
|
||||
|
||||
# doxygen
|
||||
options.extend([
|
||||
'-DDEAL_II_COMPONENT_DOCUMENTATION=%s' % ('ON' if '+doc' in spec else 'OFF'),
|
||||
])
|
||||
|
||||
|
||||
# arpack
|
||||
if '+arpack' in spec:
|
||||
options.extend([
|
||||
'-DARPACK_DIR=%s' % spec['arpack-ng'].prefix,
|
||||
'-DDEAL_II_WITH_ARPACK=ON',
|
||||
'-DDEAL_II_ARPACK_WITH_PARPACK=ON'
|
||||
])
|
||||
else:
|
||||
options.extend([
|
||||
'-DDEAL_II_WITH_ARPACK=OFF'
|
||||
])
|
||||
|
||||
# since Netcdf is spread among two, need to do it by hand:
|
||||
if '+netcdf' in spec:
|
||||
options.extend([
|
||||
'-DNETCDF_FOUND=true',
|
||||
'-DNETCDF_LIBRARIES=%s;%s' %
|
||||
(join_path(spec['netcdf-cxx'].prefix.lib,'libnetcdf_c++.%s' % dsuf),
|
||||
join_path(spec['netcdf'].prefix.lib,'libnetcdf.%s' % dsuf)),
|
||||
'-DNETCDF_INCLUDE_DIRS=%s;%s' %
|
||||
(spec['netcdf-cxx'].prefix.include,
|
||||
spec['netcdf'].prefix.include),
|
||||
])
|
||||
else:
|
||||
options.extend([
|
||||
'-DDEAL_II_WITH_NETCDF=OFF'
|
||||
])
|
||||
|
||||
# Open Cascade
|
||||
if '+oce' in spec:
|
||||
options.extend([
|
||||
'-DOPENCASCADE_DIR=%s' % spec['oce'].prefix,
|
||||
'-DDEAL_II_WITH_OPENCASCADE=ON'
|
||||
])
|
||||
else:
|
||||
options.extend([
|
||||
'-DDEAL_II_WITH_OPENCASCADE=OFF'
|
||||
])
|
||||
|
||||
cmake('.', *options)
|
||||
|
||||
make()
|
||||
make("test")
|
||||
make("install")
|
||||
|
||||
# run some MPI examples with different solvers from PETSc and Trilinos
|
||||
env['DEAL_II_DIR'] = prefix
|
||||
print('=====================================')
|
||||
print('============ EXAMPLES ===============')
|
||||
print('=====================================')
|
||||
# take bare-bones step-3
|
||||
print('=====================================')
|
||||
print('============ Step-3 =================')
|
||||
print('=====================================')
|
||||
with working_dir('examples/step-3'):
|
||||
cmake('.')
|
||||
make('release')
|
||||
make('run',parallel=False)
|
||||
|
||||
# take step-40 which can use both PETSc and Trilinos
|
||||
# FIXME: switch step-40 to MPI run
|
||||
with working_dir('examples/step-40'):
|
||||
print('=====================================')
|
||||
print('========== Step-40 PETSc ============')
|
||||
print('=====================================')
|
||||
# list the number of cycles to speed up
|
||||
filter_file(r'(const unsigned int n_cycles = 8;)', ('const unsigned int n_cycles = 2;'), 'step-40.cc')
|
||||
cmake('.')
|
||||
if '^petsc' in spec:
|
||||
make('release')
|
||||
make('run',parallel=False)
|
||||
|
||||
print('=====================================')
|
||||
print('========= Step-40 Trilinos ==========')
|
||||
print('=====================================')
|
||||
# change Linear Algebra to Trilinos
|
||||
filter_file(r'(\/\/ #define FORCE_USE_OF_TRILINOS.*)', ('#define FORCE_USE_OF_TRILINOS'), 'step-40.cc')
|
||||
if '^trilinos+hypre' in spec:
|
||||
make('release')
|
||||
make('run',parallel=False)
|
||||
|
||||
print('=====================================')
|
||||
print('=== Step-40 Trilinos SuperluDist ====')
|
||||
print('=====================================')
|
||||
# change to direct solvers
|
||||
filter_file(r'(LA::SolverCG solver\(solver_control\);)', ('TrilinosWrappers::SolverDirect::AdditionalData data(false,"Amesos_Superludist"); TrilinosWrappers::SolverDirect solver(solver_control,data);'), 'step-40.cc')
|
||||
filter_file(r'(LA::MPI::PreconditionAMG preconditioner;)', (''), 'step-40.cc')
|
||||
filter_file(r'(LA::MPI::PreconditionAMG::AdditionalData data;)', (''), 'step-40.cc')
|
||||
filter_file(r'(preconditioner.initialize\(system_matrix, data\);)', (''), 'step-40.cc')
|
||||
filter_file(r'(solver\.solve \(system_matrix, completely_distributed_solution, system_rhs,)', ('solver.solve (system_matrix, completely_distributed_solution, system_rhs);'), 'step-40.cc')
|
||||
filter_file(r'(preconditioner\);)', (''), 'step-40.cc')
|
||||
if '^trilinos+superlu-dist' in spec:
|
||||
make('release')
|
||||
make('run',paralle=False)
|
||||
|
||||
print('=====================================')
|
||||
print('====== Step-40 Trilinos MUMPS =======')
|
||||
print('=====================================')
|
||||
# switch to Mumps
|
||||
filter_file(r'(Amesos_Superludist)', ('Amesos_Mumps'), 'step-40.cc')
|
||||
if '^trilinos+mumps' in spec:
|
||||
make('release')
|
||||
make('run',parallel=False)
|
||||
|
||||
print('=====================================')
|
||||
print('============ Step-36 ================')
|
||||
print('=====================================')
|
||||
with working_dir('examples/step-36'):
|
||||
if 'slepc' in spec:
|
||||
cmake('.')
|
||||
make('release')
|
||||
make('run',parallel=False)
|
||||
|
||||
print('=====================================')
|
||||
print('============ Step-54 ================')
|
||||
print('=====================================')
|
||||
with working_dir('examples/step-54'):
|
||||
if 'oce' in spec:
|
||||
cmake('.')
|
||||
make('release')
|
||||
make('run',parallel=False)
|
@ -4,6 +4,7 @@
|
||||
#------------------------------------------------------------------------------
|
||||
|
||||
from spack import *
|
||||
import sys
|
||||
|
||||
class Doxygen(Package):
|
||||
"""Doxygen is the de facto standard tool for generating documentation
|
||||
@ -17,6 +18,10 @@ class Doxygen(Package):
|
||||
version('1.8.10', '79767ccd986f12a0f949015efb5f058f')
|
||||
|
||||
depends_on("cmake@2.8.12:")
|
||||
# flex does not build on OSX, but it's provided there anyway
|
||||
depends_on("flex", sys.platform != 'darwin')
|
||||
depends_on("bison", sys.platform != 'darwin')
|
||||
|
||||
|
||||
def install(self, spec, prefix):
|
||||
cmake('.', *std_cmake_args)
|
||||
|
@ -48,7 +48,7 @@ class Eigen(Package):
|
||||
depends_on('metis', when='+metis')
|
||||
depends_on('scotch', when='+scotch')
|
||||
depends_on('fftw', when='+fftw')
|
||||
depends_on('SuiteSparse', when='+suitesparse')
|
||||
depends_on('suite-sparse', when='+suitesparse')
|
||||
depends_on('mpfr@2.3.0:') # Eigen 3.2.7 requires at least 2.3.0
|
||||
depends_on('gmp')
|
||||
|
||||
|
@ -33,9 +33,10 @@ def check_variants(self, spec):
|
||||
raise RuntimeError(error.format(variant='elpa'))
|
||||
|
||||
def install(self, spec, prefix):
|
||||
from glob import glob
|
||||
self.check_variants(spec)
|
||||
|
||||
options = ['-prefix=%s' % prefix]
|
||||
options = ['-prefix=%s' % prefix.bin]
|
||||
|
||||
if '+mpi' in spec:
|
||||
options.append('--enable-parallel')
|
||||
@ -61,5 +62,11 @@ def install(self, spec, prefix):
|
||||
|
||||
configure(*options)
|
||||
make('all')
|
||||
|
||||
if spec.architecture.startswith('darwin'):
|
||||
mkdirp(prefix.bin)
|
||||
for filename in glob("bin/*.x"):
|
||||
install(filename, prefix.bin)
|
||||
else:
|
||||
make('install')
|
||||
|
||||
|
42
var/spack/repos/builtin/packages/gcc/darwin/gcc-4.9.patch1
Normal file
42
var/spack/repos/builtin/packages/gcc/darwin/gcc-4.9.patch1
Normal file
@ -0,0 +1,42 @@
|
||||
diff --git a/gcc/configure b/gcc/configure
|
||||
index 9523773..52b0bf7 100755
|
||||
--- a/gcc/configure
|
||||
+++ b/gcc/configure
|
||||
@@ -24884,7 +24884,7 @@ if test "${gcc_cv_as_ix86_filds+set}" = set; then :
|
||||
else
|
||||
gcc_cv_as_ix86_filds=no
|
||||
if test x$gcc_cv_as != x; then
|
||||
- $as_echo 'filds mem; fists mem' > conftest.s
|
||||
+ $as_echo 'filds (%ebp); fists (%ebp)' > conftest.s
|
||||
if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5'
|
||||
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||
(eval $ac_try) 2>&5
|
||||
@@ -24915,7 +24915,7 @@ if test "${gcc_cv_as_ix86_fildq+set}" = set; then :
|
||||
else
|
||||
gcc_cv_as_ix86_fildq=no
|
||||
if test x$gcc_cv_as != x; then
|
||||
- $as_echo 'fildq mem; fistpq mem' > conftest.s
|
||||
+ $as_echo 'fildq (%ebp); fistpq (%ebp)' > conftest.s
|
||||
if { ac_try='$gcc_cv_as $gcc_cv_as_flags -o conftest.o conftest.s >&5'
|
||||
{ { eval echo "\"\$as_me\":${as_lineno-$LINENO}: \"$ac_try\""; } >&5
|
||||
(eval $ac_try) 2>&5
|
||||
diff --git a/gcc/configure.ac b/gcc/configure.ac
|
||||
index 68b0ee8..bd53978 100644
|
||||
--- a/gcc/configure.ac
|
||||
+++ b/gcc/configure.ac
|
||||
@@ -3869,13 +3869,13 @@ foo: nop
|
||||
|
||||
gcc_GAS_CHECK_FEATURE([filds and fists mnemonics],
|
||||
gcc_cv_as_ix86_filds,,,
|
||||
- [filds mem; fists mem],,
|
||||
+ [filds (%ebp); fists (%ebp)],,
|
||||
[AC_DEFINE(HAVE_AS_IX86_FILDS, 1,
|
||||
[Define if your assembler uses filds and fists mnemonics.])])
|
||||
|
||||
gcc_GAS_CHECK_FEATURE([fildq and fistpq mnemonics],
|
||||
gcc_cv_as_ix86_fildq,,,
|
||||
- [fildq mem; fistpq mem],,
|
||||
+ [fildq (%ebp); fistpq (%ebp)],,
|
||||
[AC_DEFINE(HAVE_AS_IX86_FILDQ, 1,
|
||||
[Define if your assembler uses fildq and fistq mnemonics.])])
|
||||
|
28
var/spack/repos/builtin/packages/gcc/darwin/gcc-4.9.patch2
Normal file
28
var/spack/repos/builtin/packages/gcc/darwin/gcc-4.9.patch2
Normal file
@ -0,0 +1,28 @@
|
||||
From 82f81877458ea372176eabb5de36329431dce99b Mon Sep 17 00:00:00 2001
|
||||
From: Iain Sandoe <iain@codesourcery.com>
|
||||
Date: Sat, 21 Dec 2013 00:30:18 +0000
|
||||
Subject: [PATCH] don't try to mark local symbols as no-dead-strip
|
||||
|
||||
---
|
||||
gcc/config/darwin.c | 5 +++++
|
||||
1 file changed, 5 insertions(+)
|
||||
|
||||
diff --git a/gcc/config/darwin.c b/gcc/config/darwin.c
|
||||
index 40804b8..0080299 100644
|
||||
--- a/gcc/config/darwin.c
|
||||
+++ b/gcc/config/darwin.c
|
||||
@@ -1259,6 +1259,11 @@ darwin_encode_section_info (tree decl, rtx rtl, int first ATTRIBUTE_UNUSED)
|
||||
void
|
||||
darwin_mark_decl_preserved (const char *name)
|
||||
{
|
||||
+ /* Actually we shouldn't mark any local symbol this way, but for now
|
||||
+ this only happens with ObjC meta-data. */
|
||||
+ if (darwin_label_is_anonymous_local_objc_name (name))
|
||||
+ return;
|
||||
+
|
||||
fprintf (asm_out_file, "\t.no_dead_strip ");
|
||||
assemble_name (asm_out_file, name);
|
||||
fputc ('\n', asm_out_file);
|
||||
--
|
||||
2.2.1
|
||||
|
@ -26,6 +26,8 @@
|
||||
|
||||
from contextlib import closing
|
||||
from glob import glob
|
||||
import sys
|
||||
import os
|
||||
|
||||
class Gcc(Package):
|
||||
"""The GNU Compiler Collection includes front ends for C, C++,
|
||||
@ -47,24 +49,33 @@ class Gcc(Package):
|
||||
version('4.6.4', 'b407a3d1480c11667f293bfb1f17d1a4')
|
||||
version('4.5.4', '27e459c2566b8209ab064570e1b378f7')
|
||||
|
||||
variant('gold', default=True, description="Build the gold linker plugin for ld-based LTO")
|
||||
variant('binutils', default=sys.platform != 'darwin',
|
||||
description="Build via binutils")
|
||||
variant('gold', default=sys.platform != 'darwin',
|
||||
description="Build the gold linker plugin for ld-based LTO")
|
||||
|
||||
depends_on("mpfr")
|
||||
depends_on("gmp")
|
||||
depends_on("mpc", when='@4.5:')
|
||||
depends_on("isl", when='@5.0:')
|
||||
depends_on("binutils~libiberty", when='~gold')
|
||||
depends_on("binutils~libiberty+gold", when='+gold')
|
||||
depends_on("binutils~libiberty", when='+binutils ~gold')
|
||||
depends_on("binutils~libiberty+gold", when='+binutils +gold')
|
||||
|
||||
# TODO: integrate these libraries.
|
||||
#depends_on("ppl")
|
||||
#depends_on("cloog")
|
||||
if sys.platform == 'darwin':
|
||||
patch('darwin/gcc-4.9.patch1', when='@4.9.3')
|
||||
patch('darwin/gcc-4.9.patch2', when='@4.9.3')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
# libjava/configure needs a minor fix to install into spack paths.
|
||||
filter_file(r"'@.*@'", "'@[[:alnum:]]*@'", 'libjava/configure', string=True)
|
||||
filter_file(r"'@.*@'", "'@[[:alnum:]]*@'", 'libjava/configure',
|
||||
string=True)
|
||||
|
||||
enabled_languages = set(('c', 'c++', 'fortran', 'java', 'objc'))
|
||||
if spec.satisfies("@4.7.1:"):
|
||||
|
||||
if spec.satisfies("@4.7.1:") and sys.platform != 'darwin':
|
||||
enabled_languages.add('go')
|
||||
|
||||
# Generic options to compile GCC
|
||||
@ -76,15 +87,18 @@ def install(self, spec, prefix):
|
||||
"--with-mpfr=%s" % spec['mpfr'].prefix,
|
||||
"--with-gmp=%s" % spec['gmp'].prefix,
|
||||
"--enable-lto",
|
||||
"--with-gnu-ld",
|
||||
"--with-gnu-as",
|
||||
"--with-quad"]
|
||||
# Binutils
|
||||
if spec.satisfies('+binutils'):
|
||||
static_bootstrap_flags = "-static-libstdc++ -static-libgcc"
|
||||
binutils_options = ["--with-sysroot=/",
|
||||
"--with-stage1-ldflags=%s %s" % (self.rpath_args, static_bootstrap_flags),
|
||||
"--with-boot-ldflags=%s %s" % (self.rpath_args, static_bootstrap_flags),
|
||||
"--with-stage1-ldflags=%s %s" %
|
||||
(self.rpath_args, static_bootstrap_flags),
|
||||
"--with-boot-ldflags=%s %s" %
|
||||
(self.rpath_args, static_bootstrap_flags),
|
||||
"--with-gnu-ld",
|
||||
"--with-ld=%s/bin/ld" % spec['binutils'].prefix,
|
||||
"--with-gnu-as",
|
||||
"--with-as=%s/bin/as" % spec['binutils'].prefix]
|
||||
options.extend(binutils_options)
|
||||
# Isl
|
||||
@ -92,12 +106,17 @@ def install(self, spec, prefix):
|
||||
isl_options = ["--with-isl=%s" % spec['isl'].prefix]
|
||||
options.extend(isl_options)
|
||||
|
||||
if sys.platform == 'darwin' :
|
||||
darwin_options = [ "--with-build-config=bootstrap-debug" ]
|
||||
options.extend(darwin_options)
|
||||
|
||||
build_dir = join_path(self.stage.path, 'spack-build')
|
||||
configure = Executable( join_path(self.stage.source_path, 'configure') )
|
||||
with working_dir(build_dir, create=True):
|
||||
# Rest of install is straightforward.
|
||||
configure(*options)
|
||||
make()
|
||||
if sys.platform == 'darwin' : make("bootstrap")
|
||||
else: make()
|
||||
make("install")
|
||||
|
||||
self.write_rpath_specs()
|
||||
@ -114,7 +133,8 @@ def write_rpath_specs(self):
|
||||
"""Generate a spec file so the linker adds a rpath to the libs
|
||||
the compiler used to build the executable."""
|
||||
if not self.spec_dir:
|
||||
tty.warn("Could not install specs for %s." % self.spec.format('$_$@'))
|
||||
tty.warn("Could not install specs for %s." %
|
||||
self.spec.format('$_$@'))
|
||||
return
|
||||
|
||||
gcc = Executable(join_path(self.prefix.bin, 'gcc'))
|
||||
@ -124,5 +144,6 @@ def write_rpath_specs(self):
|
||||
for line in lines:
|
||||
out.write(line + "\n")
|
||||
if line.startswith("*link:"):
|
||||
out.write("-rpath %s/lib:%s/lib64 \\\n"% (self.prefix, self.prefix))
|
||||
out.write("-rpath %s/lib:%s/lib64 \\\n" %
|
||||
(self.prefix, self.prefix))
|
||||
set_install_permissions(specs_file)
|
||||
|
69
var/spack/repos/builtin/packages/gdal/package.py
Normal file
69
var/spack/repos/builtin/packages/gdal/package.py
Normal file
@ -0,0 +1,69 @@
|
||||
from spack import *
|
||||
|
||||
class Gdal(Package):
|
||||
"""
|
||||
GDAL is a translator library for raster and vector geospatial
|
||||
data formats that is released under an X/MIT style Open Source
|
||||
license by the Open Source Geospatial Foundation. As a library,
|
||||
it presents a single raster abstract data model and vector
|
||||
abstract data model to the calling application for all supported
|
||||
formats. It also comes with a variety of useful command line
|
||||
utilities for data translation and processing
|
||||
"""
|
||||
|
||||
homepage = "http://www.gdal.org/"
|
||||
url = "http://download.osgeo.org/gdal/2.0.2/gdal-2.0.2.tar.gz"
|
||||
list_url = "http://download.osgeo.org/gdal/"
|
||||
list_depth = 2
|
||||
|
||||
version('2.0.2', '573865f3f59ba7b4f8f4cddf223b52a5')
|
||||
|
||||
extends('python')
|
||||
|
||||
variant('hdf5', default=False, description='Enable HDF5 support')
|
||||
variant('hdf', default=False, description='Enable HDF4 support')
|
||||
variant('openjpeg', default=False, description='Enable JPEG2000 support')
|
||||
variant('geos', default=False, description='Enable GEOS support')
|
||||
variant('kea', default=False, description='Enable KEA support')
|
||||
variant('netcdf', default=False, description='Enable netcdf support')
|
||||
|
||||
depends_on('swig')
|
||||
depends_on("hdf5", when='+hdf5')
|
||||
depends_on("hdf", when='+hdf')
|
||||
depends_on("openjpeg", when='+openjpeg')
|
||||
depends_on("geos", when='+geos')
|
||||
depends_on("kealib", when='+kea')
|
||||
depends_on("netcdf", when='+netcdf')
|
||||
depends_on("libtiff")
|
||||
depends_on("libpng")
|
||||
depends_on("zlib")
|
||||
depends_on("proj")
|
||||
depends_on("py-numpy")
|
||||
|
||||
parallel = False
|
||||
|
||||
def install(self, spec, prefix):
|
||||
args = []
|
||||
args.append("--prefix=%s" % prefix)
|
||||
args.append("--with-liblzma=yes")
|
||||
args.append("--with-zlib=%s" % spec['zlib'].prefix)
|
||||
args.append("--with-python=%s" % spec['python'].prefix.bin + "/python")
|
||||
args.append("--without-libtool")
|
||||
|
||||
if '+geos' in spec:
|
||||
args.append('--with-geos=yes')
|
||||
if '+hdf' in spec:
|
||||
args.append('--with-hdf4=%s' % spec['hdf'].prefix)
|
||||
if '+hdf5' in spec:
|
||||
args.append('--with-hdf5=%s' % spec['hdf5'].prefix)
|
||||
if '+openjpeg' in spec:
|
||||
args.append('--with-openjpeg=%s' % spec['openjpeg'].prefix)
|
||||
if '+kea' in spec:
|
||||
args.append('--with-kea=yes')
|
||||
if '+netcdf' in spec:
|
||||
args.append('--with-netcdf=%s' % spec['netcdf'].prefix)
|
||||
|
||||
configure(*args)
|
||||
|
||||
make()
|
||||
make("install")
|
@ -1,4 +1,5 @@
|
||||
from spack import *
|
||||
import os
|
||||
|
||||
class Geos(Package):
|
||||
"""GEOS (Geometry Engine - Open Source) is a C++ port of the Java
|
||||
@ -10,6 +11,10 @@ class Geos(Package):
|
||||
homepage = "http://trac.osgeo.org/geos/"
|
||||
url = "http://download.osgeo.org/geos/geos-3.4.2.tar.bz2"
|
||||
|
||||
# Verison 3.5.0 supports Autotools and CMake
|
||||
version('3.5.0', '136842690be7f504fba46b3c539438dd')
|
||||
|
||||
# Versions through 3.4.2 have CMake, but only Autotools is supported
|
||||
version('3.4.2', 'fc5df2d926eb7e67f988a43a92683bae')
|
||||
version('3.4.1', '4c930dec44c45c49cd71f3e0931ded7e')
|
||||
version('3.4.0', 'e41318fc76b5dc764a69d43ac6b18488')
|
||||
@ -21,11 +26,22 @@ class Geos(Package):
|
||||
version('3.3.4', '1bb9f14d57ef06ffa41cb1d67acb55a1')
|
||||
version('3.3.3', '8454e653d7ecca475153cc88fd1daa26')
|
||||
|
||||
extends('python')
|
||||
depends_on('swig')
|
||||
# # Python3 is not supported.
|
||||
# variant('python', default=False, description='Enable Python support')
|
||||
|
||||
# extends('python', when='+python')
|
||||
# depends_on('python', when='+python')
|
||||
# depends_on('swig', when='+python')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
configure("--prefix=%s" % prefix,
|
||||
"--enable-python")
|
||||
args = ["--prefix=%s" % prefix]
|
||||
# if '+python' in spec:
|
||||
# os.environ['PYTHON'] = join_path(spec['python'].prefix, 'bin',
|
||||
# 'python' if spec['python'].version[:1][0] <= 2 else 'python3')
|
||||
# os.environ['SWIG'] = join_path(spec['swig'].prefix, 'bin', 'swig')
|
||||
#
|
||||
# args.append("--enable-python")
|
||||
|
||||
configure(*args)
|
||||
make()
|
||||
make("install")
|
||||
|
30
var/spack/repos/builtin/packages/gettext/package.py
Normal file
30
var/spack/repos/builtin/packages/gettext/package.py
Normal file
@ -0,0 +1,30 @@
|
||||
from spack import *
|
||||
|
||||
class Gettext(Package):
|
||||
"""GNU internationalization (i18n) and localization (l10n) library."""
|
||||
homepage = "https://www.gnu.org/software/gettext/"
|
||||
url = "http://ftpmirror.gnu.org/gettext/gettext-0.19.7.tar.xz"
|
||||
|
||||
version('0.19.7', 'f81e50556da41b44c1d59ac93474dca5')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
options = ['--disable-dependency-tracking',
|
||||
'--disable-silent-rules',
|
||||
'--disable-debug',
|
||||
'--prefix=%s' % prefix,
|
||||
'--with-included-gettext',
|
||||
'--with-included-glib',
|
||||
'--with-included-libcroco',
|
||||
'--with-included-libunistring',
|
||||
'--with-emacs',
|
||||
'--with-lispdir=%s/emacs/site-lisp/gettext' % prefix.share,
|
||||
'--disable-java',
|
||||
'--disable-csharp',
|
||||
'--without-git', # Don't use VCS systems to create these archives
|
||||
'--without-cvs',
|
||||
'--without-xz']
|
||||
|
||||
configure(*options)
|
||||
|
||||
make()
|
||||
make("install")
|
24
var/spack/repos/builtin/packages/googletest/package.py
Normal file
24
var/spack/repos/builtin/packages/googletest/package.py
Normal file
@ -0,0 +1,24 @@
|
||||
from spack import *
|
||||
|
||||
class Googletest(Package):
|
||||
"""Google test framework for C++. Also called gtest."""
|
||||
homepage = "https://github.com/google/googletest"
|
||||
url = "https://github.com/google/googletest/tarball/release-1.7.0"
|
||||
|
||||
version('1.7.0', '5eaf03ed925a47b37c8e1d559eb19bc4')
|
||||
|
||||
depends_on("cmake")
|
||||
|
||||
def install(self, spec, prefix):
|
||||
which('cmake')('.', *std_cmake_args)
|
||||
|
||||
make()
|
||||
|
||||
# Google Test doesn't have a make install
|
||||
# We have to do our own install here.
|
||||
install_tree('include', prefix.include)
|
||||
|
||||
mkdirp(prefix.lib)
|
||||
install('./libgtest.a', '%s' % prefix.lib)
|
||||
install('./libgtest_main.a', '%s' % prefix.lib)
|
||||
|
@ -7,6 +7,12 @@ class Graphviz(Package):
|
||||
|
||||
version('2.38.0', '5b6a829b2ac94efcd5fa3c223ed6d3ae')
|
||||
|
||||
# By default disable optional Perl language support to prevent build issues
|
||||
# related to missing Perl packages. If spack begins support for Perl in the
|
||||
# future, this package can be updated to depend_on('perl') and the
|
||||
# ncecessary devel packages.
|
||||
variant('perl', default=False, description='Enable if you need the optional Perl language bindings.')
|
||||
|
||||
parallel = False
|
||||
|
||||
depends_on("swig")
|
||||
@ -14,8 +20,10 @@ class Graphviz(Package):
|
||||
depends_on("ghostscript")
|
||||
|
||||
def install(self, spec, prefix):
|
||||
configure("--prefix=%s" %prefix)
|
||||
options = ['--prefix=%s' % prefix]
|
||||
if not '+perl' in spec:
|
||||
options.append('--disable-perl')
|
||||
|
||||
configure(*options)
|
||||
make()
|
||||
make("install")
|
||||
|
||||
|
73
var/spack/repos/builtin/packages/hoomd-blue/package.py
Normal file
73
var/spack/repos/builtin/packages/hoomd-blue/package.py
Normal file
@ -0,0 +1,73 @@
|
||||
from spack import *
|
||||
import os
|
||||
|
||||
class HoomdBlue(Package):
|
||||
"""HOOMD-blue is a general-purpose particle simulation toolkit. It scales
|
||||
from a single CPU core to thousands of GPUs.
|
||||
|
||||
You define particle initial conditions and interactions in a high-level
|
||||
python script. Then tell HOOMD-blue how you want to execute the job and it
|
||||
takes care of the rest. Python job scripts give you unlimited flexibility
|
||||
to create custom initialization routines, control simulation parameters,
|
||||
and perform in situ analysis."""
|
||||
|
||||
homepage = "https://codeblue.umich.edu/hoomd-blue/index.html"
|
||||
url = "https://bitbucket.org/glotzer/hoomd-blue/get/v1.3.3.tar.bz2"
|
||||
|
||||
version('1.3.3', '1469ef4531dc14b579c0acddbfe6a273')
|
||||
|
||||
variant('mpi', default=True, description='Compile with MPI enabled')
|
||||
variant('cuda', default=True, description='Compile with CUDA Toolkit')
|
||||
variant('doc', default=True, description='Generate documentation')
|
||||
|
||||
extends('python')
|
||||
depends_on('py-numpy')
|
||||
depends_on('boost+python')
|
||||
depends_on('cmake')
|
||||
depends_on('mpi', when='+mpi')
|
||||
depends_on('cuda', when='+cuda')
|
||||
depends_on('doxygen', when='+doc')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
|
||||
cmake_args = [
|
||||
'-DPYTHON_EXECUTABLE=%s/python' % spec['python'].prefix.bin,
|
||||
'-DBOOST_ROOT=%s' % spec['boost' ].prefix
|
||||
]
|
||||
|
||||
# MPI support
|
||||
if '+mpi' in spec:
|
||||
os.environ['MPI_HOME'] = spec['mpi'].prefix
|
||||
cmake_args.append('-DENABLE_MPI=ON')
|
||||
else:
|
||||
cmake_args.append('-DENABLE_MPI=OFF')
|
||||
|
||||
# CUDA support
|
||||
if '+cuda' in spec:
|
||||
cmake_args.append('-DENABLE_CUDA=ON')
|
||||
else:
|
||||
cmake_args.append('-DENABLE_CUDA=OFF')
|
||||
|
||||
# CUDA-aware MPI library support
|
||||
#if '+cuda' in spec and '+mpi' in spec:
|
||||
# cmake_args.append('-DENABLE_MPI_CUDA=ON')
|
||||
#else:
|
||||
# cmake_args.append('-DENABLE_MPI_CUDA=OFF')
|
||||
|
||||
# There may be a bug in the MPI-CUDA code. See:
|
||||
# https://groups.google.com/forum/#!msg/hoomd-users/2griTESmc5I/E69s_M5fDwAJ
|
||||
# This prevented "make test" from passing for me.
|
||||
cmake_args.append('-DENABLE_MPI_CUDA=OFF')
|
||||
|
||||
# Documentation
|
||||
if '+doc' in spec:
|
||||
cmake_args.append('-DENABLE_DOXYGEN=ON')
|
||||
else:
|
||||
cmake_args.append('-DENABLE_DOXYGEN=OFF')
|
||||
|
||||
cmake_args.extend(std_cmake_args)
|
||||
cmake('.', *cmake_args)
|
||||
|
||||
make()
|
||||
make("test")
|
||||
make("install")
|
@ -1,5 +1,5 @@
|
||||
from spack import *
|
||||
import os
|
||||
import os, sys
|
||||
|
||||
class Hypre(Package):
|
||||
"""Hypre is a library of high performance preconditioners that
|
||||
@ -12,7 +12,10 @@ class Hypre(Package):
|
||||
version('2.10.1', 'dc048c4cabb3cd549af72591474ad674')
|
||||
version('2.10.0b', '768be38793a35bb5d055905b271f5b8e')
|
||||
|
||||
variant('shared', default=True, description="Build shared library version (disables static library)")
|
||||
# hypre does not know how to build shared libraries on Darwin
|
||||
variant('shared', default=sys.platform!='darwin', description="Build shared library version (disables static library)")
|
||||
# SuperluDist have conflicting headers with those in Hypre
|
||||
variant('internal-superlu', default=True, description="Use internal Superlu routines")
|
||||
|
||||
depends_on("mpi")
|
||||
depends_on("blas")
|
||||
@ -37,6 +40,12 @@ def install(self, spec, prefix):
|
||||
if '+shared' in self.spec:
|
||||
configure_args.append("--enable-shared")
|
||||
|
||||
if '~internal-superlu' in self.spec:
|
||||
configure_args.append("--without-superlu")
|
||||
# MLI and FEI do not build without superlu on Linux
|
||||
configure_args.append("--without-mli")
|
||||
configure_args.append("--without-fei")
|
||||
|
||||
# Hypre's source is staged under ./src so we'll have to manually
|
||||
# cd into it.
|
||||
with working_dir("src"):
|
||||
|
35
var/spack/repos/builtin/packages/kealib/package.py
Normal file
35
var/spack/repos/builtin/packages/kealib/package.py
Normal file
@ -0,0 +1,35 @@
|
||||
from spack import *
|
||||
|
||||
class Kealib(Package):
|
||||
"""An HDF5 Based Raster File Format
|
||||
|
||||
KEALib provides an implementation of the GDAL data model.
|
||||
The format supports raster attribute tables, image pyramids,
|
||||
meta-data and in-built statistics while also handling very
|
||||
large files and compression throughout.
|
||||
|
||||
Based on the HDF5 standard, it also provides a base from which
|
||||
other formats can be derived and is a good choice for long
|
||||
term data archiving. An independent software library (libkea)
|
||||
provides complete access to the KEA image format and a GDAL
|
||||
driver allowing KEA images to be used from any GDAL supported software.
|
||||
|
||||
Development work on this project has been funded by Landcare Research.
|
||||
"""
|
||||
homepage = "http://kealib.org/"
|
||||
url = "https://bitbucket.org/chchrsc/kealib/get/kealib-1.4.5.tar.gz"
|
||||
|
||||
version('1.4.5', '112e9c42d980b2d2987a3c15d0833a5d')
|
||||
|
||||
depends_on("hdf5")
|
||||
|
||||
def install(self, spec, prefix):
|
||||
with working_dir('trunk', create=False):
|
||||
cmake_args = []
|
||||
cmake_args.append("-DCMAKE_INSTALL_PREFIX=%s" % prefix)
|
||||
cmake_args.append("-DHDF5_INCLUDE_DIR=%s" % spec['hdf5'].prefix.include)
|
||||
cmake_args.append("-DHDF5_LIB_PATH=%s" % spec['hdf5'].prefix.lib)
|
||||
cmake('.', *cmake_args)
|
||||
|
||||
make()
|
||||
make("install")
|
@ -11,6 +11,8 @@ class Libdrm(Package):
|
||||
version('2.4.59', '105ac7af1afcd742d402ca7b4eb168b6')
|
||||
version('2.4.33', '86e4e3debe7087d5404461e0032231c8')
|
||||
|
||||
depends_on('libpciaccess')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
configure("--prefix=%s" % prefix)
|
||||
|
||||
|
@ -38,8 +38,6 @@ class Libelf(Package):
|
||||
|
||||
provides('elf')
|
||||
|
||||
sanity_check_is_file = 'include/libelf.h'
|
||||
|
||||
def install(self, spec, prefix):
|
||||
configure("--prefix=" + prefix,
|
||||
"--enable-shared",
|
||||
|
@ -9,6 +9,8 @@ class Libpng(Package):
|
||||
version('1.6.15', '829a256f3de9307731d4f52dc071916d')
|
||||
version('1.6.14', '2101b3de1d5f348925990f9aa8405660')
|
||||
|
||||
depends_on('zlib')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
configure("--prefix=%s" % prefix)
|
||||
make()
|
||||
|
@ -52,7 +52,7 @@ class Llvm(Package):
|
||||
depends_on('cmake @2.8.12.2:')
|
||||
|
||||
# Universal dependency
|
||||
depends_on('python@2.7:')
|
||||
depends_on('python@2.7:2.8') # Seems not to support python 3.X.Y
|
||||
|
||||
# lldb dependencies
|
||||
depends_on('ncurses', when='+lldb')
|
||||
@ -132,6 +132,21 @@ class Llvm(Package):
|
||||
'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',
|
||||
|
@ -0,0 +1,22 @@
|
||||
# HG changeset patch
|
||||
# User Sean Farley <sean@mcs.anl.gov>
|
||||
# Date 1332269671 18000
|
||||
# Tue Mar 20 13:54:31 2012 -0500
|
||||
# Node ID b95c0c2e1d8bf8e3273f7d45e856f0c0127d998e
|
||||
# Parent 88049269953c67c3fdcc4309bf901508a875f0dc
|
||||
cmake: add gklib headers to install into include
|
||||
|
||||
diff -r 88049269953c -r b95c0c2e1d8b libmetis/CMakeLists.txt
|
||||
Index: libmetis/CMakeLists.txt
|
||||
===================================================================
|
||||
--- a/libmetis/CMakeLists.txt Tue Mar 20 13:54:29 2012 -0500
|
||||
+++ b/libmetis/CMakeLists.txt Tue Mar 20 13:54:31 2012 -0500
|
||||
@@ -12,6 +12,8 @@ endif()
|
||||
if(METIS_INSTALL)
|
||||
install(TARGETS metis
|
||||
LIBRARY DESTINATION lib
|
||||
RUNTIME DESTINATION lib
|
||||
ARCHIVE DESTINATION lib)
|
||||
+ install(FILES gklib_defs.h DESTINATION include)
|
||||
+ install(FILES gklib_rename.h DESTINATION include)
|
||||
endif()
|
@ -24,7 +24,7 @@
|
||||
##############################################################################
|
||||
|
||||
from spack import *
|
||||
|
||||
import glob,sys
|
||||
|
||||
class Metis(Package):
|
||||
"""
|
||||
@ -49,6 +49,8 @@ class Metis(Package):
|
||||
|
||||
depends_on('gdb', when='+gdb')
|
||||
|
||||
patch('install_gklib_defs_rename.patch')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
|
||||
options = []
|
||||
@ -81,3 +83,14 @@ def install(self, spec, prefix):
|
||||
cmake(source_directory, *options)
|
||||
make()
|
||||
make("install")
|
||||
|
||||
# install GKlib headers, which will be needed for ParMETIS
|
||||
GKlib_dist = join_path(prefix.include,'GKlib')
|
||||
mkdirp(GKlib_dist)
|
||||
fs = glob.glob(join_path(source_directory,'GKlib',"*.h"))
|
||||
for f in fs:
|
||||
install(f, GKlib_dist)
|
||||
|
||||
# The shared library is not installed correctly on Darwin; correct this
|
||||
if (sys.platform == 'darwin') and ('+shared' in spec):
|
||||
fix_darwin_install_name(prefix.lib)
|
||||
|
25
var/spack/repos/builtin/packages/modules/package.py
Normal file
25
var/spack/repos/builtin/packages/modules/package.py
Normal file
@ -0,0 +1,25 @@
|
||||
from spack import *
|
||||
|
||||
class Modules(Package):
|
||||
""" The Environment Modules package provides for the dynamic modification of a user's environment via modulefiles. """
|
||||
|
||||
homepage = "http://modules.sf.net"
|
||||
url = "http://downloads.sourceforge.net/project/modules/Modules/modules-3.2.10/modules-3.2.10.tar.gz"
|
||||
|
||||
version('3.2.10', '8b097fdcb90c514d7540bb55a3cb90fb')
|
||||
|
||||
depends_on("tcl")
|
||||
|
||||
def install(self, spec, prefix):
|
||||
|
||||
options = ['--prefix=%s' % prefix,
|
||||
'--disable-debug',
|
||||
'--disable-dependency-tracking',
|
||||
'--disable-silent-rules',
|
||||
'--disable-versioning',
|
||||
'--datarootdir=%s' % prefix.share,
|
||||
'CPPFLAGS=-DUSE_INTERP_ERRORLINE']
|
||||
|
||||
configure(*options)
|
||||
make()
|
||||
make("install")
|
@ -25,6 +25,7 @@
|
||||
from spack import *
|
||||
import os
|
||||
|
||||
|
||||
class Mpich(Package):
|
||||
"""MPICH is a high performance and widely portable implementation of
|
||||
the Message Passing Interface (MPI) standard."""
|
||||
@ -46,14 +47,16 @@ class Mpich(Package):
|
||||
provides('mpi@:3.0', when='@3:')
|
||||
provides('mpi@:1.3', when='@1:')
|
||||
|
||||
def setup_dependent_environment(self, module, spec, dep_spec):
|
||||
"""For dependencies, make mpicc's use spack wrapper."""
|
||||
os.environ['MPICH_CC'] = os.environ['CC']
|
||||
os.environ['MPICH_CXX'] = os.environ['CXX']
|
||||
os.environ['MPICH_F77'] = os.environ['F77']
|
||||
os.environ['MPICH_F90'] = os.environ['FC']
|
||||
os.environ['MPICH_FC'] = os.environ['FC']
|
||||
def setup_dependent_environment(self, env, dependent_spec):
|
||||
env.set('MPICH_CC', spack_cc)
|
||||
env.set('MPICH_CXX', spack_cxx)
|
||||
env.set('MPICH_F77', spack_f77)
|
||||
env.set('MPICH_F90', spack_f90)
|
||||
env.set('MPICH_FC', spack_fc)
|
||||
|
||||
def setup_dependent_package(self, module, dep_spec):
|
||||
"""For dependencies, make mpicc's use spack wrapper."""
|
||||
# FIXME : is this necessary ? Shouldn't this be part of a contract with MPI providers?
|
||||
module.mpicc = join_path(self.prefix.bin, 'mpicc')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
@ -75,6 +78,9 @@ def install(self, spec, prefix):
|
||||
if not self.compiler.fc:
|
||||
config_args.append("--disable-fc")
|
||||
|
||||
if not self.compiler.fc and not self.compiler.f77:
|
||||
config_args.append("--disable-fortran")
|
||||
|
||||
configure(*config_args)
|
||||
make()
|
||||
make("install")
|
||||
|
@ -8,12 +8,9 @@ IORDERINGSF = $(ISCOTCH)
|
||||
IORDERINGSC = $(IMETIS) $(IPORD) $(ISCOTCH)
|
||||
|
||||
PLAT =
|
||||
LIBEXT = .a
|
||||
OUTC = -o
|
||||
OUTF = -o
|
||||
RM = /bin/rm -f
|
||||
AR = ar vr
|
||||
RANLIB = ranlib
|
||||
|
||||
INCSEQ = -I$(topdir)/libseq
|
||||
LIBSEQ = -L$(topdir)/libseq -lmpiseq
|
||||
|
@ -1,6 +1,5 @@
|
||||
from spack import *
|
||||
import os
|
||||
|
||||
import os, sys
|
||||
|
||||
class Mumps(Package):
|
||||
"""MUMPS: a MUltifrontal Massively Parallel sparse direct Solver"""
|
||||
@ -19,11 +18,12 @@ class Mumps(Package):
|
||||
variant('float', default=True, description='Activate the compilation of smumps')
|
||||
variant('complex', default=True, description='Activate the compilation of cmumps and/or zmumps')
|
||||
variant('idx64', default=False, description='Use int64_t/integer*8 as default index type')
|
||||
variant('shared', default=True, description='Build shared libraries')
|
||||
|
||||
|
||||
depends_on('scotch + esmumps', when='~ptscotch+scotch')
|
||||
depends_on('scotch + esmumps + mpi', when='+ptscotch')
|
||||
depends_on('metis', when='~parmetis+metis')
|
||||
depends_on('metis', when='+metis')
|
||||
depends_on('parmetis', when="+parmetis")
|
||||
depends_on('blas')
|
||||
depends_on('lapack')
|
||||
@ -54,18 +54,25 @@ def write_makefile_inc(self):
|
||||
if '+ptscotch' in self.spec:
|
||||
orderings.append('-Dptscotch')
|
||||
|
||||
if '+parmetis' in self.spec or '+metis' in self.spec:
|
||||
if '+parmetis' in self.spec and '+metis' in self.spec:
|
||||
libname = 'parmetis' if '+parmetis' in self.spec else 'metis'
|
||||
makefile_conf.extend(
|
||||
["IMETIS = -I%s" % self.spec[libname].prefix.include,
|
||||
"LMETIS = -L%s -l%s" % (self.spec[libname].prefix.lib, libname)])
|
||||
["IMETIS = -I%s" % self.spec['parmetis'].prefix.include,
|
||||
"LMETIS = -L%s -l%s -L%s -l%s" % (self.spec['parmetis'].prefix.lib, 'parmetis',self.spec['metis'].prefix.lib, 'metis')])
|
||||
|
||||
orderings.append('-Dparmetis')
|
||||
elif '+metis' in self.spec:
|
||||
makefile_conf.extend(
|
||||
["IMETIS = -I%s" % self.spec['metis'].prefix.include,
|
||||
"LMETIS = -L%s -l%s" % (self.spec['metis'].prefix.lib, 'metis')])
|
||||
|
||||
orderings.append('-Dmetis')
|
||||
if '+parmetis' in self.spec:
|
||||
orderings.append('-Dparmetis')
|
||||
|
||||
makefile_conf.append("ORDERINGSF = %s" % (' '.join(orderings)))
|
||||
|
||||
# when building shared libs need -fPIC, otherwise
|
||||
# /usr/bin/ld: graph.o: relocation R_X86_64_32 against `.rodata.str1.1' can not be used when making a shared object; recompile with -fPIC
|
||||
fpic = '-fPIC' if '+shared' in self.spec else ''
|
||||
# TODO: test this part, it needs a full blas, scalapack and
|
||||
# partitionning environment with 64bit integers
|
||||
if '+idx64' in self.spec:
|
||||
@ -73,14 +80,14 @@ def write_makefile_inc(self):
|
||||
# the fortran compilation flags most probably are
|
||||
# working only for intel and gnu compilers this is
|
||||
# perhaps something the compiler should provide
|
||||
['OPTF = -O -DALLOW_NON_INIT %s' % '-fdefault-integer-8' if self.compiler.name == "gcc" else '-i8',
|
||||
'OPTL = -O ',
|
||||
'OPTC = -O -DINTSIZE64'])
|
||||
['OPTF = %s -O -DALLOW_NON_INIT %s' % (fpic,'-fdefault-integer-8' if self.compiler.name == "gcc" else '-i8'),
|
||||
'OPTL = %s -O ' % fpic,
|
||||
'OPTC = %s -O -DINTSIZE64' % fpic])
|
||||
else:
|
||||
makefile_conf.extend(
|
||||
['OPTF = -O -DALLOW_NON_INIT',
|
||||
'OPTL = -O ',
|
||||
'OPTC = -O '])
|
||||
['OPTF = %s -O -DALLOW_NON_INIT' % fpic,
|
||||
'OPTL = %s -O ' % fpic,
|
||||
'OPTC = %s -O ' % fpic])
|
||||
|
||||
|
||||
if '+mpi' in self.spec:
|
||||
@ -101,6 +108,27 @@ def write_makefile_inc(self):
|
||||
# compiler possible values are -DAdd_, -DAdd__ and/or -DUPPER
|
||||
makefile_conf.append("CDEFS = -DAdd_")
|
||||
|
||||
if '+shared' in self.spec:
|
||||
if sys.platform == 'darwin':
|
||||
# Building dylibs with mpif90 causes segfaults on 10.8 and 10.10. Use gfortran. (Homebrew)
|
||||
makefile_conf.extend([
|
||||
'LIBEXT=.dylib',
|
||||
'AR=%s -dynamiclib -Wl,-install_name -Wl,%s/$(notdir $@) -undefined dynamic_lookup -o ' % (os.environ['FC'],prefix.lib),
|
||||
'RANLIB=echo'
|
||||
])
|
||||
else:
|
||||
makefile_conf.extend([
|
||||
'LIBEXT=.so',
|
||||
'AR=$(FL) -shared -Wl,-soname -Wl,%s/$(notdir $@) -o' % prefix.lib,
|
||||
'RANLIB=echo'
|
||||
])
|
||||
else:
|
||||
makefile_conf.extend([
|
||||
'LIBEXT = .a',
|
||||
'AR = ar vr',
|
||||
'RANLIB = ranlib'
|
||||
])
|
||||
|
||||
|
||||
makefile_inc_template = join_path(os.path.dirname(self.module.__file__),
|
||||
'Makefile.inc')
|
||||
@ -117,7 +145,7 @@ def write_makefile_inc(self):
|
||||
def install(self, spec, prefix):
|
||||
make_libs = []
|
||||
|
||||
# the coice to compile ?examples is to have kind of a sanity
|
||||
# the choice to compile ?examples is to have kind of a sanity
|
||||
# check on the libraries generated.
|
||||
if '+float' in spec:
|
||||
make_libs.append('sexamples')
|
||||
@ -131,9 +159,24 @@ def install(self, spec, prefix):
|
||||
|
||||
self.write_makefile_inc()
|
||||
|
||||
make(*make_libs)
|
||||
# Build fails in parallel
|
||||
make(*make_libs, parallel=False)
|
||||
|
||||
install_tree('lib', prefix.lib)
|
||||
install_tree('include', prefix.include)
|
||||
if '~mpi' in spec:
|
||||
install('libseq/libmpiseq.a', prefix.lib)
|
||||
lib_dsuffix = '.dylib' if sys.platform == 'darwin' else '.so'
|
||||
lib_suffix = lib_dsuffix if '+shared' in spec else '.a'
|
||||
install('libseq/libmpiseq%s' % lib_suffix, prefix.lib)
|
||||
|
||||
# FIXME: extend the tests to mpirun -np 2 (or alike) when build with MPI
|
||||
# FIXME: use something like numdiff to compare blessed output with the current
|
||||
with working_dir('examples'):
|
||||
if '+float' in spec:
|
||||
os.system('./ssimpletest < input_simpletest_real')
|
||||
if '+complex' in spec:
|
||||
os.system('./csimpletest < input_simpletest_real')
|
||||
if '+double' in spec:
|
||||
os.system('./dsimpletest < input_simpletest_real')
|
||||
if '+complex' in spec:
|
||||
os.system('./zsimpletest < input_simpletest_cmplx')
|
||||
|
18
var/spack/repos/builtin/packages/muparser/package.py
Normal file
18
var/spack/repos/builtin/packages/muparser/package.py
Normal file
@ -0,0 +1,18 @@
|
||||
from spack import *
|
||||
|
||||
class Muparser(Package):
|
||||
"""C++ math expression parser library."""
|
||||
homepage = "http://muparser.beltoforion.de/"
|
||||
url = "https://github.com/beltoforion/muparser/archive/v2.2.5.tar.gz"
|
||||
|
||||
version('2.2.5', '02dae671aa5ad955fdcbcd3fee313fb7')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
options = ['--disable-debug',
|
||||
'--disable-dependency-tracking',
|
||||
'--prefix=%s' % prefix]
|
||||
|
||||
configure(*options)
|
||||
|
||||
make(parallel=False)
|
||||
make("install")
|
@ -123,7 +123,7 @@ def set_network_type(self, spec, configure_args):
|
||||
count += 1
|
||||
if count > 1:
|
||||
raise RuntimeError('network variants are mutually exclusive (only one can be selected at a time)')
|
||||
|
||||
network_options = []
|
||||
# From here on I can suppose that only one variant has been selected
|
||||
if self.enabled(Mvapich2.PSM) in spec:
|
||||
network_options = ["--with-device=ch3:psm"]
|
||||
|
15
var/spack/repos/builtin/packages/netcdf-cxx/package.py
Normal file
15
var/spack/repos/builtin/packages/netcdf-cxx/package.py
Normal file
@ -0,0 +1,15 @@
|
||||
from spack import *
|
||||
|
||||
class NetcdfCxx(Package):
|
||||
"""C++ compatibility bindings for NetCDF"""
|
||||
homepage = "http://www.unidata.ucar.edu/software/netcdf"
|
||||
url = "http://www.unidata.ucar.edu/downloads/netcdf/ftp/netcdf-cxx-4.2.tar.gz"
|
||||
|
||||
version('4.2', 'd32b20c00f144ae6565d9e98d9f6204c')
|
||||
|
||||
depends_on('netcdf')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
configure('--prefix=%s' % prefix)
|
||||
make()
|
||||
make("install")
|
@ -43,6 +43,13 @@ def install(self, spec, prefix):
|
||||
"--enable-dap"
|
||||
]
|
||||
|
||||
# Make sure Netcdf links against Spack's curl
|
||||
# Otherwise it may pick up system's curl, which could lead to link errors:
|
||||
# /usr/lib/x86_64-linux-gnu/libcurl.so: undefined reference to `SSL_CTX_use_certificate_chain_file@OPENSSL_1.0.0'
|
||||
LIBS.append("-lcurl")
|
||||
CPPFLAGS.append("-I%s" % spec['curl'].prefix.include)
|
||||
LDFLAGS.append ("-L%s" % spec['curl'].prefix.lib)
|
||||
|
||||
if '+mpi' in spec:
|
||||
config_args.append('--enable-parallel4')
|
||||
|
||||
|
@ -1,46 +0,0 @@
|
||||
from spack import *
|
||||
import os
|
||||
|
||||
|
||||
class NetlibBlas(Package):
|
||||
"""Netlib reference BLAS"""
|
||||
homepage = "http://www.netlib.org/lapack/"
|
||||
url = "http://www.netlib.org/lapack/lapack-3.5.0.tgz"
|
||||
|
||||
version('3.5.0', 'b1d3e3e425b2e44a06760ff173104bdf')
|
||||
|
||||
variant('fpic', default=False, description="Build with -fpic compiler option")
|
||||
|
||||
# virtual dependency
|
||||
provides('blas')
|
||||
|
||||
# Doesn't always build correctly in parallel
|
||||
parallel = False
|
||||
|
||||
def patch(self):
|
||||
os.symlink('make.inc.example', 'make.inc')
|
||||
|
||||
mf = FileFilter('make.inc')
|
||||
mf.filter('^FORTRAN.*', 'FORTRAN = f90')
|
||||
mf.filter('^LOADER.*', 'LOADER = f90')
|
||||
mf.filter('^CC =.*', 'CC = cc')
|
||||
|
||||
if '+fpic' in self.spec:
|
||||
mf.filter('^OPTS.*=.*', 'OPTS = -O2 -frecursive -fpic')
|
||||
mf.filter('^CFLAGS =.*', 'CFLAGS = -O3 -fpic')
|
||||
|
||||
|
||||
def install(self, spec, prefix):
|
||||
make('blaslib')
|
||||
|
||||
# Tests that blas builds correctly
|
||||
make('blas_testing')
|
||||
|
||||
# No install provided
|
||||
mkdirp(prefix.lib)
|
||||
install('librefblas.a', prefix.lib)
|
||||
|
||||
# Blas virtual package should provide blas.a and libblas.a
|
||||
with working_dir(prefix.lib):
|
||||
symlink('librefblas.a', 'blas.a')
|
||||
symlink('librefblas.a', 'libblas.a')
|
@ -1,13 +1,12 @@
|
||||
from spack import *
|
||||
|
||||
|
||||
class NetlibLapack(Package):
|
||||
"""
|
||||
LAPACK version 3.X is a comprehensive FORTRAN library that does
|
||||
linear algebra operations including matrix inversions, least
|
||||
squared solutions to linear sets of equations, eigenvector
|
||||
analysis, singular value decomposition, etc. It is a very
|
||||
comprehensive and reputable package that has found extensive
|
||||
use in the scientific community.
|
||||
LAPACK version 3.X is a comprehensive FORTRAN library that does linear algebra operations including matrix
|
||||
inversions, least squared solutions to linear sets of equations, eigenvector analysis, singular value
|
||||
decomposition, etc. It is a very comprehensive and reputable package that has found extensive use in the
|
||||
scientific community.
|
||||
"""
|
||||
homepage = "http://www.netlib.org/lapack/"
|
||||
url = "http://www.netlib.org/lapack/lapack-3.5.0.tgz"
|
||||
@ -19,42 +18,68 @@ class NetlibLapack(Package):
|
||||
version('3.4.0', '02d5706ec03ba885fc246e5fa10d8c70')
|
||||
version('3.3.1', 'd0d533ec9a5b74933c2a1e84eedc58b4')
|
||||
|
||||
variant('shared', default=False, description="Build shared library version")
|
||||
variant('debug', default=False, description='Activates the Debug build type')
|
||||
variant('shared', default=True, description="Build shared library version")
|
||||
variant('external-blas', default=False, description='Build lapack with an external blas')
|
||||
|
||||
variant('lapacke', default=True, description='Activates the build of the LAPACKE C interface')
|
||||
|
||||
# virtual dependency
|
||||
provides('blas', when='~external-blas')
|
||||
provides('lapack')
|
||||
|
||||
# blas is a virtual dependency.
|
||||
depends_on('blas')
|
||||
|
||||
depends_on('cmake')
|
||||
|
||||
# Doesn't always build correctly in parallel
|
||||
parallel = False
|
||||
|
||||
@when('^netlib-blas')
|
||||
def get_blas_libs(self):
|
||||
blas = self.spec['netlib-blas']
|
||||
return [join_path(blas.prefix.lib, 'blas.a')]
|
||||
depends_on('blas', when='+external-blas')
|
||||
|
||||
|
||||
@when('^atlas')
|
||||
def get_blas_libs(self):
|
||||
blas = self.spec['atlas']
|
||||
return [join_path(blas.prefix.lib, l)
|
||||
for l in ('libf77blas.a', 'libatlas.a')]
|
||||
def patch(self):
|
||||
# Fix cblas CMakeLists.txt -- has wrong case for subdirectory name.
|
||||
filter_file('${CMAKE_CURRENT_SOURCE_DIR}/CMAKE/',
|
||||
'${CMAKE_CURRENT_SOURCE_DIR}/cmake/', 'CBLAS/CMakeLists.txt', string=True)
|
||||
|
||||
|
||||
def install(self, spec, prefix):
|
||||
blas_libs = ";".join(self.get_blas_libs())
|
||||
cmake_args = [".", '-DBLAS_LIBRARIES=' + blas_libs]
|
||||
def install_one(self, spec, prefix, shared):
|
||||
cmake_args = ['-DBUILD_SHARED_LIBS:BOOL=%s' % ('ON' if shared else 'OFF'),
|
||||
'-DCBLAS=ON', # always build CBLAS
|
||||
'-DCMAKE_BUILD_TYPE:STRING=%s' % ('Debug' if '+debug' in spec else 'Release'),
|
||||
'-DLAPACKE:BOOL=%s' % ('ON' if '+lapacke' in spec else 'OFF')]
|
||||
if '+external-blas' in spec:
|
||||
# TODO : the 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')
|
||||
])
|
||||
|
||||
if '+shared' in spec:
|
||||
cmake_args.append('-DBUILD_SHARED_LIBS=ON')
|
||||
cmake_args.extend(std_cmake_args)
|
||||
|
||||
cmake_args += std_cmake_args
|
||||
|
||||
cmake(*cmake_args)
|
||||
build_dir = 'spack-build' + ('-shared' if shared else '-static')
|
||||
with working_dir(build_dir, create=True):
|
||||
cmake('..', *cmake_args)
|
||||
make()
|
||||
make("install")
|
||||
|
||||
|
||||
def install(self, spec, prefix):
|
||||
# Always build static libraries.
|
||||
self.install_one(spec, prefix, False)
|
||||
|
||||
# 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)
|
||||
|
||||
|
||||
|
||||
|
@ -1,4 +1,5 @@
|
||||
from spack import *
|
||||
import sys
|
||||
|
||||
class NetlibScalapack(Package):
|
||||
"""ScaLAPACK is a library of high-performance linear algebra routines for parallel distributed memory machines"""
|
||||
@ -40,11 +41,16 @@ def install(self, spec, prefix):
|
||||
make()
|
||||
make("install")
|
||||
|
||||
def setup_dependent_environment(self, module, spec, dependent_spec):
|
||||
# TODO treat OS that are not Linux...
|
||||
lib_suffix = '.so' if '+shared' in spec['scalapack'] else '.a'
|
||||
# The shared libraries are not installed correctly on Darwin; correct this
|
||||
if (sys.platform == 'darwin') and ('+shared' in spec):
|
||||
fix_darwin_install_name(prefix.lib)
|
||||
|
||||
spec['scalapack'].fc_link = '-L%s -lscalapack' % spec['scalapack'].prefix.lib
|
||||
spec['scalapack'].cc_link = spec['scalapack'].fc_link
|
||||
spec['scalapack'].libraries = [join_path(spec['scalapack'].prefix.lib,
|
||||
'libscalapack%s' % lib_suffix)]
|
||||
|
||||
def setup_dependent_package(self, module, dependent_spec):
|
||||
spec = self.spec
|
||||
lib_dsuffix = '.dylib' if sys.platform == 'darwin' else '.so'
|
||||
lib_suffix = lib_dsuffix 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)]
|
||||
|
@ -16,7 +16,7 @@ def install(self, spec, prefix):
|
||||
|
||||
cp = which('cp')
|
||||
|
||||
bindir = os.path.join(prefix, 'bin')
|
||||
bindir = os.path.join(prefix, 'bin/')
|
||||
mkdir(bindir)
|
||||
cp('-a', '-t', bindir, 'ninja')
|
||||
cp('-ra', 'misc', prefix)
|
||||
cp('-a', 'ninja', bindir)
|
||||
cp('-a', 'misc', prefix)
|
||||
|
44
var/spack/repos/builtin/packages/numdiff/package.py
Normal file
44
var/spack/repos/builtin/packages/numdiff/package.py
Normal file
@ -0,0 +1,44 @@
|
||||
##############################################################################
|
||||
# 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://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 *
|
||||
import sys
|
||||
|
||||
class Numdiff(Package):
|
||||
"""Numdiff is a little program that can be used to compare putatively
|
||||
similar files line by line and field by field, ignoring small numeric
|
||||
differences or/and different numeric formats."""
|
||||
|
||||
homepage = 'https://www.nongnu.org/numdiff'
|
||||
url = 'http://nongnu.askapache.com/numdiff/numdiff-5.8.1.tar.gz'
|
||||
|
||||
version('5.8.1', 'a295eb391f6cb1578209fc6b4f9d994e')
|
||||
|
||||
depends_on('gettext', sys.platform=='darwin')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
options = ['--prefix=%s' % prefix]
|
||||
configure(*options)
|
||||
make()
|
||||
make('install')
|
482
var/spack/repos/builtin/packages/oce/null.patch
Normal file
482
var/spack/repos/builtin/packages/oce/null.patch
Normal file
@ -0,0 +1,482 @@
|
||||
From 61cb965b9ffeca419005bc15e635e67589c421dd Mon Sep 17 00:00:00 2001
|
||||
From: Martin Siggel <martin.siggel@dlr.de>
|
||||
Date: Thu, 28 Jan 2016 19:05:00 +0100
|
||||
Subject: [PATCH] Workaround clang optimizations for null references
|
||||
|
||||
OCCT/OCE includes some evil code that uses NULL references,
|
||||
which are normally not possible. Clang removes code in
|
||||
branches like if(&myNullRef==NULL) as it assumes this can
|
||||
never be true. This fix was inspired from the mantis issue
|
||||
http://tracker.dev.opencascade.org/view.php?id=26042. This
|
||||
code will be fixed in OCCT 7, but we might require the fix
|
||||
for earlier releases as well.
|
||||
|
||||
Fixes issue #576
|
||||
---
|
||||
inc/PLib.hxx | 2 +-
|
||||
src/BSplCLib/BSplCLib.cxx | 16 ++++++-------
|
||||
src/BSplCLib/BSplCLib_2.cxx | 6 ++---
|
||||
src/BSplCLib/BSplCLib_CurveComputation.gxx | 26 ++++++++++-----------
|
||||
src/BSplSLib/BSplSLib.cxx | 36 +++++++++++++++---------------
|
||||
src/BSplSLib/BSplSLib_BzSyntaxes.cxx | 2 +-
|
||||
src/PLib/PLib.cxx | 10 ++++-----
|
||||
7 files changed, 49 insertions(+), 49 deletions(-)
|
||||
|
||||
diff --git a/inc/PLib.hxx b/inc/PLib.hxx
|
||||
index 7513234..52b1f84 100644
|
||||
--- a/inc/PLib.hxx
|
||||
+++ b/inc/PLib.hxx
|
||||
@@ -343,6 +343,6 @@ friend class PLib_DoubleJacobiPolynomial;
|
||||
|
||||
|
||||
|
||||
-
|
||||
+#define IS_NULL_REF(ref) ((reinterpret_cast<size_t>(&ref) & 0xFFFFFF) == 0)
|
||||
|
||||
#endif // _PLib_HeaderFile
|
||||
diff --git a/src/BSplCLib/BSplCLib.cxx b/src/BSplCLib/BSplCLib.cxx
|
||||
index 683e4ab..2a2d9ea 100644
|
||||
--- a/src/BSplCLib/BSplCLib.cxx
|
||||
+++ b/src/BSplCLib/BSplCLib.cxx
|
||||
@@ -298,7 +298,7 @@ void BSplCLib::LocateParameter
|
||||
Standard_Real& NewU)
|
||||
{
|
||||
Standard_Integer first,last;
|
||||
- if (&Mults) {
|
||||
+ if (!IS_NULL_REF(Mults)) {
|
||||
if (Periodic) {
|
||||
first = Knots.Lower();
|
||||
last = Knots.Upper();
|
||||
@@ -1434,7 +1434,7 @@ void BSplCLib::BuildKnots(const Standard_Integer Degree,
|
||||
const Standard_Real * pkn = &Knots(KLower);
|
||||
pkn -= KLower;
|
||||
Standard_Real *knot = &LK;
|
||||
- if (&Mults == NULL) {
|
||||
+ if (IS_NULL_REF(Mults)) {
|
||||
switch (Degree) {
|
||||
case 1 : {
|
||||
Standard_Integer j = Index ;
|
||||
@@ -1672,7 +1672,7 @@ Standard_Boolean BSplCLib::PrepareInsertKnots
|
||||
const Standard_Real Tolerance,
|
||||
const Standard_Boolean Add)
|
||||
{
|
||||
- Standard_Boolean addflat = &AddMults == NULL;
|
||||
+ Standard_Boolean addflat = IS_NULL_REF(AddMults);
|
||||
|
||||
Standard_Integer first,last;
|
||||
if (Periodic) {
|
||||
@@ -1856,7 +1856,7 @@ void BSplCLib::InsertKnots
|
||||
const Standard_Real Tolerance,
|
||||
const Standard_Boolean Add)
|
||||
{
|
||||
- Standard_Boolean addflat = &AddMults == NULL;
|
||||
+ Standard_Boolean addflat = IS_NULL_REF(AddMults);
|
||||
|
||||
Standard_Integer i,k,mult,firstmult;
|
||||
Standard_Integer index,kn,curnk,curk;
|
||||
@@ -3902,7 +3902,7 @@ void BSplCLib::Resolution( Standard_Real& Poles,
|
||||
num_poles = FlatKnots.Length() - Deg1;
|
||||
switch (ArrayDimension) {
|
||||
case 2 : {
|
||||
- if (&Weights != NULL) {
|
||||
+ if (!IS_NULL_REF(Weights)) {
|
||||
const Standard_Real * WG = &Weights(Weights.Lower());
|
||||
min_weights = WG[0];
|
||||
|
||||
@@ -3970,7 +3970,7 @@ void BSplCLib::Resolution( Standard_Real& Poles,
|
||||
break;
|
||||
}
|
||||
case 3 : {
|
||||
- if (&Weights != NULL) {
|
||||
+ if (!IS_NULL_REF(Weights)) {
|
||||
const Standard_Real * WG = &Weights(Weights.Lower());
|
||||
min_weights = WG[0];
|
||||
|
||||
@@ -4047,7 +4047,7 @@ void BSplCLib::Resolution( Standard_Real& Poles,
|
||||
break;
|
||||
}
|
||||
case 4 : {
|
||||
- if (&Weights != NULL) {
|
||||
+ if (!IS_NULL_REF(Weights)) {
|
||||
const Standard_Real * WG = &Weights(Weights.Lower());
|
||||
min_weights = WG[0];
|
||||
|
||||
@@ -4134,7 +4134,7 @@ void BSplCLib::Resolution( Standard_Real& Poles,
|
||||
}
|
||||
default : {
|
||||
Standard_Integer kk;
|
||||
- if (&Weights != NULL) {
|
||||
+ if (!IS_NULL_REF(Weights)) {
|
||||
const Standard_Real * WG = &Weights(Weights.Lower());
|
||||
min_weights = WG[0];
|
||||
|
||||
diff --git a/src/BSplCLib/BSplCLib_2.cxx b/src/BSplCLib/BSplCLib_2.cxx
|
||||
index 35c4639..653b7cd 100644
|
||||
--- a/src/BSplCLib/BSplCLib_2.cxx
|
||||
+++ b/src/BSplCLib/BSplCLib_2.cxx
|
||||
@@ -70,7 +70,7 @@ void BSplCLib::BuildEval(const Standard_Integer Degree,
|
||||
Standard_Integer i;
|
||||
Standard_Integer ip = PLower + Index - 1;
|
||||
Standard_Real w, *pole = &LP;
|
||||
- if (&Weights == NULL) {
|
||||
+ if (IS_NULL_REF(Weights)) {
|
||||
|
||||
for (i = 0; i <= Degree; i++) {
|
||||
ip++;
|
||||
@@ -115,13 +115,13 @@ static void PrepareEval
|
||||
|
||||
// make the knots
|
||||
BSplCLib::BuildKnots(Degree,index,Periodic,Knots,Mults,*dc.knots);
|
||||
- if (&Mults == NULL)
|
||||
+ if (IS_NULL_REF(Mults))
|
||||
index -= Knots.Lower() + Degree;
|
||||
else
|
||||
index = BSplCLib::PoleIndex(Degree,index,Periodic,Mults);
|
||||
|
||||
// check truly rational
|
||||
- rational = (&Weights != NULL);
|
||||
+ rational = (!IS_NULL_REF(Weights));
|
||||
if (rational) {
|
||||
Standard_Integer WLower = Weights.Lower() + index;
|
||||
rational = BSplCLib::IsRational(Weights, WLower, WLower + Degree);
|
||||
diff --git a/src/BSplCLib/BSplCLib_CurveComputation.gxx b/src/BSplCLib/BSplCLib_CurveComputation.gxx
|
||||
index e71b4e0..9d42643 100644
|
||||
--- a/src/BSplCLib/BSplCLib_CurveComputation.gxx
|
||||
+++ b/src/BSplCLib/BSplCLib_CurveComputation.gxx
|
||||
@@ -92,7 +92,7 @@ Standard_Boolean BSplCLib::RemoveKnot
|
||||
TColStd_Array1OfInteger& NewMults,
|
||||
const Standard_Real Tolerance)
|
||||
{
|
||||
- Standard_Boolean rational = &Weights != NULL;
|
||||
+ Standard_Boolean rational = !IS_NULL_REF(Weights);
|
||||
Standard_Integer dim;
|
||||
dim = Dimension_gen;
|
||||
if (rational) dim++;
|
||||
@@ -133,7 +133,7 @@ void BSplCLib::InsertKnots
|
||||
const Standard_Real Epsilon,
|
||||
const Standard_Boolean Add)
|
||||
{
|
||||
- Standard_Boolean rational = &Weights != NULL;
|
||||
+ Standard_Boolean rational = !IS_NULL_REF(Weights);
|
||||
Standard_Integer dim;
|
||||
dim = Dimension_gen;
|
||||
if (rational) dim++;
|
||||
@@ -222,7 +222,7 @@ void BSplCLib::IncreaseDegree
|
||||
TColStd_Array1OfReal& NewKnots,
|
||||
TColStd_Array1OfInteger& NewMults)
|
||||
{
|
||||
- Standard_Boolean rational = &Weights != NULL;
|
||||
+ Standard_Boolean rational = !IS_NULL_REF(Weights);
|
||||
Standard_Integer dim;
|
||||
dim = Dimension_gen;
|
||||
if (rational) dim++;
|
||||
@@ -256,7 +256,7 @@ void BSplCLib::Unperiodize
|
||||
Array1OfPoints& NewPoles,
|
||||
TColStd_Array1OfReal& NewWeights)
|
||||
{
|
||||
- Standard_Boolean rational = &Weights != NULL;
|
||||
+ Standard_Boolean rational = !IS_NULL_REF(Weights);
|
||||
Standard_Integer dim;
|
||||
dim = Dimension_gen;
|
||||
if (rational) dim++;
|
||||
@@ -292,7 +292,7 @@ void BSplCLib::Trimming(const Standard_Integer Degree,
|
||||
Array1OfPoints& NewPoles,
|
||||
TColStd_Array1OfReal& NewWeights)
|
||||
{
|
||||
- Standard_Boolean rational = &Weights != NULL;
|
||||
+ Standard_Boolean rational = !IS_NULL_REF(Weights);
|
||||
Standard_Integer dim;
|
||||
dim = Dimension_gen;
|
||||
if (rational) dim++;
|
||||
@@ -339,7 +339,7 @@ void BSplCLib::BuildEval(const Standard_Integer Degree,
|
||||
Standard_Integer PUpper = Poles.Upper();
|
||||
Standard_Integer i;
|
||||
Standard_Integer ip = PLower + Index - 1;
|
||||
- if (&Weights == NULL) {
|
||||
+ if (IS_NULL_REF(Weights)) {
|
||||
for (i = 0; i <= Degree; i++) {
|
||||
ip++;
|
||||
if (ip > PUpper) ip = PLower;
|
||||
@@ -384,13 +384,13 @@ static void PrepareEval
|
||||
|
||||
// make the knots
|
||||
BSplCLib::BuildKnots(Degree,index,Periodic,Knots,Mults,*dc.knots);
|
||||
- if (&Mults == NULL)
|
||||
+ if (IS_NULL_REF(Mults))
|
||||
index -= Knots.Lower() + Degree;
|
||||
else
|
||||
index = BSplCLib::PoleIndex(Degree,index,Periodic,Mults);
|
||||
|
||||
// check truly rational
|
||||
- rational = (&Weights != NULL);
|
||||
+ rational = (!IS_NULL_REF(Weights));
|
||||
if (rational) {
|
||||
Standard_Integer WLower = Weights.Lower() + index;
|
||||
rational = BSplCLib::IsRational(Weights, WLower, WLower + Degree);
|
||||
@@ -741,7 +741,7 @@ void BSplCLib::CacheD0(const Standard_Real Parameter,
|
||||
Degree * Dimension_gen,
|
||||
PArray[0],
|
||||
myPoint[0]) ;
|
||||
- if (&WeightsArray != NULL) {
|
||||
+ if (!IS_NULL_REF(WeightsArray)) {
|
||||
Standard_Real *
|
||||
WArray = (Standard_Real *) &WeightsArray(WeightsArray.Lower()) ;
|
||||
PLib::NoDerivativeEvalPolynomial(NewParameter,
|
||||
@@ -798,7 +798,7 @@ void BSplCLib::CacheD1(const Standard_Real Parameter,
|
||||
|
||||
ModifyCoords (LocalPDerivatives + Dimension_gen, /= SpanLenght);
|
||||
|
||||
- if (&WeightsArray != NULL) {
|
||||
+ if (!IS_NULL_REF(WeightsArray)) {
|
||||
Standard_Real *
|
||||
WArray = (Standard_Real *) &WeightsArray(WeightsArray.Lower()) ;
|
||||
PLib::EvalPolynomial(NewParameter,
|
||||
@@ -878,7 +878,7 @@ void BSplCLib::CacheD2(const Standard_Real Parameter,
|
||||
Index += Dimension_gen;
|
||||
}
|
||||
|
||||
- if (&WeightsArray != NULL) {
|
||||
+ if (!IS_NULL_REF(WeightsArray)) {
|
||||
Standard_Real *
|
||||
WArray = (Standard_Real *) &WeightsArray(WeightsArray.Lower()) ;
|
||||
|
||||
@@ -971,7 +971,7 @@ void BSplCLib::CacheD3(const Standard_Real Parameter,
|
||||
Index += Dimension_gen;
|
||||
}
|
||||
|
||||
- if (&WeightsArray != NULL) {
|
||||
+ if (!IS_NULL_REF(WeightsArray)) {
|
||||
Standard_Real *
|
||||
WArray = (Standard_Real *) &WeightsArray(WeightsArray.Lower()) ;
|
||||
|
||||
@@ -1081,7 +1081,7 @@ void BSplCLib::BuildCache
|
||||
LocalValue *= SpanDomain / (Standard_Real) ii ;
|
||||
}
|
||||
|
||||
- if (&Weights != NULL) {
|
||||
+ if (!IS_NULL_REF(Weights)) {
|
||||
for (ii = 1 ; ii <= Degree + 1 ; ii++)
|
||||
CacheWeights(ii) = 0.0e0 ;
|
||||
CacheWeights(1) = 1.0e0 ;
|
||||
diff --git a/src/BSplSLib/BSplSLib.cxx b/src/BSplSLib/BSplSLib.cxx
|
||||
index 5ad633c..07040d5 100644
|
||||
--- a/src/BSplSLib/BSplSLib.cxx
|
||||
+++ b/src/BSplSLib/BSplSLib.cxx
|
||||
@@ -309,12 +309,12 @@ static Standard_Boolean PrepareEval (const Standard_Real U,
|
||||
BSplCLib::BuildKnots(UDegree,uindex,UPer,UKnots,UMults,*dc.knots1);
|
||||
BSplCLib::BuildKnots(VDegree,vindex,VPer,VKnots,VMults,*dc.knots2);
|
||||
|
||||
- if (&UMults == NULL)
|
||||
+ if (IS_NULL_REF(UMults))
|
||||
uindex -= UKLower + UDegree;
|
||||
else
|
||||
uindex = BSplCLib::PoleIndex(UDegree,uindex,UPer,UMults);
|
||||
|
||||
- if (&VMults == NULL)
|
||||
+ if (IS_NULL_REF(VMults))
|
||||
vindex -= VKLower + VDegree;
|
||||
else
|
||||
vindex = BSplCLib::PoleIndex(VDegree,vindex,VPer,VMults);
|
||||
@@ -460,12 +460,12 @@ static Standard_Boolean PrepareEval (const Standard_Real U,
|
||||
BSplCLib::BuildKnots(UDegree,uindex,UPer,UKnots,UMults,*dc.knots2);
|
||||
BSplCLib::BuildKnots(VDegree,vindex,VPer,VKnots,VMults,*dc.knots1);
|
||||
|
||||
- if (&UMults == NULL)
|
||||
+ if (IS_NULL_REF(UMults))
|
||||
uindex -= UKLower + UDegree;
|
||||
else
|
||||
uindex = BSplCLib::PoleIndex(UDegree,uindex,UPer,UMults);
|
||||
|
||||
- if (&VMults == NULL)
|
||||
+ if (IS_NULL_REF(VMults))
|
||||
vindex -= VKLower + VDegree;
|
||||
else
|
||||
vindex = BSplCLib::PoleIndex(VDegree,vindex,VPer,VMults);
|
||||
@@ -1299,7 +1299,7 @@ void BSplSLib::Iso(const Standard_Real Param,
|
||||
{
|
||||
Standard_Integer index = 0;
|
||||
Standard_Real u = Param;
|
||||
- Standard_Boolean rational = &Weights != NULL;
|
||||
+ Standard_Boolean rational = !IS_NULL_REF(Weights);
|
||||
Standard_Integer dim = rational ? 4 : 3;
|
||||
|
||||
// compute local knots
|
||||
@@ -1307,7 +1307,7 @@ void BSplSLib::Iso(const Standard_Real Param,
|
||||
NCollection_LocalArray<Standard_Real> locknots1 (2*Degree);
|
||||
BSplCLib::LocateParameter(Degree,Knots,Mults,u,Periodic,index,u);
|
||||
BSplCLib::BuildKnots(Degree,index,Periodic,Knots,Mults,*locknots1);
|
||||
- if (&Mults == NULL)
|
||||
+ if (IS_NULL_REF(Mults))
|
||||
index -= Knots.Lower() + Degree;
|
||||
else
|
||||
index = BSplCLib::PoleIndex(Degree,index,Periodic,Mults);
|
||||
@@ -1381,7 +1381,7 @@ void BSplSLib::Iso(const Standard_Real Param,
|
||||
}
|
||||
|
||||
// if the input is not rational but weights are wanted
|
||||
- if (!rational && (&CWeights != NULL)) {
|
||||
+ if (!rational && (!IS_NULL_REF(CWeights))) {
|
||||
|
||||
for (i = CWeights.Lower(); i <= CWeights.Upper(); i++)
|
||||
CWeights(i) = 1.;
|
||||
@@ -1741,7 +1741,7 @@ void BSplSLib::InsertKnots(const Standard_Boolean UDirection,
|
||||
const Standard_Real Epsilon,
|
||||
const Standard_Boolean Add )
|
||||
{
|
||||
- Standard_Boolean rational = &Weights != NULL;
|
||||
+ Standard_Boolean rational = !IS_NULL_REF(Weights);
|
||||
Standard_Integer dim = 3;
|
||||
if (rational) dim++;
|
||||
|
||||
@@ -1787,7 +1787,7 @@ Standard_Boolean BSplSLib::RemoveKnot
|
||||
TColStd_Array1OfInteger& NewMults,
|
||||
const Standard_Real Tolerance)
|
||||
{
|
||||
- Standard_Boolean rational = &Weights != NULL;
|
||||
+ Standard_Boolean rational = !IS_NULL_REF(Weights);
|
||||
Standard_Integer dim = 3;
|
||||
if (rational) dim++;
|
||||
|
||||
@@ -1834,7 +1834,7 @@ void BSplSLib::IncreaseDegree
|
||||
TColStd_Array1OfReal& NewKnots,
|
||||
TColStd_Array1OfInteger& NewMults)
|
||||
{
|
||||
- Standard_Boolean rational = &Weights != NULL;
|
||||
+ Standard_Boolean rational = !IS_NULL_REF(Weights);
|
||||
Standard_Integer dim = 3;
|
||||
if (rational) dim++;
|
||||
|
||||
@@ -1876,7 +1876,7 @@ void BSplSLib::Unperiodize
|
||||
TColgp_Array2OfPnt& NewPoles,
|
||||
TColStd_Array2OfReal& NewWeights)
|
||||
{
|
||||
- Standard_Boolean rational = &Weights != NULL;
|
||||
+ Standard_Boolean rational = !IS_NULL_REF(Weights);
|
||||
Standard_Integer dim = 3;
|
||||
if (rational) dim++;
|
||||
|
||||
@@ -1929,7 +1929,7 @@ void BSplSLib::BuildCache
|
||||
Standard_Boolean rational,rational_u,rational_v,flag_u_or_v;
|
||||
Standard_Integer kk,d1,d1p1,d2,d2p1,ii,jj,iii,jjj,Index;
|
||||
Standard_Real u1,min_degree_domain,max_degree_domain,f,factor[2],u2;
|
||||
- if (&Weights != NULL)
|
||||
+ if (!IS_NULL_REF(Weights))
|
||||
rational_u = rational_v = Standard_True;
|
||||
else
|
||||
rational_u = rational_v = Standard_False;
|
||||
@@ -2025,7 +2025,7 @@ void BSplSLib::BuildCache
|
||||
}
|
||||
factor[0] *= max_degree_domain / (Standard_Real) (iii) ;
|
||||
}
|
||||
- if (&Weights != NULL) {
|
||||
+ if (!IS_NULL_REF(Weights)) {
|
||||
//
|
||||
// means that PrepareEval did found out that the surface was
|
||||
// locally polynomial but since the surface is constructed
|
||||
@@ -2110,7 +2110,7 @@ void BSplSLib::CacheD0(const Standard_Real UParameter,
|
||||
(min_degree << 1) + min_degree,
|
||||
locpoles[0],
|
||||
myPoint[0]) ;
|
||||
- if (&WeightsArray != NULL) {
|
||||
+ if (!IS_NULL_REF(WeightsArray)) {
|
||||
dimension = min_degree + 1 ;
|
||||
Standard_Real *
|
||||
WArray = (Standard_Real *)
|
||||
@@ -2190,7 +2190,7 @@ void BSplSLib::CacheD1(const Standard_Real UParameter,
|
||||
// the coefficients
|
||||
//
|
||||
//
|
||||
- if (&WeightsArray != NULL) {
|
||||
+ if (!IS_NULL_REF(WeightsArray)) {
|
||||
|
||||
local_poles_array [0][0][0] = 0.0e0 ;
|
||||
local_poles_array [0][0][1] = 0.0e0 ;
|
||||
@@ -2275,7 +2275,7 @@ void BSplSLib::CacheD1(const Standard_Real UParameter,
|
||||
locpoles[dimension],
|
||||
local_poles_array[1][0][0]) ;
|
||||
|
||||
- if (&WeightsArray != NULL) {
|
||||
+ if (!IS_NULL_REF(WeightsArray)) {
|
||||
dimension = min_degree + 1 ;
|
||||
Standard_Real *
|
||||
WArray = (Standard_Real *)
|
||||
@@ -2435,7 +2435,7 @@ void BSplSLib::CacheD2(const Standard_Real UParameter,
|
||||
// the coefficients
|
||||
//
|
||||
//
|
||||
- if (&WeightsArray != NULL) {
|
||||
+ if (!IS_NULL_REF(WeightsArray)) {
|
||||
|
||||
local_poles_and_weights_array[0][0][0] = 0.0e0 ;
|
||||
local_poles_and_weights_array[0][0][1] = 0.0e0 ;
|
||||
@@ -2564,7 +2564,7 @@ void BSplSLib::CacheD2(const Standard_Real UParameter,
|
||||
locpoles[dimension + dimension],
|
||||
local_poles_array[2][0][0]) ;
|
||||
|
||||
- if (&WeightsArray != NULL) {
|
||||
+ if (!IS_NULL_REF(WeightsArray)) {
|
||||
dimension = min_degree + 1 ;
|
||||
Standard_Real *
|
||||
WArray = (Standard_Real *)
|
||||
diff --git a/src/BSplSLib/BSplSLib_BzSyntaxes.cxx b/src/BSplSLib/BSplSLib_BzSyntaxes.cxx
|
||||
index 0faf6b6..f2c0f74 100644
|
||||
--- a/src/BSplSLib/BSplSLib_BzSyntaxes.cxx
|
||||
+++ b/src/BSplSLib/BSplSLib_BzSyntaxes.cxx
|
||||
@@ -68,7 +68,7 @@ void BSplSLib::PolesCoefficients (const TColgp_Array2OfPnt& Poles,
|
||||
biduflatknots,bidvflatknots,
|
||||
Poles,Weights,
|
||||
CPoles,CWeights);
|
||||
- if (&Weights == NULL) {
|
||||
+ if (IS_NULL_REF(Weights)) {
|
||||
|
||||
for (ii = 1; ii <= uclas; ii++) {
|
||||
|
||||
diff --git a/src/PLib/PLib.cxx b/src/PLib/PLib.cxx
|
||||
index 23fa302..7ee231f 100644
|
||||
--- a/src/PLib/PLib.cxx
|
||||
+++ b/src/PLib/PLib.cxx
|
||||
@@ -2427,7 +2427,7 @@ void PLib::CoefficientsPoles (const Standard_Integer dim,
|
||||
TColStd_Array1OfReal& Poles,
|
||||
TColStd_Array1OfReal& Weights)
|
||||
{
|
||||
- Standard_Boolean rat = &WCoefs != NULL;
|
||||
+ Standard_Boolean rat = !IS_NULL_REF(WCoefs);
|
||||
Standard_Integer loc = Coefs.Lower();
|
||||
Standard_Integer lop = Poles.Lower();
|
||||
Standard_Integer lowc=0;
|
||||
@@ -2550,7 +2550,7 @@ void PLib::Trimming(const Standard_Real U1,
|
||||
Standard_Integer indc, indw=0;
|
||||
Standard_Integer upc = Coefs.Upper() - dim + 1, upw=0;
|
||||
Standard_Integer len = Coefs.Length()/dim;
|
||||
- Standard_Boolean rat = &WCoefs != NULL;
|
||||
+ Standard_Boolean rat = !IS_NULL_REF(WCoefs);
|
||||
|
||||
if (rat) {
|
||||
if(len != WCoefs.Length())
|
||||
@@ -2607,7 +2607,7 @@ void PLib::CoefficientsPoles (const TColgp_Array2OfPnt& Coefs,
|
||||
TColgp_Array2OfPnt& Poles,
|
||||
TColStd_Array2OfReal& Weights)
|
||||
{
|
||||
- Standard_Boolean rat = (&WCoefs != NULL);
|
||||
+ Standard_Boolean rat = (!IS_NULL_REF(WCoefs));
|
||||
Standard_Integer LowerRow = Poles.LowerRow();
|
||||
Standard_Integer UpperRow = Poles.UpperRow();
|
||||
Standard_Integer LowerCol = Poles.LowerCol();
|
||||
@@ -2701,7 +2701,7 @@ void PLib::UTrimming(const Standard_Real U1,
|
||||
TColgp_Array2OfPnt& Coeffs,
|
||||
TColStd_Array2OfReal& WCoeffs)
|
||||
{
|
||||
- Standard_Boolean rat = &WCoeffs != NULL;
|
||||
+ Standard_Boolean rat = !IS_NULL_REF(WCoeffs);
|
||||
Standard_Integer lr = Coeffs.LowerRow();
|
||||
Standard_Integer ur = Coeffs.UpperRow();
|
||||
Standard_Integer lc = Coeffs.LowerCol();
|
||||
@@ -2735,7 +2735,7 @@ void PLib::VTrimming(const Standard_Real V1,
|
||||
TColgp_Array2OfPnt& Coeffs,
|
||||
TColStd_Array2OfReal& WCoeffs)
|
||||
{
|
||||
- Standard_Boolean rat = &WCoeffs != NULL;
|
||||
+ Standard_Boolean rat = !IS_NULL_REF(WCoeffs);
|
||||
Standard_Integer lr = Coeffs.LowerRow();
|
||||
Standard_Integer ur = Coeffs.UpperRow();
|
||||
Standard_Integer lc = Coeffs.LowerCol();
|
67
var/spack/repos/builtin/packages/oce/package.py
Normal file
67
var/spack/repos/builtin/packages/oce/package.py
Normal file
@ -0,0 +1,67 @@
|
||||
from spack import *
|
||||
import platform, sys
|
||||
|
||||
class Oce(Package):
|
||||
"""
|
||||
Open CASCADE Community Edition:
|
||||
patches/improvements/experiments contributed by users over the official Open CASCADE library.
|
||||
"""
|
||||
homepage = "https://github.com/tpaviot/oce"
|
||||
url = "https://github.com/tpaviot/oce/archive/OCE-0.17.tar.gz"
|
||||
|
||||
version('0.17.1', '36c67b87093c675698b483454258af91')
|
||||
version('0.17' , 'f1a89395c4b0d199bea3db62b85f818d')
|
||||
version('0.16.1', '4d591b240c9293e879f50d86a0cb2bb3')
|
||||
version('0.16' , '7a4b4df5a104d75a537e25e7dd387eca')
|
||||
|
||||
variant('tbb', default=True, description='Build with Intel Threading Building Blocks')
|
||||
|
||||
depends_on('cmake@2.8:')
|
||||
depends_on('tbb', when='+tbb')
|
||||
|
||||
# There is a bug in OCE which appears with Clang (version?) or GCC 6.0
|
||||
# and has to do with compiler optimization, see
|
||||
# https://github.com/tpaviot/oce/issues/576
|
||||
# http://tracker.dev.opencascade.org/view.php?id=26042
|
||||
# https://github.com/tpaviot/oce/issues/605
|
||||
# https://github.com/tpaviot/oce/commit/61cb965b9ffeca419005bc15e635e67589c421dd.patch
|
||||
patch('null.patch',when='@0.16:0.17.1')
|
||||
|
||||
|
||||
def install(self, spec, prefix):
|
||||
options = []
|
||||
options.extend(std_cmake_args)
|
||||
options.extend([
|
||||
'-DOCE_INSTALL_PREFIX=%s' % prefix,
|
||||
'-DOCE_BUILD_SHARED_LIB:BOOL=ON',
|
||||
'-DCMAKE_BUILD_TYPE:STRING=Release',
|
||||
'-DOCE_DATAEXCHANGE:BOOL=ON',
|
||||
'-DOCE_DISABLE_X11:BOOL=ON',
|
||||
'-DOCE_DRAW:BOOL=OFF',
|
||||
'-DOCE_MODEL:BOOL=ON',
|
||||
'-DOCE_MULTITHREAD_LIBRARY:STRING=%s' % ('TBB' if '+tbb' in spec else 'NONE'),
|
||||
'-DOCE_OCAF:BOOL=ON',
|
||||
'-DOCE_USE_TCL_TEST_FRAMEWORK:BOOL=OFF',
|
||||
'-DOCE_VISUALISATION:BOOL=OFF',
|
||||
'-DOCE_WITH_FREEIMAGE:BOOL=OFF',
|
||||
'-DOCE_WITH_GL2PS:BOOL=OFF',
|
||||
'-DOCE_WITH_OPENCL:BOOL=OFF'
|
||||
])
|
||||
|
||||
if platform.system() == 'Darwin':
|
||||
options.extend([
|
||||
'-DOCE_OSX_USE_COCOA:BOOL=ON',
|
||||
])
|
||||
|
||||
cmake('.', *options)
|
||||
|
||||
make("install/strip")
|
||||
|
||||
# OCE tests build is brocken at least on Darwin.
|
||||
# Unit tests are linked against libTKernel.10.dylib isntead of /full/path/libTKernel.10.dylib
|
||||
# see https://github.com/tpaviot/oce/issues/612
|
||||
# make("test")
|
||||
|
||||
# The shared libraries are not installed correctly on Darwin; correct this
|
||||
if (sys.platform == 'darwin'):
|
||||
fix_darwin_install_name(prefix.lib)
|
@ -62,7 +62,7 @@ class Octave(Package):
|
||||
depends_on('qrupdate', when='+qrupdate')
|
||||
#depends_on('qscintilla', when='+qscintilla) # TODO: add package
|
||||
depends_on('qt', when='+qt')
|
||||
depends_on('SuiteSparse', when='+suitesparse')
|
||||
depends_on('suite-sparse',when='+suitesparse')
|
||||
depends_on('zlib', when='+zlib')
|
||||
|
||||
|
||||
|
@ -1,28 +1,70 @@
|
||||
from spack import *
|
||||
import sys
|
||||
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"
|
||||
|
||||
version('0.2.17', '664a12807f2a2a7cda4781e3ab2ae0e1')
|
||||
version('0.2.16', 'fef46ab92463bdbb1479dcec594ef6dc')
|
||||
version('0.2.15', 'b1190f3d3471685f17cfd1ec1d252ac9')
|
||||
|
||||
variant('shared', default=True, description="Build shared libraries as well as static libs.")
|
||||
|
||||
# virtual dependency
|
||||
provides('blas')
|
||||
provides('lapack')
|
||||
|
||||
|
||||
def install(self, spec, prefix):
|
||||
make('libs', 'netlib', 'shared', 'CC=cc', 'FC=f77')
|
||||
make('install', "PREFIX='%s'" % prefix)
|
||||
make_defs = ['CC=%s' % spack_cc,
|
||||
'FC=%s' % spack_fc]
|
||||
|
||||
make_targets = ['libs', 'netlib']
|
||||
|
||||
# Build shared if variant is set.
|
||||
if '+shared' in spec:
|
||||
make_targets += ['shared']
|
||||
else:
|
||||
make_defs += ['NO_SHARED=1']
|
||||
|
||||
# fix missing _dggsvd_ and _sggsvd_
|
||||
if spec.satisfies('@0.2.16'):
|
||||
make_defs += ['BUILD_LAPACK_DEPRECATED=1']
|
||||
|
||||
make_args = make_defs + make_targets
|
||||
make(*make_args)
|
||||
|
||||
make("tests", *make_defs)
|
||||
|
||||
# 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')
|
||||
symlink('libopenblas.so', 'libblas.so')
|
||||
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')
|
||||
symlink('libopenblas.so', 'liblapack.so')
|
||||
if '+shared' in spec:
|
||||
symlink('libopenblas.%s' % dso_suffix, 'liblapack.%s' % dso_suffix)
|
||||
|
||||
|
||||
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
|
||||
|
||||
|
26
var/spack/repos/builtin/packages/openjpeg/package.py
Normal file
26
var/spack/repos/builtin/packages/openjpeg/package.py
Normal file
@ -0,0 +1,26 @@
|
||||
from spack import *
|
||||
|
||||
class Openjpeg(Package):
|
||||
"""
|
||||
OpenJPEG is an open-source JPEG 2000 codec written in C language.
|
||||
It has been developed in order to promote the use of JPEG 2000, a
|
||||
still-image compression standard from the Joint Photographic
|
||||
Experts Group (JPEG).
|
||||
Since April 2015, it is officially recognized by ISO/IEC and
|
||||
ITU-T as a JPEG 2000 Reference Software.
|
||||
"""
|
||||
homepage = "https://github.com/uclouvain/openjpeg"
|
||||
url = "https://github.com/uclouvain/openjpeg/archive/version.2.1.tar.gz"
|
||||
|
||||
version('2.1' , '3e1c451c087f8462955426da38aa3b3d')
|
||||
version('2.0.1', '105876ed43ff7dbb2f90b41b5a43cfa5')
|
||||
version('2.0' , 'cdf266530fee8af87454f15feb619609')
|
||||
version('1.5.2', '545f98923430369a6b046ef3632ef95c')
|
||||
version('1.5.1', 'd774e4b5a0db5f0f171c4fc0aabfa14e')
|
||||
|
||||
|
||||
def install(self, spec, prefix):
|
||||
cmake('.', *std_cmake_args)
|
||||
|
||||
make()
|
||||
make("install")
|
@ -41,12 +41,13 @@ class Openmpi(Package):
|
||||
def url_for_version(self, version):
|
||||
return "http://www.open-mpi.org/software/ompi/v%s/downloads/openmpi-%s.tar.bz2" % (version.up_to(2), version)
|
||||
|
||||
def setup_dependent_environment(self, module, spec, dep_spec):
|
||||
"""For dependencies, make mpicc's use spack wrapper."""
|
||||
os.environ['OMPI_CC'] = 'cc'
|
||||
os.environ['OMPI_CXX'] = 'c++'
|
||||
os.environ['OMPI_FC'] = 'f90'
|
||||
os.environ['OMPI_F77'] = 'f77'
|
||||
|
||||
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
|
||||
spack_env.set('OMPI_CC', spack_cc)
|
||||
spack_env.set('OMPI_CXX', spack_cxx)
|
||||
spack_env.set('OMPI_FC', spack_fc)
|
||||
spack_env.set('OMPI_F77', spack_f77)
|
||||
|
||||
|
||||
def install(self, spec, prefix):
|
||||
config_args = ["--prefix=%s" % prefix,
|
||||
|
34
var/spack/repos/builtin/packages/p4est/package.py
Normal file
34
var/spack/repos/builtin/packages/p4est/package.py
Normal file
@ -0,0 +1,34 @@
|
||||
from spack import *
|
||||
|
||||
class P4est(Package):
|
||||
"""Dynamic management of a collection (a forest) of adaptive octrees in parallel"""
|
||||
homepage = "http://www.p4est.org"
|
||||
url = "http://p4est.github.io/release/p4est-1.1.tar.gz"
|
||||
|
||||
version('1.1', '37ba7f4410958cfb38a2140339dbf64f')
|
||||
|
||||
# disable by default to make it work on frontend of clusters
|
||||
variant('tests', default=False, description='Run small tests')
|
||||
|
||||
depends_on('mpi')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
options = ['--enable-mpi',
|
||||
'--enable-shared',
|
||||
'--disable-vtk-binary',
|
||||
'--without-blas',
|
||||
'CPPFLAGS=-DSC_LOG_PRIORITY=SC_LP_ESSENTIAL',
|
||||
'CFLAGS=-O2',
|
||||
'CC=%s' % join_path(self.spec['mpi'].prefix.bin, 'mpicc'), # TODO: use ENV variables or MPI class wrappers
|
||||
'CXX=%s' % join_path(self.spec['mpi'].prefix.bin, 'mpic++'),
|
||||
'FC=%s' % join_path(self.spec['mpi'].prefix.bin, 'mpif90'),
|
||||
'F77=%s' % join_path(self.spec['mpi'].prefix.bin, 'mpif77'),
|
||||
]
|
||||
|
||||
configure('--prefix=%s' % prefix, *options)
|
||||
|
||||
make()
|
||||
if '+tests' in self.spec:
|
||||
make("check")
|
||||
|
||||
make("install")
|
@ -16,9 +16,9 @@ class Paraview(Package):
|
||||
|
||||
variant('osmesa', default=False, description='Enable OSMesa support')
|
||||
variant('qt', default=False, description='Enable Qt support')
|
||||
variant('opengl2', default=False, description='Enable OPengl2 backend')
|
||||
variant('opengl2', default=False, description='Enable OpenGL2 backend')
|
||||
|
||||
depends_on('python', when='+python')
|
||||
depends_on('python@2:2.7', when='+python')
|
||||
depends_on('py-numpy', when='+python')
|
||||
depends_on('py-matplotlib', when='+python')
|
||||
depends_on('tcl', when='+tcl')
|
||||
|
@ -0,0 +1,71 @@
|
||||
diff --git a/CMakeLists.txt b/CMakeLists.txt
|
||||
index ca945dd..aff8b5f 100644
|
||||
--- a/CMakeLists.txt
|
||||
+++ b/CMakeLists.txt
|
||||
@@ -23,7 +23,7 @@ else()
|
||||
set(ParMETIS_LIBRARY_TYPE STATIC)
|
||||
endif()
|
||||
|
||||
-include(${GKLIB_PATH}/GKlibSystem.cmake)
|
||||
+include_directories(${GKLIB_PATH})
|
||||
|
||||
# List of paths that the compiler will search for header files.
|
||||
# i.e., the -I equivalent
|
||||
@@ -33,7 +33,7 @@ include_directories(${GKLIB_PATH})
|
||||
include_directories(${METIS_PATH}/include)
|
||||
|
||||
# List of directories that cmake will look for CMakeLists.txt
|
||||
-add_subdirectory(${METIS_PATH}/libmetis ${CMAKE_BINARY_DIR}/libmetis)
|
||||
+find_library(METIS_LIBRARY metis PATHS ${METIS_PATH}/lib)
|
||||
add_subdirectory(include)
|
||||
add_subdirectory(libparmetis)
|
||||
add_subdirectory(programs)
|
||||
diff --git a/libparmetis/CMakeLists.txt b/libparmetis/CMakeLists.txt
|
||||
index 9cfc8a7..e0c4de7 100644
|
||||
--- a/libparmetis/CMakeLists.txt
|
||||
+++ b/libparmetis/CMakeLists.txt
|
||||
@@ -5,7 +5,10 @@ file(GLOB parmetis_sources *.c)
|
||||
# Create libparmetis
|
||||
add_library(parmetis ${ParMETIS_LIBRARY_TYPE} ${parmetis_sources})
|
||||
# Link with metis and MPI libraries.
|
||||
-target_link_libraries(parmetis metis ${MPI_LIBRARIES})
|
||||
+target_link_libraries(parmetis ${METIS_LIBRARY} ${MPI_LIBRARIES})
|
||||
+if(UNIX)
|
||||
+ target_link_libraries(parmetis m)
|
||||
+endif()
|
||||
set_target_properties(parmetis PROPERTIES LINK_FLAGS "${MPI_LINK_FLAGS}")
|
||||
|
||||
install(TARGETS parmetis
|
||||
diff --git a/libparmetis/parmetislib.h b/libparmetis/parmetislib.h
|
||||
index c1daeeb..07511f6 100644
|
||||
--- a/libparmetis/parmetislib.h
|
||||
+++ b/libparmetis/parmetislib.h
|
||||
@@ -20,13 +20,12 @@
|
||||
|
||||
#include <parmetis.h>
|
||||
|
||||
-#include "../metis/libmetis/gklib_defs.h"
|
||||
+#include <gklib_defs.h>
|
||||
|
||||
-#include <mpi.h>
|
||||
+#include <mpi.h>
|
||||
|
||||
#include <rename.h>
|
||||
#include <defs.h>
|
||||
#include <struct.h>
|
||||
#include <macros.h>
|
||||
#include <proto.h>
|
||||
-
|
||||
diff --git a/programs/parmetisbin.h b/programs/parmetisbin.h
|
||||
index e26cd2d..d156480 100644
|
||||
--- a/programs/parmetisbin.h
|
||||
+++ b/programs/parmetisbin.h
|
||||
@@ -19,7 +19,7 @@
|
||||
#include <GKlib.h>
|
||||
#include <parmetis.h>
|
||||
|
||||
-#include "../metis/libmetis/gklib_defs.h"
|
||||
+#include <gklib_defs.h>
|
||||
#include "../libparmetis/rename.h"
|
||||
#include "../libparmetis/defs.h"
|
||||
#include "../libparmetis/struct.h"
|
@ -24,10 +24,7 @@
|
||||
##############################################################################
|
||||
|
||||
from spack import *
|
||||
|
||||
# FIXME : lot of code is duplicated from packages/metis/package.py . Inheriting from there may reduce
|
||||
# FIXME : the installation rules to just a few lines
|
||||
|
||||
import sys
|
||||
|
||||
class Parmetis(Package):
|
||||
"""
|
||||
@ -43,13 +40,17 @@ class Parmetis(Package):
|
||||
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('double', default=False, description='Use double precision floating point types')
|
||||
|
||||
depends_on('cmake @2.8:') # build dependency
|
||||
depends_on('mpi')
|
||||
|
||||
# FIXME : this should conflict with metis as it builds its own version internally
|
||||
patch('enable_external_metis.patch')
|
||||
depends_on('metis')
|
||||
|
||||
# bug fixes from PETSc developers
|
||||
# https://bitbucket.org/petsc/pkg-parmetis/commits/1c1a9fd0f408dc4d42c57f5c3ee6ace411eb222b/raw/
|
||||
patch('pkg-parmetis-1c1a9fd0f408dc4d42c57f5c3ee6ace411eb222b.patch')
|
||||
# https://bitbucket.org/petsc/pkg-parmetis/commits/82409d68aa1d6cbc70740d0f35024aae17f7d5cb/raw/
|
||||
patch('pkg-parmetis-82409d68aa1d6cbc70740d0f35024aae17f7d5cb.patch')
|
||||
|
||||
depends_on('gdb', when='+gdb')
|
||||
|
||||
@ -63,8 +64,8 @@ def install(self, spec, prefix):
|
||||
|
||||
# FIXME : Once a contract is defined, MPI compilers should be retrieved indirectly via spec['mpi'] in case
|
||||
# FIXME : they use a non-standard name
|
||||
options.extend(['-DGKLIB_PATH:PATH={metis_source}/GKlib'.format(metis_source=metis_source),
|
||||
'-DMETIS_PATH:PATH={metis_source}'.format(metis_source=metis_source),
|
||||
options.extend(['-DGKLIB_PATH:PATH={metis_source}/GKlib'.format(metis_source=spec['metis'].prefix.include),
|
||||
'-DMETIS_PATH:PATH={metis_source}'.format(metis_source=spec['metis'].prefix),
|
||||
'-DCMAKE_C_COMPILER:STRING=mpicc',
|
||||
'-DCMAKE_CXX_COMPILER:STRING=mpicxx'])
|
||||
|
||||
@ -78,18 +79,11 @@ def install(self, spec, prefix):
|
||||
if '+gdb' in spec:
|
||||
options.append('-DGDB:BOOL=ON')
|
||||
|
||||
metis_header = join_path(metis_source, 'include', 'metis.h')
|
||||
|
||||
if '+idx64' in spec:
|
||||
filter_file('IDXTYPEWIDTH 32', 'IDXTYPEWIDTH 64', metis_header)
|
||||
|
||||
if '+double' in spec:
|
||||
filter_file('REALTYPEWIDTH 32', 'REALTYPEWIDTH 64', metis_header)
|
||||
|
||||
with working_dir(build_directory, create=True):
|
||||
cmake(source_directory, *options)
|
||||
make()
|
||||
make("install")
|
||||
# Parmetis build system doesn't allow for an external metis to be used, but doesn't copy the required
|
||||
# metis header either
|
||||
install(metis_header, self.prefix.include)
|
||||
|
||||
# The shared library is not installed correctly on Darwin; correct this
|
||||
if (sys.platform == 'darwin') and ('+shared' in spec):
|
||||
fix_darwin_install_name(prefix.lib)
|
||||
|
@ -0,0 +1,77 @@
|
||||
From 1c1a9fd0f408dc4d42c57f5c3ee6ace411eb222b Mon Sep 17 00:00:00 2001
|
||||
From: Jed Brown <jed@59A2.org>
|
||||
Date: Fri, 12 Oct 2012 15:45:10 -0500
|
||||
Subject: [PATCH] ParMetis bug fixes reported by John Fettig [petsc-maint
|
||||
#133631]
|
||||
|
||||
'''
|
||||
I have also reported to to Karypis but have received zero
|
||||
response and he hasn't released any updates to the original release
|
||||
either. At least he approved my forum posting so that other people
|
||||
can see the bug and the fix.
|
||||
http://glaros.dtc.umn.edu/gkhome/node/837
|
||||
'''
|
||||
|
||||
Hg-commit: 1c2b9fe39201d404b493885093b5992028b9b8d4
|
||||
---
|
||||
libparmetis/xyzpart.c | 12 ++++++------
|
||||
1 file changed, 6 insertions(+), 6 deletions(-)
|
||||
|
||||
diff --git a/libparmetis/xyzpart.c b/libparmetis/xyzpart.c
|
||||
index 3a2c289..63abfcb 100644
|
||||
--- a/libparmetis/xyzpart.c
|
||||
+++ b/libparmetis/xyzpart.c
|
||||
@@ -104,7 +104,7 @@ void IRBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
|
||||
|
||||
for (i=0; i<nbins; i++)
|
||||
emarkers[i] = gmin + (gmax-gmin)*i/nbins;
|
||||
- emarkers[nbins] = gmax*(1.0+2.0*REAL_EPSILON);
|
||||
+ emarkers[nbins] = gmax*(1.0+copysign(1.0,gmax)*2.0*REAL_EPSILON);
|
||||
|
||||
/* get into a iterative backet boundary refinement */
|
||||
for (l=0; l<5; l++) {
|
||||
@@ -152,7 +152,7 @@ void IRBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
|
||||
}
|
||||
}
|
||||
nemarkers[0] = gmin;
|
||||
- nemarkers[nbins] = gmax*(1.0+2.0*REAL_EPSILON);
|
||||
+ nemarkers[nbins] = gmax*(1.0+copysign(1.0,gmax)*2.0*REAL_EPSILON);
|
||||
rcopy(nbins+1, nemarkers, emarkers);
|
||||
}
|
||||
|
||||
@@ -218,7 +218,7 @@ void RBBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
|
||||
|
||||
emarkers[0] = gmin;
|
||||
emarkers[1] = gsum/gnvtxs;
|
||||
- emarkers[2] = gmax*(1.0+2.0*REAL_EPSILON);
|
||||
+ emarkers[2] = gmax*(1.0+(gmax < 0 ? -1. : 1.)*2.0*REAL_EPSILON);
|
||||
cnbins = 2;
|
||||
|
||||
/* get into a iterative backet boundary refinement */
|
||||
@@ -227,7 +227,7 @@ void RBBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
|
||||
iset(cnbins, 0, lcounts);
|
||||
rset(cnbins, 0, lsums);
|
||||
for (j=0, i=0; i<nvtxs;) {
|
||||
- if (cand[i].key < emarkers[j+1]) {
|
||||
+ if (cand[i].key <= emarkers[j+1]) {
|
||||
lcounts[j]++;
|
||||
lsums[j] += cand[i].key;
|
||||
i++;
|
||||
@@ -272,12 +272,12 @@ void RBBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
|
||||
|
||||
rsorti(cnbins, nemarkers);
|
||||
rcopy(cnbins, nemarkers, emarkers);
|
||||
- emarkers[cnbins] = gmax*(1.0+2.0*REAL_EPSILON);
|
||||
+ emarkers[cnbins] = gmax*(1.0+(gmax < 0 ? -1. : 1.)*2.0*REAL_EPSILON);
|
||||
}
|
||||
|
||||
/* assign the coordinate to the appropriate bin */
|
||||
for (j=0, i=0; i<nvtxs;) {
|
||||
- if (cand[i].key < emarkers[j+1]) {
|
||||
+ if (cand[i].key <= emarkers[j+1]) {
|
||||
bxyz[cand[i].val*ndims+k] = j;
|
||||
i++;
|
||||
}
|
||||
--
|
||||
2.1.1.1.g1fb337f
|
||||
|
@ -0,0 +1,35 @@
|
||||
From 82409d68aa1d6cbc70740d0f35024aae17f7d5cb Mon Sep 17 00:00:00 2001
|
||||
From: Sean Farley <sean@mcs.anl.gov>
|
||||
Date: Tue, 20 Mar 2012 11:59:44 -0500
|
||||
Subject: [PATCH] parmetis: fix bug reported by jfettig; '<' to '<=' in xyzpart
|
||||
|
||||
Hg-commit: 2dd2eae596acaabbc80e0ef875182616f868dbc2
|
||||
---
|
||||
libparmetis/xyzpart.c | 4 ++--
|
||||
1 file changed, 2 insertions(+), 2 deletions(-)
|
||||
|
||||
diff --git a/libparmetis/xyzpart.c b/libparmetis/xyzpart.c
|
||||
index 307aed9..3a2c289 100644
|
||||
--- a/libparmetis/xyzpart.c
|
||||
+++ b/libparmetis/xyzpart.c
|
||||
@@ -111,7 +111,7 @@ void IRBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
|
||||
/* determine bucket counts */
|
||||
iset(nbins, 0, lcounts);
|
||||
for (j=0, i=0; i<nvtxs;) {
|
||||
- if (cand[i].key < emarkers[j+1]) {
|
||||
+ if (cand[i].key <= emarkers[j+1]) {
|
||||
lcounts[j]++;
|
||||
i++;
|
||||
}
|
||||
@@ -158,7 +158,7 @@ void IRBinCoordinates(ctrl_t *ctrl, graph_t *graph, idx_t ndims, real_t *xyz,
|
||||
|
||||
/* assign the coordinate to the appropriate bin */
|
||||
for (j=0, i=0; i<nvtxs;) {
|
||||
- if (cand[i].key < emarkers[j+1]) {
|
||||
+ if (cand[i].key <= emarkers[j+1]) {
|
||||
bxyz[cand[i].val*ndims+k] = j;
|
||||
i++;
|
||||
}
|
||||
--
|
||||
2.1.1.1.g1fb337f
|
||||
|
@ -20,11 +20,15 @@ class Petsc(Package):
|
||||
variant('shared', default=True, description='Enables the build of shared libraries')
|
||||
variant('mpi', default=True, description='Activates MPI support')
|
||||
variant('double', default=True, description='Switches between single and double precision')
|
||||
variant('complex', default=False, description='Build with complex numbers')
|
||||
variant('debug', default=False, description='Compile in debug mode')
|
||||
|
||||
variant('metis', default=True, description='Activates support for metis and parmetis')
|
||||
variant('hdf5', default=True, description='Activates support for HDF5 (only parallel)')
|
||||
variant('boost', default=True, description='Activates support for Boost')
|
||||
variant('hypre', default=True, description='Activates support for Hypre')
|
||||
variant('hypre', default=True, description='Activates support for Hypre (only parallel)')
|
||||
variant('mumps', default=True, description='Activates support for MUMPS (only parallel)')
|
||||
variant('superlu-dist', default=True, description='Activates support for SuperluDist (only parallel)')
|
||||
|
||||
# Virtual dependencies
|
||||
depends_on('blas')
|
||||
@ -40,7 +44,13 @@ class Petsc(Package):
|
||||
|
||||
depends_on('hdf5+mpi', when='+hdf5+mpi')
|
||||
depends_on('parmetis', when='+metis+mpi')
|
||||
depends_on('hypre', when='+hypre+mpi')
|
||||
# Hypre does not support complex numbers.
|
||||
# Also PETSc prefer to build it without internal superlu, likely due to conflict in headers
|
||||
# see https://bitbucket.org/petsc/petsc/src/90564b43f6b05485163c147b464b5d6d28cde3ef/config/BuildSystem/config/packages/hypre.py
|
||||
depends_on('hypre~internal-superlu', when='+hypre+mpi~complex')
|
||||
depends_on('superlu-dist', when='+superlu-dist+mpi')
|
||||
depends_on('mumps+mpi', when='+mumps+mpi')
|
||||
depends_on('scalapack', when='+mumps+mpi')
|
||||
|
||||
def mpi_dependent_options(self):
|
||||
if '~mpi' in self.spec:
|
||||
@ -55,7 +65,7 @@ def mpi_dependent_options(self):
|
||||
# If mpi is disabled (~mpi), it's an error to have any of these enabled.
|
||||
# This generates a list of any such errors.
|
||||
errors = [error_message_fmt.format(library=x)
|
||||
for x in ('hdf5', 'hypre', 'parmetis')
|
||||
for x in ('hdf5', 'hypre', 'parmetis','mumps','superlu-dist')
|
||||
if ('+'+x) in self.spec]
|
||||
if errors:
|
||||
errors = ['incompatible variants given'] + errors
|
||||
@ -68,15 +78,17 @@ def mpi_dependent_options(self):
|
||||
return compiler_opts
|
||||
|
||||
def install(self, spec, prefix):
|
||||
options = []
|
||||
options = ['--with-ssl=0']
|
||||
options.extend(self.mpi_dependent_options())
|
||||
options.extend([
|
||||
'--with-precision=%s' % ('double' if '+double' in spec else 'single'),
|
||||
'--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
|
||||
])
|
||||
# Activates library support if needed
|
||||
for library in ('metis', 'boost', 'hdf5', 'hypre', 'parmetis'):
|
||||
for library in ('metis', 'boost', 'hdf5', 'hypre', 'parmetis','mumps','scalapack'):
|
||||
options.append(
|
||||
'--with-{library}={value}'.format(library=library, value=('1' if library in spec else '0'))
|
||||
)
|
||||
@ -84,9 +96,24 @@ def install(self, spec, prefix):
|
||||
options.append(
|
||||
'--with-{library}-dir={path}'.format(library=library, path=spec[library].prefix)
|
||||
)
|
||||
# PETSc does not pick up SuperluDist from the dir as they look for superlu_dist_4.1.a
|
||||
if 'superlu-dist' in spec:
|
||||
options.extend([
|
||||
'--with-superlu_dist-include=%s' % spec['superlu-dist'].prefix.include,
|
||||
'--with-superlu_dist-lib=%s' % join_path(spec['superlu-dist'].prefix.lib, 'libsuperlu_dist.a'),
|
||||
'--with-superlu_dist=1'
|
||||
])
|
||||
else:
|
||||
options.append(
|
||||
'--with-superlu_dist=0'
|
||||
)
|
||||
|
||||
configure('--prefix=%s' % prefix, *options)
|
||||
|
||||
# PETSc has its own way of doing parallel make.
|
||||
make('MAKE_NP=%s' % make_jobs, parallel=False)
|
||||
make("install")
|
||||
|
||||
def setup_dependent_environment(self, spack_env, run_env, dependent_spec):
|
||||
# set up PETSC_DIR for everyone using PETSc package
|
||||
spack_env.set('PETSC_DIR', self.prefix)
|
||||
|
14
var/spack/repos/builtin/packages/py-bottleneck/package.py
Normal file
14
var/spack/repos/builtin/packages/py-bottleneck/package.py
Normal file
@ -0,0 +1,14 @@
|
||||
from spack import *
|
||||
|
||||
class PyBottleneck(Package):
|
||||
"""Bottleneck is a collection of fast NumPy array functions written in Cython."""
|
||||
homepage = "https://pypi.python.org/pypi/Bottleneck/1.0.0"
|
||||
url = "https://pypi.python.org/packages/source/B/Bottleneck/Bottleneck-1.0.0.tar.gz"
|
||||
|
||||
version('1.0.0', '380fa6f275bd24f27e7cf0e0d752f5d2')
|
||||
|
||||
extends('python', ignore=r'bin/f2py$')
|
||||
depends_on('py-numpy')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
python('setup.py', 'install', '--prefix=%s' % prefix)
|
@ -3,10 +3,14 @@
|
||||
class PyCython(Package):
|
||||
"""The Cython compiler for writing C extensions for the Python language."""
|
||||
homepage = "https://pypi.python.org/pypi/cython"
|
||||
url = "https://pypi.python.org/packages/source/C/Cython/cython-0.22.tar.gz"
|
||||
url = "https://pypi.python.org/packages/source/C/Cython/Cython-0.22.tar.gz"
|
||||
|
||||
version('0.21.2', 'd21adb870c75680dc857cd05d41046a4')
|
||||
version('0.23.5', '66b62989a67c55af016c916da36e7514')
|
||||
version('0.23.4', '157df1f69bcec6b56fd97e0f2e057f6e')
|
||||
|
||||
# These versions contain illegal Python3 code...
|
||||
version('0.22', '1ae25add4ef7b63ee9b4af697300d6b6')
|
||||
version('0.21.2', 'd21adb870c75680dc857cd05d41046a4')
|
||||
|
||||
extends('python')
|
||||
|
||||
|
@ -7,6 +7,7 @@ class PyDateutil(Package):
|
||||
|
||||
version('2.4.0', '75714163bb96bedd07685cdb2071b8bc')
|
||||
version('2.4.2', '4ef68e1c485b09e9f034e10473e5add2')
|
||||
version('2.5.2', 'eafe168e8f404bf384514f5116eedbb6')
|
||||
|
||||
extends('python')
|
||||
depends_on('py-setuptools')
|
||||
|
@ -1,15 +0,0 @@
|
||||
from spack import *
|
||||
|
||||
class PyLibxml2(Package):
|
||||
"""A Python wrapper around libxml2."""
|
||||
homepage = "https://xmlsoft.org/python.html"
|
||||
url = "ftp://xmlsoft.org/libxml2/python/libxml2-python-2.6.21.tar.gz"
|
||||
|
||||
version('2.6.21', '229dd2b3d110a77defeeaa73af83f7f3')
|
||||
|
||||
extends('python')
|
||||
depends_on('libxml2')
|
||||
depends_on('libxslt')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
python('setup.py', 'install', '--prefix=%s' % prefix)
|
@ -12,7 +12,7 @@ class PyMatplotlib(Package):
|
||||
variant('gui', default=False, description='Enable GUI')
|
||||
variant('ipython', default=False, description='Enable ipython support')
|
||||
|
||||
extends('python', ignore=r'bin/nosetests.*$|bin/pbr$')
|
||||
extends('python', ignore=r'bin/nosetests.*$|bin/pbr$|bin/f2py$')
|
||||
|
||||
depends_on('py-pyside', when='+gui')
|
||||
depends_on('py-ipython', when='+ipython')
|
||||
|
16
var/spack/repos/builtin/packages/py-netcdf/package.py
Normal file
16
var/spack/repos/builtin/packages/py-netcdf/package.py
Normal file
@ -0,0 +1,16 @@
|
||||
from spack import *
|
||||
|
||||
class PyNetcdf(Package):
|
||||
"""Python interface to the netCDF Library."""
|
||||
homepage = "http://unidata.github.io/netcdf4-python"
|
||||
url = "https://github.com/Unidata/netcdf4-python/tarball/v1.2.3.1rel"
|
||||
|
||||
version('1.2.3.1', '4fc4320d4f2a77b894ebf8da1c9895af')
|
||||
|
||||
extends('python')
|
||||
depends_on('py-numpy')
|
||||
depends_on('py-cython')
|
||||
depends_on('netcdf')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
python('setup.py', 'install', '--prefix=%s' % prefix)
|
@ -1,5 +1,6 @@
|
||||
from spack import *
|
||||
|
||||
|
||||
class PyNose(Package):
|
||||
"""nose extends the test loading and running features of unittest,
|
||||
making it easier to write, find and run tests."""
|
||||
@ -9,6 +10,7 @@ class PyNose(Package):
|
||||
|
||||
version('1.3.4', '6ed7169887580ddc9a8e16048d38274d')
|
||||
version('1.3.6', '0ca546d81ca8309080fc80cb389e7a16')
|
||||
version('1.3.7', '4d3ad0ff07b61373d2cefc89c5d0b20b')
|
||||
|
||||
extends('python', ignore=r'bin/nosetests.*$')
|
||||
depends_on('py-setuptools')
|
||||
|
@ -7,8 +7,9 @@ class PyNumexpr(Package):
|
||||
url = "https://pypi.python.org/packages/source/n/numexpr/numexpr-2.4.6.tar.gz"
|
||||
|
||||
version('2.4.6', '17ac6fafc9ea1ce3eb970b9abccb4fbd')
|
||||
version('2.5', '84f66cced45ba3e30dcf77a937763aaa')
|
||||
|
||||
extends('python')
|
||||
extends('python', ignore=r'bin/f2py$')
|
||||
depends_on('py-numpy')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
|
@ -1,24 +1,44 @@
|
||||
from spack import *
|
||||
|
||||
class PyNumpy(Package):
|
||||
"""array processing for numbers, strings, records, and objects."""
|
||||
homepage = "https://pypi.python.org/pypi/numpy"
|
||||
"""NumPy is the fundamental package for scientific computing with Python.
|
||||
It contains among other things: a powerful N-dimensional array object,
|
||||
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.9.1', '78842b73560ec378142665e712ae4ad9')
|
||||
version('1.11.0', 'bc56fb9fc2895aa4961802ffbdb31d0b')
|
||||
version('1.10.4', 'aed294de0aa1ac7bd3f9745f4f1968ad')
|
||||
version('1.9.2', 'a1ed53432dbcd256398898d35bc8e645')
|
||||
version('1.9.1', '78842b73560ec378142665e712ae4ad9')
|
||||
|
||||
|
||||
variant('blas', default=True)
|
||||
variant('lapack', default=True)
|
||||
|
||||
extends('python')
|
||||
depends_on('py-nose')
|
||||
depends_on('netlib-blas+fpic', when='+blas')
|
||||
depends_on('netlib-lapack+shared', when='+blas')
|
||||
depends_on('blas', when='+blas')
|
||||
depends_on('lapack', when='+lapack')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
libraries = []
|
||||
library_dirs = []
|
||||
|
||||
if '+blas' in spec:
|
||||
libraries.append('blas')
|
||||
library_dirs.append(spec['blas'].prefix.lib)
|
||||
if '+lapack' in spec:
|
||||
libraries.append('lapack')
|
||||
library_dirs.append(spec['lapack'].prefix.lib)
|
||||
|
||||
if '+blas' in spec or '+lapack' in spec:
|
||||
with open('site.cfg', 'w') as f:
|
||||
f.write('[DEFAULT]\n')
|
||||
f.write('libraries=lapack,blas\n')
|
||||
f.write('library_dirs=%s/lib:%s/lib\n' % (spec['blas'].prefix, spec['lapack'].prefix))
|
||||
f.write('libraries=%s\n' % ','.join(libraries))
|
||||
f.write('library_dirs=%s\n' % ':'.join(library_dirs))
|
||||
|
||||
python('setup.py', 'install', '--prefix=%s' % prefix)
|
||||
|
||||
|
@ -8,18 +8,15 @@ class PyPandas(Package):
|
||||
|
||||
version('0.16.0', 'bfe311f05dc0c351f8955fbd1e296e73')
|
||||
version('0.16.1', 'fac4f25748f9610a3e00e765474bdea8')
|
||||
version('0.18.0', 'f143762cd7a59815e348adf4308d2cf6')
|
||||
|
||||
extends('python')
|
||||
extends('python', ignore=r'bin/f2py$')
|
||||
depends_on('py-dateutil')
|
||||
depends_on('py-numpy')
|
||||
depends_on('py-matplotlib')
|
||||
depends_on('py-scipy')
|
||||
depends_on('py-setuptools')
|
||||
depends_on('py-pytz')
|
||||
depends_on('libdrm')
|
||||
depends_on('libpciaccess')
|
||||
depends_on('llvm')
|
||||
depends_on('mesa')
|
||||
depends_on('py-numexpr')
|
||||
depends_on('py-bottleneck')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
python('setup.py', 'install', '--prefix=%s' % prefix)
|
||||
|
@ -7,6 +7,7 @@ class PyPytz(Package):
|
||||
|
||||
version('2014.10', 'eb1cb941a20c5b751352c52486aa1dd7')
|
||||
version('2015.4', '417a47b1c432d90333e42084a605d3d8')
|
||||
version('2016.3', 'abae92c3301b27bd8a9f56b14f52cb29')
|
||||
|
||||
extends('python')
|
||||
|
||||
|
@ -2,17 +2,24 @@
|
||||
|
||||
class PyScipy(Package):
|
||||
"""Scientific Library for Python."""
|
||||
homepage = "https://pypi.python.org/pypi/scipy"
|
||||
homepage = "http://www.scipy.org/"
|
||||
url = "https://pypi.python.org/packages/source/s/scipy/scipy-0.15.0.tar.gz"
|
||||
|
||||
version('0.15.0', '639112f077f0aeb6d80718dc5019dc7a')
|
||||
version('0.17.0', '5ff2971e1ce90e762c59d2cd84837224')
|
||||
version('0.15.1', 'be56cd8e60591d6332aac792a5880110')
|
||||
version('0.15.0', '639112f077f0aeb6d80718dc5019dc7a')
|
||||
|
||||
extends('python')
|
||||
depends_on('py-nose')
|
||||
depends_on('py-numpy')
|
||||
depends_on('blas')
|
||||
depends_on('lapack')
|
||||
depends_on('py-numpy+blas+lapack')
|
||||
|
||||
def install(self, spec, prefix):
|
||||
if 'atlas' in spec:
|
||||
# libatlas.so actually isn't always installed, but this
|
||||
# seems to make the build autodetect things correctly.
|
||||
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
|
||||
|
||||
python('setup.py', 'install', '--prefix=%s' % prefix)
|
||||
|
@ -9,6 +9,7 @@ class PySetuptools(Package):
|
||||
version('16.0', '0ace0b96233516fc5f7c857d086aa3ad')
|
||||
version('18.1', 'f72e87f34fbf07f299f6cb46256a0b06')
|
||||
version('19.2', '78353b1f80375ca5e088f4b4627ffe03')
|
||||
version('20.5', 'fadc1e1123ddbe31006e5e43e927362b')
|
||||
|
||||
extends('python')
|
||||
|
||||
|
@ -6,6 +6,7 @@ class PySix(Package):
|
||||
url = "https://pypi.python.org/packages/source/s/six/six-1.9.0.tar.gz"
|
||||
|
||||
version('1.9.0', '476881ef4012262dfc8adc645ee786c4')
|
||||
version('1.10.0', '34eed507548117b2ab523ab14b2f8b55')
|
||||
|
||||
extends('python')
|
||||
depends_on('py-setuptools')
|
||||
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue
Block a user