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" |
| 18 | default = ["bundled", "desktop"] |
18 | default = ["bundled", "desktop"] |
| 19 | bundled = ["matrix-sdk/bundled-sqlite"] |
19 | bundled = ["matrix-sdk/bundled-sqlite"] |
| 20 | desktop = ["dep:notify-rust", "modalkit/clipboard"] |
20 | desktop = ["dep:notify-rust", "modalkit/clipboard"] |
| |
21 | max_level_warn = ["tracing/max_level_warn"] |
| |
22 | max_level_error = ["tracing/max_level_error"] |
| |
23 | max_level_off = ["tracing/max_level_off"] |
| 21 | |
24 | |
| 22 | [build-dependencies.vergen-gitcl] |
25 | [build-dependencies.vergen-gitcl] |
| 23 | version = "9" |
26 | version = "9" |
| @@ -108,6 +111,12 @@ inherits = "release" |
| 108 | incremental = false |
111 | incremental = false |
| 109 | lto = true |
112 | lto = true |
| 110 | |
113 | |
| |
114 | [profile.release-light] |
| |
115 | inherits = "release-lto" |
| |
116 | opt-level = "z" |
| |
117 | strip = true |
| |
118 | panic = "abort" |
| |
119 | |
| 111 | [package.metadata.deb] |
120 | [package.metadata.deb] |
| 112 | section = "net" |
121 | section = "net" |
| 113 | license-file = ["LICENSE", "0"] |
122 | license-file = ["LICENSE", "0"] |
README.md
+23
| @@ -60,6 +60,29 @@ containing the sources (ie: from a git clone): |
| 60 | cargo install --locked --path . |
60 | cargo install --locked --path . |
| 61 | ``` |
61 | ``` |
| 62 | |
62 | |
| |
63 | If you're willing to wait longer on the build, you can use the `release-lto` |
| |
64 | profile to enable link-time optimization: |
| |
65 | |
| |
66 | ``` |
| |
67 | cargo install --profile release-lto --locked --path . |
| |
68 | ``` |
| |
69 | |
| |
70 | If you would prefer to optimize for a smaller binary, you can use the |
| |
71 | `release-light` profile, which will do LTO, optimize code generation |
| |
72 | for smaller output, and strip the binary. The `max_level_error` feature |
| |
73 | will also make sure that any `tracing` logs below the error level have |
| |
74 | their strings removed during compile-time, so that you only get `error` |
| |
75 | logs. |
| |
76 | |
| |
77 | ``` |
| |
78 | cargo install --profile release-light --features max_level_error --path . |
| |
79 | ``` |
| |
80 | |
| |
81 | Add `--no-default-features` if you want to skip desktop integration (e.g. |
| |
82 | clipboard and notifications support) and you would like to link against |
| |
83 | your system's OpenSSL and SQLite instead of using rustls and a bundled |
| |
84 | SQLite. |
| |
85 | |
| 63 | ## Installation (via `crates.io`) |
86 | ## Installation (via `crates.io`) |
| 64 | |
87 | |
| 65 | Install Rust (1.83.0 or above) and Cargo, and then run: |
88 | Install 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; |
| 63 | const DEFAULT_ENC_INDICATOR_LOC: EncryptionIndicatorLocation = EncryptionIndicatorLocation::PROMPT; |
63 | const DEFAULT_ENC_INDICATOR_LOC: EncryptionIndicatorLocation = EncryptionIndicatorLocation::PROMPT; |
| 64 | const DEFAULT_REQ_TIMEOUT: u64 = 120; |
64 | const DEFAULT_REQ_TIMEOUT: u64 = 120; |
| 65 | |
65 | |
| |
66 | const DEFAULT_LOG_LEVEL: &str = if cfg!(feature = "max_level_error") { |
| |
67 | "error" |
| |
68 | } else { |
| |
69 | "warn" |
| |
70 | }; |
| |
71 | |
| 66 | const COLORS: [Color; 13] = [ |
72 | const COLORS: [Color; 13] = [ |
| 67 | Color::Blue, |
73 | Color::Blue, |
| 68 | Color::Cyan, |
74 | Color::Cyan, |
| @@ -940,7 +946,7 @@ impl Tunables { |
| 940 | users: self.users.unwrap_or_default(), |
946 | users: self.users.unwrap_or_default(), |
| 941 | |
947 | |
| 942 | default_markup: self.default_markup.unwrap_or_default(), |
948 | 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()), |
| 944 | max_log_files: self.max_log_files.unwrap_or(7), |
950 | max_log_files: self.max_log_files.unwrap_or(7), |
| 945 | message_shortcode_display: self.message_shortcode_display.unwrap_or(false), |
951 | message_shortcode_display: self.message_shortcode_display.unwrap_or(false), |
| 946 | normal_after_send: self.normal_after_send.unwrap_or(false), |
952 | 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 { |
| 945 | // Run command again. |
945 | // Run command again. |
| 946 | delegate!(self, w => w.editor_command(act, ctx, store)) |
946 | delegate!(self, w => w.editor_command(act, ctx, store)) |
| 947 | }, |
947 | }, |
| |
948 | #[cfg(feature = "desktop")] |
| 948 | Err(EditError::Register(RegisterError::ClipboardImage(data))) => { |
949 | Err(EditError::Register(RegisterError::ClipboardImage(data))) => { |
| 949 | let info = store.application.rooms.get_or_default(self.id().to_owned()); |
950 | let info = store.application.rooms.get_or_default(self.id().to_owned()); |
| 950 | let prompt = if self.tbox.get().is_blank() && self.get_reply_to(info).is_none() { |
951 | let prompt = if self.tbox.get().is_blank() && self.get_reply_to(info).is_none() { |