3
0
Fork 0
forked from mirrors/nixpkgs
nixpkgs/pkgs/development/tools/misc/ccache/default.nix

58 lines
1.6 KiB
Nix
Raw Normal View History

{ stdenv, fetchurl, runCommand, gcc, perl, zlib }:
let
# TODO: find out if there's harm in just using 'rec' instead.
name = "ccache-${version}";
version = "3.2.2";
sha256 = "1jm0qb3h5sypllaiyj81zp6m009vm50hzjnx994ril94kxlrj3ag";
doCheck = true;
ccache =
stdenv.mkDerivation {
inherit name doCheck;
src = fetchurl {
inherit sha256;
url = "mirror://samba/ccache/${name}.tar.xz";
};
# The test dependency on perl should be gone in the next release:
buildInputs = [ zlib ]
++ stdenv.lib.optionals doCheck [ perl ];
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" { passthru.gcc = gcc; }
''
mkdir -p $out/bin
if [ -x "${gcc.cc}/bin/gcc" ]; then
cat > $out/bin/gcc << EOF
#!/bin/sh
${extraConfig}
exec ${ccache}/bin/ccache ${gcc.cc}/bin/gcc "\$@"
EOF
chmod +x $out/bin/gcc
fi
if [ -x "${gcc.cc}/bin/g++" ]; then
cat > $out/bin/g++ << EOF
#!/bin/sh
${extraConfig}
exec ${ccache}/bin/ccache ${gcc.cc}/bin/g++ "\$@"
EOF
chmod +x $out/bin/g++
fi
'');
};
2015-01-26 03:41:30 +00:00
meta = with stdenv.lib; {
inherit version;
description = "Compiler cache for fast recompilation of C/C++ code";
homepage = http://ccache.samba.org/;
downloadPage = https://ccache.samba.org/download.html;
license = licenses.gpl3Plus;
2015-01-26 03:41:30 +00:00
maintainers = with maintainers; [ nckx ];
};
};
in
ccache