Description
When I build bindings to foreign libraries now I prefer to build static native libraries and link them statically into the rust crate. This is a very convenient form for foreign libraries to be in because then you don't have to worry about native dynamic linking rules - everything is a rust crate and follows rust rules. Treating foreign libraries as crates is also potentially convenient for build tools like cargo, which currently has little or no support for them.
The process of constructing this type of hybrid crate is pretty straightforward but there isn't any language or tool support for it.
What I want is a little library that, given the proper configuration, will
- Run custom build logic to generate a static library archive file at a specific location
- Run bindgen to generate the rust bindings
- Output the proper set of attributes to make rust find and link to the static library
This could start out as a standalone build tool, but would need to end up compatible with cargo, and possibly even a rustc plugin that does the building, linking and bindgenating.