# Template file for 'ripgrep'
pkgname=ripgrep
version=14.1.1
revision=1
build_style=cargo
build_helper=qemu
configure_args="--features=pcre2"
hostmakedepends="pkg-config"
makedepends="pcre2-devel"
short_desc="Fast search tool inspired by ag and grep"
maintainer="Leah Neukirchen <leah@vuxu.org>"
license="Unlicense, MIT"
homepage="https://github.com/BurntSushi/ripgrep/"
changelog="https://raw.githubusercontent.com/BurntSushi/ripgrep/master/CHANGELOG.md"
distfiles="https://github.com/BurntSushi/ripgrep/archive/refs/tags/${version}.tar.gz"
checksum=4dad02a2f9c8c3c8d89434e47337aa654cb0e2aa50e806589132f186bf5c2b66

post_patch() {
	rm -f .cargo/config.toml   # tries to do weird things on musl
}

post_install() {
	vlicense LICENSE-MIT
	vlicense UNLICENSE

	local _rg=${DESTDIR}/usr/bin/rg

	vtargetrun ${_rg} --generate man > rg.1
	vman rg.1

	for _shell in bash fish zsh; do
		vtargetrun ${_rg} --generate complete-${_shell} > rg.${_shell}
		vcompletion rg.${_shell} ${_shell} rg
	done
}
