Skip to content

Commit

Permalink
fix: using custom build.rs in order to avoid curl derived NSInvalidAr…
Browse files Browse the repository at this point in the history
…gumentException (fixes #8)
  • Loading branch information
evilsocket committed Nov 5, 2023
1 parent 6ced5a2 commit c9775f7
Showing 1 changed file with 18 additions and 0 deletions.
18 changes: 18 additions & 0 deletions build.rs
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
use std::env;
use std::path::PathBuf;

fn main() {
// see https://github.com/evilsocket/legba/issues/8
if env::var("CARGO_CFG_TARGET_OS").unwrap() == "macos" {
let homebrew_prefix =
PathBuf::from(env::var("HOMEBREW_PREFIX").unwrap_or("/opt/homebrew".into()));

let lib_dir = homebrew_prefix.join("lib");
let include_dir = homebrew_prefix.join("include");

// Tell cargo to link against libcurl from Homebrew
println!("cargo:rustc-link-search=native={}", lib_dir.display());
println!("cargo:rustc-link-lib=curl");
println!("cargo:include={}", include_dir.display());
}
}

0 comments on commit c9775f7

Please sign in to comment.