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 <sandro.jaeckel@gmail.com>
This commit is contained in:
Sergei Trofimovich 2022-07-14 23:42:24 +01:00
parent f0df0acc16
commit f6ee60dde4
2 changed files with 27 additions and 5 deletions

View file

@ -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 = ''

View file

@ -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;