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 {
|
2015-01-26 03:41:30 +00:00
|
|
|
name = "ccache-3.2.1";
|
2008-02-12 13:32:37 +00:00
|
|
|
src = fetchurl {
|
2015-01-26 03:41:30 +00:00
|
|
|
url = http://samba.org/ftp/ccache/ccache-3.2.1.tar.xz;
|
|
|
|
sha256 = "17dxb0adha2bqzb2r8rcc3kl9mk7y6vrvlh181liivrc3m7g6al7";
|
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
|
2015-01-15 04:44:00 +00:00
|
|
|
if [ -x "${gcc.cc}/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}
|
2015-01-15 04:44:00 +00:00
|
|
|
exec ${ccache}/bin/ccache ${gcc.cc}/bin/gcc "\$@"
|
2012-01-21 00:25:30 +00:00
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/gcc
|
|
|
|
fi
|
2015-01-15 04:44:00 +00:00
|
|
|
if [ -x "${gcc.cc}/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}
|
2015-01-15 04:44:00 +00:00
|
|
|
exec ${ccache}/bin/ccache ${gcc.cc}/bin/g++ "\$@"
|
2012-01-21 00:25:30 +00:00
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/g++
|
|
|
|
fi
|
|
|
|
'');
|
2008-02-12 13:32:37 +00:00
|
|
|
};
|
|
|
|
|
2015-01-26 03:41:30 +00:00
|
|
|
meta = with stdenv.lib; {
|
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/;
|
2015-01-26 03:41:30 +00:00
|
|
|
license = with licenses; gpl3Plus;
|
|
|
|
maintainers = with maintainers; [ nckx ];
|
2008-02-12 13:32:37 +00:00
|
|
|
};
|
2012-01-21 00:25:30 +00:00
|
|
|
};
|
|
|
|
in
|
|
|
|
ccache
|