# Description: Simple, fast and user-friendly alternative to find
# URL: https://github.com/sharkdp/fd
# Maintainer: Danny Rawlins, crux at romster dot me
# Depends on: rust

name=fd
version=8.1.1
release=1
source=(https://github.com/sharkdp/fd/archive/v$version/$name-v$version.tar.gz)

build() {
	cd $name-$version

	prt-get isinst sccache && export RUSTC_WRAPPER=/usr/bin/sccache
	mkdir "$PKGMK_SOURCE_DIR/rust" || true
	export CARGO_HOME="$PKGMK_SOURCE_DIR/rust"

	cargo fetch
	cargo build --release --locked

	install -Dm755 target/release/fd $PKG/usr/bin/fd
	install -Dm644 target/release/build/fd-find-*/out/fd.bash $PKG/usr/share/bash-completion/completions/fd
	install -Dm644 target/release/build/fd-find-*/out/fd.fish $PKG/usr/share/fish/vendor_completions.d/fd.fish
	install -Dm644 target/release/build/fd-find-*/out/_fd $PKG/usr/share/zsh/site-functions/_fd
	install -Dm644 doc/fd.1 $PKG/usr/share/man/man1/fd.1
}
