Skip to content

Commit

Permalink
ucommon: workaround for Sequoia SDK
Browse files Browse the repository at this point in the history
  • Loading branch information
cho-m committed Nov 3, 2024
1 parent 4ea0d62 commit c0f695f
Showing 1 changed file with 20 additions and 2 deletions.
22 changes: 20 additions & 2 deletions Formula/u/ucommon.rb
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand All @@ -42,7 +45,7 @@ def install
test do
system bin/"ucommon-config", "--libs"

(testpath/"test.cpp").write <<~EOS
(testpath/"test.cpp").write <<~CPP
#include <commoncpp/string.h>
#include <iostream>
Expand All @@ -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));

0 comments on commit c0f695f

Please sign in to comment.