diff options
author | scheibelp <scheibel1@llnl.gov> | 2016-11-09 08:00:34 -0800 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2016-11-09 08:00:34 -0800 |
commit | bece9aca84061ef82b61f20ed2b00dbb65275b1c (patch) | |
tree | 0094d30902eb28a760cae67af09d99283b4d37d4 /lib/spack/spack/build_environment.py | |
parent | 2e11e7e456668f81392b12be124d8280b511a7a4 (diff) | |
download | spack-bece9aca84061ef82b61f20ed2b00dbb65275b1c.tar.gz spack-bece9aca84061ef82b61f20ed2b00dbb65275b1c.tar.bz2 spack-bece9aca84061ef82b61f20ed2b00dbb65275b1c.tar.xz spack-bece9aca84061ef82b61f20ed2b00dbb65275b1c.zip |
Allow compiler wrapper to modify environment (#2275)
* Allow compiler wrapper to modify environment
This adds the ability to set environment variables in the compiler
wrappers. These are specified as part of the compilers.yaml config.
The user may also specify RPATHs in compilers.yaml that should be
added.
* Minor doc tweak
Diffstat (limited to 'lib/spack/spack/build_environment.py')
-rw-r--r-- | lib/spack/spack/build_environment.py | 17 |
1 files changed, 17 insertions, 0 deletions
diff --git a/lib/spack/spack/build_environment.py b/lib/spack/spack/build_environment.py index 1e6c473efd..49df7a90b4 100644 --- a/lib/spack/spack/build_environment.py +++ b/lib/spack/spack/build_environment.py @@ -302,6 +302,23 @@ def set_build_environment_variables(pkg, env, dirty=False): if '/macports/' in p: env.remove_path('PATH', p) + # Set environment variables if specified for + # the given compiler + compiler = pkg.compiler + environment = compiler.environment + if 'set' in environment: + env_to_set = environment['set'] + for key, value in env_to_set.iteritems(): + env.set('SPACK_ENV_SET_%s' % key, value) + env.set('%s' % key, value) + # Let shell know which variables to set + env_variables = ":".join(env_to_set.keys()) + env.set('SPACK_ENV_TO_SET', env_variables) + + if compiler.extra_rpaths: + extra_rpaths = ':'.join(compiler.extra_rpaths) + env.set('SPACK_COMPILER_EXTRA_RPATHS', extra_rpaths) + # Add bin directories from dependencies to the PATH for the build. bin_dirs = reversed(filter(os.path.isdir, [ '%s/bin' % d.prefix for d in pkg.spec.dependencies(deptype='build')])) |