Merge pull request #28103 from volth/patch-10

ccacheWrapper: extraConfig does not handle special characters
This commit is contained in:
Jörg Thalheim 2017-08-10 21:24:07 +01:00 committed by GitHub
commit bd41e827de

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
} }