# $Id: PKGBUILD 24027 2009-01-11 23:38:33Z eric $
# Maintainer: Giovanni Scafora <giovanni@archlinux.org>
# Contributor: Sarah Hay <sarahhay@mb.sympatico.ca>

pkgname=vlc
pkgver=0.9.8a
pkgrel=4
pkgdesc="A multi-platform MPEG, VCD/DVD, and DivX player"
arch=('i686' 'x86_64')
url="http://www.videolan.org/vlc/"
license=('GPL2')
depends=('libmad' 'libmpeg2' 'ffmpeg>=20081220' 'x264>=20090108' 'fluidsynth' \
         'libdvbpsi' 'fribidi' 'sysfsutils' 'libdvdnav' \
         'libmatroska' 'zvbi' 'libdvdread' 'libmpcdec' \
         'libdca' 'libxml2' 'lirc-utils' 'libcddb' 'libraw1394' \
         'smbclient' 'taglib'  'libmodplug' 'avahi' 'libv4l' \
         'sdl_image' 'libshout' 'lua' 'qt' 'a52dec' 'libgcrypt')
makedepends=('pkgconfig' 'live-media>=2008.09.02')
optdepends=('libnotify')
options=('!libtool' 'force')
source=(http://download.videolan.org/pub/videolan/vlc/${pkgver}/${pkgname}-${pkgver}.tar.bz2)
md5sums=('8ffa2ff763badd5de7592004d8d69a63')

build() {
  cd ${srcdir}/${pkgname}-${pkgver}
  sed -i -e 's:#include <vlc\/vlc.h>:#include <vlc/vlc.h> \n #include <locale.h>: ' modules/misc/freetype.c
  sed -i -e 's:/usr/share/fonts/truetype/freefont/FreeSerifBold.ttf:/usr/share/fonts/TTF/VeraBd.ttf:' modules/misc/freetype.c
  [ "${CARCH}" = "i686" ] && EXTRAFEATURES="--enable-loader --enable-live555 --with-live555-tree=/usr/lib/live-media"
  [ "${CARCH}" = "x86_64" ] && EXTRAFEATURES="--enable-fast-install"
  ./configure --prefix=/usr \
              --enable-dvdread \
              --enable-dvdnav \
              --enable-madi \
              --enable-ffmpeg \
              --disable-rpath \
              --enable-qt4 \
              --enable-faad \
              --enable-alsa \
              --enable-skins2 \
              --enable-dvb \
              --enable-dmo \
              --with-ffmpeg-faac \
              --with-ffmpeg-vorbis \
              --with-ffmpeg-dts \
              --with-ffmpeg-ogg \
              --with-ffmpeg-theora \
              --enable-v4l \
              --enable-theora \
              --enable-flac \
              --enable-snapshot \
              --enable-hal \
              --enable-dbus \
              --enable-ogg \
              --enable-dbus-control \
              --enable-shared \
              --enable-nls \
              --enable-lirc \
              --enable-shout \
              --enable-pvr \
              --enable-release \
              --program-suffix= \
              --with-dv-raw1394=/usr/include/libraw1394 ${EXTRAFEATURES} || return 1
  make || return 1
  make DESTDIR=${pkgdir}/ install || return 1
  
  for res in 16 32 48 128; do
    install -D -m644 ${srcdir}/vlc-${pkgver}/share/vlc${res}x${res}.png \
		     ${pkgdir}/usr/share/icons/hicolor/${res}x${res}/apps/vlc.png || return 1
  done
  rm -rf ${pkgdir}/usr/lib/mozilla
}