# Template file for 'glab'
pkgname=glab
version=1.107.0
revision=1
build_style=go
build_helper=qemu
go_ldflags="-X main.version=$version"
go_import_path=gitlab.com/gitlab-org/cli
go_package="${go_import_path}/cmd/glab"
short_desc="Command line tool bringing GitLab's features to your command line"
maintainer="Enno Boland <gottox@voidlinux.org>"
license="MIT"
homepage="https://gitlab.com/gitlab-org/cli"
changelog="https://gitlab.com/gitlab-org/cli/-/releases"
distfiles="https://gitlab.com/gitlab-org/cli/-/archive/v$version/cli-v$version.tar.gz"
checksum=a861959d8f59558ac0b7b1486ad20d05dda87e296d130430ba87e743bfebf8e5
make_check_pre="env PATH=/usr/libexec/chroot-git:${PATH}"

if [ $XBPS_MACHINE = "i686" ]; then
	# https://gitlab.com/gitlab-org/cli/-/issues/8198
	# https://gitlab.com/gitlab-org/cli/-/issues/8199
	make_check_args+=" -skip=TestDetectPlatform|Test_helperRun/support_OAuth2"
fi

pre_check() {
	/usr/libexec/chroot-git/git init -q
}

post_install() {
	for shell in bash fish zsh; do
		vtargetrun ${DESTDIR}/usr/bin/glab completion -s ${shell} > glab.${shell}
		vcompletion glab.${shell} ${shell}
	done
	vlicense LICENSE
}
