# $Id: PKGBUILD 253654 2015-12-08 09:52:35Z arojas $
# Maintainer (Arch): Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor (Arch): Jan de Groot <jgc@archlinux.org>
# Contributor (Arch): Tobias Kieslich <tobias@justdreams.de>
# Maintainer: André Silva <emulatorman@parabola.nu>
# Contributor: Márcio Silva <coadde@parabola.nu>

pkgname=gthumb
pkgver=3.4.1
pkgrel=2.nonprism1
pkgdesc="Image browser and viewer for the GNOME Desktop, without support for unsafe and dangerous for privacy protocols"
arch=(i686 x86_64)
license=(GPL)
url="http://live.gnome.org/gthumb"
replaces=(${pkgname}-nonprism)
conflicts=(${pkgname}-nonprism)
depends=(desktop-file-utils hicolor-icon-theme dconf librsvg clutter-gtk
         gst-plugins-base-libs gsettings-desktop-schemas libwebp libsecret
         libsoup webkit2gtk json-glib)
makedepends=(intltool libchamplain exiv2 itstool brasero libraw liboauth
             docbook-xsl yelp-tools gnome-common flex)
optdepends=('libraw: read RAW files'
            'exiv2: metadata support'
            'libchamplain: map viewer'
            'brasero: burn discs'
            'liboauth: web albums')
options=('!emptydirs')
install=gthumb.install
source=(http://ftp.gnome.org/pub/GNOME/sources/$pkgname/${pkgver%.*}/$pkgname-$pkgver.tar.xz
        nonprism.patch)
sha256sums=('1ec2cf49f499ed06eda851a3bd5c28a1768839a6ff06bc4efc5fbde46cabc857'
            'b1cd2463ab6475ce91a2b2e83dfcb1835ffaa9640c59d7bcfbe611163327fa45')

prepare() {
  cd $pkgname-$pkgver
  patch -Np1 -i ../nonprism.patch
}

build() {
  cd $pkgname-$pkgver
  
  ./configure --prefix=/usr --sysconfdir=/etc \
      --localstatedir=/var --disable-static \
      --enable-libchamplain
  
  sed -i -e 's/ -shared / -Wl,-O1,--as-needed\0 /g' -e 's/    if test "$export_dynamic" = yes && test -n "$export_dynamic_flag_spec"; then/      func_append compile_command " -Wl,-O1,--as-needed"\n      func_append finalize_command " -Wl,-O1,--as-needed"\n\0/' libtool

  make
}

check() {
  cd $pkgname-$pkgver
  make check
}

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