SUMMARY="GStreamer backend for Phonon library"
DESCRIPTION="A GStreamer backend for the Phonon multimedia library."
HOMEPAGE="https://github.com/KDE/phonon-gstreamer/"
COPYRIGHT="2010-2021 KDE Organisation"
LICENSE="GNU LGPL v2"
REVISION="1"
SOURCE_URI="https://github.com/KDE/phonon-gstreamer/archive/v$portVersion.tar.gz"
CHECKSUM_SHA256="2077d440bc03e5a21a27745aaae0cbeeecf95cf8740b16a34304b9565a2be5e1"
SOURCE_DIR="phonon-gstreamer-$portVersion"
PATCHES="phonon_gstreamer-$portVersion.patchset"

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

PROVIDES="
	phonon_gstreamer$secondaryArchSuffix = $portVersion
	"
REQUIRES="
	haiku$secondaryArchSuffix
	lib:libglib_2.0$secondaryArchSuffix
	lib:libgstapp_1.0$secondaryArchSuffix
	lib:libgstaudio_1.0$secondaryArchSuffix
	lib:libgstbadaudio_1.0$secondaryArchSuffix
	lib:libgstreamer_1.0$secondaryArchSuffix
	lib:libgstvideo_1.0$secondaryArchSuffix
	lib:libphonon4qt5$secondaryArchSuffix
	lib:libQt5Core$secondaryArchSuffix
	lib:libQt5DBus$secondaryArchSuffix
	lib:libQt5Gui$secondaryArchSuffix
	lib:libQt5Widgets$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	"
SUPPLEMENTS="
	phonon$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	extra_cmake_modules$secondaryArchSuffix >= $portVersion
	devel:libglib_2.0$secondaryArchSuffix
	devel:libgstapp_1.0$secondaryArchSuffix
	devel:libgstaudio_1.0$secondaryArchSuffix
	devel:libgstbadaudio_1.0$secondaryArchSuffix
	devel:libgstbase_1.0$secondaryArchSuffix
	devel:libgstpbutils_1.0$secondaryArchSuffix
	devel:libgstreamer_1.0$secondaryArchSuffix
	devel:libgstvideo_1.0$secondaryArchSuffix
	devel:libphonon4qt5$secondaryArchSuffix
	devel:libQt5Core$secondaryArchSuffix
	devel:libQt5DBus$secondaryArchSuffix
	devel:libQt5Gui$secondaryArchSuffix
	devel:libQt5Widgets$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:cmake
	cmd:g++$secondaryArchSuffix
	cmd:make
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD()
{
	mkdir -p build
	cd build

	cmake .. $cmakeDirArgs \
		-DCMAKE_BUILD_TYPE=Release \
		-DPHONON_BUILD_PHONON4QT5=ON \
		-DPHONON_INSTALL_QT_EXTENSIONS_INTO_SYSTEM_QT=OFF \
		-DBACKEND_INSTALL_DIR=$addOnsDir/Qt5/phonon \
		-DECM_MKSPECS_INSTALL_DIR=$dataDir/Qt5/mkspecs \
		-DECM_DIR=/system/data/cmake/Modules/ECM/cmake
	make $jobArgs
}

INSTALL()
{
	mkdir -p $addOnsDir/Qt5/phonon4qt5_backend
	cp -f build/bin/phonon_gstreamer.so $addOnsDir/Qt5/phonon4qt5_backend
}

TEST()
{
	cd build
	make test
}
