# Maintainer: Dominika Liberda <ja@sdomi.pl>
# Contributor: Dominika Liberda <ja@sdomi.pl>
pkgname=libxmp
pkgver=4.6.0
pkgrel=1
pkgdesc="Libxmp is a library that renders module files to PCM data"
url="https://github.com/libxmp/libxmp/"
arch="all"
license="LGPL-2.1-or-later"
makedepends="cmake samurai"
subpackages="$pkgname-dev"
source="https://github.com/libxmp/libxmp/releases/download/libxmp-$pkgver/libxmp-$pkgver.tar.gz"

build() {
	CFLAGS="$CFLAGS -flto=auto -DNDEBUG" \
	cmake -B build -G Ninja \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DBUILD_STATIC=OFF \
		-DWITH_UNIT_TESTS="$(want_check && echo ON || echo OFF)"
	cmake --build build
}

check() {
	ctest --test-dir build --output-on-failure
}

package() {
	DESTDIR="$pkgdir" cmake --install build
}

sha512sums="
d287544c9b569515f1a3fa92d8d930097b252e84f86cba5dd70e9b4460d0fa70754ece45dcc7ec314e434d821b43207d700afb12c9df80b467d73e9d029baafe  libxmp-4.6.0.tar.gz
"
