# $Id: PKGBUILD 226760 2014-11-20 19:41:29Z heftig $
# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Jan de Groot <jgc@archlinux.org>

pkgname=totem
pkgver=3.14.1
pkgrel=1
pkgdesc="GNOME3 movie player based on GStreamer"
url="http://www.gnome.org"
arch=(i686 x86_64)
license=(GPL2 custom)
depends=(totem-plparser desktop-file-utils iso-codes libpeas clutter-gtk clutter-gst grilo
         hicolor-icon-theme gsettings-desktop-schemas dconf
         python-gobject python-xdg
         gst-plugins-base gst-plugins-good gst-plugins-bad gnome-desktop)
makedepends=(intltool libnautilus-extension lirc-utils vala zeitgeist
             itstool docbook-xsl python-pylint)
optdepends=('gst-plugins-ugly: Extra media codecs'
            'gst-libav: Extra media codecs'
            'lirc-utils: Infrared Remote Control plugin'
            'grilo-plugins: Media discovery'
            'zeitgeist: Zeitgeist plugin'
            'python-dbus: MPRIS plugin')
groups=(gnome)
options=('!emptydirs')
install=totem.install
conflicts=(totem-plugin)
replaces=(totem-plugin)
source=(http://ftp.gnome.org/pub/gnome/sources/$pkgname/${pkgver:0:4}/$pkgname-$pkgver.tar.xz
        bugreport.patch)
sha256sums=('288150837fd2693a4b672210a1ffdd178d3e542df954af247dc04c666bf97536'
            '30481dab7e21b66257e3238f5a8b708e1a5c4797d7da904f7ebaba4c2c2ef167')

prepare() {
  cd "$pkgname-$pkgver"

  # Make compatible with Python 3 and Gstreamer 1.0
  patch -Np1 -i ../bugreport.patch
}

build() {
  cd "$pkgname-$pkgver"
  ./configure --prefix=/usr \
    --sysconfdir=/etc \
    --libexecdir=/usr/lib/totem \
    --localstatedir=/var \
    --disable-static \
    --enable-python \
    --enable-nautilus

  # https://bugzilla.gnome.org/show_bug.cgi?id=655517
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0/g' libtool

  make
}

package() {
  cd "$pkgname-$pkgver"
  make DESTDIR="${pkgdir}" install

  install -Dm644 COPYING "$pkgdir/usr/share/licenses/totem/COPYING"
}
