# Template file for 'mplayer'
pkgname=mplayer
version=1.1.1
revision=2
wrksrc="MPlayer-${version}"
short_desc="A movie player"
maintainer="Juan RP <xtraeme@gmail.com>"
license="GPL-2"
homepage="http://www.mplayerhq.hu/"
distfiles="http://www2.mplayerhq.hu/MPlayer/releases/MPlayer-${version}.tar.xz"
checksum=ce8fc7c3179e6a57eb3a58cb7d1604388756b8a61764cc93e095e7aff3798c76
long_desc="
 MPlayer is a movie player which runs on many systems (see the documentation).
 It plays most MPEG/VOB, AVI, Ogg/OGM, VIVO, ASF/WMA/WMV, QT/MOV/MP4, RealMedia,
 Matroska, NUT, NuppelVideo, FLI, YUV4MPEG, FILM, RoQ, PVA files, supported by
 many native, XAnim, and Win32 DLL codecs. You can watch VideoCD, SVCD, DVD,
 3ivx, DivX 3/4/5, WMV and even H.264 movies."

build_style=configure
configure_args="--prefix=/usr --enable-runtime-cpudetection
 --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"

hostmakedepends="pkg-config yasm"
makedepends="videoproto libudev-devel>=183 libpng-devel>=1.6
 libvorbis-devel SDL_image-devel x264-devel>=20131007 jack-devel samba-devel mpg123-devel
 xcb-util-devel>=0.3.9 xcb-util-keysyms-devel>=0.3.9 libsamplerate-devel
 libXxf86vm-devel libXinerama-devel libXpm-devel libXvMC-devel libXv-devel
 libmpeg2-devel libflac-devel fribidi-devel freetype-devel libmtp-devel>=1.1.4
 avahi-libs-devel MesaLib-devel libmad-devel liba52-devel libdca-devel
 libdvbpsi-devel libgcrypt-devel gtk+-devel libnotify-devel dbus-glib-devel
 gnutls-devel>=3.1.5 taglib-devel libmatroska-devel libmpcdec-devel libproxy-devel
 libcdio-devel libdvdnav-devel libsysfs-devel libusb-compat-devel libass-devel
 sqlite-devel librsvg-devel libtheora-devel speex-devel pulseaudio-devel
 libmodplug-devel libva-devel v4l-utils-devel"

pre_configure() {
	if [ "$XBPS_MACHINE" = "i686" ]; then
		sed 's|-march=i486||g' -i configure
	fi
}

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
}


mplayer_package() {
	conf_files="
		/etc/mplayer/input.conf
		/etc/mplayer/codecs.conf"
	pkg_install() {
		vmove all
	}
}