cc-wrapper: simplify expandResponseParams parser

Import from https://github.com/orivej/expand-compiler-args/tree/b2446902fe7816f34c3f21d29a66da3ee2b1601e
This commit is contained in:
Orivej Desh
2017-07-03 21:51:23 +00:00
parent d07f30f628
commit 2bc7b4e134
5 changed files with 109 additions and 213 deletions
+9 -7
View File
@@ -120,14 +120,14 @@ let
null)
else "";
parseResponseFile = if buildPackages.stdenv.cc or null != null && buildPackages.stdenv.cc != "/dev/null"
expand-response-params = if buildPackages.stdenv.cc or null != null && buildPackages.stdenv.cc != "/dev/null"
then buildPackages.stdenv.mkDerivation {
name = "parse-response-file";
src = ./parseResponseFile.c;
name = "expand-response-params";
src = ./expand-response-params.c;
buildCommand = ''
# Make sure the output file doesn't refer to the input nix path
cp "$src" parseResponseFile.c
"$CC" -O3 -o "$out" parseResponseFile.c
# Work around "stdenv-darwin-boot-2 is not allowed to refer to path /nix/store/...-expand-response-params.c"
cp "$src" expand-response-params.c
"$CC" -std=c99 -O3 -o "$out" expand-response-params.c
'';
} else "";
@@ -383,7 +383,9 @@ stdenv.mkDerivation {
''
+ extraBuildCommands;
inherit dynamicLinker parseResponseFile;
inherit dynamicLinker expand-response-params;
expandResponseParams = expand-response-params; # for substitution in utils.sh
crossAttrs = {
shell = shell.crossDrv + shell.crossDrv.shellPath;