cc-wrapper: Pass shellcheck and other cleanups

In many cases, this involved taking @orivej's and @edolstra's recent
ld-wrapper improvements, and applying then elsewhere.
This commit is contained in:
John Ericson
2017-08-04 12:47:29 -04:00
parent f1d48ca6ba
commit 6463fd3d7e
9 changed files with 195 additions and 161 deletions
+14 -9
View File
@@ -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@