SUMMARY="A multimedia library"
DESCRIPTION="The Phonon multimedia library."
HOMEPAGE="https://github.com/KDE/phonon/"
COPYRIGHT="2010-2021 KDE Organisation"
LICENSE="GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://github.com/KDE/phonon/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="94e782d1499a7b264122cf09aa559d6245b869d4c33462d82dd1eb294c132e1b"

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

PROVIDES="
	phonon$secondaryArchSuffix = $portVersion
	lib:libphonon4qt5$secondaryArchSuffix = $portVersion compat >= 4
	lib:libphonon4qt5experimental$secondaryArchSuffix = $portVersion compat >= 4
	cmd:phononsettings = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5DBus$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	"

PROVIDES_devel="
	phonon${secondaryArchSuffix}_devel = $portVersion
	devel:libphonon4qt5$secondaryArchSuffix = $portVersion compat >= 4
	devel:libphonon4qt5experimental$secondaryArchSuffix = $portVersion compat >= 4
	"
REQUIRES_devel="
	phonon$secondaryArchSuffix == $portVersion base
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	extra_cmake_modules$secondaryArchSuffix >= $portVersion
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5DBus$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:g++$secondaryArchSuffix
	cmd:lrelease$secondaryArchSuffix >= 5
	cmd:make
	"

BUILD()
{
	mkdir -p build
	cd build

	cmake .. $cmakeDirArgs \
		-DCMAKE_BUILD_TYPE=Release \
		-DPHONON_BUILD_PHONON4QT5=ON \
		-DPHONON_INSTALL_QT_EXTENSIONS_INTO_SYSTEM_QT=OFF \
		-DPHONON_QT_PLUGIN_INSTALL_DIR=$addOnsDir/Qt5/designer \
		-DPHONON_QT_IMPORTS_INSTALL_DIR=$dataDir/Qt5/imports \
		-DPHONON_QT_MKSPECS_INSTALL_DIR=$dataDir/Qt5/mkspecs/modules \
		-DCMAKE_INSTALL_INCLUDEDIR=$includeDir \
		-DECM_MKSPECS_INSTALL_DIR=$dataDir/Qt5/mkspecs \
		-DECM_DIR=/system/data/cmake/Modules/ECM/cmake
	make $jobArgs
}

INSTALL()
{
	cd build
	make install

	prepareInstalledDevelLibs \
		libphonon4qt5 \
		libphonon4qt5experimental

	fixPkgconfig

	packageEntries devel \
		$libDir/cmake \
		$dataDir/Qt5/mkspecs \
		$developDir
}

TEST()
{
	cd build
	make test
}
