From 5ebcaa15a3c4be5cd530c0860947ef1b958f5d8a Mon Sep 17 00:00:00 2001 From: Yusuf Bera Ertan Date: Wed, 7 Jul 2021 12:16:40 +0300 Subject: [PATCH 1/3] fix: also check cfg gated field for bootloader dependency --- build.rs | 10 +++++++++- 1 file changed, 9 insertions(+), 1 deletion(-) diff --git a/build.rs b/build.rs index 87081628..93b2f5d4 100644 --- a/build.rs +++ b/build.rs @@ -242,7 +242,15 @@ mod binary { if manifest .get("dependencies") - .and_then(|d| d.get("bootloader")) + .and_then(|d| { + d.get("bootloader").or_else(|| { + manifest + .get("target") + .and_then(|table| table.get(r#"cfg(target_arch = "x86_64")"#)) + .and_then(|table| table.get("dependencies")) + .and_then(|table| table.get("bootloader")) + }) + }) .is_some() { // it seems to be the correct Cargo.toml From 1b3c2905d043520f34ba0ad8880e228f5b838b94 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Sun, 22 Aug 2021 15:15:20 +0200 Subject: [PATCH 2/3] Small simplification --- build.rs | 15 +++++++-------- 1 file changed, 7 insertions(+), 8 deletions(-) diff --git a/build.rs b/build.rs index 93b2f5d4..1a2473f1 100644 --- a/build.rs +++ b/build.rs @@ -242,14 +242,13 @@ mod binary { if manifest .get("dependencies") - .and_then(|d| { - d.get("bootloader").or_else(|| { - manifest - .get("target") - .and_then(|table| table.get(r#"cfg(target_arch = "x86_64")"#)) - .and_then(|table| table.get("dependencies")) - .and_then(|table| table.get("bootloader")) - }) + .and_then(|d| d.get("bootloader")) + .or_else(|| { + manifest + .get("target") + .and_then(|table| table.get(r#"cfg(target_arch = "x86_64")"#)) + .and_then(|table| table.get("dependencies")) + .and_then(|table| table.get("bootloader")) }) .is_some() { From a5f057c76ae8c57e0c8843f82738f9e75a68d600 Mon Sep 17 00:00:00 2001 From: Philipp Oppermann Date: Sun, 22 Aug 2021 15:16:11 +0200 Subject: [PATCH 3/3] Update one integration test to use the `cfg(target_arch = "x86_64")` syntax --- tests/test_kernels/map_phys_mem/Cargo.toml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/tests/test_kernels/map_phys_mem/Cargo.toml b/tests/test_kernels/map_phys_mem/Cargo.toml index e87d20be..7a86b592 100644 --- a/tests/test_kernels/map_phys_mem/Cargo.toml +++ b/tests/test_kernels/map_phys_mem/Cargo.toml @@ -4,7 +4,7 @@ version = "0.1.0" authors = ["Philipp Oppermann "] edition = "2018" -[dependencies] +[target.'cfg(target_arch = "x86_64")'.dependencies] bootloader = { path = "../../.." } x86_64 = { version = "0.13.2", default-features = false, features = ["instructions", "inline_asm"] } uart_16550 = "0.2.10"