diff options
author | Todd Gamblin <tgamblin@llnl.gov> | 2013-02-18 23:46:04 -0800 |
---|---|---|
committer | Todd Gamblin <tgamblin@llnl.gov> | 2013-02-18 23:46:04 -0800 |
commit | 38becacacee43b40d02e33c97f0dc3bda83f42e6 (patch) | |
tree | 9bcb13e117f32414a86aea18cd82bc3f08d7f243 /lib/spack/env | |
parent | cc76c0f5f9f8021cfb7423a226bd431c00d791ce (diff) | |
download | spack-38becacacee43b40d02e33c97f0dc3bda83f42e6.tar.gz spack-38becacacee43b40d02e33c97f0dc3bda83f42e6.tar.bz2 spack-38becacacee43b40d02e33c97f0dc3bda83f42e6.tar.xz spack-38becacacee43b40d02e33c97f0dc3bda83f42e6.zip |
Dependencies now work. Added libelf, libdwarf.
Diffstat (limited to 'lib/spack/env')
l--------- | lib/spack/env/c++ | 1 | ||||
l--------- | lib/spack/env/c89 | 1 | ||||
l--------- | lib/spack/env/c99 | 1 | ||||
l--------- | lib/spack/env/case-insensitive/CC | 1 | ||||
-rwxr-xr-x | lib/spack/env/cc | 69 | ||||
l--------- | lib/spack/env/clang | 1 | ||||
l--------- | lib/spack/env/clang++ | 1 | ||||
l--------- | lib/spack/env/cpp | 1 | ||||
l--------- | lib/spack/env/g++ | 1 | ||||
l--------- | lib/spack/env/gcc | 1 | ||||
l--------- | lib/spack/env/ld | 1 |
11 files changed, 79 insertions, 0 deletions
diff --git a/lib/spack/env/c++ b/lib/spack/env/c++ new file mode 120000 index 0000000000..2652f5f42c --- /dev/null +++ b/lib/spack/env/c++ @@ -0,0 +1 @@ +cc
\ No newline at end of file diff --git a/lib/spack/env/c89 b/lib/spack/env/c89 new file mode 120000 index 0000000000..2652f5f42c --- /dev/null +++ b/lib/spack/env/c89 @@ -0,0 +1 @@ +cc
\ No newline at end of file diff --git a/lib/spack/env/c99 b/lib/spack/env/c99 new file mode 120000 index 0000000000..2652f5f42c --- /dev/null +++ b/lib/spack/env/c99 @@ -0,0 +1 @@ +cc
\ No newline at end of file diff --git a/lib/spack/env/case-insensitive/CC b/lib/spack/env/case-insensitive/CC new file mode 120000 index 0000000000..82c2b8e90a --- /dev/null +++ b/lib/spack/env/case-insensitive/CC @@ -0,0 +1 @@ +../cc
\ No newline at end of file diff --git a/lib/spack/env/cc b/lib/spack/env/cc new file mode 100755 index 0000000000..f1ace0d3f7 --- /dev/null +++ b/lib/spack/env/cc @@ -0,0 +1,69 @@ +#!/usr/bin/env python +import sys +import os +import subprocess +import argparse + +def get_path(name): + path = os.environ.get(name, "") + return path.split(":") + +# Import spack parameters through the build environment. +spack_lib = os.environ.get("SPACK_LIB") +spack_deps = get_path("SPACK_DEPENDENCIES") +spack_env_path = get_path("SPACK_ENV_PATH") +if not spack_lib or spack_deps == None: + print "%s must be run from spack." % os.path.abspath(sys.argv[0]) + sys.exit(1) + +# Figure out what type of operation we're doing +command = os.path.basename(sys.argv[0]) + +# Grab a minimal set of spack packages +sys.path.append(spack_lib) +from spack.utils import * +from spack.compilation import parse_rpaths +import spack.tty as tty + +parser = argparse.ArgumentParser(add_help=False) +parser.add_argument("-I", action='append', default=[], dest='include_path') +parser.add_argument("-L", action='append', default=[], dest='lib_path') +parser.add_argument("-l", action='append', default=[], dest='libs') + +options, other_args = parser.parse_known_args() +rpaths, other_args = parse_rpaths(other_args) + +if rpaths: + tty.warn("Spack stripping non-spack rpaths: ", *rpaths) + +# Find the actual command the build is trying to run by removing +# Spack's env paths from the path. We use this later for which() +script_dir = os.path.dirname(os.path.expanduser(__file__)) +clean_path = get_path("PATH") +remove_items(clean_path, '.') +for path in spack_env_path: + remove_items(clean_path, path) + +# Add dependence's paths to our compiler flags. +def append_if_dir(path_list, prefix, *dirs): + full_path = os.path.join(prefix, *dirs) + if os.path.isdir(full_path): + path_list.append(full_path) + +for prefix in spack_deps: + append_if_dir(options.include_path, prefix, "include") + append_if_dir(options.lib_path, prefix, "lib") + append_if_dir(options.lib_path, prefix, "lib64") + +# Add our modified arguments to it. +cmd = which(command, path=clean_path) +arguments = ['-I%s' % path for path in options.include_path] +arguments += other_args +arguments += ['-L%s' % path for path in options.lib_path] +arguments += ['-l%s' % path for path in options.libs] + +# Unset some pesky environment variables +pop_keys(os.environ, "LD_LIBRARY_PATH", "LD_RUN_PATH", "DYLD_LIBRARY_PATH") + +rcode = cmd(*arguments, fail_on_error=False) +sys.exit(rcode) diff --git a/lib/spack/env/clang b/lib/spack/env/clang new file mode 120000 index 0000000000..2652f5f42c --- /dev/null +++ b/lib/spack/env/clang @@ -0,0 +1 @@ +cc
\ No newline at end of file diff --git a/lib/spack/env/clang++ b/lib/spack/env/clang++ new file mode 120000 index 0000000000..2652f5f42c --- /dev/null +++ b/lib/spack/env/clang++ @@ -0,0 +1 @@ +cc
\ No newline at end of file diff --git a/lib/spack/env/cpp b/lib/spack/env/cpp new file mode 120000 index 0000000000..2652f5f42c --- /dev/null +++ b/lib/spack/env/cpp @@ -0,0 +1 @@ +cc
\ No newline at end of file diff --git a/lib/spack/env/g++ b/lib/spack/env/g++ new file mode 120000 index 0000000000..2652f5f42c --- /dev/null +++ b/lib/spack/env/g++ @@ -0,0 +1 @@ +cc
\ No newline at end of file diff --git a/lib/spack/env/gcc b/lib/spack/env/gcc new file mode 120000 index 0000000000..2652f5f42c --- /dev/null +++ b/lib/spack/env/gcc @@ -0,0 +1 @@ +cc
\ No newline at end of file diff --git a/lib/spack/env/ld b/lib/spack/env/ld new file mode 120000 index 0000000000..2652f5f42c --- /dev/null +++ b/lib/spack/env/ld @@ -0,0 +1 @@ +cc
\ No newline at end of file |