about summary refs log tree commit diff
path: root/nixpkgs/pkgs/development/libraries/jemalloc
diff options
context:
space:
mode:
Diffstat (limited to 'nixpkgs/pkgs/development/libraries/jemalloc')
-rw-r--r--nixpkgs/pkgs/development/libraries/jemalloc/common.nix43
-rw-r--r--nixpkgs/pkgs/development/libraries/jemalloc/default.nix4
-rw-r--r--nixpkgs/pkgs/development/libraries/jemalloc/jemalloc450.nix4
3 files changed, 51 insertions, 0 deletions
diff --git a/nixpkgs/pkgs/development/libraries/jemalloc/common.nix b/nixpkgs/pkgs/development/libraries/jemalloc/common.nix
new file mode 100644
index 000000000000..c14ac7c65abd
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/jemalloc/common.nix
@@ -0,0 +1,43 @@
+{ version, sha256 }:
+{ stdenv, fetchurl
+# By default, jemalloc puts a je_ prefix onto all its symbols on OSX, which
+# then stops downstream builds (mariadb in particular) from detecting it. This
+# option should remove the prefix and give us a working jemalloc.
+# Causes segfaults with some software (ex. rustc), but defaults to true for backward
+# compatibility.
+, stripPrefix ? stdenv.hostPlatform.isDarwin
+, disableInitExecTls ? false
+}:
+
+with stdenv.lib;
+
+stdenv.mkDerivation rec {
+  name = "jemalloc-${version}";
+  inherit version;
+
+  src = fetchurl {
+    url = "https://github.com/jemalloc/jemalloc/releases/download/${version}/${name}.tar.bz2";
+    inherit sha256;
+  };
+
+  # see the comment on stripPrefix
+  configureFlags = []
+    ++ optional stripPrefix "--with-jemalloc-prefix="
+    ++ optional disableInitExecTls "--disable-initial-exec-tls"
+  ;
+
+  doCheck = true;
+
+  enableParallelBuilding = true;
+
+  meta = with stdenv.lib; {
+    homepage = http://jemalloc.net;
+    description = "General purpose malloc(3) implementation";
+    longDescription = ''
+      malloc(3)-compatible memory allocator that emphasizes fragmentation
+      avoidance and scalable concurrency support.
+    '';
+    license = licenses.bsd2;
+    platforms = platforms.all;
+  };
+}
diff --git a/nixpkgs/pkgs/development/libraries/jemalloc/default.nix b/nixpkgs/pkgs/development/libraries/jemalloc/default.nix
new file mode 100644
index 000000000000..7ea7bccd6b87
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/jemalloc/default.nix
@@ -0,0 +1,4 @@
+import ./common.nix {
+  version = "5.1.0";
+  sha256 = "0s3jpcyhzia8d4k0xyc67is78kg416p9yc3c2f9w6fhhqqffd5jk";
+}
diff --git a/nixpkgs/pkgs/development/libraries/jemalloc/jemalloc450.nix b/nixpkgs/pkgs/development/libraries/jemalloc/jemalloc450.nix
new file mode 100644
index 000000000000..d328ab8016a1
--- /dev/null
+++ b/nixpkgs/pkgs/development/libraries/jemalloc/jemalloc450.nix
@@ -0,0 +1,4 @@
+import ./common.nix {
+  version = "4.5.0";
+  sha256 = "10373xhpc10pgmai9fkc1z0rs029qlcb3c0qfnvkbwdlcibdh2cl";
+}