gnu: python-deepmerge: Use pyproject-build-system.
[jackhill/guix/guix.git] / gnu / packages / jemalloc.scm
1 ;;; GNU Guix --- Functional package management for GNU
2 ;;; Copyright © 2015 Sou Bunnbu <iyzsong@gmail.com>
3 ;;; Copyright © 2017, 2020, 2021 Efraim Flashner <efraim@flashner.co.il>
4 ;;; Copyright © 2017 Eric Bavier <bavier@member.fsf.org>
5 ;;; Copyright © 2021 Ryan Sundberg <ryan@arctype.co>
6 ;;;
7 ;;; This file is part of GNU Guix.
8 ;;;
9 ;;; GNU Guix is free software; you can redistribute it and/or modify it
10 ;;; under the terms of the GNU General Public License as published by
11 ;;; the Free Software Foundation; either version 3 of the License, or (at
12 ;;; your option) any later version.
13 ;;;
14 ;;; GNU Guix is distributed in the hope that it will be useful, but
15 ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
16 ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
17 ;;; GNU General Public License for more details.
18 ;;;
19 ;;; You should have received a copy of the GNU General Public License
20 ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
21
22 (define-module (gnu packages jemalloc)
23 #:use-module (srfi srfi-1)
24 #:use-module (srfi srfi-26)
25 #:use-module (ice-9 match)
26 #:use-module ((guix licenses) #:select (bsd-2))
27 #:use-module (guix packages)
28 #:use-module (guix download)
29 #:use-module (guix utils)
30 #:use-module (gnu packages)
31 #:use-module (gnu packages perl)
32 #:use-module (guix build-system gnu))
33
34 (define-public jemalloc-4.5.0
35 (package
36 (name "jemalloc")
37 (version "4.5.0")
38 (source (origin
39 (method url-fetch)
40 (uri (string-append
41 "https://github.com/jemalloc/jemalloc/releases/download/"
42 version "/jemalloc-" version ".tar.bz2"))
43 (sha256
44 (base32
45 "10373xhpc10pgmai9fkc1z0rs029qlcb3c0qfnvkbwdlcibdh2cl"))))
46 (build-system gnu-build-system)
47 (arguments
48 `(#:phases
49 (modify-phases %standard-phases
50 (add-after 'unpack 'delete-thp-test
51 ;; This test does not check if transparent huge pages are supported
52 ;; on the system before running the test.
53 (lambda _
54 (substitute* "Makefile.in"
55 (("\\$\\(srcroot\\)test/unit/pages.c \\\\") "\\"))
56 #t)))
57 #:configure-flags
58 '(,@(match (%current-system)
59 ((or "i686-linux" "x86_64-linux")
60 '())
61 ("powerpc-linux"
62 (list "--disable-thp" "CPPFLAGS=-maltivec"))
63 (_
64 (list "--disable-thp"))))))
65 ;; Install the scripts to a separate output to avoid referencing Perl and
66 ;; Bash in the default output, saving ~75 MiB on the closure.
67 (outputs '("out" "bin"))
68 (home-page "http://jemalloc.net/")
69 (synopsis "General-purpose scalable concurrent malloc implementation")
70 (description
71 "This library providing a malloc(3) implementation that emphasizes
72 fragmentation avoidance and scalable concurrency support.")
73 (license bsd-2)))
74
75 (define-public jemalloc
76 (package
77 (inherit jemalloc-4.5.0)
78 (version "5.2.1")
79 (source (origin
80 (method url-fetch)
81 (uri (string-append
82 "https://github.com/jemalloc/jemalloc/releases/download/"
83 version "/jemalloc-" version ".tar.bz2"))
84 (sha256
85 (base32
86 "1xl7z0vwbn5iycg7amka9jd6hxd8nmfk7nahi4p9w2bnw9f0wcrl"))))
87 (arguments
88 (substitute-keyword-arguments (package-arguments jemalloc-4.5.0)
89 ;; Disable the thread local storage model in jemalloc 5 to prevent
90 ;; shared libraries linked to libjemalloc from crashing on dlopen()
91 ;; https://github.com/jemalloc/jemalloc/issues/937
92 ((#:configure-flags base-configure-flags '())
93 `(cons "--disable-initial-exec-tls" ,base-configure-flags))))
94 (inputs (list perl))))