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