Skip to content

Commit 4c5ca55

Browse files
committed
Explicitly look for openssl@1.1 with Homebrew on macOS
* Some users have "openssl" still linking to the older OpenSSL 1.0.2. * OpenSSL 1.0.2 is end of life, so it should no longer be used. * Still try the older 'openssl' for compatibility. * Look in $(brew --prefix)/opt rather than `brew --prefix $FORMULA` as that can miss an installed openssl under /usr/local/opt/openssl due to Homebrew having updating the openssl formula to resolve to openssl@1.1. (cherry picked from commit df77b98)
1 parent 4dc33ec commit 4c5ca55

File tree

1 file changed

+9
-3
lines changed

1 file changed

+9
-3
lines changed

lib/truffle/truffle/openssl-prefix.rb

Lines changed: 9 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,15 @@
1313
macOS = RbConfig::CONFIG['host_os'].include?('darwin')
1414

1515
if macOS && !ENV['OPENSSL_PREFIX']
16-
homebrew_prefix = `brew --prefix openssl 2>/dev/null`.chomp
17-
if $?.success? and Dir.exist?(homebrew_prefix) # Homebrew
18-
ENV['OPENSSL_PREFIX'] = homebrew_prefix
16+
homebrew = `brew --prefix 2>/dev/null`.strip
17+
unless $?.success? and !homebrew.empty? and Dir.exist?(homebrew)
18+
homebrew = nil
19+
end
20+
21+
if homebrew and prefix = "#{homebrew}/opt/openssl@1.1" and Dir.exist?(prefix)
22+
ENV['OPENSSL_PREFIX'] = prefix
23+
elsif homebrew and prefix = "#{homebrew}/opt/openssl" and Dir.exist?(prefix)
24+
ENV['OPENSSL_PREFIX'] = prefix
1925
elsif Dir.exist?('/opt/local/include/openssl') # MacPorts
2026
ENV['OPENSSL_PREFIX'] = '/opt/local'
2127
else

0 commit comments

Comments
 (0)