bobrippling / podsync

4 stars 1 forks source link

Allow for building with rustls #3

Closed luctius closed 1 year ago

luctius commented 1 year ago

This still has native-tls as default.

Rustls is easier when cross-compiling since it doesn't rely on openssl.

bobrippling commented 1 year ago

Great! I'd been wanting to build on something a little more powerful than a raspberry pi, so thank you.

Presumably you have arm-linux-gnueabihf-gcc (or whichever cross target you're building for) installed on your machine? I notice the ring dependency needs this still.

Also, I'm thinking we make rustls the default - what do you reckon?

bobrippling commented 1 year ago

I found warp also needed a native openssl build, so to eliminate it entirely we'd need something like this on top:

diff --git i/Cargo.toml w/Cargo.toml
index a572a27..4645c42 100644
--- i/Cargo.toml
+++ w/Cargo.toml
@@ -31,4 +31,4 @@ uuid = { version = "1.3.0", features = ["v4"] }
 [features]
 default = ["native-tls"]
 native-tls = ["sqlx/runtime-tokio-native-tls"]
-rustls = ["sqlx/runtime-tokio-rustls"]
+rustls = ["sqlx/runtime-tokio-rustls", "warp/tokio-rustls"]

And after that we're using Rust for everything except libsqlite3-sys and ring, but I don't see any option to avoid the assembly / C source files these require. I don't have a cross-compiler at the moment, but does the above change work for you?

luctius commented 1 year ago

Due to another project requiring it; I tested this using cross instead of simply using cargo to crosscompile. Using 'cargo build --target armv7-unknown-linux-gnueabihf --features rustls --no-default-features' indeed that fails (both with and without your patch.)

You patch works when using cross.

Regarding rustls: If you want https support, I agree, I would just use that as standard. That said, I would always use a reverse proxy if I need https (As I do now with podsync).

bobrippling commented 1 year ago

Cool - likewise with the reverse proxy, but nice that we've got options. Thanks for the link to cross too