diff options
author | Ben Hipple <no-reply@pdtpartners.com> | 2019-11-26 00:55:16 +0000 |
---|---|---|
committer | Ben Hipple <no-reply@pdtpartners.com> | 2019-11-26 00:55:16 +0000 |
commit | 5f589d8d5de328e6831188c44b26f0ad17fe4ea0 (patch) | |
tree | 5ad3f8e44c92793c44a9358219ec0d06cdf7d305 /pkgs/build-support/cc-wrapper | |
parent | 6ec5e745dc4f9dc5f321989fef4a5fa66a21c7b2 (diff) | |
download | nixpkgs-5f589d8d5de328e6831188c44b26f0ad17fe4ea0.tar nixpkgs-5f589d8d5de328e6831188c44b26f0ad17fe4ea0.tar.gz nixpkgs-5f589d8d5de328e6831188c44b26f0ad17fe4ea0.tar.bz2 nixpkgs-5f589d8d5de328e6831188c44b26f0ad17fe4ea0.tar.lz nixpkgs-5f589d8d5de328e6831188c44b26f0ad17fe4ea0.tar.xz nixpkgs-5f589d8d5de328e6831188c44b26f0ad17fe4ea0.tar.zst nixpkgs-5f589d8d5de328e6831188c44b26f0ad17fe4ea0.zip |
stdenv: Fix gcc -idirafter shell glob in cc-wrapper
If an empty string is passed to `-idirafter`, it breaks gcc. This commit makes the stdenv less fragile by expanding out the shell glob and ensuring no empty arguments get passed.
Diffstat (limited to 'pkgs/build-support/cc-wrapper')
-rw-r--r-- | pkgs/build-support/cc-wrapper/default.nix | 12 |
1 files changed, 9 insertions, 3 deletions
diff --git a/pkgs/build-support/cc-wrapper/default.nix b/pkgs/build-support/cc-wrapper/default.nix index 2c35fdb1a3c..32501a1ffeb 100644 --- a/pkgs/build-support/cc-wrapper/default.nix +++ b/pkgs/build-support/cc-wrapper/default.nix @@ -235,7 +235,7 @@ stdenv.mkDerivation { fi '' - + optionalString (libc != null) '' + + optionalString (libc != null) ('' ## ## General libc support ## @@ -251,11 +251,17 @@ stdenv.mkDerivation { # compile, because it uses "#include_next <limits.h>" to find the # limits.h file in ../includes-fixed. To remedy the problem, # another -idirafter is necessary to add that directory again. - echo "-B${libc_lib}${libc.libdir or "/lib/"} -idirafter ${libc_dev}${libc.incdir or "/include"} ${optionalString isGNU "-idirafter ${cc}/lib/gcc/*/*/include-fixed"}" > $out/nix-support/libc-cflags + echo "-B${libc_lib}${libc.libdir or "/lib/"}" >> $out/nix-support/libc-cflags + echo "-idirafter ${libc_dev}${libc.incdir or "/include"}" >> $out/nix-support/libc-cflags + '' + optionalString isGNU '' + for dir in "${cc}"/lib/gcc/*/*/include-fixed; do + echo '-idirafter' ''${dir} >> $out/nix-support/libc-cflags + done + '' + '' echo "${libc_lib}" > $out/nix-support/orig-libc echo "${libc_dev}" > $out/nix-support/orig-libc-dev - '' + '') + optionalString (!nativeTools) '' ## |