# Template file for 'mpv'
pkgname=mpv
version=0.34.1
revision=1
build_style=waf3
configure_args="--confdir=/etc/mpv --docdir=/usr/share/examples/mpv
 --enable-cdda --enable-dvbin --enable-dvdnav --enable-libarchive
 --enable-libmpv-shared --enable-cplugins $(vopt_enable alsa) $(vopt_enable caca)
 $(vopt_enable jack) $(vopt_enable lcms lcms2) $(vopt_enable lua)
 $(vopt_enable openal) $(vopt_enable pulseaudio pulse) $(vopt_enable sdl2)
 $(vopt_enable vapoursynth) $(vopt_enable vdpau) $(vopt_enable vulkan)
 $(vopt_enable vulkan shaderc) $(vopt_enable wayland) $(vopt_enable x11)"
hostmakedepends="pkg-config python3-docutils $(vopt_if wayland wayland-devel)"
makedepends="MesaLib-devel ffmpeg-devel harfbuzz-devel libXv-devel
 libass-devel libbluray-devel libcdio-paranoia-devel libdvdnav-devel
 libuuid-devel libva-devel rubberband-devel uchardet-devel
 libarchive-devel $(vopt_if alsa alsa-lib-devel) $(vopt_if caca libcaca-devel)
 $(vopt_if jack jack-devel) $(vopt_if lcms lcms2-devel)
 $(vopt_if lua lua52-devel) $(vopt_if openal libopenal-devel)
 $(vopt_if pulseaudio pulseaudio-devel) $(vopt_if sdl2 SDL2-devel)
 $(vopt_if vapoursynth vapoursynth-devel) $(vopt_if vdpau libvdpau-devel)
 $(vopt_if vulkan "Vulkan-Headers vulkan-loader shaderc libplacebo-devel")
 $(vopt_if wayland "wayland-devel wayland-protocols libxkbcommon-devel")
 $(vopt_if x11 "libXScrnSaver-devel libXinerama-devel libXrandr-devel")"
depends="desktop-file-utils hicolor-icon-theme $(vopt_if vapoursynth vapoursynth-mvtools)"
short_desc="Video player based on MPlayer/mplayer2"
maintainer="travankor <travankor@tuta.io>"
license="GPL-2.0-or-later"
homepage="https://mpv.io"
changelog="https://github.com/mpv-player/mpv/releases"
distfiles="https://github.com/mpv-player/${pkgname}/archive/v${version}.tar.gz"
checksum=32ded8c13b6398310fa27767378193dc1db6d78b006b70dbcbd3123a1445e746

if [ "$XBPS_TARGET_NO_ATOMIC8" ]; then
	makedepends+=" libatomic-devel"
fi

build_options="alsa caca jack lcms lua openal pulseaudio sdl2 vapoursynth vdpau
 vulkan wayland x11"
build_options_default="alsa jack lcms lua pulseaudio vdpau vulkan wayland x11"
desc_option_caca="Enable support for libcaca video output"
desc_option_lcms="Enable support for LittleCMS 2 engine"
desc_option_openal="Enable support for OpenAL audio output"
vopt_conflict sdl2 wayland

if [ -z "$CROSS_BUILD" ]; then
	configure_args+=" --zshdir=/usr/share/zsh/site-functions"
fi

pre_configure() {
	python3 bootstrap.py
}

mpv-devel_package() {
	depends="${sourcepkg}>=${version}_${revision}"
	short_desc+=" - development files"
	pkg_install() {
		vmove usr/include
		vmove usr/lib/pkgconfig
		vmove usr/lib/*.so
	}
}
