Merge pull request #1186 from epfl-scitas/features/install_with_phases

do_install : allow for an arbitrary number of phases
This commit is contained in:
Todd Gamblin
2016-10-24 17:13:49 -07:00
committed by GitHub
26 changed files with 1248 additions and 678 deletions

View File

@@ -25,28 +25,24 @@
from spack import *
class Astyle(Package):
class Astyle(MakefilePackage):
"""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"
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):
parallel = False
with working_dir('src'):
# we need to edit the makefile in place to set compiler:
make_file = join_path(self.stage.source_path,
'build', 'gcc', 'Makefile')
filter_file(r'^CXX\s*=.*', 'CXX=%s' % spack_cxx, make_file)
def build_directory(self):
return join_path(self.stage.source_path, 'build', self.compiler.name)
make('-f',
make_file,
parallel=False)
def edit(self, spec, prefix):
makefile = join_path(self.build_directory(), 'Makefile')
filter_file(r'^CXX\s*=.*', 'CXX=%s' % spack_cxx, makefile)
mkdirp(self.prefix.bin)
install(join_path(self.stage.source_path, 'src', 'bin', 'astyle'),
self.prefix.bin)
def install_args(self):
return ['prefix={0}'.format(prefix)]

View File

@@ -25,10 +25,8 @@
from spack import *
class Autoconf(Package):
"""
Autoconf -- system configuration part of autotools
"""
class Autoconf(AutotoolsPackage):
"""Autoconf -- system configuration part of autotools"""
homepage = 'https://www.gnu.org/software/autoconf/'
url = 'http://ftp.gnu.org/gnu/autoconf/autoconf-2.69.tar.gz'
@@ -54,8 +52,3 @@ def setup_dependent_package(self, module, dependent_spec):
'ifnames']
for name in executables:
setattr(module, name, self._make_executable(name))
def install(self, spec, prefix):
configure("--prefix=%s" % prefix)
make()
make("install")

View File

@@ -25,16 +25,9 @@
from spack import *
class Blitz(Package):
class Blitz(AutotoolsPackage):
"""N-dimensional arrays for C++"""
homepage = "http://github.com/blitzpp/blitz"
url = "https://github.com/blitzpp/blitz/tarball/1.0.0"
url = "https://github.com/blitzpp/blitz/tarball/1.0.0"
version('1.0.0', '9f040b9827fe22228a892603671a77af')
# No dependencies
def install(self, spec, prefix):
configure('--prefix=%s' % prefix)
make()
make("install")

View File

@@ -25,12 +25,12 @@
from spack import *
class Gmp(Package):
"""GMP is a free library for arbitrary precision arithmetic, operating
on signed integers, rational numbers, and floating-point numbers."""
class Gmp(AutotoolsPackage):
"""GMP is a free library for arbitrary precision arithmetic,
operating on signed integers, rational numbers, and
floating-point numbers."""
homepage = "https://gmplib.org"
url = "https://gmplib.org/download/gmp/gmp-6.0.0a.tar.bz2"
url = "https://gmplib.org/download/gmp/gmp-6.0.0a.tar.bz2"
version('6.1.1', '4c175f86e11eb32d8bf9872ca3a8e11d')
version('6.1.0', '86ee6e54ebfc4a90b643a65e402c4048')
@@ -39,16 +39,10 @@ class Gmp(Package):
depends_on('m4', type='build')
def install(self, spec, prefix):
config_args = ['--prefix=' + prefix,
'--enable-cxx']
def configure_args(self):
args = ['--enable-cxx']
# We need this flag if we want all the following checks to pass.
if spec.compiler.name == 'intel':
config_args.append('CXXFLAGS=-no-ftz')
args.append('CXXFLAGS=-no-ftz')
configure(*config_args)
make()
make('check')
make('install')
return args

View File

@@ -27,10 +27,10 @@
import shutil
class Hdf5(Package):
class Hdf5(AutotoolsPackage):
"""HDF5 is a data model, library, and file format for storing and managing
data. It supports an unlimited variety of datatypes, and is designed for
flexible and efficient I/O and for high volume and complex data.
data. It supports an unlimited variety of datatypes, and is designed for
flexible and efficient I/O and for high volume and complex data.
"""
homepage = "http://www.hdfgroup.org/HDF5/"
@@ -58,17 +58,19 @@ class Hdf5(Package):
variant('threadsafe', default=False,
description='Enable thread-safe capabilities')
depends_on("mpi", when='+mpi')
depends_on("szip", when='+szip')
depends_on("zlib@1.1.2:")
depends_on('mpi', when='+mpi')
depends_on('szip', when='+szip')
depends_on('zlib@1.1.2:')
def validate(self, spec):
@AutotoolsPackage.precondition('configure')
def validate(self):
"""
Checks if incompatible variants have been activated at the same time
:param spec: spec of the package
:raises RuntimeError: in case of inconsistencies
"""
spec = self.spec
if '+fortran' in spec and not self.compiler.fc:
msg = 'cannot build a fortran variant without a fortran compiler'
raise RuntimeError(msg)
@@ -77,8 +79,8 @@ def validate(self, spec):
msg = 'cannot use variant +threadsafe with either +cxx or +fortran'
raise RuntimeError(msg)
def install(self, spec, prefix):
self.validate(spec)
def configure_args(self):
spec = self.spec
# Handle compilation after spec validation
extra_args = []
@@ -139,21 +141,13 @@ def install(self, spec, prefix):
'--disable-hl',
])
configure(
"--prefix=%s" % prefix,
"--with-zlib=%s" % spec['zlib'].prefix,
*extra_args)
make()
return ["--with-zlib=%s" % spec['zlib'].prefix] + extra_args
if self.run_tests:
make("check")
make("install")
self.check_install(spec)
def check_install(self, spec):
"Build and run a small program to test the installed HDF5 library"
print "Checking HDF5 installation..."
def check(self):
super(Hdf5, self).check()
# Build and run a small program to test the installed HDF5 library
spec = self.spec
print("Checking HDF5 installation...")
checkdir = "spack-check"
with working_dir(checkdir, create=True):
source = r"""
@@ -190,15 +184,15 @@ def check_install(self, spec):
output = ""
success = output == expected
if not success:
print "Produced output does not match expected output."
print "Expected output:"
print '-' * 80
print expected
print '-' * 80
print "Produced output:"
print '-' * 80
print output
print '-' * 80
print("Produced output does not match expected output.")
print("Expected output:")
print('-' * 80)
print(expected)
print('-' * 80)
print("Produced output:")
print('-' * 80)
print(output)
print('-' * 80)
raise RuntimeError("HDF5 install check failed")
shutil.rmtree(checkdir)

View File

@@ -43,7 +43,7 @@ class Ibmisc(CMakePackage):
depends_on('cmake', type='build')
depends_on('doxygen', type='build')
def configure_args(self):
def cmake_args(self):
spec = self.spec
return [
'-DUSE_EVERYTRACE=%s' % ('YES' if '+everytrace' in spec else 'NO'),

View File

@@ -25,7 +25,7 @@
from spack import *
class Lzo(Package):
class Lzo(AutotoolsPackage):
"""Real-time data compression library"""
homepage = 'https://www.oberhumer.com/opensource/lzo/'
@@ -37,15 +37,8 @@ class Lzo(Package):
version('2.06', '95380bd4081f85ef08c5209f4107e9f8')
version('2.05', 'c67cda5fa191bab761c7cb06fe091e36')
def install(self, spec, prefix):
configure_args = [
'--prefix={0}'.format(prefix),
def configure_args(self):
return [
'--disable-dependency-tracking',
'--enable-shared'
]
configure(*configure_args)
make()
if self.run_tests:
make('check')
make('test') # more exhaustive test
make('install')

View File

@@ -25,8 +25,9 @@
from spack import *
class Openjpeg(Package):
class Openjpeg(CMakePackage):
"""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).
@@ -35,7 +36,7 @@ class Openjpeg(Package):
"""
homepage = "https://github.com/uclouvain/openjpeg"
url = "https://github.com/uclouvain/openjpeg/archive/version.2.1.tar.gz"
url = "https://github.com/uclouvain/openjpeg/archive/version.2.1.tar.gz"
version('2.1', '3e1c451c087f8462955426da38aa3b3d')
version('2.0.1', '105876ed43ff7dbb2f90b41b5a43cfa5')
@@ -44,9 +45,3 @@ class Openjpeg(Package):
version('1.5.1', 'd774e4b5a0db5f0f171c4fc0aabfa14e')
depends_on('cmake', type='build')
def install(self, spec, prefix):
cmake('.', *std_cmake_args)
make()
make("install")

View File

@@ -25,7 +25,7 @@
from spack import *
class Qhull(Package):
class Qhull(CMakePackage):
"""Qhull computes the convex hull, Delaunay triangulation, Voronoi
diagram, halfspace intersection about a point, furt hest-site
Delaunay triangulation, and furthest-site Voronoi diagram. The
@@ -44,9 +44,3 @@ class Qhull(Package):
url="http://www.qhull.org/download/qhull-2012.1-src.tgz")
depends_on('cmake@2.6:', type='build')
def install(self, spec, prefix):
with working_dir('spack-build', create=True):
cmake('..', *std_cmake_args)
make()
make("install")

View File

@@ -26,7 +26,7 @@
import llnl.util.tty as tty
class Swiftsim(Package):
class Swiftsim(AutotoolsPackage):
"""SPH With Inter-dependent Fine-grained Tasking (SWIFT) provides
astrophysicists with a state of the art framework to perform
particle based simulations.
@@ -58,20 +58,15 @@ def setup_environment(self, spack_env, run_env):
tty.warn('This is needed to clone SWIFT repository')
spack_env.set('GIT_SSL_NO_VERIFY', 1)
def install(self, spec, prefix):
# Generate configure from configure.ac
# and Makefile.am
def autoreconf(self, spec, prefix):
libtoolize()
aclocal()
autoconf()
autogen = Executable('./autogen.sh')
autogen()
# Configure and install
options = ['--prefix=%s' % prefix,
'--enable-mpi' if '+mpi' in spec else '--disable-mpi',
'--with-metis={0}'.format(spec['metis'].prefix),
'--enable-optimization']
configure(*options)
make()
make("install")
def configure_args(self):
return ['--prefix=%s' % self.prefix,
'--enable-mpi' if '+mpi' in self.spec else '--disable-mpi',
'--with-metis={0}'.format(self.spec['metis'].prefix),
'--enable-optimization']

View File

@@ -25,24 +25,21 @@
from spack import *
class Szip(Package):
"""An implementation of the extended-Rice lossless compression algorithm.
It provides lossless compression of scientific data, and is provided
with HDF software products.
class Szip(AutotoolsPackage):
"""Szip is an implementation of the extended-Rice lossless
compression algorithm.
It provides lossless compression of scientific data, and is
provided with HDF software products.
"""
homepage = "https://www.hdfgroup.org/doc_resource/SZIP/"
url = "http://www.hdfgroup.org/ftp/lib-external/szip/2.1/src/szip-2.1.tar.gz"
url = "http://www.hdfgroup.org/ftp/lib-external/szip/2.1/src/szip-2.1.tar.gz"
version('2.1', '902f831bcefb69c6b635374424acbead')
def install(self, spec, prefix):
configure('--prefix=%s' % prefix,
'--enable-production',
'--enable-shared',
'--enable-static',
'--enable-encoding')
make()
make("install")
def configure_args(self):
return ['--enable-production',
'--enable-shared',
'--enable-static',
'--enable-encoding']