-
Notifications
You must be signed in to change notification settings - Fork 37
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
build: automate bindings generation #41
Comments
Hi @JarvisCraft, I took a bit of a look into how a package like In short, they build against the system OpenSSL headers and provide no guarantee of any API stability when linking against one specific version or another. This puts the burden on the higher level crates to bridge this gap. They expose the currently linked version via a One good bit of news is that Flipper Devices now provide SDK archives for each release (e.g. The current other reason for needing an upstream toolchain is for a compatible "sysroot". Unfortunately Note: The So the current trade-off has been to vendor the generated bindings to minimize build requirements (
|
I am in new territory here but would any of this work allow us to use a more recent API version? For example, the "latest"? I think it is impossible to write Rust applications with the latest API (e.g. in the upstream's |
Yes, that should be possible. To keep things somewhat reproducible, each version of the Note: I can't guarantee compatibility with forks of the official firmware. But provided you don't break the upstream APIs, things should work. |
Thanks for the detailed overview of the current implementation reasoning and problems with alternative approaches! Since there still is a possibility for improvements using the approaches you've mentioned, I suggest that this issue is kept as a tracking-issue for such improvements in the future. Maybe its worth adding some GitHub metadata to it (i.e labels, assignees etc) so it is easier to track its status. As for the |
I've just released This release still uses the old mechanism of generating |
It may be worthwhile to consider what inkwell does with LLVM versions. Basically they have This allows the user to build |
That's a very clever way of going about it! It's also probably not necessary before upstream reaches 1.0, because they are making changes quite frequently at the moment, and I'm not sure there's much benefit in spending time on supporting multiple pre-1.0 SDK APIs when we are still building out the Rust APIs. But it is an interesting idea to keep in mind as the SDK finalizes. |
Oh, didn't know they planned to stabilize. With the rate they break the API, it's probably a good idea to wait for 1.0 then |
Firmware 1.0 was just released, so we should now consider multi-version support. |
Since #152 is now merged, we can automatically generate bindings in the repository, but +1 on goal of multi-version support. |
This replaces the `generate-bindings` script with a `build.rs` script for `flipperzero-sys` that downloads the latest SDK and uses that to generate Rust bindings. Fixes: #41
This replaces the `generate-bindings` script with a `build.rs` script for `flipperzero-sys` that downloads the latest SDK and uses that to generate Rust bindings. Fixes: #41
This replaces the `generate-bindings` script with a `build.rs` script for `flipperzero-sys` that downloads the latest SDK and uses that to generate Rust bindings. Fixes: #41
This replaces the `generate-bindings` script with a `build.rs` script for `flipperzero-sys` that downloads the latest SDK and uses that to generate Rust bindings. Fixes: #41
This replaces the `generate-bindings` script with a `build.rs` script for `flipperzero-sys` that downloads the latest SDK and uses that to generate Rust bindings. Fixes: #41
This replaces the `generate-bindings` script with a `build.rs` script for `flipperzero-sys` that downloads the latest SDK and uses that to generate Rust bindings. Fixes: #41
This replaces the `generate-bindings` script with a `build.rs` script for `flipperzero-sys` that downloads the latest SDK and uses that to generate Rust bindings. Fixes: #41
This replaces the `generate-bindings` script with a `build.rs` script for `flipperzero-sys` that downloads the latest SDK and uses that to generate Rust bindings. Fixes: #41
This replaces the `generate-bindings` script with a `build.rs` script for `flipperzero-sys` that downloads the latest SDK and uses that to generate Rust bindings. Fixes: #41
I'm going to close this issue now that #152 is merged, though will create a new issue for supporting multiple SDK versions. |
This replaces the `generate-bindings` script with a `build.rs` script for `flipperzero-sys` that downloads the latest SDK and uses that to generate Rust bindings. Fixes: #41
This replaces the `generate-bindings` script with a `build.rs` script for `flipperzero-sys` that downloads the latest SDK and uses that to generate Rust bindings. Fixes: #41
This replaces the `generate-bindings` script with a `build.rs` script for `flipperzero-sys` that downloads the latest SDK and uses that to generate Rust bindings. Fixes: #41
This replaces the `generate-bindings` script with a `build.rs` script for `flipperzero-sys` that downloads the latest SDK and uses that to generate Rust bindings. Fixes: #41
This replaces the `generate-bindings` script with a `build.rs` script for `flipperzero-sys` that downloads the latest SDK and uses that to generate Rust bindings. Fixes: #41
This replaces the `generate-bindings` script with a `build.rs` script for `flipperzero-sys` that downloads the latest SDK and uses that to generate Rust bindings. Fixes: #41
This replaces the `generate-bindings` script with a `build.rs` script for `flipperzero-sys` that downloads the latest SDK and uses that to generate Rust bindings. Fixes: #41
This replaces the `generate-bindings` script with a `build.rs` script for `flipperzero-sys` that downloads the latest SDK and uses that to generate Rust bindings. Fixes: #41
This replaces the `generate-bindings` script with a `build.rs` script for `flipperzero-sys` that downloads the latest SDK and uses that to generate Rust bindings. Fixes: #41
This replaces the `generate-bindings` script with a `build.rs` script for `flipperzero-sys` that downloads the latest SDK and uses that to generate Rust bindings. Fixes: #41
Description
Introduction
Bindings are currently generated using
tools/
based on bindgen. This works okay but have the following cons:The suggestion
The idea is to replace this approach with a
build.rs
-based generation.I expect this to be in a form of a cross-platform
build.rs
incrates/sys
capable of running codegeneration by itself.Unanswered questions
Original definitions location
It's hard for me to decide what is the best way to store files with original header-definitions. I guess that it is worth looking on other projects utilizing
build.rs
for FFI code generation.One way may be using git submodules, although I look at this as not the best mechanism which is hard to maintain sometimes so looking at alternative approaches is something expected.
We may also be able to utilize
api_symbols.csv
provided in firmware repository as it seems to list available functions, but it seems to lack anystruct
definitions and type aliases which is a serious limitation.Version updates
It is also worth discussing the mechanism for performing version updates.
I would suggest following dependabot's approach of performing scheduled update checks. We could theoretically configure GitHub Actions to run on schedule checking for fresh firmware releases and, in case of them being present, run automation to create a PR with header updates.
The text was updated successfully, but these errors were encountered: