Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
It has been a few years since I have touched the xed-sys crate and advancements to the rust ecosystem have made some of the hacks we used to need obsolete. This commit reworks how and when bindings are generated.
The new approach has two main advantages:
I have also thrown in the enc2 feature that is in the process of being introduced by #65. We do end up needing bindgen when the enc2 feature is enabled as the generated bindings would be too large to submit to crates.io. (They are >40MB!).
With that said, here's how things work now:
./generate.sh
. XED's headers don't contain any platform-dependent code so this should remain portable to any platforms where XED is supported.With the new experimental --wrap-static-fns bindgen option we can drop the janky c2rust step that translates versions of these functions to rust so that they can be included. Instead bindgen generates an additional C file that declares a set of new functions that forward to the static functions, the generated bindings refer to these forwarding functions instead of the original ones.