92.5. fzf-0.74.4
General-purpose command-line fuzzy finder
| Version | 0.74.4, release 1 |
| Shelf | cli — Command-line productivity utilities: search, view, navigation and text wrangling in the terminal |
| Phase | 41_system (System), 283 of 1047 in build order |
| Licence | MIT |
| Homepage | https://github.com/junegunn/fzf |
| Build time | 0.2 SBU |
| Installed size | 5.9 MiB in 9 files |
| Recipe | ports/core/cli/fzf/kpkgbuild |
About
fzf is a fuzzy finder: it reads a list of lines, lets you narrow it by typing, and prints the lines you pick, so any command’s output becomes a menu. The port installs fzf, the fzf-tmux wrapper, both manual pages, and the bash and zsh key bindings and completion scripts under /usr/share/fzf, which a shell’s start-up file sources to get Ctrl-R history search, Ctrl-T file insertion and ** completion.
Sources
fzf-0.74.4.tar.gz(473.3 KiB)
sha2561046857c337f5bd05f6fa482446b5a42a011615105743efbe4efee0970b24bb7
upstream: https://github.com/junegunn/fzf/archive/v0.74.4.tar.gz
archive copy: sources-1/cli--fzf-0.74.4.tar.gzfzf-vendor-0.74.4.tar.xz(1.1 MiB)
sha256259dc9bdfad130205461bbc336f71c319ba3bbc9eaf9ea26d6e4c02da597f61a
a vendor bundle: the dependencies upstream’s own tool would download, packed once
archive copy: sources-1/cli--fzf-vendor-0.74.4.tar.xz
Dependencies
Depends on: go.
Required by (2): ripgrep-all, yazi.
Installation
From the repository root, inside the build container, this is the line kdosbuild runs for the port:
script/chroot/exec.sh bash -c 'source script/phases/41_system/phase.env && kpkg install fzf'
What kpkg does
kpkg runs these steps, in this order, as root inside the chroot. The port directory is /ports/core/cli/fzf.
1. Verify every declared source. Each file a sha256 = line names, found in the port directory or in /var/cache/kpkg/sources, must hash to its line; a mismatch stops the build before anything is unpacked.
cd /ports/core/cli/fzf
echo '1046857c337f5bd05f6fa482446b5a42a011615105743efbe4efee0970b24bb7 fzf-0.74.4.tar.gz' | sha256sum -c -
echo '259dc9bdfad130205461bbc336f71c319ba3bbc9eaf9ea26d6e4c02da597f61a fzf-vendor-0.74.4.tar.xz' | sha256sum -c -
2. Unpack. The work directory is emptied and the first source is unpacked into $SRC with its top directory stripped; any later tarball lands unstripped beside it in $SRC_ROOT, and a file that is not a tarball is copied into $SRC.
SRC_ROOT=/var/cache/kpkg/work/fzf
SRC=$SRC_ROOT/fzf-0.74.4
PKG=$SRC_ROOT/pkg
rm -rf "$SRC_ROOT"
mkdir -p "$SRC" "$PKG"
tar --no-same-permissions --warning=no-unknown-keyword -xf fzf-0.74.4.tar.gz -C "$SRC" --strip-components=1
Every config.guess and config.sub older than automake’s is then replaced with automake’s, so a configure script recognises the musl target.
3. Build. build.sh is sourced in a subshell under set -e, from $SRC, with name, version, release and the five paths PKGNAME, PORT_SRC, SRC_ROOT, SRC and PKG set as shell variables. Its body, verbatim:
tar xf $PORT_SRC/${name}-vendor-${version}.tar.xz
export CGO_ENABLED=0
go build -ldflags "-s -w -X main.version=$version" -o fzf
install -Dm755 fzf $PKG/usr/bin/fzf
install -Dm755 bin/fzf-tmux $PKG/usr/bin/fzf-tmux
install -Dm644 man/man1/fzf.1 $PKG/usr/share/man/man1/fzf.1
install -Dm644 man/man1/fzf-tmux.1 $PKG/usr/share/man/man1/fzf-tmux.1
install -Dm644 shell/key-bindings.bash $PKG/usr/share/fzf/key-bindings.bash
install -Dm644 shell/completion.bash $PKG/usr/share/fzf/completion.bash
install -Dm644 shell/key-bindings.zsh $PKG/usr/share/fzf/key-bindings.zsh
install -Dm644 shell/completion.zsh $PKG/usr/share/fzf/completion.zsh
The switches, and why each is set:
-X main.version=$version— Stamp the release into the binary, sofzf --versionreports it. The source carries only the major and minor version.
The common switches of each build system are explained in the Flag glossary.
4. Package. kpkg removes libtool archives, the info directory index, mimeinfo.cache and every fonts.dir from $PKG, copies the source’s licence files into /usr/share/licenses/fzf, prunes what the image does not ship, lints the tree and rolls it reproducibly:
tar --sort=name --format=gnu --numeric-owner --owner=0 --group=0 \
--mtime=@$SOURCE_DATE_EPOCH \
--use-compress-program='xz -9 -T0 --block-size=32MiB --no-adjust' \
-cf fzf-0.74.4-1.tar.xz -C "$PKG" .
5. Adopt. kpkgadd installs the package’s files over the root, refusing a path another package owns, records the file list in /var/lib/kpkg/db/fzf, and runs the triggers its paths call for.
Contents
Installed programs: fzf, fzf-tmux.
Installed directories: /usr/share/fzf, /usr/share/licenses/fzf.
Short descriptions
fzf |
a command-line fuzzy finder |
fzf-tmux |
open fzf in tmux split pane |
Notes
fzf is a pure Go program built with cgo off from a vendor bundle, fzf-vendor-<version>.tar.xz, which ports/fetch makes with go mod vendor; see Vendoring and the go build shape. The go build line passes no -mod=vendor: when a vendor/ directory is present and go.mod declares Go 1.14 or later, the go command builds from it by default.