
* reduce diffexecutor constraints for new (so it may be used in a manager-less environment) * add differential observers * finish differential observeration * requirement for observers (weak), default impl for time observer * make the map swapper, revisit how differentialobserver is implemented * semi-specialise multimap, add example * improve example slightly * fix clippy lints * fix last clippy issue * better docs + example flow * improve example: correct map sizing + multimap vs split slice * correct some comments * fix tests + slight bit more docs * fix bindings * fixups for the CI * typo fix Co-authored-by: Dominik Maier <domenukk@gmail.com> Co-authored-by: Dominik Maier <dmnk@google.com>
46 lines
1.6 KiB
Rust
46 lines
1.6 KiB
Rust
use std::{env, path::PathBuf, str::FromStr};
|
|
|
|
fn main() -> anyhow::Result<()> {
|
|
if env::var("CARGO_BIN_NAME").map_or(true, |v| v != "libafl_cc") {
|
|
println!("cargo:rerun-if-changed=./first.h");
|
|
println!("cargo:rerun-if-changed=./first.c");
|
|
println!("cargo:rerun-if-changed=./second.h");
|
|
println!("cargo:rerun-if-changed=./second.c");
|
|
println!("cargo:rerun-if-changed=./common.c");
|
|
|
|
// Configure and generate bindings.
|
|
let bindings = bindgen::builder()
|
|
.header("first.h")
|
|
.header("second.h")
|
|
.parse_callbacks(Box::new(bindgen::CargoCallbacks))
|
|
.generate()?;
|
|
|
|
// Write the generated bindings to an output file.
|
|
let out_path = PathBuf::from(env::var("OUT_DIR").unwrap());
|
|
bindings
|
|
.write_to_file(out_path.join("bindings.rs"))
|
|
.expect("Couldn't write bindings!");
|
|
|
|
let compiler = env::var("CARGO_TARGET_DIR")
|
|
.map_or(PathBuf::from_str("target").unwrap(), |v| {
|
|
PathBuf::from_str(&v).unwrap()
|
|
})
|
|
.join("release/libafl_cc");
|
|
println!("cargo:rerun-if-changed={}", compiler.to_str().unwrap());
|
|
if !compiler.try_exists().unwrap_or(false) {
|
|
println!("cargo:warning=Can't find libafl_cc; assuming that we're building it.");
|
|
} else {
|
|
cc::Build::new()
|
|
.compiler(compiler)
|
|
.file("first.c")
|
|
.file("second.c")
|
|
.file("common.c")
|
|
.compile("diff-target");
|
|
|
|
println!("cargo:rustc-link-lib=diff-target");
|
|
}
|
|
}
|
|
|
|
Ok(())
|
|
}
|