Skip to content

Commit

Permalink
Switch to cargo:: syntax for build.rs output
Browse files Browse the repository at this point in the history
  • Loading branch information
mkrasnitski committed May 18, 2024
1 parent df3c57d commit d8eebe6
Show file tree
Hide file tree
Showing 10 changed files with 67 additions and 40 deletions.
8 changes: 4 additions & 4 deletions rust/binaryninjacore-sys/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ fn link_path() -> PathBuf {
}

fn main() {
println!("cargo:rerun-if-changed=../../binaryninjacore.h");
println!("cargo::rerun-if-changed=../../binaryninjacore.h");

//Cargo's output directory
let out_dir = env::var("OUT_DIR").unwrap();
Expand All @@ -69,11 +69,11 @@ fn main() {
)
.expect("failed to create required symlink");
}
println!("cargo:rustc-link-search={}", out_dir);
println!("cargo::rustc-link-search={}", out_dir);
}

println!("cargo:rustc-link-lib=binaryninjacore");
println!("cargo:rustc-link-search={}", link_path.to_str().unwrap());
println!("cargo::rustc-link-lib=binaryninjacore");
println!("cargo::rustc-link-search={}", link_path.to_str().unwrap());

let current_line = "#define BN_CURRENT_UI_ABI_VERSION ";
let minimum_line = "#define BN_MINIMUM_UI_ABI_VERSION ";
Expand Down
11 changes: 7 additions & 4 deletions rust/examples/basic_script/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,24 @@ fn main() {

#[cfg(target_os = "linux")]
println!(
"cargo:rustc-link-arg=-Wl,-rpath,{},-L{},-l:libbinaryninjacore.so.1",
"cargo::rustc-link-arg=-Wl,-rpath,{},-L{},-l:libbinaryninjacore.so.1",
install_path.to_str().unwrap(),
install_path.to_str().unwrap(),
);

#[cfg(target_os = "macos")]
println!(
"cargo:rustc-link-arg=-Wl,-rpath,{},-L{},-lbinaryninjacore",
"cargo::rustc-link-arg=-Wl,-rpath,{},-L{},-lbinaryninjacore",
install_path.to_str().unwrap(),
install_path.to_str().unwrap(),
);

#[cfg(target_os = "windows")]
{
println!("cargo:rustc-link-lib=binaryninjacore");
println!("cargo:rustc-link-search={}", install_path.to_str().unwrap());
println!("cargo::rustc-link-lib=binaryninjacore");
println!(
"cargo::rustc-link-search={}",
install_path.to_str().unwrap()
);
}
}
11 changes: 7 additions & 4 deletions rust/examples/decompile/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,24 @@ fn main() {

#[cfg(target_os = "linux")]
println!(
"cargo:rustc-link-arg=-Wl,-rpath,{},-L{},-l:libbinaryninjacore.so.1",
"cargo::rustc-link-arg=-Wl,-rpath,{},-L{},-l:libbinaryninjacore.so.1",
install_path.to_str().unwrap(),
install_path.to_str().unwrap(),
);

#[cfg(target_os = "macos")]
println!(
"cargo:rustc-link-arg=-Wl,-rpath,{},-L{},-lbinaryninjacore",
"cargo::rustc-link-arg=-Wl,-rpath,{},-L{},-lbinaryninjacore",
install_path.to_str().unwrap(),
install_path.to_str().unwrap(),
);

#[cfg(target_os = "windows")]
{
println!("cargo:rustc-link-lib=binaryninjacore");
println!("cargo:rustc-link-search={}", install_path.to_str().unwrap());
println!("cargo::rustc-link-lib=binaryninjacore");
println!(
"cargo::rustc-link-search={}",
install_path.to_str().unwrap()
);
}
}
11 changes: 7 additions & 4 deletions rust/examples/dwarf/dwarf_export/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,24 @@ fn main() {

#[cfg(target_os = "linux")]
println!(
"cargo:rustc-link-arg=-Wl,-rpath,{},-L{},-l:libbinaryninjacore.so.1",
"cargo::rustc-link-arg=-Wl,-rpath,{},-L{},-l:libbinaryninjacore.so.1",
install_path.to_str().unwrap(),
install_path.to_str().unwrap(),
);

#[cfg(target_os = "macos")]
println!(
"cargo:rustc-link-arg=-Wl,-rpath,{},-L{},-lbinaryninjacore",
"cargo::rustc-link-arg=-Wl,-rpath,{},-L{},-lbinaryninjacore",
install_path.to_str().unwrap(),
install_path.to_str().unwrap(),
);

#[cfg(target_os = "windows")]
{
println!("cargo:rustc-link-lib=binaryninjacore");
println!("cargo:rustc-link-search={}", install_path.to_str().unwrap());
println!("cargo::rustc-link-lib=binaryninjacore");
println!(
"cargo::rustc-link-search={}",
install_path.to_str().unwrap()
);
}
}
11 changes: 7 additions & 4 deletions rust/examples/hlil_lifter/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,24 @@ fn main() {

#[cfg(target_os = "linux")]
println!(
"cargo:rustc-link-arg=-Wl,-rpath,{},-L{},-l:libbinaryninjacore.so.1",
"cargo::rustc-link-arg=-Wl,-rpath,{},-L{},-l:libbinaryninjacore.so.1",
install_path.to_str().unwrap(),
install_path.to_str().unwrap(),
);

#[cfg(target_os = "macos")]
println!(
"cargo:rustc-link-arg=-Wl,-rpath,{},-L{},-lbinaryninjacore",
"cargo::rustc-link-arg=-Wl,-rpath,{},-L{},-lbinaryninjacore",
install_path.to_str().unwrap(),
install_path.to_str().unwrap(),
);

#[cfg(target_os = "windows")]
{
println!("cargo:rustc-link-lib=binaryninjacore");
println!("cargo:rustc-link-search={}", install_path.to_str().unwrap());
println!("cargo::rustc-link-lib=binaryninjacore");
println!(
"cargo::rustc-link-search={}",
install_path.to_str().unwrap()
);
}
}
11 changes: 7 additions & 4 deletions rust/examples/hlil_visitor/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,24 @@ fn main() {

#[cfg(target_os = "linux")]
println!(
"cargo:rustc-link-arg=-Wl,-rpath,{},-L{},-l:libbinaryninjacore.so.1",
"cargo::rustc-link-arg=-Wl,-rpath,{},-L{},-l:libbinaryninjacore.so.1",
install_path.to_str().unwrap(),
install_path.to_str().unwrap(),
);

#[cfg(target_os = "macos")]
println!(
"cargo:rustc-link-arg=-Wl,-rpath,{},-L{},-lbinaryninjacore",
"cargo::rustc-link-arg=-Wl,-rpath,{},-L{},-lbinaryninjacore",
install_path.to_str().unwrap(),
install_path.to_str().unwrap(),
);

#[cfg(target_os = "windows")]
{
println!("cargo:rustc-link-lib=binaryninjacore");
println!("cargo:rustc-link-search={}", install_path.to_str().unwrap());
println!("cargo::rustc-link-lib=binaryninjacore");
println!(
"cargo::rustc-link-search={}",
install_path.to_str().unwrap()
);
}
}
11 changes: 7 additions & 4 deletions rust/examples/minidump/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,24 @@ fn main() {

#[cfg(target_os = "linux")]
println!(
"cargo:rustc-link-arg=-Wl,-rpath,{},-L{},-l:libbinaryninjacore.so.1",
"cargo::rustc-link-arg=-Wl,-rpath,{},-L{},-l:libbinaryninjacore.so.1",
install_path.to_str().unwrap(),
install_path.to_str().unwrap(),
);

#[cfg(target_os = "macos")]
println!(
"cargo:rustc-link-arg=-Wl,-rpath,{},-L{},-lbinaryninjacore",
"cargo::rustc-link-arg=-Wl,-rpath,{},-L{},-lbinaryninjacore",
install_path.to_str().unwrap(),
install_path.to_str().unwrap(),
);

#[cfg(target_os = "windows")]
{
println!("cargo:rustc-link-lib=binaryninjacore");
println!("cargo:rustc-link-search={}", install_path.to_str().unwrap());
println!("cargo::rustc-link-lib=binaryninjacore");
println!(
"cargo::rustc-link-search={}",
install_path.to_str().unwrap()
);
}
}
11 changes: 7 additions & 4 deletions rust/examples/mlil_lifter/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,24 @@ fn main() {

#[cfg(target_os = "linux")]
println!(
"cargo:rustc-link-arg=-Wl,-rpath,{},-L{},-l:libbinaryninjacore.so.1",
"cargo::rustc-link-arg=-Wl,-rpath,{},-L{},-l:libbinaryninjacore.so.1",
install_path.to_str().unwrap(),
install_path.to_str().unwrap(),
);

#[cfg(target_os = "macos")]
println!(
"cargo:rustc-link-arg=-Wl,-rpath,{},-L{},-lbinaryninjacore",
"cargo::rustc-link-arg=-Wl,-rpath,{},-L{},-lbinaryninjacore",
install_path.to_str().unwrap(),
install_path.to_str().unwrap(),
);

#[cfg(target_os = "windows")]
{
println!("cargo:rustc-link-lib=binaryninjacore");
println!("cargo:rustc-link-search={}", install_path.to_str().unwrap());
println!("cargo::rustc-link-lib=binaryninjacore");
println!(
"cargo::rustc-link-search={}",
install_path.to_str().unwrap()
);
}
}
11 changes: 7 additions & 4 deletions rust/examples/mlil_visitor/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,24 @@ fn main() {

#[cfg(target_os = "linux")]
println!(
"cargo:rustc-link-arg=-Wl,-rpath,{},-L{},-l:libbinaryninjacore.so.1",
"cargo::rustc-link-arg=-Wl,-rpath,{},-L{},-l:libbinaryninjacore.so.1",
install_path.to_str().unwrap(),
install_path.to_str().unwrap(),
);

#[cfg(target_os = "macos")]
println!(
"cargo:rustc-link-arg=-Wl,-rpath,{},-L{},-lbinaryninjacore",
"cargo::rustc-link-arg=-Wl,-rpath,{},-L{},-lbinaryninjacore",
install_path.to_str().unwrap(),
install_path.to_str().unwrap(),
);

#[cfg(target_os = "windows")]
{
println!("cargo:rustc-link-lib=binaryninjacore");
println!("cargo:rustc-link-search={}", install_path.to_str().unwrap());
println!("cargo::rustc-link-lib=binaryninjacore");
println!(
"cargo::rustc-link-search={}",
install_path.to_str().unwrap()
);
}
}
11 changes: 7 additions & 4 deletions rust/examples/template/build.rs
Original file line number Diff line number Diff line change
Expand Up @@ -48,21 +48,24 @@ fn main() {

#[cfg(target_os = "linux")]
println!(
"cargo:rustc-link-arg=-Wl,-rpath,{},-L{},-l:libbinaryninjacore.so.1",
"cargo::rustc-link-arg=-Wl,-rpath,{},-L{},-l:libbinaryninjacore.so.1",
install_path.to_str().unwrap(),
install_path.to_str().unwrap(),
);

#[cfg(target_os = "macos")]
println!(
"cargo:rustc-link-arg=-Wl,-rpath,{},-L{},-lbinaryninjacore",
"cargo::rustc-link-arg=-Wl,-rpath,{},-L{},-lbinaryninjacore",
install_path.to_str().unwrap(),
install_path.to_str().unwrap(),
);

#[cfg(target_os = "windows")]
{
println!("cargo:rustc-link-lib=binaryninjacore");
println!("cargo:rustc-link-search={}", install_path.to_str().unwrap());
println!("cargo::rustc-link-lib=binaryninjacore");
println!(
"cargo::rustc-link-search={}",
install_path.to_str().unwrap()
);
}
}

0 comments on commit d8eebe6

Please sign in to comment.