# $Id: PKGBUILD 124214 2014-12-20 20:48:59Z bgyorgy $
# Maintainer: Balló György <ballogyor+arch at gmail dot com>

pkgname=deja-dup
pkgver=32.0
pkgrel=3
pkgdesc="Simple backup tool, that hides the complexity of backing up the Right Way and uses duplicity as the backend"
arch=('i686' 'x86_64')
url="https://launchpad.net/deja-dup"
license=('GPL')
depends=('duplicity' 'libpeas' 'libnotify' 'python2-gobject' 'gvfs')
makedepends=('cmake' 'vala' 'intltool' 'itstool' 'nautilus')
optdepends=('gnome-keyring: save passwords'
            'nautilus: backup extension'
            'python2-boto: Amazon S3 backend')
install=$pkgname.install
source=(http://launchpad.net/$pkgname/${pkgver%.*}/$pkgver/+download/$pkgname-$pkgver.tar.xz
        fix-version-check.patch)
md5sums=('83e693cfebe397be0c67d3d362ae92c9'
         'f3f49f8de6f6ac98a6484506addfb630')

prepare() {
  cd $pkgname-$pkgver

  # Python2 fix
  sed -i 's/\"python\", \"-c\"/\"python2\", \"-c\"/' libdeja/PythonChecker.vala

  # Fix version check for duplicity
  # https://bugs.launchpad.net/deja-dup/+bug/1384136
  patch -Np0 -i ../fix-version-check.patch
}

build() {
  cd $pkgname-$pkgver

  cmake . -DCMAKE_BUILD_TYPE=Release \
          -DCMAKE_INSTALL_PREFIX=/usr \
          -DCMAKE_INSTALL_SYSCONFDIR=/etc \
          -DCMAKE_INSTALL_LIBDIR=/usr/lib \
          -DCMAKE_INSTALL_LIBEXECDIR=/usr/lib/$pkgname
  make
}

package() {
  cd $pkgname-$pkgver

  make DESTDIR="$pkgdir" install
}
