diff --git a/Cargo.toml b/Cargo.toml index 7589f6fe81..2cb2133a1c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -16,3 +16,13 @@ members = [ [dependencies] fcntl = { path = "fcntl" } unistd = { path = "unistd" } + +[profile.dev] +incremental = false +lto = true +panic = "abort" + +[profile.release] +incremental = false +lto = true +panic = "abort" diff --git a/fcntl/Cargo.toml b/fcntl/Cargo.toml index 1403647b70..c8e3ff555c 100644 --- a/fcntl/Cargo.toml +++ b/fcntl/Cargo.toml @@ -8,4 +8,4 @@ build = "build.rs" cbindgen = "0.5" [dependencies] -libc = "0.2" +libc = { version = "0.2", default-features = false } diff --git a/fcntl/build.rs b/fcntl/build.rs index fc96c5a7b1..b04c12cdaf 100644 --- a/fcntl/build.rs +++ b/fcntl/build.rs @@ -1,11 +1,11 @@ extern crate cbindgen; -use std::env; +use std::{env, fs}; fn main() { - let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); - + let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set"); + fs::create_dir_all("../target/include").expect("failed to create include directory"); cbindgen::generate(crate_dir) - .expect("Unable to generate bindings") - .write_to_file("../target/fcntl.h"); + .expect("failed to generate bindings") + .write_to_file("../target/include/fcntl.h"); } diff --git a/unistd/Cargo.toml b/unistd/Cargo.toml index 08fece8fcc..9d3813b9de 100644 --- a/unistd/Cargo.toml +++ b/unistd/Cargo.toml @@ -8,4 +8,4 @@ build = "build.rs" cbindgen = "0.5" [dependencies] -libc = "0.2" +libc = { version = "0.2", default-features = false } diff --git a/unistd/build.rs b/unistd/build.rs index 6d467a9aa0..c12853664c 100644 --- a/unistd/build.rs +++ b/unistd/build.rs @@ -1,11 +1,11 @@ extern crate cbindgen; -use std::env; +use std::{env, fs}; fn main() { - let crate_dir = env::var("CARGO_MANIFEST_DIR").unwrap(); - + let crate_dir = env::var("CARGO_MANIFEST_DIR").expect("CARGO_MANIFEST_DIR not set"); + fs::create_dir_all("../target/include").expect("failed to create include directory"); cbindgen::generate(crate_dir) - .expect("Unable to generate bindings") - .write_to_file("../target/unistd.h"); + .expect("failed to generate bindings") + .write_to_file("../target/include/unistd.h"); }