diff options
author | John Ericson <John.Ericson@Obsidian.Systems> | 2017-08-02 12:48:51 -0400 |
---|---|---|
committer | John Ericson <John.Ericson@Obsidian.Systems> | 2017-08-04 12:47:29 -0400 |
commit | 6463fd3d7e9b0131ba22603a764b4b35ab215e66 (patch) | |
tree | 7ce654cf0afe52e85058132c7924b4c969dec118 /pkgs/build-support/cc-wrapper/setup-hook.sh | |
parent | f1d48ca6ba77af581fa05d9ea42bfe83da6f0c8d (diff) | |
download | nixpkgs-6463fd3d7e9b0131ba22603a764b4b35ab215e66.tar nixpkgs-6463fd3d7e9b0131ba22603a764b4b35ab215e66.tar.gz nixpkgs-6463fd3d7e9b0131ba22603a764b4b35ab215e66.tar.bz2 nixpkgs-6463fd3d7e9b0131ba22603a764b4b35ab215e66.tar.lz nixpkgs-6463fd3d7e9b0131ba22603a764b4b35ab215e66.tar.xz nixpkgs-6463fd3d7e9b0131ba22603a764b4b35ab215e66.tar.zst nixpkgs-6463fd3d7e9b0131ba22603a764b4b35ab215e66.zip |
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.
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 104b82425f2..2bf507ce8df 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@ |