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 {
|
2014-11-05 08:32:27 +00:00
|
|
|
name = "ccache-3.1.10";
|
2008-02-12 13:32:37 +00:00
|
|
|
src = fetchurl {
|
2014-11-05 08:32:27 +00:00
|
|
|
url = http://samba.org/ftp/ccache/ccache-3.1.10.tar.gz;
|
|
|
|
sha256 = "0fzxa45q7wfm63zrak65wh31w7pnsp0k65fxv00cgmf454as4dza";
|
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
|
2014-11-16 08:19:11 +00:00
|
|
|
links = extraConfig : (runCommand "ccache-links" { }
|
2012-01-21 00:25:30 +00:00
|
|
|
''
|
|
|
|
mkdir -p $out/bin
|
2014-11-16 08:19:11 +00:00
|
|
|
if [ -x "${gcc.gcc}/bin/gcc" ]; then
|
2012-01-21 00:25:30 +00:00
|
|
|
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
|
2014-11-16 08:19:11 +00:00
|
|
|
if [ -x "${gcc.gcc}/bin/g++" ]; then
|
2012-01-21 00:25:30 +00:00
|
|
|
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/;
|
2014-11-05 08:32:27 +00:00
|
|
|
license = stdenv.lib.licenses.gpl3Plus;
|
2008-02-12 13:32:37 +00:00
|
|
|
};
|
2012-01-21 00:25:30 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
ccache
|