Skip to content

Commit

Permalink
Merge pull request #260963 from reckenrode/curl-fix
Browse files Browse the repository at this point in the history
curl: fix infinite recursion in staging-next
  • Loading branch information
toonn authored Oct 21, 2023
2 parents 31ebe7b + 84cf8e0 commit b525407
Show file tree
Hide file tree
Showing 3 changed files with 59 additions and 20 deletions.
58 changes: 44 additions & 14 deletions pkgs/stdenv/darwin/default.nix
Original file line number Diff line number Diff line change
Expand Up @@ -1047,21 +1047,50 @@ in

overrides = self: super: {
inherit (prevStage) ccWrapperStdenv
autoconf automake bash bison cmake cmakeMinimal cpio cyrus_sasl db expat flex groff
libedit libtool m4 ninja openldap openssh patchutils pbzx perl pkg-config python3
python3Minimal scons serf sqlite subversion sysctl texinfo unzip which
autoconf automake bash bison cmake cmakeMinimal cyrus_sasl db expat flex groff
libedit libtool m4 ninja openldap openssh patchutils perl pkg-config python3 scons
serf sqlite subversion sysctl texinfo unzip which

# CF dependencies - don’t rebuild them.
icu

# LLVM dependencies - don’t rebuild them.
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: {
inherit (prevStage.darwin) dyld CF Libsystem darwin-stubs
# CF dependencies - don’t rebuild them.
libobjc objc4;

# rewrite-tbd is also needed to build Darwin frameworks, so it’s built using the
# previous stage’s fetchFromGitHub to avoid an infinite recursion (same as above).
rewrite-tbd = superDarwin.rewrite-tbd.override {
inherit (prevStage) fetchFromGitHub;
};

signingUtils = superDarwin.signingUtils.override {
inherit (selfDarwin) sigtool;
};
Expand Down Expand Up @@ -1158,9 +1187,10 @@ in
(prevStage:
# previous stage4 stdenv:
assert lib.all isBuiltByNixpkgsCompiler (with prevStage; [
bash binutils-unwrapped brotli bzip2 curl diffutils ed file findutils gawk gettext gmp
gnugrep gnumake gnused gnutar gzip icu libffi libiconv libidn2 libkrb5 libssh2
libunistring libxml2 ncurses nghttp2 openbsm openpam openssl patch pcre xz zlib zstd
bash binutils-unwrapped brotli bzip2 cpio curl diffutils ed file findutils gawk
gettext gmp gnugrep gnumake gnused gnutar gzip icu libffi libiconv libidn2 libkrb5
libssh2 libunistring libxml2 libyaml ncurses nghttp2 openbsm openpam openssl patch
pbzx pcre python3Minimal xar xz zlib zstd
]);

assert lib.all isBuiltByNixpkgsCompiler (with prevStage.darwin; [
Expand All @@ -1176,9 +1206,9 @@ in
]);

assert lib.all isBuiltByBootstrapFilesCompiler (with prevStage; [
autoconf automake bison cmake cmakeMinimal cpio cyrus_sasl db expat flex groff libedit
libtool m4 ninja openldap openssh patchutils pbzx perl pkg-config.pkg-config python3
python3Minimal scons serf sqlite subversion sysctl.provider texinfo unzip which
autoconf automake bison cmake cmakeMinimal cyrus_sasl db expat flex groff libedit
libtool m4 ninja openldap openssh patchutils perl pkg-config.pkg-config python3 scons
serf sqlite subversion sysctl.provider texinfo unzip which
]);

assert prevStage.darwin.cctools == prevStage.darwin.cctools-llvm;
Expand Down Expand Up @@ -1307,14 +1337,14 @@ in

overrides = self: super: {
inherit (prevStage)
bash binutils brotli bzip2 coreutils curl diffutils ed file findutils gawk gettext
gmp gnugrep gnumake gnused gnutar gzip icu libffi libiconv libidn2 libssh2
libunistring libxml2 ncurses nghttp2 openbsm openpam openssl patch pcre xz zlib
zstd;
bash binutils brotli bzip2 coreutils cpio curl diffutils ed file findutils gawk
gettext gmp gnugrep gnumake gnused gnutar gzip icu libffi libiconv libidn2 libssh2
libunistring libxml2 libyaml ncurses nghttp2 openbsm openpam openssl patch pbzx
pcre python3Minimal xar xz zlib zstd;

darwin = super.darwin.overrideScope (_: _: {
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) {
inherit (prevStage.darwin) binutils binutils-unwrapped cctools-llvm cctools-port;
});
Expand Down
11 changes: 6 additions & 5 deletions pkgs/tools/networking/curl/default.nix
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
{ lib, stdenv, fetchurl, pkg-config, perl, nixosTests
{ lib, stdenv, fetchurl, darwin, pkg-config, perl, nixosTests
, brotliSupport ? false, brotli
, c-aresSupport ? false, c-aresMinimal
, gnutlsSupport ? false, gnutls
Expand Down Expand Up @@ -57,17 +57,18 @@ stdenv.mkDerivation (finalAttrs: {
hash = "sha256-FsYqnErw9wPSi9pte783ukcFWtNBTXDexj4uYzbyqC0=";
};

patches = [
./7.79.1-darwin-no-systemconfiguration.patch
];

outputs = [ "bin" "dev" "out" "man" "devdoc" ];
separateDebugInfo = stdenv.isLinux;

enableParallelBuilding = true;

strictDeps = true;

buildInputs = lib.optionals stdenv.isDarwin (with darwin.apple_sdk.frameworks; [
CoreFoundation
CoreServices
SystemConfiguration
]);
nativeBuildInputs = [ pkg-config perl ];

# Zlib and OpenSSL must be propagated because `libcurl.la' contains
Expand Down
10 changes: 9 additions & 1 deletion pkgs/top-level/darwin-packages.nix
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,11 @@ let
# default.
targetPrefix = lib.optionalString (stdenv.targetPlatform != stdenv.hostPlatform)
(stdenv.targetPlatform.config + "-");

# Bootstrap `fetchurl` needed to build SDK packages without causing an infinite recursion.
fetchurlBoot = import ../build-support/fetchurl/boot.nix {
inherit (stdenv) system;
};
in

makeScopeWithSplicing' {
Expand All @@ -32,10 +37,13 @@ makeScopeWithSplicing' {
apple_sdk_10_12 = pkgs.callPackage ../os-specific/darwin/apple-sdk {
inherit (buildPackages.darwin) print-reexports;
inherit (self) darwin-stubs;
fetchurl = fetchurlBoot;
};

# macOS 11.0 SDK
apple_sdk_11_0 = pkgs.callPackage ../os-specific/darwin/apple-sdk-11.0 { };
apple_sdk_11_0 = pkgs.callPackage ../os-specific/darwin/apple-sdk-11.0 {
fetchurl = fetchurlBoot;
};

# Pick an SDK
apple_sdk = if stdenv.hostPlatform.isAarch64 then apple_sdk_11_0 else apple_sdk_10_12;
Expand Down

0 comments on commit b525407

Please sign in to comment.