I’ve written a spatialite-sys crate that links the SpatiaLite geospatial engine into Rust binaries/libraries. 0.2.0, the current released version, links against locally-installed libspatialite. However, my primary aim was to use this on Android, and the last thing I wanted to do was manually build a whole bunch of sources natively on Android, set up linker paths, etc.
So as per recommendations in the Cargo book, 0.3.0 vendors a whole bunch of dependencies. The current crate works beautifully both as a locally-installed library on my desktop and as a library called via JNI on Android. Unfortunately, my vendored sources are 116 MB, and the crate is far too large to release on crates.io. That’s a shame, because I’d like to contribute this back. So how do I go about making this dependency available? I have a few thoughts:
- Do what I am now, and depend on the git repo. Not a bad solution, but not great for discoverability and external users either.
- Host my own crate repository with a higher upload limit. Is there a self-hostable Cargo/crate repo out there? Probably has about the same discoverability, and I’m not sure if this gets me anything above just pulling from git.
- Is it possible to swap out some dependencies for sys crates? I.e. if I depend on sqlite3-src, will that make libsqlite3.a and sqlite3.h available to other build steps? That may let me shrink the bundle somewhat–I think some dependencies are in there because they’re needed for sqlite3–but there are other large dependencies that I’ve tweaked somewhat to make them build on both Linux and Android. So that isn’t a complete fix, and since it took me a while to get this house of cards working at all, maybe I don’t want to monkey around with non-vendored dependencies.
- Something else entirely? Building the entire dependency tree for this crate takes several minutes on my high-end desktop, and likely most users can just install libspatialite and go. You only really want to build/statically link everything on platforms like Android, so maybe I can get away with putting the vendored sources in another repo/file and downloading them if needed? Are there any examples of crates that do this? Or maybe there’s another approach entirely that I’m not considering?
Thanks for any pointers.