From e1be45ebec66a5fe1f429db253d43aeb2f42e9c5 Mon Sep 17 00:00:00 2001 From: Qyriad Date: Sat, 6 Apr 2024 15:44:27 -0600 Subject: [PATCH] package: put boehmgc patch logic in package.nix In our view it really doesn't make sense to not have this in in package.nix in some way. These patches aren't just for performance or something -- Lix flat out doesn't build without these patches. (Arguably that makes them a buildsystem responsibility as well, but that can wait for when we're ready to start adding subproject fallback dependency resolution to Meson.) This is a step towards making `package.nix` more self-sufficient and `callPackage`able without excessive external logic. Change-Id: Ia37fe8171f87d3293033de8be07d9bab12716f1d --- flake.nix | 10 +++++++--- package.nix | 19 ++++++++++++++++++- 2 files changed, 25 insertions(+), 4 deletions(-) diff --git a/flake.nix b/flake.nix index 647d15b4a..4bbbedab9 100644 --- a/flake.nix +++ b/flake.nix @@ -163,6 +163,13 @@ build-release-notes = final.buildPackages.callPackage ./maintainers/build-release-notes.nix { }; clangbuildanalyzer = final.buildPackages.callPackage ./misc/clangbuildanalyzer.nix { }; + + # This patched version of boehmgc is not passed to to package.nix + # because package.nix implements this logic as well + # (since Lix just doesn't build without these patches). + # The logic is here too so the patched version of boehmgc can be + # available to consumers of this overlay, which this flake exports + # as outputs.overlays.default. boehmgc-nix = (final.boehmgc.override { enableLargeConfig = true; }).overrideAttrs (o: { @@ -203,7 +210,6 @@ nix = final.callPackage ./package.nix { inherit versionSuffix fileset; stdenv = currentStdenv; - boehmgc = final.boehmgc-nix; busybox-sandbox-shell = final.busybox-sandbox-shell or final.default-busybox-sandbox-shell; nix-doc = final.nix-doc; }; @@ -268,7 +274,6 @@ inherit versionSuffix fileset officialRelease buildUnreleasedNotes; inherit (pkgs) build-release-notes; internalApiDocs = true; - boehmgc = pkgs.boehmgc-nix; busybox-sandbox-shell = pkgs.busybox-sandbox-shell; }; in @@ -406,7 +411,6 @@ let nix = pkgs.callPackage ./package.nix { inherit stdenv versionSuffix fileset; - boehmgc = pkgs.boehmgc-nix; busybox-sandbox-shell = pkgs.busybox-sandbox-shell or pkgs.default-busybox-sandbox; forDevShell = true; }; diff --git a/package.nix b/package.nix index 6931726ad..20a80bab4 100644 --- a/package.nix +++ b/package.nix @@ -5,6 +5,23 @@ autoconf-archive, autoreconfHook, aws-sdk-cpp, + # If the patched version of Boehm isn't passed, then patch it based off of + # pkgs.boehmgc. This allows `callPackage`ing this file without needing to + # to implement behavior that this package flat out doesn't build without + # anyway, but also allows easily overriding the patch logic. + boehmgc-nix ? (boehmgc.override { + enableLargeConfig = true; + }).overrideAttrs { + # We do *not* include prev.patches (which doesn't exist in normal pkgs.boehmgc anyway) + # because if the caller of this package passed a patched boehm as `boehmgc` instead of + # `boehmgc-nix` then this will almost certainly have duplicate patches, which means + # the patches won't apply and we'll get a build failure. + patches = [ + ./boehmgc-coroutine-sp-fallback.diff + # https://github.com/ivmai/bdwgc/pull/586 + ./boehmgc-traceable_allocator-public.diff + ]; + }, boehmgc, nlohmann_json, bison, @@ -81,7 +98,7 @@ # 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 + boehmgc-nix nlohmann_json ];