From 5b1d65258db6378e9e13a23b553fcb99ce3425da Mon Sep 17 00:00:00 2001 From: Schrijvers Luc Date: Sat, 8 Nov 2025 09:13:18 +0100 Subject: [PATCH] mcfly, new recipe (#13160) mcfly, new recipe Co-authored-by: OscarL --- app-shells/mcfly/mcfly-0.9.3.recipe | 75 +++++++++++++++++++ app-shells/mcfly/patches/mcfly-0.9.3.patchset | 55 ++++++++++++++ 2 files changed, 130 insertions(+) create mode 100644 app-shells/mcfly/mcfly-0.9.3.recipe create mode 100644 app-shells/mcfly/patches/mcfly-0.9.3.patchset diff --git a/app-shells/mcfly/mcfly-0.9.3.recipe b/app-shells/mcfly/mcfly-0.9.3.recipe new file mode 100644 index 000000000..af5ae0f56 --- /dev/null +++ b/app-shells/mcfly/mcfly-0.9.3.recipe @@ -0,0 +1,75 @@ +SUMMARY="Context-aware bash history search replacement (ctrl-r)" +DESCRIPTION="McFly replaces your default ctrl-r shell history search with an intelligent search \ +engine that takes into account your working directory and the context of recently executed \ +commands. McFly's suggestions are prioritized in real time with a small neural network. + +TL;DR: an upgraded ctrl-r where history results make sense for what you're working on right now. + +Features: +* Rebinds ctrl-r to bring up a full-screen reverse history search prioritized with a small neural \ +network. +* Augments your shell history to track command exit status, timestamp, and execution directory in \ +a SQLite database. +* Maintains your normal shell history file as well so that you can stop using McFly whenever you \ +want. +* Unicode support throughout. +* Includes a simple action to scrub any history item from the McFly database and your shell \ +history files. +* Designed to be extensible for other shells in the future. +* Written in Rust, so it's fast and safe. +* You can type % to match any number of characters when searching. +* Supports Zsh, Bash (version 3+), and PowerShell (version 7+) + +To enable McFly on: +* bash: add 'eval \"\$(mcfly init bash)\"' to the end of ~/config/settings/profile +* zsh: add 'eval \"\$(mcfly init zsh)\"' to the end of ~/config/settings/zsh/zshrc + +And then restart Terminal." +HOMEPAGE="https://github.com/cantino/mcfly" +COPYRIGHT="2018 Andrew Cantino" +LICENSE="MIT" +REVISION="1" +SOURCE_URI="https://github.com/cantino/mcfly/archive/refs/tags/v$portVersion.tar.gz" +CHECKSUM_SHA256="194383276095b71dd6d085fb959ba7981384cbe09776fd5f182e95bbed5a3a13" +PATCHES="mcfly-$portVersion.patchset" + +ARCHITECTURES="all !x86_gcc2" +SECONDARY_ARCHITECTURES="x86" + +# On x86_gcc2 we don't want to install the commands in bin//, but in bin/. +commandSuffix=$secondaryArchSuffix +commandBinDir=$binDir +if [ "$targetArchitecture" = x86_gcc2 ]; then + commandSuffix= + commandBinDir=$prefix/bin +fi + +PROVIDES=" + mcfly$secondaryArchSuffix = $portVersion + cmd:mcfly$commandSuffix = $portVersion + " +REQUIRES=" + haiku$secondaryArchSuffix + " + +BUILD_REQUIRES=" + haiku${secondaryArchSuffix}_devel + " +BUILD_PREREQUIRES=" + cmd:cargo + cmd:gcc$secondaryArchSuffix + cmd:rustc + " + +BUILD() +{ + cargo fetch --locked --target "$(rustc -vV | sed -n 's/host: //p')" + cargo build --release +} + +INSTALL() +{ + install -d $commandBinDir $documentationDir/packages/mcfly + install -t $commandBinDir target/release/mcfly + install -t $documentationDir/packages/mcfly README.md +} diff --git a/app-shells/mcfly/patches/mcfly-0.9.3.patchset b/app-shells/mcfly/patches/mcfly-0.9.3.patchset new file mode 100644 index 000000000..9255b782a --- /dev/null +++ b/app-shells/mcfly/patches/mcfly-0.9.3.patchset @@ -0,0 +1,55 @@ +From a45d650b748b92b6743c01d92d57b6c6003eba42 Mon Sep 17 00:00:00 2001 +From: Luc Schrijvers +Date: Wed, 29 Oct 2025 13:47:30 +0100 +Subject: add build optimizations + +Co-authored-by: Oscar Lesta + +diff --git a/Cargo.toml b/Cargo.toml +index 7777937..562e09a 100644 +--- a/Cargo.toml ++++ b/Cargo.toml +@@ -10,7 +10,11 @@ categories = ["command-line-utilities"] + exclude = ["HomebrewFormula", "HomebrewFormula/*", "pkg/*", "docs/*"] + + [profile.release] ++opt-level = 'z' + lto = true ++codegen-units = 1 ++panic = 'abort' ++strip = true + + [profile.dev] + debug = true +-- +2.51.0 + + +From 7188ea0666b3767a0e8756fbd5a19f8b200b16ba Mon Sep 17 00:00:00 2001 +From: Luc Schrijvers +Date: Wed, 29 Oct 2025 13:36:21 +0100 +Subject: Haiku doesn't have TIOCSTI in libroot + + +diff --git a/src/fake_typer.rs b/src/fake_typer.rs +index ba97d39..fd63ec9 100644 +--- a/src/fake_typer.rs ++++ b/src/fake_typer.rs +@@ -12,10 +12,10 @@ extern "C" { + pub fn use_tiocsti(string: &str) { + for byte in string.as_bytes() { + let a: *const u8 = byte; +- assert!( +- unsafe { ioctl(0, libc::TIOCSTI.try_into().unwrap(), a) } >= 0, +- "Error encountered when calling ioctl" +- ); ++// assert!( ++// unsafe { ioctl(0, libc::TIOCSTI.try_into().unwrap(), a) } >= 0, ++// "Error encountered when calling ioctl" ++// ); + } + } + +-- +2.51.0 +