SUMMARY="A video and audio player which can play most formats and codecs"
DESCRIPTION="QMPlay2 is a video and audio player. It can play all formats \
supported by ffmpeg, libmodplug (including J2B and SFX). It also supports \
Audio CD, raw files and Rayman 2 music. It contains YouTube and Prostoplee\
r browser."
HOMEPAGE="http://zaps166.sourceforge.net"
SOURCE_URI="git+https://github.com/zaps166/QMPlay2.git#43fd55b4e648d52f11de8f9c9c303f6149867f17"

REVISION="2"
LICENSE="GNU GPL v3"
COPYRIGHT="2010-2015 Błażej Szczygieł"

ARCHITECTURES="x86 ?x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
else
	ARCHITECTURES="$ARCHITECTURES !x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	qmplay2$secondaryArchSuffix = $portVersion
	app:QMPlay2$secondaryArchSuffix = $portVersion
	"

REQUIRES="
	haiku${secondaryArchSuffix}
	libqt4$secondaryArchSuffix >= 4.8.0
	lib:libstdc++$secondaryArchSuffix
	lib:libgcc_s$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libtag$secondaryArchSuffix
	lib:libtag_c$secondaryArchSuffix
	lib:libass$secondaryArchSuffix
	lib:libcdio$secondaryArchSuffix
	lib:libcddb$secondaryArchSuffix
	lib:libtheora$secondaryArchSuffix
	lib:libvpx$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libfontconfig$secondaryArchSuffix
	lib:libfribidi$secondaryArchSuffix
	"

BUILD_PREREQUIRES="
	cmd:qmake$secondaryArchSuffix
	cmd:make
	cmd:find
	cmd:xargs
	cmd:g++$secondaryArchSuffix
	cmd:pkg_config$secondaryArchSuffix
	"

BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	libqt4${secondaryArchSuffix}_devel >= 4.8.0
	devel:libavutil$secondaryArchSuffix >= 54
	devel:libavcodec$secondaryArchSuffix >= 56
	devel:libavformat$secondaryArchSuffix >= 56
	devel:libavdevice$secondaryArchSuffix >= 56
	devel:libavfilter$secondaryArchSuffix >= 5
	devel:libavresample$secondaryArchSuffix >= 2
	devel:libswscale$secondaryArchSuffix >= 3
	devel:libswresample$secondaryArchSuffix >= 1.1
	devel:libpostproc$secondaryArchSuffix >= 53
	devel:libvorbis$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libtag$secondaryArchSuffix
	devel:libtag_c$secondaryArchSuffix
	devel:libass$secondaryArchSuffix
	devel:libcdio$secondaryArchSuffix
	devel:libcddb$secondaryArchSuffix
	devel:libtheora$secondaryArchSuffix
	devel:libvpx$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libfontconfig$secondaryArchSuffix
	devel:libfribidi$secondaryArchSuffix
	"

PATCHES="qmplay2_x86-15.05.30.patchset"

BUILD()
{
	./compile_unix
}

INSTALL()
{
	mkdir -p $appsDir/QMPlay2	

	cp app/QMPlay2 $appsDir/QMPlay2
	cp -R app/lib $appsDir/QMPlay2
	cp -R app/modules $appsDir/QMPlay2
	cp -R app/share/qmplay2/lang $appsDir/QMPlay2
	
	addResourcesToBinaries haiku/QMPlay2.rdef $appsDir/QMPlay2/QMPlay2
	addAppDeskbarSymlink $appsDir/QMPlay2/QMPlay2 QMPlay2
}
