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="daf91a63f58dd157ca340c457871e66260cb9c3333fefb008b318befbb0e081a"

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

PROVIDES="
	libmatroska$secondaryArchSuffix = $portVersion
	lib:libmatroska$secondaryArchSuffix = 7.0.0 compat >= 7
	"
REQUIRES="
	haiku${secondaryArchSuffix}
	lib:libebml$secondaryArchSuffix
	"

PROVIDES_devel="
	libmatroska${secondaryArchSuffix}_devel = $portVersion
	devel:libmatroska$secondaryArchSuffix = 7.0.0 compat >= 7
	"
REQUIRES_devel="
	libmatroska$secondaryArchSuffix == $portVersion base
	devel:libebml$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:libebml$secondaryArchSuffix >= 5
	"
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

	packageEntries devel $developDir $libDir/cmake
}
