# zoxide - A smarter cd
# Generated from manifest.tsv by gen-ports.py. Edit the manifest, not this file,
# unless the package needs something the template cannot express - in which case
# drop a `recipe.local` beside it and it will be preserved.
name=zoxide
version=0.9.9
release=1
desc="A smarter cd"
url="https://github.com/ajeetdsouza/zoxide"
license="MIT"
depend="glibc"
makedepend="rust cargo"
source="https://github.com/ajeetdsouza/zoxide/archive/refs/tags/v0.9.9.tar.gz"
sha256="SKIP"

build() {
	cd "zoxide-0.9.9"
	# --offline needs a vendored dependency tree that nothing here produces -
	# every crate the recipe does not vendor itself fails with "no matching
	# package found" before a single line of Rust compiles. The build
	# sandbox already reaches the network to fetch the source tarball
	# itself; letting cargo reach crates.io the same way is the same trust
	# boundary, not a new one.
	#
	# CARGO_HOME defaults to ~/.cargo - under the sandbox's read-only host
	# bind when building as root, so cargo's own registry cache had nowhere
	# to write and every download failed with "Read-only file system".
	export CARGO_HOME="${CARGO_HOME:-/tmp/arctic-cargo-home}"
	# Not clang/lld - nothing else in this tree builds with them (every other
	# recipe just uses cc, which is gcc here), and forcing a linker that is
	# not actually installed failed every single Rust package the same way.
	cargo build --release --locked
}

package() {
	cd "zoxide-0.9.9"
	install -Dm755 "target/release/zoxide" "$pkgdir/usr/bin/zoxide"
	for d in README.md README LICENSE; do
		[ -f "$d" ] && install -Dm644 "$d" "$pkgdir/usr/share/doc/zoxide/$d"
	done
	true
}
