2012-01-21 01:29:06 +00:00
|
|
|
{stdenv, fetchurl, runCommand, gcc, zlib}:
|
2008-02-12 13:32:37 +00:00
|
|
|
|
2014-09-29 23:51:00 +01:00
|
|
|
assert stdenv.isLinux;
|
|
|
|
|
2012-01-21 00:25:30 +00:00
|
|
|
let
|
|
|
|
ccache =
|
2008-02-12 13:32:37 +00:00
|
|
|
stdenv.mkDerivation {
|
2013-12-18 12:42:28 +00:00
|
|
|
name = "ccache-3.1.9";
|
2008-02-12 13:32:37 +00:00
|
|
|
src = fetchurl {
|
2013-12-18 12:42:28 +00:00
|
|
|
url = http://samba.org/ftp/ccache/ccache-3.1.9.tar.gz;
|
|
|
|
sha256 = "0ixlxqv1xyacwgg0k9b4a6by07c7k75y0xbr8dp76jvyada0c9x2";
|
2012-01-21 00:25:30 +00:00
|
|
|
};
|
|
|
|
|
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 = {
|
2013-10-05 15:22:46 +01:00
|
|
|
description = "Compiler cache for fast recompilation of C/C++ code";
|
2008-02-12 13:32:37 +00:00
|
|
|
homepage = http://ccache.samba.org/;
|
|
|
|
license = "GPL";
|
|
|
|
};
|
2012-01-21 00:25:30 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
ccache
|