# Contributor: omni <omni@gitlab.alpinelinux.org>
# Maintainer: Patrycja Rosa <alpine@ptrcnull.me>
pkgname=termshark
pkgver=2.4.0
pkgrel=19
pkgdesc="terminal UI for tshark, inspired by Wireshark"
url="https://termshark.io"
license="MIT"
arch="all !armhf" # no tshark on armhf
depends="tshark"
makedepends="go"
options="net"
source="$pkgname-$pkgver.tar.gz::https://github.com/gcla/termshark/archive/v$pkgver.tar.gz
	loongarch64-support.patch"

export GOFLAGS="$GOFLAGS -trimpath -mod=readonly -modcacherw"
export GOCACHE="${GOCACHE:-"$srcdir/go-cache"}"
export GOTMPDIR="${GOTMPDIR:-"$srcdir"}"
export GOMODCACHE="${GOMODCACHE:-"$srcdir/go"}"

build() {
	go build -v ./cmd/...
}

check() {
	go test -v ./...
}

package() {
	install -Dm755 $pkgname "$pkgdir"/usr/bin/$pkgname
	install -Dm644 docs/UserGuide.md -t "$pkgdir"/usr/share/doc/$pkgname
	install -Dm644 LICENSE -t "$pkgdir"/usr/share/licenses/$pkgname
}

sha512sums="
378bb67ff50a8dfa80f614540371f326627e73bdf63bceb183ed73afbbf9dead4e0597fb969ba49c4ee3d3de00ac7bb91166421c19c788df47ff8d9fcbc5b9fc  termshark-2.4.0.tar.gz
21080967cf59878cb2c86e815faaec481bbe48bcbf1bc9de2ef9755d2e12e76c481493835697a720af7e43ad9417b7da63d92ae62a2aad2e9c5f9222994f65f6  loongarch64-support.patch
"
