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