# Template file for 'uv'
pkgname=uv
version=0.11.23
revision=1
build_style=python3-pep517
build_helper="rust qemu"
hostmakedepends="maturin cargo cmake pkg-config"
makedepends="rust-std libzstd-devel bzip2-devel"
depends="uv-build>=${version}_${revision}"
short_desc="Extremely fast Python package installer and resolver"
maintainer="Orphaned <orphan@voidlinux.org>"
license="Apache-2.0 OR MIT"
homepage="https://github.com/astral-sh/uv"
changelog="https://github.com/astral-sh/uv/raw/main/CHANGELOG.md"
distfiles="https://github.com/astral-sh/uv/releases/download/${version}/source.tar.gz>uv-${version}.tar.gz"
checksum=b366edfbcf520a14643243a8d85f4e61c0cd0a2e8b674adf2b80f95b79b721a4

case "$XBPS_TARGET_MACHINE" in
	i686*)
		# rustc-LLVM ERROR: out of memory
		export CARGO_PROFILE_RELEASE_LTO=false
		;;
esac

post_build() {
	make_build_target="crates/uv-build" do_build
}

post_install() {
	make_install_target="target/wheels/uv_build-*.whl" do_install
	vlicense LICENSE-MIT
	for sh in bash fish zsh; do
		vtargetrun "$DESTDIR"/usr/bin/uv --generate-shell-completion "$sh" > "uv.$sh"
		vcompletion "uv.$sh" "$sh"
	done
}

uv-build_package() {
	short_desc+=" - PEP517 build backend"
	pkg_install() {
		vmove usr/bin/uv-build
		vmove "${py3_sitelib}"/uv_build*
		vlicense LICENSE-MIT
	}
}
