# Contributor: Rasmus Thomsen <oss@cogitri.dev>
# Maintainer: Natanael Copa <ncopa@alpinelinux.org>
pkgname=libmusicbrainz
pkgver=5.1.0
pkgrel=3
pkgdesc="MusicBrainz Client Library"
url="https://musicbrainz.org/doc/libmusicbrainz"
arch="all"
license="LGPL-2.1-or-later"
makedepends="cmake neon-dev libxml2-dev"
options="!check" # no tests
subpackages="$pkgname-dev"
source="https://github.com/metabrainz/libmusicbrainz/releases/download/release-$pkgver/libmusicbrainz-$pkgver.tar.gz
	libxml2.12.patch
	"

build() {
	if [ "$CBUILD" != "$CHOST" ]; then
		CMAKE_CROSSOPTS="-DCMAKE_SYSTEM_NAME=Linux -DCMAKE_HOST_SYSTEM_NAME=Linux"
	fi
	cmake \
		-DCMAKE_INSTALL_PREFIX=/usr \
		-DCMAKE_INSTALL_LIBDIR=lib \
		-DBUILD_SHARED_LIBS=True \
		-DCMAKE_BUILD_TYPE=None \
		-DCMAKE_CXX_FLAGS="$CXXFLAGS" \
		-DCMAKE_C_FLAGS="$CFLAGS" \
		$CMAKE_CROSSOPTS .
	make
}

package() {
	make DESTDIR="$pkgdir" install
}

sha512sums="
daa7ccb94e517e90f7d88a0659c84b00f04c6a73ef7771b7e3bd9101fa6569b1935a68a3689502ed0cc8c0d71ba9d2d0ebd9c074dd5eed9f75a3db390b222e03  libmusicbrainz-5.1.0.tar.gz
2e0c1abfac00e6712d8f6f0539a49ac6a8266c97cfe2570f84735986808020f5b3cd8ba42dd9e2b7743adaf672b11e0112e219fb0a44850d41dbc559a24ed40a  libxml2.12.patch
"
