blob: 066087fcd13bcb479115feceb244d52310efa5b7 (
plain) (
blame)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
|
{stdenv, fetchurl, runCommand, gcc, zlib}:
assert stdenv.isLinux;
let
ccache =
stdenv.mkDerivation {
name = "ccache-3.1.10";
src = fetchurl {
url = http://samba.org/ftp/ccache/ccache-3.1.10.tar.gz;
sha256 = "0fzxa45q7wfm63zrak65wh31w7pnsp0k65fxv00cgmf454as4dza";
};
buildInputs = [ zlib ];
passthru = {
# A derivation that provides gcc and g++ commands, but that
# will end up calling ccache for the given cacheDir
links = extraConfig : (runCommand "ccache-links"
{ inherit (gcc) langC langCC; }
''
mkdir -p $out/bin
if [ $langC -eq 1 ]; then
cat > $out/bin/gcc << EOF
#!/bin/sh
${extraConfig}
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
${extraConfig}
exec ${ccache}/bin/ccache ${gcc.gcc}/bin/g++ "\$@"
EOF
chmod +x $out/bin/g++
fi
'');
};
meta = {
description = "Compiler cache for fast recompilation of C/C++ code";
homepage = http://ccache.samba.org/;
license = stdenv.lib.licenses.gpl3Plus;
};
};
in
ccache
|