Skip to content

Commit 2517b1f

Browse files
arman-bdclaude
andcommitted
fix: use vendor-built BoringSSL and nghttp2 on macOS for wheel compatibility
This ensures macOS wheels link against vendor-built static libraries (compatible with macOS 11.0+) instead of Homebrew dynamic libraries (requiring macOS 15.0+). 🤖 Generated with [Claude Code](https://claude.com/claude-code) Co-Authored-By: Claude <noreply@anthropic.com>
1 parent 86460d1 commit 2517b1f

File tree

1 file changed

+31
-24
lines changed

1 file changed

+31
-24
lines changed

setup.py

Lines changed: 31 additions & 24 deletions
Original file line numberDiff line numberDiff line change
@@ -118,34 +118,41 @@ def get_library_paths():
118118
import subprocess
119119

120120
if IS_MACOS:
121-
# Try Homebrew paths
122-
try:
123-
openssl_prefix = (
124-
subprocess.check_output(
125-
["brew", "--prefix", "openssl@3"], stderr=subprocess.DEVNULL
126-
)
127-
.decode()
128-
.strip()
129-
)
130-
except (subprocess.CalledProcessError, FileNotFoundError):
131-
openssl_prefix = "/opt/homebrew/opt/openssl@3"
121+
# Use vendor-built libraries for wheel compatibility
122+
vendor_dir = Path("vendor").resolve()
132123

133-
try:
134-
nghttp2_prefix = (
135-
subprocess.check_output(
136-
["brew", "--prefix", "libnghttp2"], stderr=subprocess.DEVNULL
124+
# BoringSSL (always vendor-built)
125+
vendor_boringssl = vendor_dir / "boringssl"
126+
boringssl_include = str(vendor_boringssl / "include")
127+
boringssl_lib = str(vendor_boringssl / "build" / "ssl")
128+
129+
# nghttp2 - prefer vendor build for wheel compatibility
130+
vendor_nghttp2 = vendor_dir / "nghttp2" / "install"
131+
if vendor_nghttp2.exists() and (vendor_nghttp2 / "include").exists():
132+
print(f"Using vendor nghttp2 from: {vendor_nghttp2}")
133+
nghttp2_include = str(vendor_nghttp2 / "include")
134+
nghttp2_lib = str(vendor_nghttp2 / "lib")
135+
else:
136+
# Fall back to Homebrew if vendor not available
137+
try:
138+
nghttp2_prefix = (
139+
subprocess.check_output(
140+
["brew", "--prefix", "libnghttp2"], stderr=subprocess.DEVNULL
141+
)
142+
.decode()
143+
.strip()
137144
)
138-
.decode()
139-
.strip()
140-
)
141-
except (subprocess.CalledProcessError, FileNotFoundError):
142-
nghttp2_prefix = "/opt/homebrew/opt/libnghttp2"
145+
nghttp2_include = f"{nghttp2_prefix}/include"
146+
nghttp2_lib = f"{nghttp2_prefix}/lib"
147+
except (subprocess.CalledProcessError, FileNotFoundError):
148+
nghttp2_include = "/opt/homebrew/opt/libnghttp2/include"
149+
nghttp2_lib = "/opt/homebrew/opt/libnghttp2/lib"
143150

144151
return {
145-
"openssl_include": f"{openssl_prefix}/include",
146-
"openssl_lib": f"{openssl_prefix}/lib",
147-
"nghttp2_include": f"{nghttp2_prefix}/include",
148-
"nghttp2_lib": f"{nghttp2_prefix}/lib",
152+
"openssl_include": boringssl_include,
153+
"openssl_lib": boringssl_lib,
154+
"nghttp2_include": nghttp2_include,
155+
"nghttp2_lib": nghttp2_lib,
149156
}
150157

151158
elif IS_LINUX:

0 commit comments

Comments
 (0)