# Template file for 'mplayer'
pkgname=mplayer
version=1.4
revision=6
wrksrc="MPlayer-${version}"
build_style=configure
hostmakedepends="pkg-config yasm"
makedepends="xorgproto eudev-libudev-devel libpng-devel libass-devel
 libvorbis-devel SDL_image-devel x264-devel jack-devel samba-devel
 mpg123-devel xcb-util-devel xcb-util-keysyms-devel libsamplerate-devel
 libXxf86vm-devel libXinerama-devel libXpm-devel libXvMC-devel libXv-devel
 libmpeg2-devel libflac-devel fribidi-devel freetype-devel libmtp-devel
 avahi-libs-devel MesaLib-devel libmad-devel liba52-devel libdca-devel
 libdvbpsi-devel libgcrypt-devel gtk+-devel libnotify-devel dbus-glib-devel
 gnutls-devel taglib-devel libmatroska-devel libmpcdec-devel libproxy-devel
 libcdio-paranoia-devel libdvdnav-devel libsysfs-devel libusb-compat-devel
 sqlite-devel librsvg-devel libtheora-devel speex-devel pulseaudio-devel
 libmodplug-devel libva-devel libvdpau-devel v4l-utils-devel xvidcore-devel"
short_desc="Multimedia player"
maintainer="Orphaned <orphan@voidlinux.org>"
license="GPL-2.0-or-later"
homepage="http://www.mplayerhq.hu/"
distfiles="http://www2.mplayerhq.hu/MPlayer/releases/MPlayer-${version}.tar.xz"
checksum=82596ed558478d28248c7bc3828eb09e6948c099bbd76bb7ee745a0e3275b548

nocross=yes

conf_files="
	/etc/mplayer/input.conf
	/etc/mplayer/codecs.conf"

do_configure() {
	sed 's|-march=i486||g' -i configure

	# we tried runtime cpudetection for ppc32 but stuff's broken
	case "$XBPS_TARGET_MACHINE" in
		i686*|x86_64*|ppc64*) configure_args+=" --enable-vdpau --enable-runtime-cpudetection";;
		ppc*) configure_args+=" --enable-vdpau --disable-altivec";;
	esac

	./configure --prefix=/usr \
		--disable-gui --disable-arts --disable-liblzo --disable-speex \
		--disable-openal --disable-libdv --disable-musepack --disable-esd \
		--disable-mga --disable-ass-internal --disable-cdparanoia --enable-xvmc \
		--enable-radio --enable-radio-capture --language=all --confdir=/etc/mplayer \
		--enable-debug=3 --disable-vidix --extra-cflags="$CFLAGS" \
		--extra-ldflags="$LDFLAGS" ${configure_args}
}

post_install() {
	vmkdir etc/mplayer
	install -Dm644 etc/{codecs.conf,input.conf} \
		${DESTDIR}/etc/mplayer
	vinstall etc/example.conf 644 usr/share/examples/mplayer
	vmkdir usr/share/mplayer
	ln -s /usr/share/fonts/TTF/DejaVuSans.ttf \
		${DESTDIR}/usr/share/mplayer/subfont.ttf
	rm -rf ${DESTDIR}/usr/share/mplayer/font
	vinstall ${FILESDIR}/mplayer.desktop 644 usr/share/applications
	vinstall etc/mplayer256x256.png 644 usr/share/pixmaps mplayer.png
}
