From 9ddc5e84fd3048204b8e278e6a159aaa78dbaa6f Mon Sep 17 00:00:00 2001 From: Benoit Daloze Date: Thu, 7 Nov 2024 15:01:29 +0100 Subject: [PATCH] Prefer OpenSSL 3.0, then OpenSSL 3.x, then OpenSSL 1.1 * Should help when 1.1 is removed like in https://github.com/actions/runner-images/issues/10817 * 1.1 is EOL --- lib/truffle/truffle/openssl-prefix.rb | 19 ++++++++++++++----- 1 file changed, 14 insertions(+), 5 deletions(-) diff --git a/lib/truffle/truffle/openssl-prefix.rb b/lib/truffle/truffle/openssl-prefix.rb index 0cbc9c73ea87..b093b3b66270 100644 --- a/lib/truffle/truffle/openssl-prefix.rb +++ b/lib/truffle/truffle/openssl-prefix.rb @@ -8,10 +8,16 @@ # GNU General Public License version 2, or # GNU Lesser General Public License version 2.1. -# Set OPENSSL_PREFIX in ENV to find the OpenSSL headers +# From https://openssl-library.org/policies/releasestrat/index.html +# 3.0 is LTS, 3.1+ is non-LTS and 1.1 is EOL +# See the existing formula at https://github.com/Homebrew/homebrew-core/tree/master/Formula/o search_homebrew = -> homebrew { - if prefix = "#{homebrew}/opt/openssl@1.1" and Dir.exist?(prefix) + if prefix = "#{homebrew}/opt/openssl@3.0" and Dir.exist?(prefix) + prefix + elsif prefix = "#{homebrew}/opt/openssl@3" and Dir.exist?(prefix) + prefix + elsif prefix = "#{homebrew}/opt/openssl@1.1" and Dir.exist?(prefix) prefix elsif prefix = "#{homebrew}/opt/openssl" and Dir.exist?(prefix) prefix @@ -26,17 +32,20 @@ homebrew = `brew --prefix 2>/dev/null`.strip homebrew = nil unless $?.success? and !homebrew.empty? and Dir.exist?(homebrew) + # See https://ports.macports.org/search/?q=openssl&name=on for the list of MacPorts openssl ports if homebrew and prefix = search_homebrew.call(homebrew) # found - elsif Dir.exist?('/opt/local/libexec/openssl11') # MacPorts, prefer OpenSSL 1.1 as known to be compatible + elsif Dir.exist?('/opt/local/libexec/openssl3') + prefix = '/opt/local/libexec/openssl3' + elsif Dir.exist?('/opt/local/libexec/openssl11') prefix = '/opt/local/libexec/openssl11' - # MacPorts, try the generic version, too, but might not be compatible - elsif Dir.exist?('/opt/local/include/openssl') + elsif Dir.exist?('/opt/local/include/openssl') # symlinks, unknown version prefix = '/opt/local' end end if prefix + # Set OPENSSL_PREFIX in ENV to find the OpenSSL headers ENV['OPENSSL_PREFIX'] = prefix else abort 'Could not find OpenSSL headers, install via Homebrew or MacPorts or set OPENSSL_PREFIX'