Skip to content

Commit

Permalink
Support homebrew openssl@3
Browse files Browse the repository at this point in the history
  • Loading branch information
sfackler committed Oct 28, 2021
1 parent 4707adc commit b89432a
Showing 1 changed file with 16 additions and 10 deletions.
26 changes: 16 additions & 10 deletions openssl-sys/build/find_normal.rs
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,27 @@ pub fn get_openssl(target: &str) -> (PathBuf, PathBuf) {
}

fn resolve_with_wellknown_homebrew_location(dir: &str) -> Option<PathBuf> {
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 <package>` 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 <package>` 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());
}
}
}

Expand Down

0 comments on commit b89432a

Please sign in to comment.