# Contributor note: keep the source tarball checksum aligned with SHA256SUMS.
pkgname=wireshare
pkgver=@release_version@
pkgrel=0
pkgdesc="Peer-to-peer sharing for Gnutella, BitTorrent, magnet, and eD2k"
url="@release_homepage_url@"
arch="x86_64"
license="GPL-3.0-or-later"
depends="openjdk21-jre-headless"
makedepends="openjdk21 gradle"
options="!check"
source="$pkgname-$pkgver.tar.gz::@source_tarball_url@"
builddir="$srcdir/hermes-wireshare-$pkgver"

build() {
	cd "$builddir"
	./gradlew --no-daemon wireShareJar
}

package() {
	cd "$builddir"
	install -d "$pkgdir"/usr/bin "$pkgdir"/usr/share/wireshare
	install -m755 packaging/common/launchers/WireShare "$pkgdir"/usr/bin/WireShare
	install -m644 WireShare.jar "$pkgdir"/usr/share/wireshare/WireShare.jar
	install -Dm644 packaging/common/app/@release_app_id@.desktop "$pkgdir"/usr/share/applications/@release_app_id@.desktop
	install -Dm644 packaging/common/app/@release_app_id@.metainfo.xml "$pkgdir"/usr/share/metainfo/@release_app_id@.metainfo.xml
	cp -a packaging/common/icons "$pkgdir"/usr/share/
}

sha256sums="@source_tarball_sha256@  $pkgname-$pkgver.tar.gz"
