From b89432a66dcb47d9c2422db1cc364c4df725825a Mon Sep 17 00:00:00 2001 From: Steven Fackler Date: Wed, 27 Oct 2021 20:26:43 -0400 Subject: [PATCH] Support homebrew openssl@3 --- openssl-sys/build/find_normal.rs | 26 ++++++++++++++++---------- 1 file changed, 16 insertions(+), 10 deletions(-) diff --git a/openssl-sys/build/find_normal.rs b/openssl-sys/build/find_normal.rs index 786b31ae5c..3c338441cc 100644 --- a/openssl-sys/build/find_normal.rs +++ b/openssl-sys/build/find_normal.rs @@ -22,21 +22,27 @@ pub fn get_openssl(target: &str) -> (PathBuf, PathBuf) { } fn resolve_with_wellknown_homebrew_location(dir: &str) -> Option { + let versions = ["openssl@3", "openssl@1.1"]; + // Check up default aarch 64 Homebrew installation location first // for quick resolution if possible. // `pkg-config` on brew doesn't necessarily contain settings for openssl apparently. - let homebrew = Path::new(dir).join("opt/openssl@1.1"); - if homebrew.exists() { - return Some(homebrew); + for version in versions { + let homebrew = Path::new(dir).join(format!("opt/{}", version)); + if homebrew.exists() { + return Some(homebrew); + } } - // Calling `brew --prefix ` command usually slow and - // takes seconds, and will be used only as a last resort. - let output = execute_command_and_get_output("brew", &["--prefix", "openssl@1.1"]); - if let Some(ref output) = output { - let homebrew = Path::new(&output); - if homebrew.exists() { - return Some(homebrew.to_path_buf()); + for version in versions { + // Calling `brew --prefix ` command usually slow and + // takes seconds, and will be used only as a last resort. + let output = execute_command_and_get_output("brew", &["--prefix", version]); + if let Some(ref output) = output { + let homebrew = Path::new(&output); + if homebrew.exists() { + return Some(homebrew.to_path_buf()); + } } }