summaryrefslogtreecommitdiff
path: root/lib/spack/env/cc
diff options
context:
space:
mode:
Diffstat (limited to 'lib/spack/env/cc')
-rwxr-xr-xlib/spack/env/cc69
1 files changed, 22 insertions, 47 deletions
diff --git a/lib/spack/env/cc b/lib/spack/env/cc
index 70f429055d..da1fee8756 100755
--- a/lib/spack/env/cc
+++ b/lib/spack/env/cc
@@ -24,7 +24,6 @@
# the script runs. They are set by routines in spack.build_environment
# as part of spack.package.Package.do_install().
parameters=(
- SPACK_PREFIX
SPACK_ENV_PATH
SPACK_DEBUG_LOG_DIR
SPACK_DEBUG_LOG_ID
@@ -46,8 +45,6 @@ parameters=(
# SPACK_DEBUG
# Test command is used to unit test the compiler script.
# SPACK_TEST_COMMAND
-# Dependencies can be empty for pkgs with no deps:
-# SPACK_DEPENDENCIES
# die()
# Prints a message and exits with error 1.
@@ -385,52 +382,30 @@ case "$mode" in
flags=("${flags[@]}" "${SPACK_LDFLAGS[@]}") ;;
esac
+# Prepend include directories
+IFS=':' read -ra include_dirs <<< "$SPACK_INCLUDE_DIRS"
+if [[ $mode == cpp || $mode == cc || $mode == as || $mode == ccld ]]; then
+ for include_dir in "${include_dirs[@]}"; do
+ includes=("${includes[@]}" "$include_dir")
+ done
+fi
-# Include the package's prefix/lib[64] dirs in rpath. We don't know until
-# *after* installation which one's correct, so we include both lib and
-# lib64, assuming that only one will be present.
-case "$mode" in
- ld|ccld)
- $add_rpaths && rpaths+=("$SPACK_PREFIX/lib")
- $add_rpaths && rpaths+=("$SPACK_PREFIX/lib64")
- ;;
-esac
-
-# Read spack dependencies from the environment. This is a list of prefixes.
-IFS=':' read -ra deps <<< "$SPACK_DEPENDENCIES"
-for dep in "${deps[@]}"; do
- # Append include directories in any compilation mode
- case "$mode" in
- cpp|cc|as|ccld)
- if [[ -d $dep/include ]]; then
- includes=("${includes[@]}" "$dep/include")
- fi
- ;;
- esac
-
- # Append lib/lib64 and RPATH directories, but only if we're linking
- case "$mode" in
- ld|ccld)
- if [[ -d $dep/lib ]]; then
- if [[ $SPACK_RPATH_DEPS == *$dep* ]]; then
- $add_rpaths && rpaths=("${rpaths[@]}" "$dep/lib")
- fi
- if [[ $SPACK_LINK_DEPS == *$dep* ]]; then
- libdirs=("${libdirs[@]}" "$dep/lib")
- fi
- fi
+IFS=':' read -ra rpath_dirs <<< "$SPACK_RPATH_DIRS"
+if [[ $mode == ccld || $mode == ld ]]; then
+ for rpath_dir in "${rpath_dirs[@]}"; do
+ # Append RPATH directories. Note that in the case of the
+ # top-level package these directories may not exist yet. For dependencies
+ # it is assumed that paths have already been confirmed.
+ $add_rpaths && rpaths=("${rpaths[@]}" "$rpath_dir")
+ done
+fi
- if [[ -d $dep/lib64 ]]; then
- if [[ $SPACK_RPATH_DEPS == *$dep* ]]; then
- $add_rpaths && rpaths+=("$dep/lib64")
- fi
- if [[ $SPACK_LINK_DEPS == *$dep* ]]; then
- libdirs+=("$dep/lib64")
- fi
- fi
- ;;
- esac
-done
+IFS=':' read -ra link_dirs <<< "$SPACK_LINK_DIRS"
+if [[ $mode == ccld || $mode == ld ]]; then
+ for link_dir in "${link_dirs[@]}"; do
+ libdirs=("${libdirs[@]}" "$link_dir")
+ done
+fi
# add RPATHs if we're in in any linking mode
case "$mode" in