aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authoralois31 <alois1@gmx-topmail.de>2024-08-07 07:07:28 +0000
committerGerrit Code Review <gerrit@localhost>2024-08-07 07:07:28 +0000
commit780998f4ea203444e5b07c4523449a8e4f19ecdd (patch)
treeaf8e1375edd756af09244b6d5c6962ec4579192d
parent529eed74c477eee8567f28379210cd47f0b4e18f (diff)
parent58758c0f87c3c643cf6cd188e17597c5299b66d4 (diff)
Merge "package: improve support for building without BDW-GC" into main
-rw-r--r--package.nix16
-rw-r--r--src/libexpr/eval.hh1
2 files changed, 8 insertions, 9 deletions
diff --git a/package.nix b/package.nix
index 0f006fef4..be2f0010d 100644
--- a/package.nix
+++ b/package.nix
@@ -58,8 +58,11 @@
buildUnreleasedNotes ? true,
internalApiDocs ? false,
+ # Support garbage collection in the evaluator.
+ enableGC ? sanitize == null || !builtins.elem "address" sanitize,
# List of Meson sanitize options. Accepts values of b_sanitize, e.g.
# "address", "undefined", "thread".
+ # Enabling the "address" sanitizer will disable garbage collection in the evaluator.
sanitize ? null,
# Turn compiler warnings into errors.
werror ? false,
@@ -118,10 +121,7 @@ let
# The internal API docs need these for the build, but if we're not building
# Nix itself, then these don't need to be propagated.
- maybePropagatedInputs = [
- boehmgc-nix
- nlohmann_json
- ];
+ maybePropagatedInputs = lib.optional enableGC boehmgc-nix ++ [ nlohmann_json ];
# .gitignore has already been processed, so any changes in it are irrelevant
# at this point. It is not represented verbatim for test purposes because
@@ -179,10 +179,9 @@ stdenv.mkDerivation (finalAttrs: {
mesonFlags =
let
- sanitizeOpts = lib.optionals (sanitize != null) (
- [ "-Db_sanitize=${builtins.concatStringsSep "," sanitize}" ]
- ++ lib.optional (builtins.elem "address" sanitize) "-Dgc=disabled"
- );
+ sanitizeOpts = lib.optional (
+ sanitize != null
+ ) "-Db_sanitize=${builtins.concatStringsSep "," sanitize}";
in
lib.optionals hostPlatform.isLinux [
# You'd think meson could just find this in PATH, but busybox is in buildInputs,
@@ -196,6 +195,7 @@ stdenv.mkDerivation (finalAttrs: {
# mesonConfigurePhase automatically passes -Dauto_features=enabled,
# so we must explicitly enable or disable features that we are not passing
# dependencies for.
+ (lib.mesonEnable "gc" enableGC)
(lib.mesonEnable "internal-api-docs" internalApiDocs)
(lib.mesonBool "enable-tests" finalAttrs.finalPackage.doCheck)
(lib.mesonBool "enable-docs" canRunInstalled)
diff --git a/src/libexpr/eval.hh b/src/libexpr/eval.hh
index e54eede40..a264dd348 100644
--- a/src/libexpr/eval.hh
+++ b/src/libexpr/eval.hh
@@ -13,7 +13,6 @@
#include "search-path.hh"
#include "repl-exit-status.hh"
-#include <gc/gc_allocator.h>
#include <map>
#include <optional>
#include <unordered_map>