Clone of https://github.com/NixOS/nixpkgs.git (to stress-test knotserver)
at fix-function-merge 61 lines 1.9 kB view raw
1{ stdenv 2, lib 3, fetchFromGitHub 4, fetchpatch 5, autoreconfHook 6, libunwind 7, perl 8}: 9 10stdenv.mkDerivation rec { 11 pname = "gperftools"; 12 version = "2.15"; 13 14 src = fetchFromGitHub { 15 owner = pname; 16 repo = pname; 17 rev = "${pname}-${version}"; 18 sha256 = "sha256-3ibr8AHzo7txX1U+9oOWA60qeeJs/OGeevv+sgBwQa0="; 19 }; 20 21 patches = [ 22 # Add the --disable-general-dynamic-tls configure option: 23 # https://bugzilla.redhat.com/show_bug.cgi?id=1483558 24 (fetchpatch { 25 url = "https://src.fedoraproject.org/rpms/gperftools/raw/f62d87a34f56f64fb8eb86727e34fbc2d3f5294a/f/gperftools-2.7.90-disable-generic-dynamic-tls.patch"; 26 sha256 = "02falhpaqkl27hl1dib4yvmhwsddmgbw0krb46w31fyf3awb2ydv"; 27 }) 28 ]; 29 30 nativeBuildInputs = [ autoreconfHook ]; 31 32 # tcmalloc uses libunwind in a way that works correctly only on non-ARM dynamically linked linux 33 buildInputs = [ perl ] 34 ++ lib.optional (stdenv.isLinux && !(stdenv.hostPlatform.isAarch || stdenv.hostPlatform.isStatic )) libunwind; 35 36 # Disable general dynamic TLS on AArch to support dlopen()'ing the library: 37 # https://bugzilla.redhat.com/show_bug.cgi?id=1483558 38 configureFlags = lib.optional stdenv.hostPlatform.isAarch 39 "--disable-general-dynamic-tls"; 40 41 prePatch = lib.optionalString stdenv.isDarwin '' 42 substituteInPlace Makefile.am --replace stdc++ c++ 43 ''; 44 45 env.NIX_CFLAGS_COMPILE = lib.optionalString stdenv.isDarwin 46 "-D_XOPEN_SOURCE"; 47 48 # some packages want to link to the static tcmalloc_minimal 49 # to drop the runtime dependency on gperftools 50 dontDisableStatic = true; 51 52 enableParallelBuilding = true; 53 54 meta = with lib; { 55 homepage = "https://github.com/gperftools/gperftools"; 56 description = "Fast, multi-threaded malloc() and nifty performance analysis tools"; 57 platforms = platforms.all; 58 license = licenses.bsd3; 59 maintainers = with maintainers; [ vcunat ]; 60 }; 61}