Skip to content

Commit ae282d6

Browse files
committed
Update build.rs
Use new cargo:: syntax, and stop warning about unknown cfg flag.
1 parent 76c4260 commit ae282d6

File tree

1 file changed

+11
-10
lines changed

1 file changed

+11
-10
lines changed

neotron-os/build.rs

Lines changed: 11 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -3,11 +3,11 @@ use std::io::prelude::*;
33
fn main() {
44
if let Ok("none") = std::env::var("CARGO_CFG_TARGET_OS").as_deref() {
55
copy_linker_script("neotron-flash-1002.ld");
6-
println!("cargo:rustc-link-arg-bin=flash1002=-Tneotron-flash-1002.ld");
6+
println!("cargo::rustc-link-arg-bin=flash1002=-Tneotron-flash-1002.ld");
77
copy_linker_script("neotron-flash-0802.ld");
8-
println!("cargo:rustc-link-arg-bin=flash0802=-Tneotron-flash-0802.ld");
8+
println!("cargo::rustc-link-arg-bin=flash0802=-Tneotron-flash-0802.ld");
99
copy_linker_script("neotron-flash-0002.ld");
10-
println!("cargo:rustc-link-arg-bin=flash0002=-Tneotron-flash-0002.ld");
10+
println!("cargo::rustc-link-arg-bin=flash0002=-Tneotron-flash-0002.ld");
1111
}
1212

1313
if let Ok(cmd_output) = std::process::Command::new("git")
@@ -19,25 +19,26 @@ fn main() {
1919
{
2020
let git_version = std::str::from_utf8(&cmd_output.stdout).unwrap();
2121
println!(
22-
"cargo:rustc-env=OS_VERSION={} (git:{})",
22+
"cargo::rustc-env=OS_VERSION={} (git:{})",
2323
env!("CARGO_PKG_VERSION"),
2424
git_version.trim()
2525
);
2626
} else {
27-
println!("cargo:rustc-env=OS_VERSION={}", env!("CARGO_PKG_VERSION"));
27+
println!("cargo::rustc-env=OS_VERSION={}", env!("CARGO_PKG_VERSION"));
2828
}
2929

3030
if Ok("macos") == std::env::var("CARGO_CFG_TARGET_OS").as_deref() {
31-
println!("cargo:rustc-link-lib=c");
31+
println!("cargo::rustc-link-lib=c");
3232
}
3333

3434
if Ok("windows") == std::env::var("CARGO_CFG_TARGET_OS").as_deref() {
35-
println!("cargo:rustc-link-lib=dylib=msvcrt");
35+
println!("cargo::rustc-link-lib=dylib=msvcrt");
3636
}
3737

3838
if option_env!("ROMFS_PATH").is_some() {
39-
println!("cargo:rustc-cfg=romfs_enabled=\"yes\"");
40-
println!("cargo:rerun-if-env-changed=ROMFS_PATH");
39+
println!("cargo::rustc-cfg=romfs_enabled=\"yes\"");
40+
println!("cargo::rustc-check-cfg=cfg(romfs_enabled, values(\"yes\"))");
41+
println!("cargo::rerun-if-env-changed=ROMFS_PATH");
4142
}
4243
}
4344

@@ -50,7 +51,7 @@ fn copy_linker_script(path: &str) {
5051
.unwrap()
5152
.write_all(contents.as_bytes())
5253
.unwrap();
53-
println!("cargo:rustc-link-search={}", out.display());
54+
println!("cargo::rustc-link-search={}", out.display());
5455
}
5556

5657
// End of file

0 commit comments

Comments
 (0)