# Maintainer: Balló György <ballogyor+arch at gmail dot com>

pkgname=pdfslicer
pkgver=1.8.8
pkgrel=1
pkgdesc="Simple application to extract, merge, rotate and reorder pages of PDF documents"
arch=(x86_64)
url="https://junrrein.github.io/pdfslicer/"
license=(GPL3)
depends=(gtkmm3 poppler qpdf)
makedepends=(cmake git intltool)
_commit=c843e4b5bff170d920aaf36debd454d11ac6e03b
source=("git+https://github.com/junrrein/pdfslicer.git#commit=$_commit"
        "git+https://github.com/ericniebler/range-v3.git"
        "git+https://github.com/Microsoft/GSL.git"
        "git+https://github.com/fmtlib/fmt.git")
sha256sums=('SKIP'
            'SKIP'
            'SKIP'
            'SKIP')

pkgver() {
  cd $pkgname
  git describe --tags | sed 's/^v//;s/-/+/g'
}

prepare() {
  [[ -d build ]] || mkdir build

  cd $pkgname
  git submodule init
  git submodule set-url third-party/range-v3 "$srcdir/range-v3"
  git submodule set-url third-party/GSL "$srcdir/GSL"
  git submodule set-url third-party/fmtlib "$srcdir/fmt"
  git submodule update
}

build() {
  cd build
  cmake -G "Unix Makefiles" ../$pkgname/ \
    -DCMAKE_INSTALL_PREFIX=/usr
  make
}

package() {
  cd build
  make DESTDIR="$pkgdir" install
  rm -r "$pkgdir"/usr/{include,lib}
}
