From c0f695fd7091461b7312c2e2be33f950ac9fd98d Mon Sep 17 00:00:00 2001 From: Michael Cho Date: Sat, 2 Nov 2024 22:37:53 -0400 Subject: [PATCH] ucommon: workaround for Sequoia SDK --- Formula/u/ucommon.rb | 22 ++++++++++++++++++++-- 1 file changed, 20 insertions(+), 2 deletions(-) diff --git a/Formula/u/ucommon.rb b/Formula/u/ucommon.rb index 16bdda9bb2db0..b22ca13555abd 100644 --- a/Formula/u/ucommon.rb +++ b/Formula/u/ucommon.rb @@ -33,6 +33,9 @@ class Ucommon < Formula depends_on "gettext" end + # Workaround for macOS 15 SDK adding SO_BINDTODEVICE in sys/socket.h + patch :DATA + def install system "autoreconf", "--force", "--install", "--verbose" system "./configure", "--disable-silent-rules", "--with-sslstack=gnutls", "--with-pkg-config", *std_configure_args @@ -42,7 +45,7 @@ def install test do system bin/"ucommon-config", "--libs" - (testpath/"test.cpp").write <<~EOS + (testpath/"test.cpp").write <<~CPP #include #include @@ -51,9 +54,24 @@ def install std::cout << test_string << std::endl; return 0; } - EOS + CPP system ENV.cxx, "-std=c++11", "test.cpp", "-o", "test", "-I#{include}", "-L#{lib}", "-lucommon" system "./test" end end + +__END__ +diff --git a/corelib/socket.cpp b/corelib/socket.cpp +index 76a52273..04dae257 100644 +--- a/corelib/socket.cpp ++++ b/corelib/socket.cpp +@@ -3023,7 +3023,7 @@ int Socket::bindto(socket_t so, const char *host, const char *svc, int protocol) + if(host && !strcmp(host, "*")) + host = NULL; + +-#if defined(SO_BINDTODEVICE) && !defined(__QNX__) ++#if defined(SO_BINDTODEVICE) && !defined(__QNX__) && !defined(__APPLE__) + if(host && !strchr(host, '.') && !strchr(host, ':')) { + struct ifreq ifr; + memset(&ifr, 0, sizeof(ifr));