Last active
July 2, 2020 09:06
-
-
Save Mic92/8f095a2836f037639d7fd53b8ac3efe2 to your computer and use it in GitHub Desktop.
stdenv with -nostdinc support
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
with import <nixpkgs> {}; | |
let | |
libcPattern = | |
builtins.replaceStrings ["/"] ["\\/"] "${gcc.libc_dev}/include"; | |
gcc' = wrapCCWith { | |
cc = gcc.cc; | |
bintools = binutils; | |
extraBuildCommands = '' | |
cat >> $out/nix-support/add-flags.sh <<'EOF' | |
if [[ "$@" = *-nostdinc* ]]; then | |
NIX_CFLAGS_COMPILE_${gcc.suffixSalt}=''${NIX_CFLAGS_COMPILE_${gcc.suffixSalt}//-idirafter ${libcPattern}/} | |
fi | |
EOF | |
''; | |
}; | |
in (overrideCC stdenv gcc').mkDerivation { | |
name = "env"; | |
buildInputs = [ | |
bashInteractive | |
]; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment