Commit 10389ff7e2

10389ff7e23179eb30f44bfc1af076e307653a2a

parent: 53bd451d7c

Unsigned

Darafei Praliaskouski <me@komzpa.net> · 2026-06-23 13:52 UTC
committer: <strk@kbt.io>

fix: propagate WeeChat API cfg to plugin crate

Layout: unified · split

Cargo.lock +4 −13
@@ -284,7 +284,7 @@ dependencies = [
284284 "bitflags 2.10.0",
285285 "cexpr",
286286 "clang-sys",
287 "itertools 0.13.0",
287 "itertools 0.10.5",
288288 "log",
289289 "prettyplease",
290290 "proc-macro2",
@@ -1792,15 +1792,6 @@ dependencies = [
17921792 "either",
17931793]
17941794
1795[[package]]
1796name = "itertools"
1797version = "0.13.0"
1798source = "registry+https://github.com/rust-lang/crates.io-index"
1799checksum = "413ee7dfc52ee1a4949ceeb7dbc8a33f2d6c088194d9f922fb8318faf1f01186"
1800dependencies = [
1801 "either",
1802]
1803
18041795[[package]]
18051796name = "itertools"
18061797version = "0.14.0"
@@ -4602,7 +4593,7 @@ dependencies = [
46024593[[package]]
46034594name = "weechat"
46044595version = "0.4.0"
4605source = "git+https://github.com/poljar/rust-weechat#fbe2ed45d42d4c7f34d5d7aeaff98d76b7cd9211"
4596source = "git+https://github.com/poljar/rust-weechat#adb96ffc9f229cbff05ad51b0ff4c9d46597e2f4"
46064597dependencies = [
46074598 "async-task",
46084599 "async-trait",
@@ -4619,7 +4610,7 @@ dependencies = [
46194610[[package]]
46204611name = "weechat-macro"
46214612version = "0.4.0"
4622source = "git+https://github.com/poljar/rust-weechat#fbe2ed45d42d4c7f34d5d7aeaff98d76b7cd9211"
4613source = "git+https://github.com/poljar/rust-weechat#adb96ffc9f229cbff05ad51b0ff4c9d46597e2f4"
46234614dependencies = [
46244615 "libc",
46254616 "proc-macro2",
@@ -4652,7 +4643,7 @@ dependencies = [
46524643[[package]]
46534644name = "weechat-sys"
46544645version = "0.4.0"
4655source = "git+https://github.com/poljar/rust-weechat#fbe2ed45d42d4c7f34d5d7aeaff98d76b7cd9211"
4646source = "git+https://github.com/poljar/rust-weechat#adb96ffc9f229cbff05ad51b0ff4c9d46597e2f4"
46564647dependencies = [
46574648 "bindgen",
46584649 "libc",
Cargo.toml +3
@@ -34,6 +34,9 @@ image = { version = "*", default-features = false, features = ["jpeg"] }
3434git = "https://github.com/poljar/rust-weechat"
3535features = ["async", "config_macro"]
3636
37[build-dependencies.weechat-sys]
38git = "https://github.com/poljar/rust-weechat"
39
3740[dependencies.matrix-sdk]
3841version = "0.14.0"
3942# git = "https://github.com/matrix-org/matrix-rust-sdk.git"
build.rs added +30
@@ -0,0 +1,30 @@
1#[allow(unused)]
2#[repr(u64)]
3enum WeechatApiVersions {
4 V4_1_0 = 20230908,
5 V4_2_0 = 20240105,
6}
7
8fn main() {
9 println!("cargo::rerun-if-changed=build.rs");
10 println!("cargo::rerun-if-env-changed=WEECHAT_BUNDLED");
11 println!("cargo::rerun-if-env-changed=WEECHAT_PLUGIN_FILE");
12 println!("cargo::rustc-check-cfg=cfg(weechat410)");
13 println!("cargo::rustc-check-cfg=cfg(weechat420)");
14
15 let (version, _) =
16 std::str::from_utf8(weechat_sys::WEECHAT_PLUGIN_API_VERSION)
17 .expect("Failed to parse WeeChat API version string")
18 .split_once('-')
19 .expect("Failed to split WeeChat API version string");
20
21 let version: u64 = version
22 .parse()
23 .expect("Failed to parse WeeChat API version string as u64");
24
25 if version >= WeechatApiVersions::V4_2_0 as u64 {
26 println!("cargo::rustc-cfg=weechat420");
27 } else {
28 println!("cargo::rustc-cfg=weechat410");
29 }
30}