diff --git a/pkgs/os-specific/darwin/cctools/darwin-no-memstream.patch b/pkgs/os-specific/darwin/cctools/darwin-memstream.patch similarity index 66% rename from pkgs/os-specific/darwin/cctools/darwin-no-memstream.patch rename to pkgs/os-specific/darwin/cctools/darwin-memstream.patch index bb8a4ad68f3b..3e0d0a43ba8d 100644 --- a/pkgs/os-specific/darwin/cctools/darwin-no-memstream.patch +++ b/pkgs/os-specific/darwin/cctools/darwin-memstream.patch @@ -1,7 +1,3 @@ -MacOS SDKs before 10.13 don't support open_memstream. This is already replaced -by a runtime check in cctools-port, but because we build with SDK 10.12 by -default, linking still fails for us. Disable it entirely here. - --- a/cctools/include/stuff/diagnostics.h +++ b/cctools/include/stuff/diagnostics.h @@ -60,13 +60,6 @@ void diagnostics_log_msg(enum diagnostic_level level, const char* message); @@ -16,6 +12,6 @@ default, linking still fails for us. Disable it entirely here. -#ifndef HAVE_OPENMEMSTREAM_RUNTIME -# define HAVE_OPENMEMSTREAM_RUNTIME 1 -#endif -+#define HAVE_OPENMEMSTREAM_RUNTIME 0 ++#define HAVE_OPENMEMSTREAM_RUNTIME 1 #endif /* diagnostics_h */ diff --git a/pkgs/os-specific/darwin/cctools/port.nix b/pkgs/os-specific/darwin/cctools/port.nix index 4d8079977513..c9b11ee20155 100644 --- a/pkgs/os-specific/darwin/cctools/port.nix +++ b/pkgs/os-specific/darwin/cctools/port.nix @@ -1,4 +1,4 @@ -{ lib, stdenv, fetchFromGitHub, autoconf, automake, libtool, autoreconfHook +{ lib, stdenv, fetchFromGitHub, autoconf, automake, libtool, autoreconfHook, memstreamHook , installShellFiles , libuuid , libobjc ? null, maloader ? null @@ -35,7 +35,8 @@ stdenv.mkDerivation { outputs = [ "out" "dev" "man" ]; - nativeBuildInputs = [ autoconf automake libtool autoreconfHook installShellFiles ]; + nativeBuildInputs = [ autoconf automake libtool autoreconfHook installShellFiles ] + ++ lib.optionals (stdenv.isDarwin && stdenv.isx86_64) [ memstreamHook ]; buildInputs = [ libuuid ] ++ lib.optionals stdenv.isDarwin [ libobjc ] ++ lib.optional enableTapiSupport libtapi; @@ -51,8 +52,9 @@ stdenv.mkDerivation { url = "https://github.com/MercuryTechnologies/cctools-port/commit/025899b7b3593dedb0c681e689e57c0e7bbd9b80.patch"; hash = "sha256-SWVUzFaJHH2fu9y8RcU3Nx/QKx60hPE5zFx0odYDeQs="; }) - ] - ++ lib.optional stdenv.isDarwin ./darwin-no-memstream.patch; + # Always use `open_memstream`. This is provided by memstream via hook on x86_64-darwin. + ./darwin-memstream.patch + ]; __propagatedImpureHostDeps = [ # As far as I can tell, otool from cctools is the only thing that depends on these two, and we should fix them