ccacheWrapper: extraConfig does not handle special characters

An independent part of https://github.com/NixOS/nixpkgs/pull/28022
This commit is contained in:
volth 2017-08-10 10:13:17 +00:00 committed by GitHub
parent c2ef89aac9
commit 031eb79a0b
1 changed files with 5 additions and 7 deletions

View File

@ -1,4 +1,4 @@
{ stdenv, fetchurl, fetchpatch, runCommand, zlib }: { stdenv, fetchurl, fetchpatch, runCommand, zlib, makeWrapper }:
let ccache = stdenv.mkDerivation rec { let ccache = stdenv.mkDerivation rec {
name = "ccache-${version}"; name = "ccache-${version}";
@ -32,18 +32,16 @@ let ccache = stdenv.mkDerivation rec {
isGNU = unwrappedCC.isGNU or false; isGNU = unwrappedCC.isGNU or false;
}; };
inherit (unwrappedCC) lib; inherit (unwrappedCC) lib;
nativeBuildInputs = [ makeWrapper ];
buildCommand = '' buildCommand = ''
mkdir -p $out/bin mkdir -p $out/bin
wrap() { wrap() {
local cname="$1" local cname="$1"
if [ -x "${unwrappedCC}/bin/$cname" ]; then if [ -x "${unwrappedCC}/bin/$cname" ]; then
cat > $out/bin/$cname << EOF makeWrapper ${ccache}/bin/ccache $out/bin/$cname \
#!/bin/sh --run ${stdenv.lib.escapeShellArg extraConfig} \
${extraConfig} --add-flags ${unwrappedCC}/bin/$cname
exec ${ccache}/bin/ccache ${unwrappedCC}/bin/$cname "\$@"
EOF
chmod +x $out/bin/$cname
fi fi
} }