bdw-gc.scm 5.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148
  1. ;;; GNU Guix --- Functional package management for GNU
  2. ;;; Copyright © 2012, 2013, 2014, 2016, 2017, 2020, 2021 Ludovic Courtès <ludo@gnu.org>
  3. ;;; Copyright © 2014 Mark H Weaver <mhw@netris.org>
  4. ;;; Copyright © 2016, 2018 Leo Famulari <leo@famulari.name>
  5. ;;; Copyright © 2017 Rene Saavedra <rennes@openmailbox.org>
  6. ;;; Copyright © 2019, 2020 Marius Bakke <mbakke@fastmail.com>
  7. ;;;
  8. ;;; This file is part of GNU Guix.
  9. ;;;
  10. ;;; GNU Guix is free software; you can redistribute it and/or modify it
  11. ;;; under the terms of the GNU General Public License as published by
  12. ;;; the Free Software Foundation; either version 3 of the License, or (at
  13. ;;; your option) any later version.
  14. ;;;
  15. ;;; GNU Guix is distributed in the hope that it will be useful, but
  16. ;;; WITHOUT ANY WARRANTY; without even the implied warranty of
  17. ;;; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  18. ;;; GNU General Public License for more details.
  19. ;;;
  20. ;;; You should have received a copy of the GNU General Public License
  21. ;;; along with GNU Guix. If not, see <http://www.gnu.org/licenses/>.
  22. (define-module (gnu packages bdw-gc)
  23. #:use-module (guix licenses)
  24. #:use-module (guix packages)
  25. #:use-module (guix download)
  26. #:use-module (guix utils)
  27. #:use-module (guix build-system gnu)
  28. #:use-module (gnu packages pkg-config)
  29. #:use-module (gnu packages hurd))
  30. (define-public libgc
  31. (package
  32. (name "libgc")
  33. (version "8.0.4")
  34. (source (origin
  35. (method url-fetch)
  36. (uri (string-append "https://github.com/ivmai/bdwgc/releases"
  37. "/download/v" version "/gc-" version ".tar.gz"))
  38. (sha256
  39. (base32
  40. "1798rp3mcfkgs38ynkbg2p47bq59pisrc6mn0l20pb5iczf0ssj3"))))
  41. (build-system gnu-build-system)
  42. (arguments
  43. `(#:configure-flags
  44. (list
  45. ;; Install gc_cpp.h et al.
  46. "--enable-cplusplus"
  47. ;; Work around <https://github.com/ivmai/bdwgc/issues/353>.
  48. "--disable-munmap"
  49. ;; In GNU/Hurd systems during the 'check' phase,
  50. ;; there is a deadlock caused by the 'gctest' test.
  51. ;; To disable the error set "--disable-gcj-support"
  52. ;; to configure script. See bug report and discussion:
  53. ;; <https://lists.opendylan.org/pipermail/bdwgc/2017-April/006275.html>
  54. ;; <https://lists.gnu.org/archive/html/bug-hurd/2017-01/msg00008.html>
  55. ,@(if (target-hurd? (or (%current-system)
  56. (%current-target-system)))
  57. '("--disable-gcj-support")
  58. '()))))
  59. (native-inputs `(("pkg-config" ,pkg-config)))
  60. (propagated-inputs
  61. (if (%current-target-system)
  62. ;; The build system refuses to check for compiler intrinsics when
  63. ;; cross-compiling, and demands using libatomic-ops instead.
  64. `(("libatomic-ops" ,libatomic-ops))
  65. '()))
  66. (outputs '("out" "debug"))
  67. (synopsis "The Boehm-Demers-Weiser conservative garbage collector
  68. for C and C++")
  69. (description
  70. "The Boehm-Demers-Weiser conservative garbage collector can be used
  71. as a garbage collecting replacement for C malloc or C++ new. It allows
  72. you to allocate memory basically as you normally would, without
  73. explicitly deallocating memory that is no longer useful. The collector
  74. automatically recycles memory when it determines that it can no longer
  75. be otherwise accessed.
  76. The collector is also used by a number of programming language
  77. implementations that either use C as intermediate code, want to
  78. facilitate easier interoperation with C libraries, or just prefer the
  79. simple collector interface.
  80. Alternatively, the garbage collector may be used as a leak detector for
  81. C or C++ programs, though that is not its primary goal.")
  82. (home-page "https://www.hboehm.info/gc/")
  83. (license (x11-style (string-append home-page "license.txt")))))
  84. ;; TODO: Add a static output in libgc in the next rebuild cycle.
  85. (define-public libgc/static-libs
  86. (package/inherit
  87. libgc
  88. (arguments (substitute-keyword-arguments (package-arguments libgc)
  89. ((#:configure-flags flags ''())
  90. `(cons "--enable-static" ,flags))))
  91. (properties '((hidden? . #t)))))
  92. (define-public libgc-7
  93. (package
  94. (inherit libgc)
  95. (version "7.6.12")
  96. (source (origin
  97. (method url-fetch)
  98. (uri (string-append "https://github.com/ivmai/bdwgc/releases"
  99. "/download/v" version "/gc-" version ".tar.gz"))
  100. (sha256
  101. (base32
  102. "10jhhi79d5brwlsyhwgpnrmc8nhlf7aan2lk9xhgihk5jc6srbvc"))))
  103. (propagated-inputs `(("libatomic-ops" ,libatomic-ops)))))
  104. (define-public libgc/back-pointers
  105. (package/inherit
  106. libgc
  107. (name "libgc-back-pointers")
  108. (arguments
  109. `(#:make-flags
  110. (list "CPPFLAGS=-DKEEP_BACK_PTRS=1")
  111. ,@(package-arguments libgc)))
  112. (synopsis "The BDW garbage collector, with back-pointer tracking")))
  113. (define-public libatomic-ops
  114. (package
  115. (name "libatomic-ops")
  116. (version "7.6.10")
  117. (source (origin
  118. (method url-fetch)
  119. (uri (string-append
  120. "https://github.com/ivmai/libatomic_ops/releases/download/v"
  121. version "/libatomic_ops-" version ".tar.gz"))
  122. (sha256
  123. (base32
  124. "1bwry043f62pc4mgdd37zx3fif19qyrs8f5bw7qxlmkzh5hdyzjq"))))
  125. (build-system gnu-build-system)
  126. (outputs '("out" "debug"))
  127. (synopsis "Accessing hardware atomic memory update operations")
  128. (description
  129. "This C library provides semi-portable access to hardware-provided atomic
  130. memory update operations on a number of architectures. These might allow you to
  131. write code that does more interesting things in signal handlers, write
  132. lock-free code, experiment with thread programming paradigms, etc.")
  133. (home-page "https://github.com/ivmai/libatomic_ops/")
  134. ;; Some source files are X11-style, others are GPLv2+.
  135. (license gpl2+)))