Avoid linking to Homebrew Cellar

Links to the Cellar break when packages are upgraded.
This commit is contained in:
Nicolas Bachschmidt 2025-06-27 13:01:02 +02:00
parent 3ec7db4629
commit 9df6a7ea9c
No known key found for this signature in database
GPG key ID: 4605C9C0DE2B8C75
2 changed files with 9 additions and 0 deletions

View file

@ -1107,6 +1107,11 @@ has_broken_mac_openssl() {
}
pkgconfig_openssl_version() {
local libdir
libdir="$(pkg-config --variable=prefix openssl 2>/dev/null || true)"
# We don't want to link to Homebrew Cellar because links break when packages are upgraded.
[[ "$libdir" != */Cellar/* ]] || return 0
pkg-config --modversion openssl 2>/dev/null || true
}

View file

@ -536,6 +536,9 @@ OUT
@test "link to Homebrew OpenSSL" {
cached_tarball "ruby-3.2.0" configure
openssl_libdir="$TMP/homebrew/Cellar/openssl@3/3.0.0"
mkdir -p "$openssl_libdir"
local homebrew_prefix="${TMP}/homebrew"
executable "${homebrew_prefix}/opt/openssl@3/bin/openssl" <<EXE
#!/$BASH
@ -563,6 +566,7 @@ EXE
stub_repeated brew \
'list : printf "git\nopenssl@3\nopenssl-utils\nopenssl@1.1\nopenssl@3.0\nwget\nopenssl@3.1"' \
"--prefix : echo '$homebrew_prefix'/opt/\$2 "
stub_repeated pkg-config '--modversion openssl : echo 3.0.0' "--variable=prefix openssl : echo '$openssl_libdir'"
stub_make_install
run_inline_definition <<DEF