6 # doc: https://github.com/ivmai/bdwgc/blob/v8.2.8/doc/README.macros (LARGE_CONFIG)
7 enableLargeConfig ? false,
13 stdenv.mkDerivation (finalAttrs: {
17 src = fetchFromGitHub {
20 rev = "v${finalAttrs.version}";
21 hash = "sha256-UQSLK/05uPal6/m+HMz0QwXVII1leonlmtSZsXjJ+/c=";
29 separateDebugInfo = stdenv.hostPlatform.isLinux && stdenv.hostPlatform.libc != "musl";
38 "--with-libatomic-ops=none"
40 ++ lib.optional enableStatic "--enable-static"
41 ++ lib.optional enableMmap "--enable-mmap"
42 ++ lib.optional enableLargeConfig "--enable-large-config";
44 # This stanza can be dropped when a release fixes this issue:
45 # https://github.com/ivmai/bdwgc/issues/376
46 # The version is checked with == instead of versionAtLeast so we
47 # don't forget to disable the fix (and if the next release does
48 # not fix the problem the test failure will be a reminder to
49 # extend the set of versions requiring the workaround).
50 makeFlags = lib.optionals (stdenv.hostPlatform.isPower64 && finalAttrs.version == "8.2.8") [
51 # do not use /proc primitives to track dirty bits; see:
52 # https://github.com/ivmai/bdwgc/issues/479#issuecomment-1279687537
53 # https://github.com/ivmai/bdwgc/blob/54522af853de28f45195044dadfd795c4e5942aa/include/private/gcconfig.h#L741
54 "CFLAGS_EXTRA=-DNO_SOFT_VDB"
57 # `gctest` fails under x86_64 emulation on aarch64-darwin
58 # and also on aarch64-linux (qemu-user)
61 (stdenv.hostPlatform.isDarwin && stdenv.hostPlatform.isx86_64)
62 || (stdenv.hostPlatform.isLinux && stdenv.hostPlatform.isAarch64)
65 enableParallelBuilding = true;
67 passthru.tests = nixVersions;
70 homepage = "https://hboehm.info/gc/";
71 description = "Boehm-Demers-Weiser conservative garbage collector for C and C++";
73 The Boehm-Demers-Weiser conservative garbage collector can be used as a
74 garbage collecting replacement for C malloc or C++ new. It allows you
75 to allocate memory basically as you normally would, without explicitly
76 deallocating memory that is no longer useful. The collector
77 automatically recycles memory when it determines that it can no longer
78 be otherwise accessed.
80 The collector is also used by a number of programming language
81 implementations that either use C as intermediate code, want to
82 facilitate easier interoperation with C libraries, or just prefer the
83 simple collector interface.
85 Alternatively, the garbage collector may be used as a leak detector for
86 C or C++ programs, though that is not its primary goal.
88 changelog = "https://github.com/ivmai/bdwgc/blob/v${finalAttrs.version}/ChangeLog";
89 license = "https://hboehm.info/gc/license.txt"; # non-copyleft, X11-style license
90 maintainers = with lib.maintainers; [ ];
91 platforms = lib.platforms.all;