Re: [PATCH V4 2/8] libgpiod: Add pre generated rust bindings

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

 



On Fri, Jul 08, 2022 at 05:04:55PM +0530, Viresh Kumar wrote:
> This adds a copy of pre generated bindings and adds the suggested way of
> updating those in README.
> 
> Signed-off-by: Viresh Kumar <viresh.kumar@xxxxxxxxxx>
> ---
>  bindings/rust/libgpiod-sys/README.md       |   10 +
>  bindings/rust/libgpiod-sys/src/bindings.rs | 1920 ++++++++++++++++++++
>  2 files changed, 1930 insertions(+)
>  create mode 100644 bindings/rust/libgpiod-sys/README.md
>  create mode 100644 bindings/rust/libgpiod-sys/src/bindings.rs
> 
> diff --git a/bindings/rust/libgpiod-sys/README.md b/bindings/rust/libgpiod-sys/README.md
> new file mode 100644
> index 000000000000..ea037d6d7803
> --- /dev/null
> +++ b/bindings/rust/libgpiod-sys/README.md
> @@ -0,0 +1,10 @@
> +# Generated libgpiod-sys Rust FFI bindings
> +Automatically generated Rust FFI bindings via
> +	[bindgen](https://github.com/rust-lang/rust-bindgen).
> +
> +## Updating bindings
> +1. Clone the source from
> +	<https://git.kernel.org/pub/scm/libs/libgpiod/libgpiod.git/>
> +2. run `cd libgpiod/bindings/rust/libgpiod-sys/`
> +2. run `cargo build --features generate`
> +3. Commit changes in `src/bindings.rs`

Those instructions do not force the regeneration of the bindings.
I assume the rust build system is being clever and determining nothing has
changed and short circuiting, but I would like to regnerate them to be sure.
How do I do that?

How is the --features approach better than just
bindgen -o src/bindings.rs ../../../include/gpiod.h
?

Why not build this all the time rather than hiding it behind a feature?

> diff --git a/bindings/rust/libgpiod-sys/src/bindings.rs b/bindings/rust/libgpiod-sys/src/bindings.rs
> new file mode 100644
> index 000000000000..930eb894f66f
> --- /dev/null
> +++ b/bindings/rust/libgpiod-sys/src/bindings.rs
> @@ -0,0 +1,1920 @@
> +/* automatically generated by rust-bindgen 0.59.2 */
> +

Yet the Cargo.toml specifies 0.59.1.
So you didn't generate this with the instructions above then?

Having said that, I can confirm that 

bindgen -o src/bindings.rs wrapper.h

with the appropriate bindgen, regenerates the pre-generated file.

Cheers,
Kent.



[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