# Contributor: Thomas Deutsch <thomas@tuxpeople.org>
# Maintainer: Thomas Deutsch <thomas@tuxpeople.org>
pkgname=lazygit
pkgver=0.44.1
pkgrel=5
pkgdesc="Simple terminal UI for git commands"
url="https://github.com/jesseduffield/lazygit"
arch="all"
license="MIT"
depends="git"
makedepends="go"
subpackages="$pkgname-doc"
source="$pkgname-$pkgver.tar.gz::https://github.com/jesseduffield/lazygit/archive/v$pkgver.tar.gz
	update-go-mod.patch
	"

case "$CARCH" in
loongarch64)
	options="$options !check" ;;
esac

export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build -mod=mod -ldflags="-X main.version=$pkgver" -v
}

check() {
	# in Voidlinux, TestIntegration was disabled with the 0.44.0 upgrade
	go test -v -skip=TestIntegration ./...
}

package() {
	install -Dm0755 $pkgname -t "$pkgdir"/usr/bin

	install -dm0755 "$pkgdir"/usr/share/doc
	mv docs "$pkgdir"/usr/share/doc/"$pkgname"
	install -Dm0644 LICENSE -t "$pkgdir"/usr/share/licenses/"$pkgname"
}

sha512sums="
036b17618c9bc4c436a9d08dd62b7553293a414ed3ac852c7a7edb39f20de86fb405d111391856bc4bf542e7d3ac163481e267249433705f40c7bc6eb83805ac  lazygit-0.44.1.tar.gz
b45f55858f80e9a7023aa157d0f90d1326829cf68d8e10ffcca4df414c79c77b6793edd5e85da0115816090b2806ebdfee7d3f8f3d320a37746a9efbd07b3038  update-go-mod.patch
"
