jemalloc.scm 3.7 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283848586878889909192939495
  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. (define-module (gnu packages jemalloc)
  22. #:use-module (srfi srfi-1)
  23. #:use-module (srfi srfi-26)
  24. #:use-module (ice-9 match)
  25. #:use-module ((guix licenses) #:select (bsd-2))
  26. #:use-module (guix packages)
  27. #:use-module (guix download)
  28. #:use-module (guix utils)
  29. #:use-module (gnu packages)
  30. #:use-module (gnu packages perl)
  31. #:use-module (guix build-system gnu))
  32. (define-public jemalloc-4.5.0
  33. (package
  34. (name "jemalloc")
  35. (version "4.5.0")
  36. (source (origin
  37. (method url-fetch)
  38. (uri (string-append
  39. "https://github.com/jemalloc/jemalloc/releases/download/"
  40. version "/jemalloc-" version ".tar.bz2"))
  41. (sha256
  42. (base32
  43. "10373xhpc10pgmai9fkc1z0rs029qlcb3c0qfnvkbwdlcibdh2cl"))))
  44. (build-system gnu-build-system)
  45. (arguments
  46. `(#:phases
  47. (modify-phases %standard-phases
  48. (add-after 'unpack 'delete-thp-test
  49. ;; This test does not check if transparent huge pages are supported
  50. ;; on the system before running the test.
  51. (lambda _
  52. (substitute* "Makefile.in"
  53. (("\\$\\(srcroot\\)test/unit/pages.c \\\\") "\\"))
  54. #t)))
  55. #:configure-flags
  56. '(,@(match (%current-system)
  57. ((or "i686-linux" "x86_64-linux")
  58. '())
  59. ("powerpc-linux"
  60. (list "--disable-thp" "CPPFLAGS=-maltivec"))
  61. (_
  62. (list "--disable-thp"))))))
  63. ;; Install the scripts to a separate output to avoid referencing Perl and
  64. ;; Bash in the default output, saving ~75 MiB on the closure.
  65. (outputs '("out" "bin"))
  66. (home-page "http://jemalloc.net/")
  67. (synopsis "General-purpose scalable concurrent malloc implementation")
  68. (description
  69. "This library providing a malloc(3) implementation that emphasizes
  70. fragmentation avoidance and scalable concurrency support.")
  71. (license bsd-2)))
  72. (define-public jemalloc
  73. (package
  74. (inherit jemalloc-4.5.0)
  75. (version "5.2.1")
  76. (source (origin
  77. (method url-fetch)
  78. (uri (string-append
  79. "https://github.com/jemalloc/jemalloc/releases/download/"
  80. version "/jemalloc-" version ".tar.bz2"))
  81. (sha256
  82. (base32
  83. "1xl7z0vwbn5iycg7amka9jd6hxd8nmfk7nahi4p9w2bnw9f0wcrl"))))
  84. (arguments
  85. (substitute-keyword-arguments (package-arguments jemalloc-4.5.0)
  86. ;; Disable the thread local storage model in jemalloc 5 to prevent
  87. ;; shared libraries linked to libjemalloc from crashing on dlopen()
  88. ;; https://github.com/jemalloc/jemalloc/issues/937
  89. ((#:configure-flags base-configure-flags '())
  90. `(cons "--disable-initial-exec-tls" ,base-configure-flags))))
  91. (inputs `(("perl" ,perl)))))