Making the ccacheWrapper a bit nicer. More flexible, specifically.

svn path=/nixpkgs/trunk/; revision=31753
This commit is contained in:
Lluís Batlle i Rossell
2012-01-21 01:29:06 +00:00
parent 4a1c721c01
commit 8ea631310b
2 changed files with 11 additions and 7 deletions

View File

@@ -1,4 +1,4 @@
{stdenv, fetchurl, runCommand, gcc}:
{stdenv, fetchurl, runCommand, gcc, zlib}:
let
ccache =
@@ -9,17 +9,19 @@ stdenv.mkDerivation {
sha256 = "04ax6ks49b6rn57hx4v9wbvmsfmw6ipn0wyfqwhh4lzw70flv3r7";
};
buildInputs = [ zlib ];
passthru = {
# A derivation that provides gcc and g++ commands, but that
# will end up calling ccache for the given cacheDir
links = cacheDir : (runCommand "ccache-links"
links = extraConfig : (runCommand "ccache-links"
{ inherit (gcc) langC langCC; }
''
mkdir -p $out/bin
if [ $langC -eq 1 ]; then
cat > $out/bin/gcc << EOF
#!/bin/sh
export CCACHE_DIR=${cacheDir}
${extraConfig}
exec ${ccache}/bin/ccache ${gcc.gcc}/bin/gcc "\$@"
EOF
chmod +x $out/bin/gcc
@@ -27,7 +29,7 @@ stdenv.mkDerivation {
if [ $langCC -eq 1 ]; then
cat > $out/bin/g++ << EOF
#!/bin/sh
export CCACHE_DIR=${cacheDir}
${extraConfig}
exec ${ccache}/bin/ccache ${gcc.gcc}/bin/g++ "\$@"
EOF
chmod +x $out/bin/g++