# Contributor: Thomas Deutsch <thomas@tuxpeople.org>
# Maintainer: Thomas Deutsch <thomas@tuxpeople.org>
pkgname=lazygit
pkgver=0.48.0
pkgrel=2
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="
11ccc07a82cc9fb11d36df4166001aff007e70e0af2941317bcd983acacaa89716c337aab7190415da7a49917ef62080b6cee0175cc9ac2b1624280b1635837b  lazygit-0.48.0.tar.gz
a1c1f3f8dc584e5a38f898273c300c8f97368ed8200983884119c5c0406ce2aec5df62aa238c098ecee5f341d59d974e67cf0aa6ef92f655754e09fb97b6fbe1  update-go-mod.patch
"
