From 419308de54870bb2c7ebab4ac7d178aac0adb254 Mon Sep 17 00:00:00 2001 From: pravic Date: Sat, 16 Apr 2016 00:46:29 +0300 Subject: simplify build: remove links from toml and provide path to the libs via single build.rs --- examples/01.minimal/Cargo.toml | 3 +-- examples/01.minimal/build.rs | 1 - examples/02.unload/Cargo.toml | 3 +-- examples/02.unload/build.rs | 1 - examples/03.urandom/Cargo.toml | 3 +-- examples/03.urandom/build.rs | 1 - examples/build.rs | 12 ++++++++++++ 7 files changed, 15 insertions(+), 9 deletions(-) delete mode 100644 examples/01.minimal/build.rs delete mode 100644 examples/02.unload/build.rs delete mode 100644 examples/03.urandom/build.rs create mode 100644 examples/build.rs (limited to 'examples') diff --git a/examples/01.minimal/Cargo.toml b/examples/01.minimal/Cargo.toml index a2177af..9d525f6 100644 --- a/examples/01.minimal/Cargo.toml +++ b/examples/01.minimal/Cargo.toml @@ -5,8 +5,7 @@ version = "0.1.0" authors = ["pravic "] readme = "../README.md" -build = "build.rs" -links = "ntoskrnl" +build = "../build.rs" [lib] path = "driver.rs" diff --git a/examples/01.minimal/build.rs b/examples/01.minimal/build.rs deleted file mode 100644 index f328e4d..0000000 --- a/examples/01.minimal/build.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/examples/02.unload/Cargo.toml b/examples/02.unload/Cargo.toml index e3d298c..9c380d6 100644 --- a/examples/02.unload/Cargo.toml +++ b/examples/02.unload/Cargo.toml @@ -5,8 +5,7 @@ version = "0.1.0" authors = ["pravic "] readme = "../README.md" -build = "build.rs" -links = "ntoskrnl" +build = "../build.rs" [lib] path = "driver.rs" diff --git a/examples/02.unload/build.rs b/examples/02.unload/build.rs deleted file mode 100644 index f328e4d..0000000 --- a/examples/02.unload/build.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/examples/03.urandom/Cargo.toml b/examples/03.urandom/Cargo.toml index 8b45bdf..f41fc36 100644 --- a/examples/03.urandom/Cargo.toml +++ b/examples/03.urandom/Cargo.toml @@ -5,8 +5,7 @@ version = "0.1.0" authors = ["pravic "] readme = "../README.md" -build = "build.rs" -links = "ntoskrnl" +build = "../build.rs" [lib] path = "driver.rs" diff --git a/examples/03.urandom/build.rs b/examples/03.urandom/build.rs deleted file mode 100644 index f328e4d..0000000 --- a/examples/03.urandom/build.rs +++ /dev/null @@ -1 +0,0 @@ -fn main() {} diff --git a/examples/build.rs b/examples/build.rs new file mode 100644 index 0000000..06a0e4f --- /dev/null +++ b/examples/build.rs @@ -0,0 +1,12 @@ +use std::env; + +fn main() { + let target = env::var("TARGET").unwrap(); + let triple: Vec<_> = target.split('-').collect(); + let mapped = match triple.get(0) { + Some(&"i686") => "i386", + Some(&"x86_64") => "amd64", + _ => panic!("unknown architecture of {:?}", target), + }; + println!("cargo:rustc-link-search=../../../native/win7/{}", mapped); +} -- cgit v1.2.3