2012-01-21 02:29:06 +01:00
|
|
|
{stdenv, fetchurl, runCommand, gcc, zlib}:
|
2008-02-12 14:32:37 +01:00
|
|
|
|
2012-01-21 01:25:30 +01:00
|
|
|
let
|
|
|
|
ccache =
|
2008-02-12 14:32:37 +01:00
|
|
|
stdenv.mkDerivation {
|
2012-01-21 01:25:30 +01:00
|
|
|
name = "ccache-3.1.7";
|
2008-02-12 14:32:37 +01:00
|
|
|
src = fetchurl {
|
2012-01-21 01:25:30 +01:00
|
|
|
url = http://samba.org/ftp/ccache/ccache-3.1.7.tar.gz;
|
|
|
|
sha256 = "04ax6ks49b6rn57hx4v9wbvmsfmw6ipn0wyfqwhh4lzw70flv3r7";
|
|
|
|
};
|
|
|
|
|
2012-01-21 02:29:06 +01:00
|
|
|
buildInputs = [ zlib ];
|
|
|
|
|
2012-01-21 01:25:30 +01:00
|
|
|
passthru = {
|
|
|
|
# A derivation that provides gcc and g++ commands, but that
|
|
|
|
# will end up calling ccache for the given cacheDir
|
2012-01-21 02:29:06 +01:00
|
|
|
links = extraConfig : (runCommand "ccache-links"
|
2012-01-21 01:25:30 +01:00
|
|
|
{ inherit (gcc) langC langCC; }
|
|
|
|
''
|
|
|
|
mkdir -p $out/bin
|
|
|
|
if [ $langC -eq 1 ]; then
|
|
|
|
cat > $out/bin/gcc << EOF
|
|
|
|
#!/bin/sh
|
2012-01-21 02:29:06 +01:00
|
|
|
${extraConfig}
|
2012-01-21 01:25:30 +01:00
|
|
|
exec ${ccache}/bin/ccache ${gcc.gcc}/bin/gcc "\$@"
|
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/gcc
|
|
|
|
fi
|
|
|
|
if [ $langCC -eq 1 ]; then
|
|
|
|
cat > $out/bin/g++ << EOF
|
|
|
|
#!/bin/sh
|
2012-01-21 02:29:06 +01:00
|
|
|
${extraConfig}
|
2012-01-21 01:25:30 +01:00
|
|
|
exec ${ccache}/bin/ccache ${gcc.gcc}/bin/g++ "\$@"
|
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/g++
|
|
|
|
fi
|
|
|
|
'');
|
2008-02-12 14:32:37 +01:00
|
|
|
};
|
|
|
|
|
|
|
|
meta = {
|
2013-10-05 16:22:46 +02:00
|
|
|
description = "Compiler cache for fast recompilation of C/C++ code";
|
2008-02-12 14:32:37 +01:00
|
|
|
homepage = http://ccache.samba.org/;
|
|
|
|
license = "GPL";
|
|
|
|
};
|
2012-01-21 01:25:30 +01:00
|
|
|
};
|
|
|
|
in
|
|
|
|
ccache
|