summary refs log tree commit diff
path: root/gnu/packages/crates-io.scm
diff options
context:
space:
mode:
authorEfraim Flashner <efraim@flashner.co.il>2019-09-05 18:14:38 +0300
committerEfraim Flashner <efraim@flashner.co.il>2019-09-06 15:46:01 +0300
commitf32a4ba74660b6f1adfc7e61343a1684ffedeb8a (patch)
tree3e8789e6ba6166e41956ed3cb9d980d79b9000d9 /gnu/packages/crates-io.scm
parentc891c7f174eb1942e75324f494aade8da1c04f36 (diff)
downloadguix-f32a4ba74660b6f1adfc7e61343a1684ffedeb8a.tar.gz
gnu: Add rust-jemalloc-sys.
* gnu/packages/crates-io.scm (rust-jemalloc-sys): New variable.
Diffstat (limited to 'gnu/packages/crates-io.scm')
-rw-r--r--gnu/packages/crates-io.scm36
1 files changed, 36 insertions, 0 deletions
diff --git a/gnu/packages/crates-io.scm b/gnu/packages/crates-io.scm
index 35453124ef..7a7b2be4f4 100644
--- a/gnu/packages/crates-io.scm
+++ b/gnu/packages/crates-io.scm
@@ -25,6 +25,7 @@
   #:use-module ((guix licenses) #:prefix license:)
   #:use-module (guix packages)
   #:use-module (gnu packages gcc)
+  #:use-module (gnu packages jemalloc)
   #:use-module (gnu packages maths)
   #:use-module (gnu packages pkg-config))
 
@@ -1026,6 +1027,41 @@ primitives to an @code{io::Write}.")
     (license (list license:asl2.0
                    license:expat))))
 
+(define-public rust-jemalloc-sys
+  (package
+    (name "rust-jemalloc-sys")
+    (version "0.3.2")
+    (source
+      (origin
+        (method url-fetch)
+        (uri (crate-uri "jemalloc-sys" version))
+        (file-name (string-append name "-" version ".tar.gz"))
+        (sha256
+         (base32
+          "0ify9vlql01qhfxlj7d4p9jvcp90mj2h69nkbq7slccvbhzryfqd"))))
+    (build-system cargo-build-system)
+    (arguments
+     `(#:cargo-inputs
+       (("rust-libc" ,rust-libc)
+        ("rust-cc" ,rust-cc)
+        ("rust-fs-extra" ,rust-fs-extra))
+       #:phases
+       (modify-phases %standard-phases
+         (add-after 'unpack 'override-jemalloc
+           (lambda* (#:key inputs #:allow-other-keys)
+             (let ((jemalloc (assoc-ref inputs "jemalloc")))
+               (delete-file-recursively "jemalloc")
+               (setenv "JEMALLOC_OVERRIDE"
+                       (string-append jemalloc "/lib/libjemalloc_pic.a")))
+             #t)))))
+    (inputs
+     `(("jemalloc" ,jemalloc)))
+    (home-page "https://github.com/gnzlbg/jemallocator")
+    (synopsis "Rust FFI bindings to jemalloc")
+    (description "This package provides Rust FFI bindings to jemalloc.")
+    (license (list license:asl2.0
+                   license:expat))))
+
 (define-public rust-json
   (package
     (name "rust-json")