# Template file for 'cargo-bootstrap'
pkgname=cargo-bootstrap
version=0.58.0
revision=1
short_desc="Bootstrap binaries of Rust package manager"
maintainer="q66 <daniel@octaforge.org>"
license="MIT, Apache-2.0"
homepage="https://www.rust-lang.org/"
conflicts="cargo>=0"
lib32disabled=yes
nostrip=yes

_bootstrap_url="https://static.rust-lang.org/dist"
_bootver=1.57.0

# we don't use upstream cargo binaries for ppc32, as they are busted (probably
# a dependency is wrong, which results in failed signature verification when
# updating the crates.io index)
case "$XBPS_TARGET_MACHINE" in
	x86_64*|i686|ppc64le) ;;
	*)
		_bootstrap_url="https://alpha.de.repo.voidlinux.org/distfiles"
		_bootver=${version}
		;;
esac

wrksrc="cargo-${_bootver}-${RUST_TARGET}"
distfiles="${_bootstrap_url}/cargo-${_bootver}-${RUST_TARGET}.tar.xz"

case "$XBPS_TARGET_MACHINE" in
	i686)
		checksum="9898a1fae2647f930fa14b9c160a1d22e67ccc70ac0d2d8f79ef1ffcf8d89af7"
		;;
	x86_64)
		checksum="ed2013713ae742895af5df8d91c5430ba9ba3c781e3bc7f3471b220cc06d565d"
		;;
	x86_64-musl)
		checksum="0d8564d0348843d6c08d98990d9eac50b7b7ab790f89d514b4f45079e786d932"
		;;
	ppc64le)
		checksum="599cf1b5a8cdbf76d591621bc9222aefa60e2f5fd378ae71c4dcf4514c47122e"
		;;
	ppc64le-musl)
		checksum="99ae7661c62617ac42adacb50cce9ae8d019bcf85e987b98fbc27240bceb1dd9"
		;;
	ppc64)
		checksum="c64b9cce7a3ceaf5c310fad70be33077f1e6dea1384767fcf744732c0daa7473"
		;;
	ppc)
		checksum="e67c2a7d16b3c732a1dcb663d031daf6eaca4b74d1d15196086c53c0c3a5b0a2"
		;;
	*) broken="cargo bootstrap binaries unavailable for ${XBPS_MACHINE}";;
esac

do_install() {
	vbin cargo/bin/cargo
	vlicense LICENSE-APACHE
	vlicense LICENSE-MIT
	vlicense LICENSE-THIRD-PARTY
}
