SUMMARY="A free, open source, and cross-platform media player"
DESCRIPTION="
mpv is a media player based on MPlayer and mplayer2. It supports a wide \
variety of video file formats, audio and video codecs, and subtitle types."
HOMEPAGE="http://mpv.io"

REVISION="1"

SOURCE_URI="https://github.com/mpv-player/mpv/archive/v$portVersion.zip"
CHECKSUM_SHA256="59994bf2da9b7c617c98a6188a40a507b9b09badcfb8d99a4f68b0ba327b3d6e"

ARCHITECTURES="x86 x86_64"
if [ $effectiveTargetArchitecture != x86_gcc2 ]; then
	# x86_gcc2 is fine as primary target architecture as long as we're building
	# for a different secondary architecture.
	ARCHITECTURES="$ARCHITECTURES x86_gcc2"
fi
SECONDARY_ARCHITECTURES="x86"

PROVIDES="
	mpv$secondaryArchSuffix = $portVersion
	cmd:mpv$secondaryArchSuffix
"

REQUIRES="
	haiku$secondaryArchSuffix
	lib:libass$secondaryArchSuffix
	lib:libavdevice$secondaryArchSuffix >= 56
	lib:libavutil$secondaryArchSuffix >= 54
	lib:libavcodec$secondaryArchSuffix >= 56
	lib:libswscale$secondaryArchSuffix >= 3
	lib:libavfilter$secondaryArchSuffix >= 5
	lib:libbluray$secondaryArchSuffix
	lib:libdvdnav$secondaryArchSuffix
	lib:libdvdread$secondaryArchSuffix
	lib:libenca$secondaryArchSuffix
	lib:libiconv$secondaryArchSuffix
	lib:libjpeg$secondaryArchSuffix
	lib:libmpg123$secondaryArchSuffix
	lib:libsdl2$secondaryArchSuffix
	lib:libsdl2$secondaryArchSuffix
	lib:libz$secondaryArchSuffix
"

BUILD_REQUIRES="
	devel:libass$secondaryArchSuffix
	devel:libavutil$secondaryArchSuffix >= 54
	devel:libbluray$secondaryArchSuffix
	devel:libdvdcss$secondaryArchSuffix
	devel:libdvdnav$secondaryArchSuffix
	devel:libdvdread$secondaryArchSuffix
	devel:libenca$secondaryArchSuffix
	devel:libfontconfig$secondaryArchSuffix
	devel:libfreetype$secondaryArchSuffix
	devel:libfribidi$secondaryArchSuffix
	devel:libgl$secondaryArchSuffix
	devel:libglib_2.0$secondaryArchSuffix
	devel:libharfbuzz$secondaryArchSuffix
	devel:libiconv$secondaryArchSuffix
	devel:libjpeg$secondaryArchSuffix
	devel:libmpg123$secondaryArchSuffix
	devel:libsdl2$secondaryArchSuffix
#	devel:libsmbclient$secondaryArchSuffix
	devel:libz$secondaryArchSuffix
"

BUILD_PREREQUIRES="
	haiku${secondaryArchSuffix}_devel
	cmd:gcc$secondaryArchSuffix
	cmd:perl
	cmd:python
	cmd:pkg_config$secondaryArchSuffix
	cmd:yasm
"

SOURCE_DIR="mpv-$portVersion"

PATCHES="mpv_x86-$portVersion.patchset"

GLOBAL_WRITABLE_FILES="settings/encoding-profiles.conf"

BUILD()
{
	python bootstrap.py
	export LDFLAGS=-lnetwork 
	waf configure --enable-sdl2 --bindir=$binDir --confdir=$settingsDir/mpv # --datadir=$dataDir 
	waf build
}

INSTALL()
{
	waf install
	rm -rf $dataDir/mpv/applications
}

LICENSE="GNU GPL v2"
COPYRIGHT="2013-2015 MPV Developers"
