1
0
Fork 1
mirror of https://github.com/NixOS/nixpkgs.git synced 2024-09-11 15:08:33 +01:00
nixpkgs/pkgs/development/tools/misc/ccache/default.nix
2014-11-16 09:19:35 +01:00

49 lines
1.2 KiB
Nix

{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" { }
''
mkdir -p $out/bin
if [ -x "${gcc.gcc}/bin/gcc" ]; 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 [ -x "${gcc.gcc}/bin/g++" ]; 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