# starship - Cross-shell prompt
# 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=starship
version=1.24.0
release=1
desc="Cross-shell prompt"
url="https://starship.rs/"
license="ISC"
depend="glibc"
makedepend="rust cargo"
source="https://github.com/starship/starship/archive/refs/tags/v1.24.0.tar.gz"
sha256="SKIP"

build() {
	cd "starship-1.24.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 "starship-1.24.0"
	install -Dm755 "target/release/starship" "$pkgdir/usr/bin/starship"
	for d in README.md README LICENSE; do
		[ -f "$d" ] && install -Dm644 "$d" "$pkgdir/usr/share/doc/starship/$d"
	done
	true
}
