From 66181c61af127bf63a062213f3da6b473729a813 Mon Sep 17 00:00:00 2001 From: Jade Ellis Date: Thu, 24 Jul 2025 21:51:52 +0100 Subject: [PATCH] chore: Update rocksdb, feature flag changes Most of the way to static musl builds, just zlib I think --- .forgejo/workflows/rust-checks.yml | 4 ++-- CONTRIBUTING.md | 6 +++--- Cargo.lock | 29 +++++++++++++++++++++++------ Cargo.toml | 2 +- docker/musl.Dockerfile | 2 +- docs/deploying/generic.md | 2 +- engage.toml | 6 +++--- src/database/Cargo.toml | 8 ++++++++ src/main/Cargo.toml | 27 +++++++++++++++++++++------ tests/cargo_smoke.sh | 2 +- 10 files changed, 64 insertions(+), 24 deletions(-) diff --git a/.forgejo/workflows/rust-checks.yml b/.forgejo/workflows/rust-checks.yml index 0595c053..c46363a0 100644 --- a/.forgejo/workflows/rust-checks.yml +++ b/.forgejo/workflows/rust-checks.yml @@ -73,7 +73,7 @@ jobs: run: | cargo clippy \ --workspace \ - --all-features \ + --features full \ --locked \ --no-deps \ --profile test \ @@ -133,7 +133,7 @@ jobs: run: | cargo test \ --workspace \ - --all-features \ + --features full \ --locked \ --profile test \ --all-targets \ diff --git a/CONTRIBUTING.md b/CONTRIBUTING.md index 2e11cff4..b5ecf38a 100644 --- a/CONTRIBUTING.md +++ b/CONTRIBUTING.md @@ -65,11 +65,11 @@ Tests, compilation, and linting can be run with standard Cargo commands: cargo test # Check compilation -cargo check --workspace --all-features +cargo check --workspace --features full # Run lints -cargo clippy --workspace --all-features -# Auto-fix: cargo clippy --workspace --all-features --fix --allow-staged; +cargo clippy --workspace --features full +# Auto-fix: cargo clippy --workspace --features full --fix --allow-staged; # Format code (must use nightly) cargo +nightly fmt diff --git a/Cargo.lock b/Cargo.lock index 1866a691..bfab6255 100644 --- a/Cargo.lock +++ b/Cargo.lock @@ -543,6 +543,24 @@ dependencies = [ "syn", ] +[[package]] +name = "bindgen" +version = "0.72.0" +source = "registry+https://github.com/rust-lang/crates.io-index" +checksum = "4f72209734318d0b619a5e0f5129918b848c416e122a3c4ce054e03cb87b726f" +dependencies = [ + "bitflags 2.9.1", + "cexpr", + "clang-sys", + "itertools 0.12.1", + "proc-macro2", + "quote", + "regex", + "rustc-hash 2.1.1", + "shlex", + "syn", +] + [[package]] name = "bit_field" version = "0.10.2" @@ -847,7 +865,6 @@ dependencies = [ name = "conduwuit" version = "0.5.0-rc.6" dependencies = [ - "bindgen 0.71.1", "clap", "conduwuit_admin", "conduwuit_api", @@ -4117,10 +4134,10 @@ dependencies = [ [[package]] name = "rust-librocksdb-sys" -version = "0.33.0+9.11.1" -source = "git+https://forgejo.ellis.link/continuwuation/rust-rocksdb-zaidoon1?rev=fc9a99ac54a54208f90fdcba33ae6ee8bc3531dd#fc9a99ac54a54208f90fdcba33ae6ee8bc3531dd" +version = "0.38.0+10.4.2" +source = "git+https://forgejo.ellis.link/continuwuation/rust-rocksdb-zaidoon1?rev=01e1128898fc4bbb776e7a6deec2aa3b675b0442#01e1128898fc4bbb776e7a6deec2aa3b675b0442" dependencies = [ - "bindgen 0.71.1", + "bindgen 0.72.0", "bzip2-sys", "cc", "glob", @@ -4134,8 +4151,8 @@ dependencies = [ [[package]] name = "rust-rocksdb" -version = "0.37.0" -source = "git+https://forgejo.ellis.link/continuwuation/rust-rocksdb-zaidoon1?rev=fc9a99ac54a54208f90fdcba33ae6ee8bc3531dd#fc9a99ac54a54208f90fdcba33ae6ee8bc3531dd" +version = "0.42.1" +source = "git+https://forgejo.ellis.link/continuwuation/rust-rocksdb-zaidoon1?rev=01e1128898fc4bbb776e7a6deec2aa3b675b0442#01e1128898fc4bbb776e7a6deec2aa3b675b0442" dependencies = [ "libc", "rust-librocksdb-sys", diff --git a/Cargo.toml b/Cargo.toml index 9cb5ff84..e95567bd 100644 --- a/Cargo.toml +++ b/Cargo.toml @@ -391,7 +391,7 @@ features = [ [workspace.dependencies.rust-rocksdb] git = "https://forgejo.ellis.link/continuwuation/rust-rocksdb-zaidoon1" -rev = "fc9a99ac54a54208f90fdcba33ae6ee8bc3531dd" +rev = "01e1128898fc4bbb776e7a6deec2aa3b675b0442" default-features = false features = [ "multi-threaded-cf", diff --git a/docker/musl.Dockerfile b/docker/musl.Dockerfile index d5317d15..b55aecb0 100644 --- a/docker/musl.Dockerfile +++ b/docker/musl.Dockerfile @@ -133,7 +133,7 @@ RUN --mount=type=cache,target=/usr/local/cargo/registry \ mkdir /out/sbin PACKAGE=conduwuit xx-cargo build --locked --profile ${RUST_PROFILE} \ - -p $PACKAGE --features libclang_static; + -p $PACKAGE --no-default-features --features bindgen-static,release_max_log_level,standard; BINARIES=($(cargo metadata --no-deps --format-version 1 | \ jq -r ".packages[] | select(.name == \"$PACKAGE\") | .targets[] | select( .kind | map(. == \"bin\") | any ) | .name")) for BINARY in "${BINARIES[@]}"; do diff --git a/docs/deploying/generic.md b/docs/deploying/generic.md index 3f9d1a16..9f5051f7 100644 --- a/docs/deploying/generic.md +++ b/docs/deploying/generic.md @@ -44,7 +44,7 @@ If wanting to build using standard Rust toolchains, make sure you install: - (On linux) `pkg-config` on the compiling machine to allow finding `liburing` - A C++ compiler and (on linux) `libclang` for RocksDB -You can build Continuwuity using `cargo build --release --all-features`. +You can build Continuwuity using `cargo build --release`. ### Building with Nix diff --git a/engage.toml b/engage.toml index 5048fde2..92e9d399 100644 --- a/engage.toml +++ b/engage.toml @@ -83,7 +83,7 @@ env DIRENV_DEVSHELL=all-features \ --workspace \ --locked \ --profile test \ - --all-features \ + --features full \ --no-deps \ --document-private-items \ --color always @@ -96,7 +96,7 @@ script = """ direnv exec . \ cargo clippy \ --workspace \ - --all-features \ + --features full \ --locked \ --profile test \ --color=always \ @@ -114,7 +114,7 @@ env DIRENV_DEVSHELL=all-features \ --workspace \ --locked \ --profile test \ - --all-features \ + --features full \ --color=always \ -- \ -D warnings diff --git a/src/database/Cargo.toml b/src/database/Cargo.toml index 55d4793f..9f51f366 100644 --- a/src/database/Cargo.toml +++ b/src/database/Cargo.toml @@ -44,6 +44,14 @@ zstd_compression = [ "conduwuit-core/zstd_compression", "rust-rocksdb/zstd", ] +bindgen-static = [ + # "bindgen/static" + # "clang-sys/static" + "rust-rocksdb/bindgen-static" +] +bindgen-runtime = [ + "rust-rocksdb/bindgen-runtime" +] [dependencies] async-channel.workspace = true diff --git a/src/main/Cargo.toml b/src/main/Cargo.toml index 3b97f625..0d7dd844 100644 --- a/src/main/Cargo.toml +++ b/src/main/Cargo.toml @@ -43,6 +43,11 @@ assets = [ [features] default = [ + "standard", + "release_max_log_level", + "bindgen-runtime", # replace with bindgen-static on alpine +] +standard = [ "blurhashing", "brotli_compression", "element_hacks", @@ -52,10 +57,17 @@ default = [ "jemalloc_conf", "journald", "media_thumbnail", - "release_max_log_level", "systemd", "url_preview", - "zstd_compression", + "zstd_compression" +] +full = [ + "standard", + "hardened_malloc", + "jemalloc_prof", + "perf_measurements", + "tokio_console" + # sentry_telemetry ] blurhashing = [ @@ -161,14 +173,17 @@ zstd_compression = [ conduwuit_mods = [ "conduwuit-core/conduwuit_mods", ] - -libclang_static = [ - "bindgen/static" +bindgen-static = [ + # "bindgen/static" # "clang-sys/static" + "conduwuit-database/bindgen-static" +] +bindgen-runtime = [ + "conduwuit-database/bindgen-runtime" ] [build-dependencies] -bindgen = {version = "0.71.1", default-features = false} +# bindgen = {version = "0.71.1", default-features = false} # clang-sys = {version = "1", default-features = false} [dependencies] diff --git a/tests/cargo_smoke.sh b/tests/cargo_smoke.sh index 946790c3..e8bb5512 100755 --- a/tests/cargo_smoke.sh +++ b/tests/cargo_smoke.sh @@ -48,7 +48,7 @@ vector () { VECTOR_OPTS=$@ element "$TOOLCHAIN" $VECTOR_OPTS --no-default-features element "$TOOLCHAIN" $VECTOR_OPTS --features=default - element "$TOOLCHAIN" $VECTOR_OPTS --all-features + element "$TOOLCHAIN" $VECTOR_OPTS --features full } matrix () {