summary refs log tree commit diff
path: root/pkgs/development/tools/misc/ccache
diff options
context:
space:
mode:
authorvolth <volth@webmaster.ms>2017-08-10 10:13:17 +0000
committerGitHub <noreply@github.com>2017-08-10 10:13:17 +0000
commit031eb79a0b99b75577b375a503368a680f7389c1 (patch)
treebe6043787fdb27b6a9098d7322674be40800f71a /pkgs/development/tools/misc/ccache
parentc2ef89aac97b6eb8e3efe53173ec8eea7d2ebf17 (diff)
downloadnixpkgs-031eb79a0b99b75577b375a503368a680f7389c1.tar
nixpkgs-031eb79a0b99b75577b375a503368a680f7389c1.tar.gz
nixpkgs-031eb79a0b99b75577b375a503368a680f7389c1.tar.bz2
nixpkgs-031eb79a0b99b75577b375a503368a680f7389c1.tar.lz
nixpkgs-031eb79a0b99b75577b375a503368a680f7389c1.tar.xz
nixpkgs-031eb79a0b99b75577b375a503368a680f7389c1.tar.zst
nixpkgs-031eb79a0b99b75577b375a503368a680f7389c1.zip
ccacheWrapper: extraConfig does not handle special characters
An independent part of https://github.com/NixOS/nixpkgs/pull/28022
Diffstat (limited to 'pkgs/development/tools/misc/ccache')
-rw-r--r--pkgs/development/tools/misc/ccache/default.nix12
1 files changed, 5 insertions, 7 deletions
diff --git a/pkgs/development/tools/misc/ccache/default.nix b/pkgs/development/tools/misc/ccache/default.nix
index 765fdfb2ea4..65c7e633f8e 100644
--- a/pkgs/development/tools/misc/ccache/default.nix
+++ b/pkgs/development/tools/misc/ccache/default.nix
@@ -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
         }