# Maintainer: Iru Dog <mytbk920423@gmail.com>

# NOTE: This package relies on Mplayer's configure script to detect what is
# useful on your system. Build it on the machine you will use it on.
# If some features don't work, install the related optdepends *before*
# building.
# Before reporting any bug, please download a fresh copy of the package from
# the AUR and build the package using makepkg (not Yaourt).
#
# This is a multi-package PKGBUILD for testing. If it's not satisfactory, 
# I'll use the original single-package one instead.

#pkgbase=mplayer-build
pkgname=mplayer-pra
#true && pkgname=("ffmpeg-lite" "mplayer-build")
arch=('i686' 'x86_64')
pkgver=1.1.1
pkgrel=1
license=('GPL')
#depends=('libxv' 'alsa-lib' 'libass' 'xvidcore' 'libtheora' 'libpng' 'libmad' 'libgl' 'openal' ) 
#depends=('xvidcore' 'libvorbis'     'libxv' 'alsa-lib'  'xvidcore' 'libtheora' 'libpng'  ) 
#depends=('libxv' 'alsa-lib' 'libass' 'xvidcore' 'libtheora' 'libpng' 'libmad'  'openal' ) 
#depends=('ffmpeg-git')
makedepends=('yasm')

_mplayer_tar='mplayer-export-snapshot.tar.bz2'
_mplayer_source="http://www.mplayerhq.hu/MPlayer/releases/$_mplayer_tar"

##_ffmpeg_tar='ffmpeg-snapshot.tar.bz2'
# because of the problems in snapshot ffmpeg, now use stable
#_use_stable=1
##ffmpeg_ver=1.2.1snapshot
#_ffmpeg_tar="ffmpeg-${ffmpeg_ver}.tar.bz2"
##_ffmpeg_source="http://ffmpeg.org/releases/$_ffmpeg_tar"

source=("${_mplayer_source}")
#		"${_ffmpeg_source}")
#sha256sums=("SKIP")
#			 "SKIP")
md5sums=('SKIP')

prepare() {
	cd $srcdir
	[ -d mplayer-pra ] || mv mplayer-*/ mplayer-pra/
#	mv ffmpeg mplayer/ffmpeg

}

build(){
  cd "$srcdir/$pkgname"

	unset CFLAGS CXXFLAGS LDFLAGS 
#	./configure \
#    --prefix=/usr --confdir=/etc --disable-mencoder --enable-radio --enable-radio-capture --enable-menu \
#    --disable-ffmpeg_a --yasm='' --target=i686-linux --enable-dynamic-plugins       
    #--enable-gui 

#pacman -Rs fridibi && pkgfile -U ffmpeg-lite

#static
#	./configure 
#	./configure --disable-ffmpeg_a \
	./configure \
		--prefix=/usr --confdir=/etc/mplayer --enable-menu \
		--disable-mencoder --disable-mpg123 --disable-x264 --disable-static \
		--disable-aa --disable-caca --disable-md5sum --disable-esd \
		--disable-ossaudio --disable-arts --disable-cddb --disable-libdv \
		--disable-lirc --disable-lircc --disable-libcdio \
		--disable-libgsm --disable-librtmp --disable-libdca --disable-speex \
		--disable-libopencore_amrnb --disable-libopencore_amrwb \
		--disable-pulse --disable-jack --disable-xss \
		--disable-libschroedinger-lavc --disable-faad \
		--disable-faac --disable-vdpau 

make
}

package() {
  cd "$srcdir/$pkgname"
  make DESTDIR="$pkgdir" install 
  #install-man
  #install -D -m755 tools/qt-faststart "$pkgdir/usr/bin/qt-faststart"
}
