# Template file for 'cargo-bootstrap'
pkgname=cargo-bootstrap
version=1.63.0
revision=1
short_desc="Bootstrap binaries of Rust package manager"
maintainer="Orphaned <orphan@voidlinux.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"

# 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)
# ppc64 is excluded because of ABI incompatibility
case "$XBPS_TARGET_MACHINE" in
	x86_64*|i686|ppc64le) ;;
	# See srcpkgs/rust-bootstrap/files/generating-distfiles.md for details
	*) _bootstrap_url="https://repo-default.voidlinux.org/distfiles" ;;
esac

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

case "$XBPS_TARGET_MACHINE" in
	i686)
		checksum="6f2c109fc38ed8ccadcdcccf51d11505651ca9e12c396ab46ac1dbb55265b792"
		;;
	x86_64)
		checksum="f370d12e4c11f0c835becb738bcf00d363f29b76f8b424b4dcb005abcf15fc9a"
		;;
	x86_64-musl)
		checksum="6f6ce044832a2433c250f4f27a61f69081e2b0f7e4e1f141492c2ce99ee8511e"
		;;
	ppc64le)
		checksum="a4cdc00a42fd767bf5a296f7126d9db22a0a609cd956bbf0cb3eae882add1be7"
		;;
	ppc64le-musl)
		checksum="3dc497186493a9fc974ae8add91a6fed34d95e263bedb95142d636ba257b2240"
		;;
	ppc64)
		checksum="babded6c2d112aa92cb1af5ca24d93a034b20c0315f03c231a4eb3a92408a6cd"
		;;
	ppc)
		checksum="3c7f4d28987d8bf5d10fb0cf4ec792b73a4725add2845d69b85e36d47f3c228e"
		;;
	*) broken="cargo bootstrap binaries unavailable for ${XBPS_TARGET_MACHINE}";;
esac

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