Merge "package: improve support for building without BDW-GC" into main

This commit is contained in:
alois31 2024-08-07 07:07:28 +00:00 committed by Gerrit Code Review
commit 780998f4ea
2 changed files with 8 additions and 9 deletions

View file

@ -58,8 +58,11 @@
buildUnreleasedNotes ? true, buildUnreleasedNotes ? true,
internalApiDocs ? false, 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. # List of Meson sanitize options. Accepts values of b_sanitize, e.g.
# "address", "undefined", "thread". # "address", "undefined", "thread".
# Enabling the "address" sanitizer will disable garbage collection in the evaluator.
sanitize ? null, sanitize ? null,
# Turn compiler warnings into errors. # Turn compiler warnings into errors.
werror ? false, werror ? false,
@ -118,10 +121,7 @@ let
# The internal API docs need these for the build, but if we're not building # 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. # Nix itself, then these don't need to be propagated.
maybePropagatedInputs = [ maybePropagatedInputs = lib.optional enableGC boehmgc-nix ++ [ nlohmann_json ];
boehmgc-nix
nlohmann_json
];
# .gitignore has already been processed, so any changes in it are irrelevant # .gitignore has already been processed, so any changes in it are irrelevant
# at this point. It is not represented verbatim for test purposes because # at this point. It is not represented verbatim for test purposes because
@ -179,10 +179,9 @@ stdenv.mkDerivation (finalAttrs: {
mesonFlags = mesonFlags =
let let
sanitizeOpts = lib.optionals (sanitize != null) ( sanitizeOpts = lib.optional (
[ "-Db_sanitize=${builtins.concatStringsSep "," sanitize}" ] sanitize != null
++ lib.optional (builtins.elem "address" sanitize) "-Dgc=disabled" ) "-Db_sanitize=${builtins.concatStringsSep "," sanitize}";
);
in in
lib.optionals hostPlatform.isLinux [ lib.optionals hostPlatform.isLinux [
# You'd think meson could just find this in PATH, but busybox is in buildInputs, # 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, # mesonConfigurePhase automatically passes -Dauto_features=enabled,
# so we must explicitly enable or disable features that we are not passing # so we must explicitly enable or disable features that we are not passing
# dependencies for. # dependencies for.
(lib.mesonEnable "gc" enableGC)
(lib.mesonEnable "internal-api-docs" internalApiDocs) (lib.mesonEnable "internal-api-docs" internalApiDocs)
(lib.mesonBool "enable-tests" finalAttrs.finalPackage.doCheck) (lib.mesonBool "enable-tests" finalAttrs.finalPackage.doCheck)
(lib.mesonBool "enable-docs" canRunInstalled) (lib.mesonBool "enable-docs" canRunInstalled)

View file

@ -13,7 +13,6 @@
#include "search-path.hh" #include "search-path.hh"
#include "repl-exit-status.hh" #include "repl-exit-status.hh"
#include <gc/gc_allocator.h>
#include <map> #include <map>
#include <optional> #include <optional>
#include <unordered_map> #include <unordered_map>