# tealdeer - Fast tldr client, for when man is too much
# 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=tealdeer
version=1.8.0
release=1
desc="Fast tldr client, for when man is too much"
url="https://github.com/tealdeer-rs/tealdeer"
license="MIT Apache-2.0"
depend="glibc libressl"
makedepend="rust cargo"
source="https://github.com/tealdeer-rs/tealdeer/archive/refs/tags/v1.8.0.tar.gz"
sha256="SKIP"

build() {
	cd "tealdeer-1.8.0"
	# --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 "tealdeer-1.8.0"
	# The crate's own Cargo.toml names the binary tldr, not tealdeer.
	install -Dm755 "target/release/tldr" "$pkgdir/usr/bin/tldr"
	for d in README.md README LICENSE; do
		[ -f "$d" ] && install -Dm644 "$d" "$pkgdir/usr/share/doc/tealdeer/$d"
	done
	true
}
