anacrolix / cove

A combined BitTorrent frontend and DHT indexer for personal use
https://www.coveapp.info
32 stars 0 forks source link

Use "go:embed" to embed "dht-indexer-rust.so" into go binary #4

Open weebney opened 11 months ago

weebney commented 11 months ago

Using the package embed to embed "dht-indexer-rust.so" into the binary would prevent having to package the library with the binary as a separate file—this would add minimal complexity to cove but make distribution much easier and cleaner.

anacrolix commented 11 months ago

Thank you for the great suggestion! Do you have a use case that can guide my changing this? Do you prefer a single executable? I believe it may be possible to statically link the dht-indexer-rust.so file so that I don't need to copy it out at runtime, which would be the case if it were embedded. I suspect needing to have dht-indexer-rust.so in the working directory can be an issue for Linux users, is that the case for you?

weebney commented 11 months ago

I'm currently packaging cove for Arch; I'm sure as you know it's the de-facto standard for go programs to be entirely self contained (to cut down on package coupling and make distribution easier) and I think cove would be no exception in benefiting from these perks. It doesn't seem like you use Linux, but the primary use case I can see would be in simplifying the packaging of cove for the various flavors of Linux—not a huge use case I guess, but would help me out and anyone else who packages cove in the future. I can do a PR for this and #5 if you can't be bothered.

I suspect needing to have dht-indexer-rust.so in the working directory can be an issue for Linux users, is that the case for you?

See #5—a bit of a broader issue on Linux than just the library not being in the working directory.

anacrolix commented 11 months ago

5 should be fixed shortly. I think I'll look into statically linking the extension for the longer term.

anacrolix commented 11 months ago

Statically linking rust sqlite extensions is non trivial. 😢