# Template file for 'rustup'
pkgname=rustup
version=1.23.1
revision=2
# rustup doesn't recognize this target
archs="~armv*-musl"
build_style=cargo
build_helper=qemu
configure_args="--features no-self-update --bin rustup-init"
hostmakedepends="pkg-config"
makedepends="libressl-devel zlib-devel libcurl-devel"
short_desc="Rust toolchain installer"
maintainer="Jan Christian Grünhage <jan.christian@gruenhage.xyz>"
license="Apache-2.0, MIT"
homepage="https://www.rustup.rs"
distfiles="https://github.com/rust-lang/${pkgname}/archive/${version}.tar.gz"
checksum=0203231bfe405ee1c7d5e7e1c013b9b8a2dc87fbd8474e77f500331d8c26365f

post_build() {
	RUSTUP="target/${RUST_TARGET}/release/rustup-init"
	ln -sf "$RUSTUP" rustup

	# generate shell completions
	vtargetrun ./rustup completions zsh >rustup.zsh
	vtargetrun ./rustup completions bash >rustup.bash
	vtargetrun ./rustup completions fish >rustup.fish
}

do_install() {
	vbin target/${RUST_TARGET}/release/rustup-init

	vcompletion rustup.bash bash
	vcompletion rustup.fish fish
	vcompletion rustup.zsh zsh

	vdoc README.md
	vlicense LICENSE-APACHE
	vlicense LICENSE-MIT
}
