SUMMARY="A library to parse Matroska files"
DESCRIPTION="libmatroska is a C++ libary to parse Matroska files."
HOMEPAGE="https://www.matroska.org/"
COPYRIGHT="2003-2019 Matroska"
LICENSE="GNU LGPL v2.1"
REVISION="1"
SOURCE_URI="https://dl.matroska.org/downloads/libmatroska/libmatroska-$portVersion.tar.xz"
CHECKSUM_SHA256="0ac6debfbf781d47f001b830aaf9be9dfbcefd13bcfb80ca5efc1c04b4a3c962"
SOURCE_DIR="libmatroska-$portVersion"

ARCHITECTURES="all !x86_gcc2"
SECONDARY_ARCHITECTURES="!x86_gcc2 x86"

PROVIDES="
	libmatroska6$secondaryArchSuffix = $portVersion
	lib:libmatroska$secondaryArchSuffix = 6.0.0 compat >= 6
	"
REQUIRES="
	haiku${secondaryArchSuffix}
	lib:libebml$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	# devel:libebml version is the same between 1.3.1 and 1.3.9
	# but we need 1.3.9
	libebml${secondaryArchSuffix}_devel >= 1.3.9
	devel:libebml$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:gcc$secondaryArchSuffix
	cmd:ld$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	mkdir -p build && cd build
	cmake .. $cmakeDirArgs -DBUILD_SHARED_LIBS=TRUE \
		-DCMAKE_BUILD_TYPE=Release
	make $jobArgs
}

INSTALL()
{
	make -C build install

	prepareInstalledDevelLibs libmatroska
	fixPkgconfig

	rm -rf $developDir $libDir/cmake
}
