# Maintainer: Balló György <ballogyor+arch at gmail dot com>
# Contributor: NicoHood <archlinux {cat} nicohood {dog} de>
# Contributor: btd1337

pkgname=spice-up
pkgver=1.8.2
pkgrel=3
pkgdesc='Create simple and beautiful presentations'
arch=('x86_64')
url='https://github.com/Philip-Scott/Spice-up'
license=('GPL3')
depends=('granite' 'libevdev')
makedepends=('cmake' 'vala')
checkdepends=('xorg-server-xvfb')
source=("https://github.com/Philip-Scott/Spice-up/archive/$pkgver/Spice-up-$pkgver.tar.gz"
        '0001-Fix-build-with-vala-0.46.patch'
        '0001-Add-missing-icons.patch')
sha256sums=('67783d7fb8f7a4756f4312e8a43d4d9c9d60524956dd3de9076506a2da513c17'
            '482cec26f089f13e2bcf3edf427535cfabc840681eb2f754469828a0c1ac359b'
            '460d16cab1cd4ed7c8722e1dbf9d934b8ecdc8494d05e9b7448be3ef8630fd0d')

prepare() {
  patch -d Spice-up-$pkgver -Np1 -i ../0001-Fix-build-with-vala-0.46.patch
  patch -d Spice-up-$pkgver -Np1 -i ../0001-Add-missing-icons.patch
}

build() {
  cmake -S Spice-up-$pkgver -B build -G 'Unix Makefiles' -DCMAKE_INSTALL_PREFIX='/usr'
  cmake --build build
}

check() {
  dbus-run-session xvfb-run -s '-screen 0 1920x1080x24 -nolisten local' \
    ctest --test-dir build --output-on-failure
}

package() {
  DESTDIR="$pkgdir" cmake --install build
  ln -s com.github.philip-scott.spice-up "$pkgdir/usr/bin/$pkgname"
}
