SUMMARY="A tool to convert video from nearly any format to modern codecs" 
DESCRIPTION="Handbrake is an open-source, GPL-licensed, multiplatform, \
multithreaded video transcoder.
Convert from many common multimedia file formats, including unprotected \
DVD or BluRay sources to a handful of modern output file formats."
HOMEPAGE="http://www.handbrake.fr"
LICENSE="GNU GPL v2"
COPYRIGHT="2003-2013 HandBrake Team"
REVISION="1"
SOURCE_URI="http://sourceforge.net/projects/handbrake/files/$portVersion/HandBrake-$portVersion.tar.bz2"
CHECKSUM_SHA256="a71dd774104cda00cfb51a813550351d638253791f2f419d04a66f3158a835b3"
SOURCE_DIR="HandBrake-$portVersion"
ARCHITECTURES="x86_gcc2 x86 x86_64"
SECONDARY_ARCHITECTURES="x86"

PATCHES="handbrake-$portVersion.patchset"

PROVIDES="
	handbrake$secondaryArchSuffix = $portVersion
	cmd:HandBrakeCLI$secondaryArchSuffix
	"
REQUIRES="
	haiku
	lib:liba52$secondaryArchSuffix
	lib:libavcodec$secondaryArchSuffix
	lib:libmpeg2$secondaryArchSuffix
	lib:libmp4v2$secondaryArchSuffix
	lib:libogg$secondaryArchSuffix
	lib:libtheora$secondaryArchSuffix
	lib:libbluray$secondaryArchSuffix
	lib:libdvdnav$secondaryArchSuffix
	lib:libdvdread$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libsamplerate$secondaryArchSuffix
	lib:libmkv$secondaryArchSuffix
	lib:libmp3lame$secondaryArchSuffix
	lib:libass$secondaryArchSuffix
	lib:libx264$secondaryArchSuffix
	lib:libvorbis$secondaryArchSuffix
	lib:libfreetype$secondaryArchSuffix
	lib:libfontconfig$secondaryArchSuffix
	lib:libfribidi$secondaryArchSuffix
	lib:libbz2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
	lib:libxml2$secondaryArchSuffix
	lib:libstdc++$secondaryArchSuffix
	"
BUILD_REQUIRES="
	haiku${secondaryArchSuffix}_devel
	devel:liba52$secondaryArchSuffix
	devel:libavcodec$secondaryArchSuffix
	devel:libmpeg2$secondaryArchSuffix
	devel:libmp4v2$secondaryArchSuffix
	devel:libogg$secondaryArchSuffix
	devel:libtheora$secondaryArchSuffix
	devel:libbluray$secondaryArchSuffix
	devel:libdvdnav$secondaryArchSuffix
	devel:libdvdread$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libsamplerate$secondaryArchSuffix
	devel:libmkv$secondaryArchSuffix
	devel:libmp3lame$secondaryArchSuffix
	devel:libass$secondaryArchSuffix
	devel:libx264$secondaryArchSuffix
	devel:libvorbis$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libfontconfig$secondaryArchSuffix
	devel:libfribidi$secondaryArchSuffix
	devel:libbz2$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
	devel:libxml2$secondaryArchSuffix
	"
BUILD_PREREQUIRES="
	cmd:gcc$secondaryArchSuffix
	cmd:make
	cmd:libtoolize
	cmd:autoconf
	cmd:automake
	#cmd:yasm
	cmd:python
	cmd:m4
	cmd:tar
	"

PATCH()
{
	sed -i 's/MODULES += contrib\/.*//g' make/include/main.defs	
}

BUILD()
{
	cp make/variant/linux.defs make/variant/haiku.defs
	
	./configure --prefix=$prefix --force
	cd build
	make
}

INSTALL()
{
	cd build
	make install

	#addResourcesToBinaries handbrake.rdef $binDir/HandBrake
	#addAppDeskbarSymlink $binDir/HandBrake "HandBrake"
}
