# Template file for 'gitu'
pkgname=gitu
version=0.43.0
revision=1
build_style=cargo
build_helper="rust qemu"
hostmakedepends="pkg-config libgit2-1.9-devel libssh2-devel zlib-devel git"
makedepends="libgit2-1.9-devel openssl-devel libssh2-devel zlib-devel"
short_desc="Git client inspired by Magit"
maintainer="rayfadh <rayfadh@duck.com>"
license="MIT"
homepage="https://github.com/altsem/gitu"
changelog="https://raw.githubusercontent.com/altsem/gitu/refs/heads/master/CHANGELOG.md"
distfiles="https://github.com/altsem/gitu/archive/refs/tags/v${version}.tar.gz"
checksum=4cc89732b2fa4fee07b2db5ce4cf325577fd195995e70e11c86b9bc1a6a2e114

if [ "$XBPS_TARGET_MACHINE" = "i686" ]; then
	make_check=no # snapshot tests (insta) produce different output on i686
fi

_setup_env() {
	# workaround the cc-rs mixing CFLAGS for host and target.
	# https://github.com/rust-lang/cc-rs/issues/1469
	export CFLAGS_${RUST_BUILD//-/_}="${CFLAGS_host}" \
		CXXFLAGS_${RUST_BUILD//-/_}="${CXXFLAGS_host}" \
		LDFLAGS_${RUST_BUILD//-/_}="${LDFLAGS_host}" \
		CFLAGS_${RUST_TARGET//-/_}="${CFLAGS}" \
		CXXFLAGS_${RUST_TARGET//-/_}="${CXXFLAGS}" \
		LDFLAGS_${RUST_TARGET//-/_}="${LDFLAGS}" \
		CFLAGS="" CXXFLAGS="" LDFLAGS=""
}

pre_build() {
	_setup_env
}

pre_install() {
	_setup_env
}

post_install() {
	vlicense LICENSE
}
