Commit 1b2e1c2d58

1b2e1c2d58cd97ed15ac611f1eaf73d2ea0103a8

parent: d11f0ef40d

Unregistered key

Ulyssa <git@ulyssa.dev> · 2026-08-18 00:46 UTC
committer: <noreply@github.com>

Document how to build size-optimized binaries in the README (#644)

Layout: unified · split

Cargo.toml +9
@@ -18,6 +18,9 @@ build = "build.rs"
1818default = ["bundled", "desktop"]
1919bundled = ["matrix-sdk/bundled-sqlite"]
2020desktop = ["dep:notify-rust", "modalkit/clipboard"]
21max_level_warn = ["tracing/max_level_warn"]
22max_level_error = ["tracing/max_level_error"]
23max_level_off = ["tracing/max_level_off"]
2124
2225[build-dependencies.vergen-gitcl]
2326version = "9"
@@ -108,6 +111,12 @@ inherits = "release"
108111incremental = false
109112lto = true
110113
114[profile.release-light]
115inherits = "release-lto"
116opt-level = "z"
117strip = true
118panic = "abort"
119
111120[package.metadata.deb]
112121section = "net"
113122license-file = ["LICENSE", "0"]
README.md +23
@@ -60,6 +60,29 @@ containing the sources (ie: from a git clone):
6060cargo install --locked --path .
6161```
6262
63If you're willing to wait longer on the build, you can use the `release-lto`
64profile to enable link-time optimization:
65
66```
67cargo install --profile release-lto --locked --path .
68```
69
70If you would prefer to optimize for a smaller binary, you can use the
71`release-light` profile, which will do LTO, optimize code generation
72for smaller output, and strip the binary. The `max_level_error` feature
73will also make sure that any `tracing` logs below the error level have
74their strings removed during compile-time, so that you only get `error`
75logs.
76
77```
78cargo install --profile release-light --features max_level_error --path .
79```
80
81Add `--no-default-features` if you want to skip desktop integration (e.g.
82clipboard and notifications support) and you would like to link against
83your system's OpenSSL and SQLite instead of using rustls and a bundled
84SQLite.
85
6386## Installation (via `crates.io`)
6487
6588Install Rust (1.83.0 or above) and Cargo, and then run:
src/config.rs +7 −1
@@ -63,6 +63,12 @@ const DEFAULT_ENABLE_TITLE: bool = true;
6363const DEFAULT_ENC_INDICATOR_LOC: EncryptionIndicatorLocation = EncryptionIndicatorLocation::PROMPT;
6464const DEFAULT_REQ_TIMEOUT: u64 = 120;
6565
66const DEFAULT_LOG_LEVEL: &str = if cfg!(feature = "max_level_error") {
67 "error"
68} else {
69 "warn"
70};
71
6672const COLORS: [Color; 13] = [
6773 Color::Blue,
6874 Color::Cyan,
@@ -940,7 +946,7 @@ impl Tunables {
940946 users: self.users.unwrap_or_default(),
941947
942948 default_markup: self.default_markup.unwrap_or_default(),
943 log_level: self.log_level.unwrap_or_else(|| "warn".to_string()),
949 log_level: self.log_level.unwrap_or_else(|| DEFAULT_LOG_LEVEL.to_owned()),
944950 max_log_files: self.max_log_files.unwrap_or(7),
945951 message_shortcode_display: self.message_shortcode_display.unwrap_or(false),
946952 normal_after_send: self.normal_after_send.unwrap_or(false),
src/windows/room/chat.rs +1
@@ -945,6 +945,7 @@ impl Editable<ProgramContext, ProgramStore, IambInfo> for ChatState {
945945 // Run command again.
946946 delegate!(self, w => w.editor_command(act, ctx, store))
947947 },
948 #[cfg(feature = "desktop")]
948949 Err(EditError::Register(RegisterError::ClipboardImage(data))) => {
949950 let info = store.application.rooms.get_or_default(self.id().to_owned());
950951 let prompt = if self.tbox.get().is_blank() && self.get_reply_to(info).is_none() {