# Description: Versatile media player and encoder/converter
# URL: http://www.mplayerhq.hu/
# Maintainer: Matt Housh, jaeger at morpheus dot net
# Depends on: x11

# Nice to have: libsdl, libjpeg, libpng, lame, zlib, libogg, libvorbis, \
# cdparanoia, win32-essential-codecs

# More information can be found at http://www.mplayerhq.hu/DOCS/codecs.html and
# http://www.mplayerhq.hu/DOCS/HTML/en/index.html

name=mplayer
version=1.0pre7try2
release=2
source=(http://www2.mplayerhq.hu/MPlayer/releases/MPlayer-$version.tar.bz2 \
	http://www2.mplayerhq.hu/MPlayer/releases/fonts/font-arial-iso-8859-1.tar.bz2 \
	mplayer.conf demuxer_h_fix_20060212.diff mplayer-1.0_pre7-gcc4.patch)

build() {
	cd MPlayer-$version

	# ASF demuxer security patch (CAN-2006-0579)
	patch -p0 -i $SRC/demuxer_h_fix_20060212.diff

	# gcc4 patch
	patch -p1 -i $SRC/mplayer-1.0_pre7-gcc4.patch

	# mplayer decides optimizations at configure time, don't use CRUX's
	unset CFLAGS
	./configure --prefix=/usr \
		--enable-linux-devfs \
		--disable-divx4linux \
		--with-codecsdir=/usr/lib/win32

	make
	make DESTDIR=$PKG install

	(cd $PKG/usr/man/man1; rm mencoder.1; ln -s mplayer.1.gz mencoder.1.gz)

	# fonts
	cp -a $SRC/font-arial-iso-8859-1/font-arial-??-iso-8859-1 \
		$PKG/usr/share/mplayer/font
	(cd $PKG/usr/share/mplayer/font
	for i in font-arial-14-iso-8859-1/*
		do
			ln -s $i
		done)
	chmod 644 $PKG/usr/share/mplayer/font/font-arial-??-iso-8859-1/*

	# config
	cp $SRC/mplayer.conf $PKG/usr/etc/mplayer/
	cp etc/input.conf $PKG/usr/etc/mplayer/

	# finish up
	chown -R root:root $PKG
}