Răsfoiți Sursa

Remove std from outputted libc.a

Jeremy Soller 7 ani în urmă
părinte
comite
d337caafe6
5 a modificat fișierele cu 22 adăugiri și 12 ștergeri
  1. 10 0
      Cargo.toml
  2. 1 1
      fcntl/Cargo.toml
  3. 5 5
      fcntl/build.rs
  4. 1 1
      unistd/Cargo.toml
  5. 5 5
      unistd/build.rs

+ 10 - 0
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"

+ 1 - 1
fcntl/Cargo.toml

@@ -8,4 +8,4 @@ build = "build.rs"
 cbindgen = "0.5"
 
 [dependencies]
-libc = "0.2"
+libc = { version = "0.2", default-features = false }

+ 5 - 5
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");
 }

+ 1 - 1
unistd/Cargo.toml

@@ -8,4 +8,4 @@ build = "build.rs"
 cbindgen = "0.5"
 
 [dependencies]
-libc = "0.2"
+libc = { version = "0.2", default-features = false }

+ 5 - 5
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");
 }