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/add-flags.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/add-flags.sh')
-rw-r--r-- | pkgs/build-support/cc-wrapper/add-flags.sh | 21 |
1 files changed, 15 insertions, 6 deletions
diff --git a/pkgs/build-support/cc-wrapper/add-flags.sh b/pkgs/build-support/cc-wrapper/add-flags.sh index 5634c82aa28..1edfe8bfc75 100644 --- a/pkgs/build-support/cc-wrapper/add-flags.sh +++ b/pkgs/build-support/cc-wrapper/add-flags.sh @@ -1,28 +1,37 @@ # `-B@out@/bin' forces cc to use ld-wrapper.sh when calling ld. export NIX_CFLAGS_COMPILE="-B@out@/bin/ $NIX_CFLAGS_COMPILE" +# Export and assign separately in order that a failing $(..) will fail +# the script. + if [ -e @out@/nix-support/libc-cflags ]; then - export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/libc-cflags) $NIX_CFLAGS_COMPILE" + export NIX_CFLAGS_COMPILE + NIX_CFLAGS_COMPILE="$(< @out@/nix-support/libc-cflags) $NIX_CFLAGS_COMPILE" fi if [ -e @out@/nix-support/cc-cflags ]; then - export NIX_CFLAGS_COMPILE="$(cat @out@/nix-support/cc-cflags) $NIX_CFLAGS_COMPILE" + export NIX_CFLAGS_COMPILE + NIX_CFLAGS_COMPILE="$(< @out@/nix-support/cc-cflags) $NIX_CFLAGS_COMPILE" fi if [ -e @out@/nix-support/gnat-cflags ]; then - export NIX_GNATFLAGS_COMPILE="$(cat @out@/nix-support/gnat-cflags) $NIX_GNATFLAGS_COMPILE" + export NIX_GNATFLAGS_COMPILE + NIX_GNATFLAGS_COMPILE="$(< @out@/nix-support/gnat-cflags) $NIX_GNATFLAGS_COMPILE" fi if [ -e @out@/nix-support/libc-ldflags ]; then - export NIX_LDFLAGS+=" $(cat @out@/nix-support/libc-ldflags)" + export NIX_LDFLAGS + NIX_LDFLAGS+=" $(< @out@/nix-support/libc-ldflags)" fi if [ -e @out@/nix-support/cc-ldflags ]; then - export NIX_LDFLAGS+=" $(cat @out@/nix-support/cc-ldflags)" + export NIX_LDFLAGS + NIX_LDFLAGS+=" $(< @out@/nix-support/cc-ldflags)" fi if [ -e @out@/nix-support/libc-ldflags-before ]; then - export NIX_LDFLAGS_BEFORE="$(cat @out@/nix-support/libc-ldflags-before) $NIX_LDFLAGS_BEFORE" + export NIX_LDFLAGS_BEFORE + NIX_LDFLAGS_BEFORE="$(< @out@/nix-support/libc-ldflags-before) $NIX_LDFLAGS_BEFORE" fi export NIX_CC_WRAPPER_FLAGS_SET=1 |