2015-07-01 17:43:04 +02:00
|
|
|
{ stdenv, fetchurl, runCommand, gcc, zlib }:
|
2008-02-12 14:32:37 +01:00
|
|
|
|
2012-01-21 01:25:30 +01:00
|
|
|
let
|
2015-05-11 14:56:41 +02:00
|
|
|
name = "ccache-${version}";
|
2015-10-09 21:59:51 +02:00
|
|
|
version = "3.2.4";
|
|
|
|
sha256 = "0pga3hvd80f2p7mz88jmmbwzxh4vn5ihyjx5f6na8y2fclzsjg8w";
|
2015-05-11 14:56:41 +02:00
|
|
|
|
2012-01-21 01:25:30 +01:00
|
|
|
ccache =
|
2008-02-12 14:32:37 +01:00
|
|
|
stdenv.mkDerivation {
|
2015-07-01 17:43:04 +02:00
|
|
|
inherit name;
|
2008-02-12 14:32:37 +01:00
|
|
|
src = fetchurl {
|
2015-05-11 14:56:41 +02:00
|
|
|
inherit sha256;
|
|
|
|
url = "mirror://samba/ccache/${name}.tar.xz";
|
2012-01-21 01:25:30 +01:00
|
|
|
};
|
|
|
|
|
2015-07-01 17:43:04 +02:00
|
|
|
buildInputs = [ zlib ];
|
|
|
|
|
2015-08-25 05:03:05 +02:00
|
|
|
postPatch = ''
|
|
|
|
substituteInPlace Makefile.in --replace 'objs) $(extra_libs)' 'objs)'
|
|
|
|
'';
|
|
|
|
|
2015-07-01 17:43:04 +02:00
|
|
|
doCheck = true;
|
2012-01-21 02:29:06 +01:00
|
|
|
|
2012-01-21 01:25:30 +01:00
|
|
|
passthru = {
|
|
|
|
# A derivation that provides gcc and g++ commands, but that
|
|
|
|
# will end up calling ccache for the given cacheDir
|
2015-08-25 05:03:05 +02:00
|
|
|
links = extraConfig: (runCommand "ccache-links"
|
|
|
|
{ passthru.gcc = gcc; passthru.isGNU = true; }
|
2012-01-21 01:25:30 +01:00
|
|
|
''
|
|
|
|
mkdir -p $out/bin
|
2015-01-15 05:44:00 +01:00
|
|
|
if [ -x "${gcc.cc}/bin/gcc" ]; then
|
2012-01-21 01:25:30 +01:00
|
|
|
cat > $out/bin/gcc << EOF
|
|
|
|
#!/bin/sh
|
2012-01-21 02:29:06 +01:00
|
|
|
${extraConfig}
|
2015-01-15 05:44:00 +01:00
|
|
|
exec ${ccache}/bin/ccache ${gcc.cc}/bin/gcc "\$@"
|
2012-01-21 01:25:30 +01:00
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/gcc
|
|
|
|
fi
|
2015-01-15 05:44:00 +01:00
|
|
|
if [ -x "${gcc.cc}/bin/g++" ]; then
|
2012-01-21 01:25:30 +01:00
|
|
|
cat > $out/bin/g++ << EOF
|
|
|
|
#!/bin/sh
|
2012-01-21 02:29:06 +01:00
|
|
|
${extraConfig}
|
2015-01-15 05:44:00 +01:00
|
|
|
exec ${ccache}/bin/ccache ${gcc.cc}/bin/g++ "\$@"
|
2012-01-21 01:25:30 +01:00
|
|
|
EOF
|
|
|
|
chmod +x $out/bin/g++
|
|
|
|
fi
|
2015-07-29 11:03:39 +02:00
|
|
|
for executable in $(ls ${gcc.cc}/bin); do
|
|
|
|
if [ ! -x "$out/bin/$executable" ]; then
|
|
|
|
ln -s ${gcc.cc}/bin/$executable $out/bin/$executable
|
|
|
|
fi
|
|
|
|
done
|
2012-01-21 01:25:30 +01:00
|
|
|
'');
|
2008-02-12 14:32:37 +01:00
|
|
|
};
|
|
|
|
|
2015-01-26 04:41:30 +01:00
|
|
|
meta = with stdenv.lib; {
|
2015-05-11 14:56:41 +02:00
|
|
|
inherit version;
|
2013-10-05 16:22:46 +02:00
|
|
|
description = "Compiler cache for fast recompilation of C/C++ code";
|
2008-02-12 14:32:37 +01:00
|
|
|
homepage = http://ccache.samba.org/;
|
2015-05-11 14:56:41 +02:00
|
|
|
downloadPage = https://ccache.samba.org/download.html;
|
2015-05-28 19:20:29 +02:00
|
|
|
license = licenses.gpl3Plus;
|
2015-01-26 04:41:30 +01:00
|
|
|
maintainers = with maintainers; [ nckx ];
|
2008-02-12 14:32:37 +01:00
|
|
|
};
|
2012-01-21 01:25:30 +01:00
|
|
|
};
|
|
|
|
in
|
|
|
|
ccache
|