From d44f647e45745e1ce6073ec2a28dffb5887120dd Mon Sep 17 00:00:00 2001 From: salmonik Date: Thu, 29 Oct 2026 23:20:07 +0100 Subject: v3.1.1: make native-tls optional so the client cross-compiles without OpenSSL --- Cargo.toml | 20 ++++++++++++++++++-- docs/TESTING.md | 24 ++++++++++++++++++++++++ 2 files changed, 42 insertions(+), 2 deletions(-) diff --git a/Cargo.toml b/Cargo.toml index f212238..d13a16c 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -1,8 +1,24 @@ [package] name = "zagan-bet" -version = "3.1.0" +version = "3.1.1" edition = "2024" +[features] +default = ["server"] +# The server links native-tls (OpenSSL). The client is rustls-only, so 32-bit +# builds can skip the server dependency entirely: +# cargo build --bin client --no-default-features --target i686-unknown-linux-gnu +server = ["native-tls"] + +[[bin]] +name = "client" +path = "src/bin/client/main.rs" + +[[bin]] +name = "server" +path = "src/bin/server/main.rs" +required-features = ["server"] + [dependencies] rusqlite = { version = "0.29", features = ["bundled"] } crossterm = "0.27" @@ -14,5 +30,5 @@ ctrlc = "3.4" serde = { version = "1.0", features = ["derive"] } serde_json = "1.0" uuid = { version = "1.0", features = ["v4"] } -native-tls = "0.2" +native-tls = { version = "0.2", optional = true } rustls = { version = "0.21", features = ["dangerous_configuration"] } diff --git a/docs/TESTING.md b/docs/TESTING.md index 0c931d8..c68b6c4 100644 --- a/docs/TESTING.md +++ b/docs/TESTING.md @@ -9,6 +9,30 @@ cargo test The suite is deterministic and headless: no network, no PTY, no sleeps, no shared global database. Each test owns its state. +## Cross-compiling the client + +The client is rustls-only. The server is the only thing that links OpenSSL via +`native-tls`, so it is behind the default `server` feature. Building the client +for another target does not need that toolchain at all: + +```sh +rustup target add i686-unknown-linux-gnu +cargo build --release --bin client --no-default-features \ + --target i686-unknown-linux-gnu +``` + +`--no-default-features` drops `native-tls`, which is what fails with +`Could not find OpenSSL` when no 32-bit OpenSSL is installed. `rusqlite` is +bundled and `ring` (rustls) only needs `gcc -m32`, which a normal multilib +setup provides. The binary can be checked with +`file target/i686-unknown-linux-gnu/release/client`; it must say `ELF 32-bit` +and `Intel i386`. + +Building the server for i686 is a different problem: it needs 32-bit OpenSSL +headers and libraries (`libssl-dev:i386` plus +`PKG_CONFIG_ALLOW_CROSS=1 PKG_CONFIG_LIBDIR=/usr/lib/i386-linux-gnu/pkgconfig`), +or a vendored OpenSSL. + | File | Covers | | --- | --- | | `tests/client_core.rs` | Client command/game flows via a headless screen applying logical effects. | -- cgit v1.2.3