nixpkgs mirror (for testing) github.com/NixOS/nixpkgs
nix
at 20.09 50 lines 1.6 kB view raw
1{ version, sha256 }: 2{ stdenv, fetchurl 3# By default, jemalloc puts a je_ prefix onto all its symbols on OSX, which 4# then stops downstream builds (mariadb in particular) from detecting it. This 5# option should remove the prefix and give us a working jemalloc. 6# Causes segfaults with some software (ex. rustc), but defaults to true for backward 7# compatibility. 8, stripPrefix ? stdenv.hostPlatform.isDarwin 9, disableInitExecTls ? false 10}: 11 12with stdenv.lib; 13 14stdenv.mkDerivation rec { 15 pname = "jemalloc"; 16 inherit version; 17 18 src = fetchurl { 19 url = "https://github.com/jemalloc/jemalloc/releases/download/${version}/${pname}-${version}.tar.bz2"; 20 inherit sha256; 21 }; 22 23 # see the comment on stripPrefix 24 configureFlags = [] 25 ++ optional stripPrefix "--with-jemalloc-prefix=" 26 ++ optional disableInitExecTls "--disable-initial-exec-tls" 27 # jemalloc is unable to correctly detect transparent hugepage support on 28 # ARM (https://github.com/jemalloc/jemalloc/issues/526), and the default 29 # kernel ARMv6/7 kernel does not enable it, so we explicitly disable support 30 ++ optionals (stdenv.isAarch32 && versionOlder version "5") [ 31 "--disable-thp" 32 "je_cv_thp=no" 33 ] 34 ; 35 36 doCheck = true; 37 38 enableParallelBuilding = true; 39 40 meta = with stdenv.lib; { 41 homepage = "http://jemalloc.net"; 42 description = "General purpose malloc(3) implementation"; 43 longDescription = '' 44 malloc(3)-compatible memory allocator that emphasizes fragmentation 45 avoidance and scalable concurrency support. 46 ''; 47 license = licenses.bsd2; 48 platforms = platforms.all; 49 }; 50}