From 7a7f78d2ff8b0e9813da7e9991919ed198a18e49 Mon Sep 17 00:00:00 2001 From: Addison Crump Date: Tue, 3 Jan 2023 21:44:19 +0100 Subject: [PATCH 1/3] fix some minor build.rs issues --- build.rs | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index bf6c12f..9d1a76a 100644 --- a/build.rs +++ b/build.rs @@ -1,10 +1,11 @@ fn main() { + println!("cargo:rerun-if-env-changed=CUSTOM_LIBFUZZER_PATH"); if let Ok(custom) = ::std::env::var("CUSTOM_LIBFUZZER_PATH") { 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); From f47576d2afb5549cb9343204391d490eceeaad6f Mon Sep 17 00:00:00 2001 From: Addison Crump Date: Tue, 3 Jan 2023 21:55:41 +0100 Subject: [PATCH 2/3] fmt --- build.rs | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 9d1a76a..6403f2f 100644 --- a/build.rs +++ b/build.rs @@ -5,7 +5,9 @@ fn main() { 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.strip_prefix("lib").unwrap_or(custom_lib_name.as_ref()); + 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); From 663c0b6c212e9cb1000b182aef260406115402ae Mon Sep 17 00:00:00 2001 From: Addison Crump Date: Wed, 25 Jan 2023 17:05:07 +0100 Subject: [PATCH 3/3] rerun if the targeted library is also changed, not just if the path does --- build.rs | 2 ++ 1 file changed, 2 insertions(+) diff --git a/build.rs b/build.rs index 6403f2f..ab1bbc5 100644 --- a/build.rs +++ b/build.rs @@ -1,6 +1,8 @@ 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();