Skip to content

Commit d6e3d0d

Browse files
committed
integration-test: fixes in build.rs
Not exactly sure why this distinction is necessary. But by looking at the verbose cargo output, I found out that build.rs never found link.ld
1 parent 0558ff2 commit d6e3d0d

File tree

2 files changed

+20
-6
lines changed

2 files changed

+20
-6
lines changed
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
fn main() {
2-
let linker_script = "multiboot2_chainloader/link.ld";
3-
println!("cargo:rerun-if-changed={linker_script}");
4-
println!("cargo:rustc-link-arg=-T{linker_script}");
2+
let linker_script = "link.ld";
3+
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
4+
5+
// relative to build.rs:
6+
let rerun_if_changed_path = linker_script;
7+
// relative to workspace root:
8+
let linker_arg_path = format!("{manifest_dir}/{linker_script}");
9+
10+
println!("cargo:rerun-if-changed={rerun_if_changed_path}");
11+
println!("cargo:rustc-link-arg=-T{linker_arg_path}");
512
}
Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,12 @@
11
fn main() {
2-
let linker_script = "multiboot2_payload/link.ld";
3-
println!("cargo:rerun-if-changed={linker_script}");
4-
println!("cargo:rustc-link-arg=-T{linker_script}");
2+
let linker_script = "link.ld";
3+
let manifest_dir = std::env::var("CARGO_MANIFEST_DIR").unwrap();
4+
5+
// relative to build.rs:
6+
let rerun_if_changed_path = linker_script;
7+
// relative to workspace root:
8+
let linker_arg_path = format!("{manifest_dir}/{linker_script}");
9+
10+
println!("cargo:rerun-if-changed={rerun_if_changed_path}");
11+
println!("cargo:rustc-link-arg=-T{linker_arg_path}");
512
}

0 commit comments

Comments
 (0)