summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/spack/spack/build_environment.py52
-rw-r--r--lib/spack/spack/package.py2
-rw-r--r--var/spack/repos/builtin/packages/arpack-ng/package.py4
-rw-r--r--var/spack/repos/builtin/packages/arpack-ng/pdlamch10.patch15
-rw-r--r--var/spack/repos/builtin/packages/mpich/package.py2
-rw-r--r--var/spack/repos/builtin/packages/netlib-lapack/package.py7
-rw-r--r--var/spack/repos/builtin/packages/netlib-scalapack/package.py22
7 files changed, 74 insertions, 30 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py
index fc5b7d6207..119a255a34 100644
--- a/lib/spack/spack/build_environment.py
+++ b/lib/spack/spack/build_environment.py
@@ -225,7 +225,7 @@ def set_module_variables_for_package(pkg, module):
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
@@ -270,32 +270,56 @@ def parent_class_modules(cls):
return result
+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.
+ spkg = spec.package
+ modules = parent_class_modules(spkg.__class__)
+ for mod in modules:
+ set_module_variables_for_package(spkg, mod)
+ set_module_variables_for_package(spkg, spkg.module)
+
+
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)
-
- # 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__)
- for mod in modules:
- set_module_variables_for_package(pkg, mod)
+ setup_module_variables_for_dag(pkg)
# Allow dependencies to modify the module
- for dependency_spec in pkg.spec.traverse(root=False):
+ spec = pkg.spec
+ for dependency_spec in spec.traverse(root=False):
dpkg = dependency_spec.package
- dpkg.setup_dependent_python_module(pkg.module, pkg.spec)
+ dpkg.setup_dependent_package(pkg.module, spec)
# Allow dependencies to set up environment as well
- for dependency_spec in pkg.spec.traverse(root=False):
+ for dependency_spec in spec.traverse(root=False):
dpkg = dependency_spec.package
- dpkg.setup_dependent_environment(spack_env, run_env, pkg.spec)
+ dpkg.setup_dependent_environment(spack_env, run_env, spec)
# Allow the package to apply some settings.
pkg.setup_environment(spack_env, run_env)
diff --git a/lib/spack/spack/package.py b/lib/spack/spack/package.py
index 9d8ac87bd7..9af3221837 100644
--- a/lib/spack/spack/package.py
+++ b/lib/spack/spack/package.py
@@ -1075,7 +1075,7 @@ class Package(object):
self.setup_environment(spack_env, run_env)
- def setup_dependent_python_module(self, module, dependent_spec):
+ def setup_dependent_package(self, module, dependent_spec):
"""Set up Python module-scope variables for dependent packages.
Called before the install() method of dependents.
diff --git a/var/spack/repos/builtin/packages/arpack-ng/package.py b/var/spack/repos/builtin/packages/arpack-ng/package.py
index 0b49d14202..614071cf53 100644
--- a/var/spack/repos/builtin/packages/arpack-ng/package.py
+++ b/var/spack/repos/builtin/packages/arpack-ng/package.py
@@ -35,6 +35,10 @@ 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('mpi', when='+mpi')
diff --git a/var/spack/repos/builtin/packages/arpack-ng/pdlamch10.patch b/var/spack/repos/builtin/packages/arpack-ng/pdlamch10.patch
new file mode 100644
index 0000000000..922828909f
--- /dev/null
+++ b/var/spack/repos/builtin/packages/arpack-ng/pdlamch10.patch
@@ -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
diff --git a/var/spack/repos/builtin/packages/mpich/package.py b/var/spack/repos/builtin/packages/mpich/package.py
index c4d9940bb7..b20dc8dd60 100644
--- a/var/spack/repos/builtin/packages/mpich/package.py
+++ b/var/spack/repos/builtin/packages/mpich/package.py
@@ -54,7 +54,7 @@ class Mpich(Package):
env.set('MPICH_F90', spack_f90)
env.set('MPICH_FC', spack_fc)
- def setup_dependent_python_module(self, module, spec, dep_spec):
+ 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')
diff --git a/var/spack/repos/builtin/packages/netlib-lapack/package.py b/var/spack/repos/builtin/packages/netlib-lapack/package.py
index 741f4af421..78c5a053fe 100644
--- a/var/spack/repos/builtin/packages/netlib-lapack/package.py
+++ b/var/spack/repos/builtin/packages/netlib-lapack/package.py
@@ -20,13 +20,13 @@ class NetlibLapack(Package):
version('3.3.1', 'd0d533ec9a5b74933c2a1e84eedc58b4')
variant('shared', default=False, description="Build shared library version")
+ variant('fpic', default=False, description="Build with -fpic compiler option")
# virtual dependency
provides('lapack')
# blas is a virtual dependency.
depends_on('blas')
-
depends_on('cmake')
# Doesn't always build correctly in parallel
@@ -37,24 +37,23 @@ class NetlibLapack(Package):
blas = self.spec['netlib-blas']
return [join_path(blas.prefix.lib, 'blas.a')]
-
@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 install(self, spec, prefix):
blas_libs = ";".join(self.get_blas_libs())
cmake_args = [".", '-DBLAS_LIBRARIES=' + blas_libs]
if '+shared' in spec:
cmake_args.append('-DBUILD_SHARED_LIBS=ON')
+ if '+fpic' in spec:
+ cmake_args.append('-DCMAKE_POSITION_INDEPENDENT_CODE=ON')
cmake_args += std_cmake_args
cmake(*cmake_args)
make()
make("install")
-
diff --git a/var/spack/repos/builtin/packages/netlib-scalapack/package.py b/var/spack/repos/builtin/packages/netlib-scalapack/package.py
index 62abfcc48e..c3e6822cdf 100644
--- a/var/spack/repos/builtin/packages/netlib-scalapack/package.py
+++ b/var/spack/repos/builtin/packages/netlib-scalapack/package.py
@@ -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"""
@@ -11,16 +12,16 @@ class NetlibScalapack(Package):
version('2.0.0', '9e76ae7b291be27faaad47cfc256cbfe')
# versions before 2.0.0 are not using cmake and requires blacs as
# a separated package
-
+
variant('shared', default=True, description='Build the shared library version')
variant('fpic', default=False, description="Build with -fpic compiler option")
-
+
provides('scalapack')
-
+
depends_on('mpi')
depends_on('lapack')
-
- def install(self, spec, prefix):
+
+ def install(self, spec, prefix):
options = [
"-DBUILD_SHARED_LIBS:BOOL=%s" % ('ON' if '+shared' in spec else 'OFF'),
"-DBUILD_STATIC_LIBS:BOOL=%s" % ('OFF' if '+shared' in spec else 'ON'),
@@ -40,10 +41,11 @@ class NetlibScalapack(Package):
make()
make("install")
- def setup_dependent_python_module(self, module, spec, dependent_spec):
+ 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['scalapack'] else '.a'
+ lib_suffix = lib_dsuffix if '+shared' in spec else '.a'
- 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)]
+ 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)]