| 1 | ;;; GNU Guix --- Functional package management for GNU |
| 2 | ;;; Copyright © 2012, 2013, 2014, 2016, 2017, 2020 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 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 | |
| 23 | (define-module (gnu packages bdw-gc) |
| 24 | #:use-module (guix licenses) |
| 25 | #:use-module (guix packages) |
| 26 | #:use-module (guix download) |
| 27 | #:use-module (guix build-system gnu) |
| 28 | #:use-module (gnu packages pkg-config) |
| 29 | #:use-module (gnu packages hurd)) |
| 30 | |
| 31 | (define-public libgc |
| 32 | (package |
| 33 | (name "libgc") |
| 34 | (version "7.6.12") |
| 35 | (source (origin |
| 36 | (method url-fetch) |
| 37 | (uri (string-append "https://github.com/ivmai/bdwgc/releases" |
| 38 | "/download/v" version "/gc-" version ".tar.gz")) |
| 39 | (sha256 |
| 40 | (base32 |
| 41 | "10jhhi79d5brwlsyhwgpnrmc8nhlf7aan2lk9xhgihk5jc6srbvc")))) |
| 42 | (build-system gnu-build-system) |
| 43 | (arguments |
| 44 | `(#:configure-flags |
| 45 | (list |
| 46 | ;; Install gc_cpp.h et al. |
| 47 | "--enable-cplusplus" |
| 48 | ;; In GNU/Hurd systems during the 'Check' phase, |
| 49 | ;; there is a deadlock caused by the 'gctest' test. |
| 50 | ;; To disable the error set "--disable-gcj-support" |
| 51 | ;; to configure script. See bug report and discussion: |
| 52 | ;; <https://lists.opendylan.org/pipermail/bdwgc/2017-April/006275.html> |
| 53 | ;; <https://lists.gnu.org/archive/html/bug-hurd/2017-01/msg00008.html> |
| 54 | ,@(if (hurd-triplet? (or (%current-system) |
| 55 | (%current-target-system))) |
| 56 | '("--disable-gcj-support") |
| 57 | '())) |
| 58 | #:phases (modify-phases %standard-phases |
| 59 | (add-after 'unpack 'adjust-pc-file |
| 60 | (lambda* (#:key inputs #:allow-other-keys) |
| 61 | (let ((libatomic-ops (assoc-ref inputs "libatomic-ops"))) |
| 62 | ;; GC 7.6.10 and later includes -latomic_ops in the |
| 63 | ;; pkg-config file. To avoid propagation, insert an |
| 64 | ;; absolute reference so dependent programs can find it. |
| 65 | (substitute* "bdw-gc.pc.in" |
| 66 | (("@ATOMIC_OPS_LIBS@" match) |
| 67 | (string-append "-L" libatomic-ops "/lib " |
| 68 | match))) |
| 69 | #t)))))) |
| 70 | (native-inputs `(("pkg-config" ,pkg-config))) |
| 71 | (inputs `(("libatomic-ops" ,libatomic-ops))) |
| 72 | (outputs '("out" "debug")) |
| 73 | (synopsis "The Boehm-Demers-Weiser conservative garbage collector |
| 74 | for C and C++") |
| 75 | (description |
| 76 | "The Boehm-Demers-Weiser conservative garbage collector can be used |
| 77 | as a garbage collecting replacement for C malloc or C++ new. It allows |
| 78 | you to allocate memory basically as you normally would, without |
| 79 | explicitly deallocating memory that is no longer useful. The collector |
| 80 | automatically recycles memory when it determines that it can no longer |
| 81 | be otherwise accessed. |
| 82 | |
| 83 | The collector is also used by a number of programming language |
| 84 | implementations that either use C as intermediate code, want to |
| 85 | facilitate easier interoperation with C libraries, or just prefer the |
| 86 | simple collector interface. |
| 87 | |
| 88 | Alternatively, the garbage collector may be used as a leak detector for |
| 89 | C or C++ programs, though that is not its primary goal.") |
| 90 | (home-page "https://www.hboehm.info/gc/") |
| 91 | |
| 92 | (license (x11-style (string-append home-page "license.txt"))))) |
| 93 | |
| 94 | (define-public libgc-8.0 |
| 95 | (package |
| 96 | (inherit libgc) |
| 97 | (version "8.0.4") |
| 98 | (source (origin |
| 99 | (method url-fetch) |
| 100 | (uri (string-append "https://github.com/ivmai/bdwgc/releases" |
| 101 | "/download/v" version "/gc-" version ".tar.gz")) |
| 102 | (sha256 |
| 103 | (base32 |
| 104 | "1798rp3mcfkgs38ynkbg2p47bq59pisrc6mn0l20pb5iczf0ssj3")))))) |
| 105 | |
| 106 | (define-public libgc/back-pointers |
| 107 | (package/inherit |
| 108 | libgc |
| 109 | (name "libgc-back-pointers") |
| 110 | (arguments |
| 111 | `(#:make-flags |
| 112 | (list "CPPFLAGS=-DKEEP_BACK_PTRS=1") |
| 113 | ,@(package-arguments libgc))) |
| 114 | (synopsis "The BDW garbage collector, with back-pointer tracking"))) |
| 115 | |
| 116 | (define-public libatomic-ops |
| 117 | (package |
| 118 | (name "libatomic-ops") |
| 119 | (version "7.6.10") |
| 120 | (source (origin |
| 121 | (method url-fetch) |
| 122 | (uri (string-append |
| 123 | "https://github.com/ivmai/libatomic_ops/releases/download/v" |
| 124 | version "/libatomic_ops-" version ".tar.gz")) |
| 125 | (sha256 |
| 126 | (base32 |
| 127 | "1bwry043f62pc4mgdd37zx3fif19qyrs8f5bw7qxlmkzh5hdyzjq")))) |
| 128 | (build-system gnu-build-system) |
| 129 | (outputs '("out" "debug")) |
| 130 | (synopsis "Accessing hardware atomic memory update operations") |
| 131 | (description |
| 132 | "This C library provides semi-portable access to hardware-provided atomic |
| 133 | memory update operations on a number of architectures. These might allow you to |
| 134 | write code that does more interesting things in signal handlers, write |
| 135 | lock-free code, experiment with thread programming paradigms, etc.") |
| 136 | (home-page "https://github.com/ivmai/libatomic_ops/") |
| 137 | |
| 138 | ;; Some source files are X11-style, others are GPLv2+. |
| 139 | (license gpl2+))) |