# Contributor: Jakub Jirutka <jakub@jirutka.cz>
# Maintainer: Jakub Jirutka <jakub@jirutka.cz>
#
# TODO: Build from source.
pkgname=jetty-runner
pkgver=9.4.54.20240208
_pkgver="${pkgver%.*}.v${pkgver##*.}"
pkgrel=0
pkgdesc="Fast and easy way to run Java web application from the command line."
url="https://www.eclipse.org/jetty"
# riscv64 blocked by java-jre-headless
arch="noarch !riscv64"
license="Apache-2.0"
case "$CARCH" in
	# Newer Java is not supported on 32bit.
	armhf | armv7 | x86) depends="openjdk8-jre-base";;
	*) depends="java-jre-headless"
esac
subpackages="$pkgname-openrc"
source="https://repo.maven.apache.org/maven2/org/eclipse/jetty/jetty-runner/$_pkgver/jetty-runner-$_pkgver.jar
	$pkgname
	$pkgname.initd
	$pkgname.confd
	"

# secfixes:
#   9.4.53.20231009-r0:
#     - CVE-2023-44487
#     - CVE-2023-36478

package() {
	cd "$srcdir"

	install -m644 -D "$pkgname-$_pkgver.jar" \
		"$pkgdir/usr/share/java/$pkgname.jar"
	install -m755 -D $pkgname "$pkgdir/usr/bin/$pkgname"

	install -m755 -D $pkgname.initd "$pkgdir/etc/init.d/$pkgname"
	install -m644 -D $pkgname.confd "$pkgdir/etc/conf.d/$pkgname"
}

sha512sums="
8301661de5b120592b55f8e86c2423ed56b4ad655e50188d4d189b5fa4f6be8153092e01754bb1e8817f5af9564545fee19159e950ed4932c7cfcf9f21b1bc68  jetty-runner-9.4.54.v20240208.jar
aac40bdc4c6e48e6c70b8306a8bdcbb1b0f9d67a7ac6feac926b3207a8496f2d30a6db763e23a4f14e1276c19a96fa4e154e9ca767db1f3e17dde08a4ad28c26  jetty-runner
3e17a8071c345946d40c9eaf3cb444ec06b73f8145d47b7a3b00bcd2d5018cdec3c087c2db3c94922c5c267e7b1f4759a86deadfd22c5a81a9679b95d9bfde0f  jetty-runner.initd
21473182b2ecb51ecd346fb01d83de153a5730b2ecf361231a617ad612fdf3b696a6893d47dbadd6217b582af9e024cfdf80523f3627ae25f495a6cbda949f18  jetty-runner.confd
"
