stdenv.darwin: fix infinite recursion after curl update

curl needs to link against several frameworks, but building the
frameworks (directly or indirectly) depends on curl via fetchurl and
fetchFromGitHub. Break the infinite recursion by building the SDKs’
dependencies in the last stage of the stdenv bootstrap using the prior
stage’s fetchurl and fetchFromGitHub.
This commit is contained in:
Randy Eckenrode 2023-10-13 18:28:27 -04:00
parent beb14644b7
commit df14e86d9c
No known key found for this signature in database
GPG Key ID: 64C1CD4EC2A600D9

View File

@ -1047,9 +1047,9 @@ in
overrides = self: super: { overrides = self: super: {
inherit (prevStage) ccWrapperStdenv inherit (prevStage) ccWrapperStdenv
autoconf automake bash bison cmake cmakeMinimal cpio cyrus_sasl db expat flex groff autoconf automake bash bison cmake cmakeMinimal cyrus_sasl db expat flex groff
libedit libtool m4 ninja openldap openssh patchutils pbzx perl pkg-config python3 libedit libtool m4 ninja openldap openssh patchutils perl pkg-config python3 scons
python3Minimal scons serf sqlite subversion sysctl texinfo unzip which serf sqlite subversion sysctl texinfo unzip which
# CF dependencies - dont rebuild them. # CF dependencies - dont rebuild them.
icu icu
@ -1057,11 +1057,40 @@ in
# LLVM dependencies - dont rebuild them. # LLVM dependencies - dont rebuild them.
libffi libiconv libxml2 ncurses zlib; libffi libiconv libxml2 ncurses zlib;
# These overrides are required to break an infinite recursion. curl depends on Darwin
# frameworks, but those frameworks require these dependencies to build, which
# depend on curl indirectly.
cpio = super.cpio.override {
inherit (prevStage) fetchurl;
};
libyaml = super.libyaml.override {
inherit (prevStage) fetchFromGitHub;
};
pbzx = super.pbzx.override {
inherit (prevStage) fetchFromGitHub;
};
python3Minimal = super.python3Minimal.override {
inherit (prevStage) fetchurl;
};
xar = super.xar.override {
inherit (prevStage) fetchurl;
};
darwin = super.darwin.overrideScope (selfDarwin: superDarwin: { darwin = super.darwin.overrideScope (selfDarwin: superDarwin: {
inherit (prevStage.darwin) dyld CF Libsystem darwin-stubs inherit (prevStage.darwin) dyld CF Libsystem darwin-stubs
# CF dependencies - dont rebuild them. # CF dependencies - dont rebuild them.
libobjc objc4; libobjc objc4;
# rewrite-tbd is also needed to build Darwin frameworks, so its built using the
# previous stages fetchFromGitHub to avoid an infinite recursion (same as above).
rewrite-tbd = superDarwin.rewrite-tbd.override {
inherit (prevStage) fetchFromGitHub;
};
signingUtils = superDarwin.signingUtils.override { signingUtils = superDarwin.signingUtils.override {
inherit (selfDarwin) sigtool; inherit (selfDarwin) sigtool;
}; };
@ -1158,9 +1187,10 @@ in
(prevStage: (prevStage:
# previous stage4 stdenv: # previous stage4 stdenv:
assert lib.all isBuiltByNixpkgsCompiler (with prevStage; [ assert lib.all isBuiltByNixpkgsCompiler (with prevStage; [
bash binutils-unwrapped brotli bzip2 curl diffutils ed file findutils gawk gettext gmp bash binutils-unwrapped brotli bzip2 cpio curl diffutils ed file findutils gawk
gnugrep gnumake gnused gnutar gzip icu libffi libiconv libidn2 libkrb5 libssh2 gettext gmp gnugrep gnumake gnused gnutar gzip icu libffi libiconv libidn2 libkrb5
libunistring libxml2 ncurses nghttp2 openbsm openpam openssl patch pcre xz zlib zstd libssh2 libunistring libxml2 libyaml ncurses nghttp2 openbsm openpam openssl patch
pbzx pcre python3Minimal xar xz zlib zstd
]); ]);
assert lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [ assert lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [
@ -1176,9 +1206,9 @@ in
]); ]);
assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage; [ assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage; [
autoconf automake bison cmake cmakeMinimal cpio cyrus_sasl db expat flex groff libedit autoconf automake bison cmake cmakeMinimal cyrus_sasl db expat flex groff libedit
libtool m4 ninja openldap openssh patchutils pbzx perl pkg-config.pkg-config python3 libtool m4 ninja openldap openssh patchutils perl pkg-config.pkg-config python3 scons
python3Minimal scons serf sqlite subversion sysctl.provider texinfo unzip which serf sqlite subversion sysctl.provider texinfo unzip which
]); ]);
assert prevStage.darwin.cctools == prevStage.darwin.cctools-llvm; assert prevStage.darwin.cctools == prevStage.darwin.cctools-llvm;
@ -1307,14 +1337,14 @@ in
overrides = self: super: { overrides = self: super: {
inherit (prevStage) inherit (prevStage)
bash binutils brotli bzip2 coreutils curl diffutils ed file findutils gawk gettext bash binutils brotli bzip2 coreutils cpio curl diffutils ed file findutils gawk
gmp gnugrep gnumake gnused gnutar gzip icu libffi libiconv libidn2 libssh2 gettext gmp gnugrep gnumake gnused gnutar gzip icu libffi libiconv libidn2 libssh2
libunistring libxml2 ncurses nghttp2 openbsm openpam openssl patch pcre xz zlib libunistring libxml2 libyaml ncurses nghttp2 openbsm openpam openssl patch pbzx
zstd; pcre python3Minimal xar xz zlib zstd;
darwin = super.darwin.overrideScope (_: _: { darwin = super.darwin.overrideScope (_: _: {
inherit (prevStage.darwin) inherit (prevStage.darwin)
CF ICU Libsystem darwin-stubs dyld locale libobjc libtapi xnu; CF ICU Libsystem darwin-stubs dyld locale libobjc libtapi rewrite-tbd xnu;
} // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) { } // lib.optionalAttrs (super.stdenv.targetPlatform == localSystem) {
inherit (prevStage.darwin) binutils binutils-unwrapped cctools-llvm cctools-port; inherit (prevStage.darwin) binutils binutils-unwrapped cctools-llvm cctools-port;
}); });