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

View File

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