From c1f4cf956d7ae63b80c8fd9507ca12aa55dcfd22 Mon Sep 17 00:00:00 2001 From: Raboneko <119771935+raboneko@users.noreply.github.com> Date: Tue, 25 Feb 2025 18:10:00 -0800 Subject: [PATCH] add: kanata (#3534) (#3554) (cherry picked from commit 94844e57e292ffb7600909f7cd449c93e21cf96e) Co-authored-by: madomado --- anda/tools/kanata/anda.hcl | 5 + .../kanata/kanata-fix-metadata-auto.diff | 128 ++++++++ anda/tools/kanata/rust-kanata.spec | 276 ++++++++++++++++++ anda/tools/kanata/update.rhai | 1 + 4 files changed, 410 insertions(+) create mode 100644 anda/tools/kanata/anda.hcl create mode 100644 anda/tools/kanata/kanata-fix-metadata-auto.diff create mode 100644 anda/tools/kanata/rust-kanata.spec create mode 100644 anda/tools/kanata/update.rhai diff --git a/anda/tools/kanata/anda.hcl b/anda/tools/kanata/anda.hcl new file mode 100644 index 0000000000..7bcdfdbbaa --- /dev/null +++ b/anda/tools/kanata/anda.hcl @@ -0,0 +1,5 @@ +project pkg { + rpm { + spec = "rust-kanata.spec" + } +} diff --git a/anda/tools/kanata/kanata-fix-metadata-auto.diff b/anda/tools/kanata/kanata-fix-metadata-auto.diff new file mode 100644 index 0000000000..6dad0fb43f --- /dev/null +++ b/anda/tools/kanata/kanata-fix-metadata-auto.diff @@ -0,0 +1,128 @@ +--- kanata-1.8.0/Cargo.toml 1970-01-01T00:00:01+00:00 ++++ kanata-1.8.0/Cargo.toml 2025-02-24T02:18:17.384667+00:00 +@@ -124,23 +124,9 @@ + "kanata-parser/gui", + "win_sendinput_send_scancodes", + "win_llhook_read_scancodes", +- "muldiv", +- "strip-ansi-escapes", + "open", +- "dep:windows-sys", +- "winapi/processthreadsapi", +- "native-windows-gui/tray-notification", +- "native-windows-gui/message-window", +- "native-windows-gui/menu", +- "native-windows-gui/cursor", +- "native-windows-gui/high-dpi", +- "native-windows-gui/embed-resource", +- "native-windows-gui/image-decoder", +- "native-windows-gui/notice", +- "native-windows-gui/animation-timer", + ] + interception_driver = [ +- "kanata-interception", + "kanata-parser/interception_driver", + ] + passthru_ahk = [ +@@ -154,9 +140,7 @@ + wasm = ["instant/wasm-bindgen"] + win_llhook_read_scancodes = ["kanata-parser/win_llhook_read_scancodes"] + win_manifest = [ +- "embed-resource", + "indoc", +- "regex", + ] + win_sendinput_send_scancodes = ["kanata-parser/win_sendinput_send_scancodes"] + zippychord = ["kanata-parser/zippychord"] +@@ -189,91 +173,3 @@ + [target.'cfg(target_os = "linux")'.dependencies.signal-hook] + version = "0.3.14" + +-[target.'cfg(target_os = "macos")'.dependencies.core-graphics] +-version = "0.24.0" +- +-[target.'cfg(target_os = "macos")'.dependencies.karabiner-driverkit] +-version = "0.1.4" +- +-[target.'cfg(target_os = "macos")'.dependencies.libc] +-version = "0.2" +- +-[target.'cfg(target_os = "macos")'.dependencies.objc] +-version = "0.2.7" +- +-[target.'cfg(target_os = "macos")'.dependencies.open] +-version = "5" +-optional = true +- +-[target.'cfg(target_os = "macos")'.dependencies.os_pipe] +-version = "1.2.1" +- +-[target.'cfg(target_os = "windows")'.dependencies.encode_unicode] +-version = "0.3.6" +- +-[target.'cfg(target_os = "windows")'.dependencies.kanata-interception] +-version = "0.3.0" +-optional = true +- +-[target.'cfg(target_os = "windows")'.dependencies.muldiv] +-version = "1.0.1" +-optional = true +- +-[target.'cfg(target_os = "windows")'.dependencies.native-windows-gui] +-version = "1.0.13" +-default-features = false +- +-[target.'cfg(target_os = "windows")'.dependencies.open] +-version = "5" +-features = ["shellexecute-on-windows"] +-optional = true +- +-[target.'cfg(target_os = "windows")'.dependencies.regex] +-version = "1.10.4" +-optional = true +- +-[target.'cfg(target_os = "windows")'.dependencies.strip-ansi-escapes] +-version = "0.2.0" +-optional = true +- +-[target.'cfg(target_os = "windows")'.dependencies.winapi] +-version = "0.3.9" +-features = [ +- "wincon", +- "timeapi", +- "mmsystem", +-] +- +-[target.'cfg(target_os = "windows")'.dependencies.windows-sys] +-version = "0.52.0" +-features = [ +- "Win32_Devices_DeviceAndDriverInstallation", +- "Win32_Devices_Usb", +- "Win32_Foundation", +- "Win32_Graphics_Gdi", +- "Win32_Security", +- "Win32_System_Diagnostics_Debug", +- "Win32_System_Registry", +- "Win32_System_Threading", +- "Win32_UI_Controls", +- "Win32_UI_Shell", +- "Win32_UI_HiDpi", +- "Win32_UI_WindowsAndMessaging", +- "Win32_System_SystemInformation", +- "Wdk", +- "Wdk_System", +- "Wdk_System_SystemServices", +-] +-optional = true +- +-[target.'cfg(target_os = "windows")'.build-dependencies.embed-resource] +-version = "2.4.2" +-optional = true +- +-[target.'cfg(target_os = "windows")'.build-dependencies.indoc] +-version = "2.0.4" +-optional = true +- +-[target.'cfg(target_os = "windows")'.build-dependencies.regex] +-version = "1.10.4" +-optional = true diff --git a/anda/tools/kanata/rust-kanata.spec b/anda/tools/kanata/rust-kanata.spec new file mode 100644 index 0000000000..509066965c --- /dev/null +++ b/anda/tools/kanata/rust-kanata.spec @@ -0,0 +1,276 @@ +# Generated by rust2rpm 27 +%bcond check 1 + +%global crate kanata + +Name: rust-kanata +Version: 1.8.0 +Release: %autorelease +Summary: Multi-layer keyboard customization + +License: LGPL-3.0-only +URL: https://crates.io/crates/kanata +Source: %{crates_source} +# Automatically generated patch to strip dependencies and normalize metadata +Patch: kanata-fix-metadata-auto.diff +Packager: madonuko + +BuildRequires: anda-srpm-macros cargo-rpm-macros >= 24 + +%global _description %{expand: +Multi-layer keyboard customization.} + +%description %{_description} + +%package -n %{crate} +Summary: %{summary} +License: (0BSD OR MIT OR Apache-2.0) AND Apache-2.0 AND (Apache-2.0 OR BSL-1.0) AND (Apache-2.0 OR MIT) AND (Apache-2.0 WITH LLVM-exception OR Apache-2.0 OR MIT) AND BSD-3-Clause AND BSL-1.0 AND ISC AND LGPL-3.0-only AND MIT AND (MIT OR Apache-2.0) AND (MIT OR Zlib OR Apache-2.0) AND MPL-2.0 AND (Unlicense OR MIT) AND (Zlib OR Apache-2.0 OR MIT) +# LICENSE.dependencies contains a full license breakdown + +%description -n %{crate} %{_description} + +%files -n %{crate} +%license LICENSE +%license cfg_samples/tray-icon/license_icons.txt +%license src/gui/win_nwg_ext/license-MIT +%license src/gui/win_nwg_ext/license-nwg-MIT +%license LICENSE.dependencies +%doc README.md +%{_bindir}/kanata + +%package devel +Summary: %{summary} +BuildArch: noarch + +%description devel %{_description} + +This package contains library source intended for building other packages which +use the "%{crate}" crate. + +%files devel +%license %{crate_instdir}/LICENSE +%license %{crate_instdir}/cfg_samples/tray-icon/license_icons.txt +%license %{crate_instdir}/src/gui/win_nwg_ext/license-MIT +%license %{crate_instdir}/src/gui/win_nwg_ext/license-nwg-MIT +%doc %{crate_instdir}/README.md +%{crate_instdir}/ + +%package -n %{name}+default-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+default-devel %{_description} + +This package contains library source intended for building other packages which +use the "default" feature of the "%{crate}" crate. + +%files -n %{name}+default-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+cmd-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+cmd-devel %{_description} + +This package contains library source intended for building other packages which +use the "cmd" feature of the "%{crate}" crate. + +%files -n %{name}+cmd-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+gui-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+gui-devel %{_description} + +This package contains library source intended for building other packages which +use the "gui" feature of the "%{crate}" crate. + +%files -n %{name}+gui-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+indoc-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+indoc-devel %{_description} + +This package contains library source intended for building other packages which +use the "indoc" feature of the "%{crate}" crate. + +%files -n %{name}+indoc-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+interception_driver-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+interception_driver-devel %{_description} + +This package contains library source intended for building other packages which +use the "interception_driver" feature of the "%{crate}" crate. + +%files -n %{name}+interception_driver-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+open-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+open-devel %{_description} + +This package contains library source intended for building other packages which +use the "open" feature of the "%{crate}" crate. + +%files -n %{name}+open-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+passthru_ahk-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+passthru_ahk-devel %{_description} + +This package contains library source intended for building other packages which +use the "passthru_ahk" feature of the "%{crate}" crate. + +%files -n %{name}+passthru_ahk-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+perf_logging-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+perf_logging-devel %{_description} + +This package contains library source intended for building other packages which +use the "perf_logging" feature of the "%{crate}" crate. + +%files -n %{name}+perf_logging-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+serde_json-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+serde_json-devel %{_description} + +This package contains library source intended for building other packages which +use the "serde_json" feature of the "%{crate}" crate. + +%files -n %{name}+serde_json-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+simulated_input-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+simulated_input-devel %{_description} + +This package contains library source intended for building other packages which +use the "simulated_input" feature of the "%{crate}" crate. + +%files -n %{name}+simulated_input-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+simulated_output-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+simulated_output-devel %{_description} + +This package contains library source intended for building other packages which +use the "simulated_output" feature of the "%{crate}" crate. + +%files -n %{name}+simulated_output-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+tcp_server-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+tcp_server-devel %{_description} + +This package contains library source intended for building other packages which +use the "tcp_server" feature of the "%{crate}" crate. + +%files -n %{name}+tcp_server-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+wasm-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+wasm-devel %{_description} + +This package contains library source intended for building other packages which +use the "wasm" feature of the "%{crate}" crate. + +%files -n %{name}+wasm-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+win_llhook_read_scancodes-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+win_llhook_read_scancodes-devel %{_description} + +This package contains library source intended for building other packages which +use the "win_llhook_read_scancodes" feature of the "%{crate}" crate. + +%files -n %{name}+win_llhook_read_scancodes-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+win_manifest-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+win_manifest-devel %{_description} + +This package contains library source intended for building other packages which +use the "win_manifest" feature of the "%{crate}" crate. + +%files -n %{name}+win_manifest-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+win_sendinput_send_scancodes-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+win_sendinput_send_scancodes-devel %{_description} + +This package contains library source intended for building other packages which +use the "win_sendinput_send_scancodes" feature of the "%{crate}" crate. + +%files -n %{name}+win_sendinput_send_scancodes-devel +%ghost %{crate_instdir}/Cargo.toml + +%package -n %{name}+zippychord-devel +Summary: %{summary} +BuildArch: noarch + +%description -n %{name}+zippychord-devel %{_description} + +This package contains library source intended for building other packages which +use the "zippychord" feature of the "%{crate}" crate. + +%files -n %{name}+zippychord-devel +%ghost %{crate_instdir}/Cargo.toml + +%prep +%autosetup -n %{crate}-%{version} -p1 +%cargo_prep_online + +%build +%{cargo_license_summary_online} +%{cargo_license_online} > LICENSE.dependencies + +%install +%cargo_install + +%if %{with check} +%check +%cargo_test +%endif diff --git a/anda/tools/kanata/update.rhai b/anda/tools/kanata/update.rhai new file mode 100644 index 0000000000..610de31c42 --- /dev/null +++ b/anda/tools/kanata/update.rhai @@ -0,0 +1 @@ +rpm.version(crates("kanata"));