# Contributor: Kay Thomas <kaythomas@pm.me>
# Maintainer: Kay Thomas <kaythomas@pm.me>
pkgname=airsonic-advanced
_sha=1397446f979b1cdea283eec89ce4f0eae7d63450
pkgver=11.0.0_git20230217
pkgrel=0
pkgdesc="Modern implementation of the Airsonic fork with several key performance and feature enhancements"
url="https://github.com/airsonic-advanced/airsonic-advanced"
# inconsistent test and build failures on other arches
arch="x86_64"
license="GPL-3.0-or-later"
depends="openjdk11"
makedepends="maven"
subpackages="$pkgname-openrc"
pkgusers="airsonic-advanced"
pkggroups="airsonic-advanced"
install="$pkgname.pre-install"
source="$pkgname-$pkgver.tar.gz::https://github.com/airsonic-advanced/airsonic-advanced/archive/$_sha.tar.gz
	maven.patch
	airsonic-advanced.initd
	"
builddir="$srcdir/$pkgname-$_sha"

build() {
	mvn clean package -DskipTests
}

check() {
	mvn test
}

package() {
	install -dm755 -o airsonic-advanced -g airsonic-advanced \
		"$pkgdir"/var/airsonic

	install -m755 -o airsonic-advanced -g airsonic-advanced \
		"$builddir"/airsonic-main/target/airsonic.war \
		"$pkgdir"/var/airsonic/airsonic.war

	install -Dm755 "$srcdir"/$pkgname.initd \
		"$pkgdir"/etc/init.d/$pkgname
}

sha512sums="
f415620bdbed9fb3874afbf30d9362e68b1e9e8e90dbbed4ca3206b643cad97ca0558e64ec5b4440382f0ec908c3325e321ea3631c38ff9a2109163c8f0cfe0b  airsonic-advanced-11.0.0_git20230217.tar.gz
6cb52fee19815fcdf2596e55d97d3e750321b1df7a4fec36fc9bc2a57d4be979a3905a42d3aa9dbeb2bf0d4f56edbf344f13551219b8e4d2ca583abd4bb5c8f9  maven.patch
ca87e6a7199950e6ac52aeb076a03f831d60ee9d4ceed47366bbd78443765d205796d895ebb244051d8033e5b2e9ccd648d20434039c854b8b50e766cc5cd10d  airsonic-advanced.initd
"
