Skip to content

Commit

Permalink
Merge pull request #103 from VTCAKAVSMoACE/main
Browse files Browse the repository at this point in the history
Fix minor build.rs issues w.r.t. custom libfuzzer paths
  • Loading branch information
fitzgen committed Jan 26, 2023
2 parents 55c8e0b + 663c0b6 commit 289f20f
Showing 1 changed file with 6 additions and 1 deletion.
7 changes: 6 additions & 1 deletion build.rs
Original file line number Diff line number Diff line change
@@ -1,10 +1,15 @@
fn main() {
println!("cargo:rerun-if-env-changed=CUSTOM_LIBFUZZER_PATH");
if let Ok(custom) = ::std::env::var("CUSTOM_LIBFUZZER_PATH") {
println!("cargo:rerun-if-changed={custom}");

let custom_lib_path = ::std::path::PathBuf::from(&custom);
let custom_lib_dir = custom_lib_path.parent().unwrap().to_string_lossy();

let custom_lib_name = custom_lib_path.file_stem().unwrap().to_string_lossy();
let custom_lib_name = custom_lib_name.trim_start_matches("lib");
let custom_lib_name = custom_lib_name
.strip_prefix("lib")
.unwrap_or(custom_lib_name.as_ref());

println!("cargo:rustc-link-search=native={}", custom_lib_dir);
println!("cargo:rustc-link-lib=static={}", custom_lib_name);
Expand Down

0 comments on commit 289f20f

Please sign in to comment.