1{ stdenv, fetchurl, libunwind }:
2
3stdenv.mkDerivation rec {
4 name = "gperftools-2.6.1";
5
6 src = fetchurl {
7 url = "https://github.com/gperftools/gperftools/releases/download/${name}/${name}.tar.gz";
8 sha256 = "10cxd6s5pkm2d934gh47hrn9xcrw4qlc9yr7s99z4a508bmngd1q";
9 };
10
11 buildInputs = stdenv.lib.optional stdenv.isLinux libunwind;
12
13 prePatch = stdenv.lib.optionalString stdenv.isDarwin ''
14 substituteInPlace Makefile.am --replace stdc++ c++
15 substituteInPlace Makefile.in --replace stdc++ c++
16 substituteInPlace libtool --replace stdc++ c++
17 '';
18
19 NIX_CFLAGS_COMPILE = stdenv.lib.optional stdenv.isDarwin "-D_XOPEN_SOURCE";
20
21 # some packages want to link to the static tcmalloc_minimal
22 # to drop the runtime dependency on gperftools
23 dontDisableStatic = true;
24
25 enableParallelBuilding = true;
26
27 meta = with stdenv.lib; {
28 homepage = https://github.com/gperftools/gperftools;
29 description = "Fast, multi-threaded malloc() and nifty performance analysis tools";
30 platforms = with platforms; linux ++ darwin;
31 license = licenses.bsd3;
32 maintainers = with maintainers; [ vcunat wkennington ];
33 };
34}