diff options
Diffstat (limited to 'pkgs/build-support/cc-wrapper/setup-hook.sh')
-rw-r--r-- | pkgs/build-support/cc-wrapper/setup-hook.sh | 23 |
1 files changed, 14 insertions, 9 deletions
diff --git a/pkgs/build-support/cc-wrapper/setup-hook.sh b/pkgs/build-support/cc-wrapper/setup-hook.sh index 104b82425f29..2bf507ce8dff 100644 --- a/pkgs/build-support/cc-wrapper/setup-hook.sh +++ b/pkgs/build-support/cc-wrapper/setup-hook.sh @@ -1,45 +1,50 @@ addCVars () { - if [ -d $1/include ]; then + if [[ -d "$1/include" ]]; then export NIX_CFLAGS_COMPILE+=" ${ccIncludeFlag:--isystem} $1/include" fi - if [ -d $1/lib64 -a ! -L $1/lib64 ]; then + if [[ -d "$1/lib64" && ! -L "$1/lib64" ]]; then export NIX_LDFLAGS+=" -L$1/lib64" fi - if [ -d $1/lib ]; then + if [[ -d "$1/lib" ]]; then export NIX_LDFLAGS+=" -L$1/lib" fi - if test -d $1/Library/Frameworks; then - export NIX_CFLAGS_COMPILE="$NIX_CFLAGS_COMPILE -F$1/Library/Frameworks" + if [[ -d "$1/Library/Frameworks" ]]; then + export NIX_CFLAGS_COMPILE+=" -F$1/Library/Frameworks" fi } envHooks+=(addCVars) -# Note: these come *after* $out in the PATH (see setup.sh). +# Note 1: these come *after* $out in the PATH (see setup.sh). +# Note 2: phase separation makes this look useless to shellcheck. +# shellcheck disable=SC2157 if [ -n "@cc@" ]; then addToSearchPath _PATH @cc@/bin fi +# shellcheck disable=SC2157 if [ -n "@binutils_bin@" ]; then addToSearchPath _PATH @binutils_bin@/bin fi +# shellcheck disable=SC2157 if [ -n "@libc_bin@" ]; then addToSearchPath _PATH @libc_bin@/bin fi +# shellcheck disable=SC2157 if [ -n "@coreutils_bin@" ]; then addToSearchPath _PATH @coreutils_bin@/bin fi -if [ -z "$crossConfig" ]; then - ENV_PREFIX="" +if [ -z "${crossConfig:-}" ]; then + ENV_PREFIX="" else - ENV_PREFIX="BUILD_" + ENV_PREFIX="BUILD_" fi export NIX_${ENV_PREFIX}CC=@out@ |