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