From f6ee60dde4a00f94d57f44ae768b3f5ccb228672 Mon Sep 17 00:00:00 2001 From: Sergei Trofimovich Date: Thu, 14 Jul 2022 23:42:24 +0100 Subject: [PATCH] gnumake: unconditionally disable guileSupport on bootstrap Before the change an attempt to use `gnumake.override { guileSupport = true; }` caused recursion in bootstrap stages as guileSupport pulls in guile and it's dependencies. To restore the bootstrap the change unconditionally sets `guileSupport = false;` for `gnumake`. Co-authored-by: Sandro --- .../tools/build-managers/gnumake/default.nix | 25 ++++++++++++++++--- pkgs/stdenv/linux/default.nix | 7 +++++- 2 files changed, 27 insertions(+), 5 deletions(-) diff --git a/pkgs/development/tools/build-managers/gnumake/default.nix b/pkgs/development/tools/build-managers/gnumake/default.nix index 7c4b0ad4650e..7a6b78ec084b 100644 --- a/pkgs/development/tools/build-managers/gnumake/default.nix +++ b/pkgs/development/tools/build-managers/gnumake/default.nix @@ -1,4 +1,16 @@ -{ lib, stdenv, fetchurl, guileSupport ? false, pkg-config, guile }: +{ lib +, stdenv +, fetchurl +, guileSupport ? false, guile +# avoid guile depend on bootstrap to prevent dependency cycles +, inBootstrap ? false +, pkg-config +, gnumake +}: + +let + guileEnabled = guileSupport && !inBootstrap; +in stdenv.mkDerivation rec { pname = "gnumake"; @@ -19,10 +31,10 @@ stdenv.mkDerivation rec { ./0002-remove-impure-dirs.patch ]; - nativeBuildInputs = lib.optionals guileSupport [ pkg-config ]; - buildInputs = lib.optionals guileSupport [ guile ]; + nativeBuildInputs = lib.optionals guileEnabled [ pkg-config ]; + buildInputs = lib.optionals guileEnabled [ guile ]; - configureFlags = lib.optional guileSupport "--with-guile" + configureFlags = lib.optional guileEnabled "--with-guile" # Make uses this test to decide whether it should keep track of # subseconds. Apple made this possible with APFS and macOS 10.13. @@ -36,6 +48,11 @@ stdenv.mkDerivation rec { outputs = [ "out" "man" "info" ]; separateDebugInfo = true; + passthru.tests = { + # make sure that the override doesn't break bootstrapping + gnumakeWithGuile = gnumake.override { guileSupport = true; }; + }; + meta = with lib; { description = "A tool to control the generation of non-source files from sources"; longDescription = '' diff --git a/pkgs/stdenv/linux/default.nix b/pkgs/stdenv/linux/default.nix index ff9602722bf3..09a0a50c0037 100644 --- a/pkgs/stdenv/linux/default.nix +++ b/pkgs/stdenv/linux/default.nix @@ -356,6 +356,10 @@ in # stage5.gcc -> stage4.coreutils -> stage3.glibc -> bootstrap gmp = lib.makeOverridable (super.gmp.override { stdenv = self.stdenv; }).overrideAttrs (a: { pname = "${a.pname}-stage4"; }); + # To allow users' overrides inhibit dependencies too heavy for + # bootstrap, like guile: https://github.com/NixOS/nixpkgs/issues/181188 + gnumake = super.gnumake.override { inBootstrap = true; }; + gcc = lib.makeOverridable (import ../../build-support/cc-wrapper) { nativeTools = false; nativeLibc = false; @@ -446,7 +450,7 @@ in overrides = self: super: { inherit (prevStage) gzip bzip2 xz bash coreutils diffutils findutils gawk - gnumake gnused gnutar gnugrep gnupatch patchelf + gnused gnutar gnugrep gnupatch patchelf attr acl zlib pcre libunistring; ${localSystem.libc} = getLibc prevStage; @@ -457,6 +461,7 @@ in inherit (self) stdenv runCommandLocal patchelf libunistring; }; + gnumake = super.gnumake.override { inBootstrap = false; }; } // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) { # Need to get rid of these when cross-compiling. inherit (prevStage) binutils binutils-unwrapped;