Re: [PATCH V4 1/8] libgpiod: Add libgpiod-sys rust crate

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



On 27-07-22, 13:17, Kent Gibson wrote:
> Sure, it is a problem, but static isn't the solution.
> You should be able to get the appropriate paths from autoconf, but I would
> refer you to Bart on that.

Sure, if someone can suggest a better way of doing this, I am up for it. I just
don't know how to do it as of now.

> By "all builds" I meant build/tests/fmt/clippy etc of this module, not
> others.

Ahh.

> My concern being that a subsequent bindgen may introduce a problem into
> the generated code that the allows would hide.  So try to keep them
> restricted to the problem at hand as much as possible.

I agree.

> #[cfg_attr(any(test,fmt,clippy), allow(deref_nullptr, non_snake_case))]
> ?

Finally just this was enough for fmt/clippy too :)

#[cfg_attr(test, allow(deref_nullptr, non_snake_case))]

> Specifically the tutoral says:
> "The wrapper.h file will include all the various headers containing
> declarations of structs and functions we would like bindings for."
> 
> If you do need to bundle several headers then fair enough, but I don't
> see any benefit in this case - gpiod.h contains all that.
> 
> The tutorial is probably written that way so it is easy for them to
> refer to the general "wrapper.h", but there is nothing in bindgen that
> requires it.

Sure nothing will break if the file isn't there. Okay removed it now:

diff --git a/bindings/rust/libgpiod-sys/build.rs b/bindings/rust/libgpiod-sys/build.rs
index 147daaf6b1da..96f832134431 100644
--- a/bindings/rust/libgpiod-sys/build.rs
+++ b/bindings/rust/libgpiod-sys/build.rs
@@ -8,7 +8,7 @@ use std::path::PathBuf;
 #[cfg(feature = "generate")]
 fn generate_bindings(files: &Vec<&str>) {
     // Tell cargo to invalidate the built crate whenever following files change
-    println!("cargo:rerun-if-changed=wrapper.h");
+    println!("cargo:rerun-if-changed=../../../include/gpiod.h");

     for file in files {
         println!("cargo:rerun-if-changed={}", file);
@@ -24,7 +24,7 @@ fn generate_bindings(files: &Vec<&str>) {
     let mut builder = bindgen::Builder::default()
         // The input header we would like to generate
         // bindings for.
-        .header("wrapper.h");
+        .header("../../../include/gpiod.h");

     if cfg!(feature = "gpiosim") {
         builder = builder.header("gpiosim_wrapper.h");
diff --git a/bindings/rust/libgpiod-sys/wrapper.h b/bindings/rust/libgpiod-sys/wrapper.h
deleted file mode 100644
index 32290711642a..000000000000
--- a/bindings/rust/libgpiod-sys/wrapper.h
+++ /dev/null
@@ -1 +0,0 @@
-#include "../../../include/gpiod.h"

-- 
viresh



[Index of Archives]     [Linux SPI]     [Linux Kernel]     [Linux ARM (vger)]     [Linux ARM MSM]     [Linux Omap]     [Linux Arm]     [Linux Tegra]     [Fedora ARM]     [Linux for Samsung SOC]     [eCos]     [Linux Fastboot]     [Gcc Help]     [Git]     [DCCP]     [IETF Announce]     [Security]     [Linux MIPS]     [Yosemite Campsites]

  Powered by Linux