# Maintainer: Antonio Rojas <arojas@archlinux.org>
# Contributor: XavierCLL <xavier.corredor.llano (a) gmail.com>
# PKGBUILD base; Simper < simonpersson1 AT gmail DOT com >

pkgname=kup
pkgver=0.7.3
pkgrel=3
pkgdesc="A KDE bup backup software for helping people to keep up-to-date backups"
arch=(x86_64)
url="https://www.linux-apps.com/p/1127689/"
license=(GPL2)
depends=(kidletime kinit libgit2 hicolor-icon-theme)
makedepends=(extra-cmake-modules plasma-framework)
optdepends=('bup: support for incremental backups'
            'rsync: support for synced backups')
source=("https://github.com/spersson/Kup/archive/$pkgname-$pkgver.tar.gz"
        kup-cmake-build-type.patch::"https://patch-diff.githubusercontent.com/raw/spersson/Kup/pull/81.patch")
sha256sums=('47b97314dd11579a6ecc723de687c9ebe7cafb300d2ce39f2510d36c17de2f3b'
            '5ba2786dc43436774f24c72ca7abdc887bdf7e739bfe97b71f89c64912441f99')

prepare() {
  mkdir -p build

  cd Kup-$pkgname-$pkgver
  patch -p1 -i ../kup-cmake-build-type.patch # Fix build when CMAKE_BUILD_TYPE is not specified
}

build() {
  cd build
  cmake ../Kup-$pkgname-$pkgver \
    -DCMAKE_INSTALL_PREFIX=/usr \
    -DCMAKE_INSTALL_LIBDIR=lib \
    -DUSE_SYSTEM_LIBGIT2=ON \
    -DBUILD_TESTING=OFF
  make
}

package() {
  cd build
  make DESTDIR="$pkgdir" install
}
