# Maintainer: Developer <dev@opalos.org>
# Maintainer: Developer <dev@opalos.org>

pkgbase=tracker3
pkgname=(
  tracker3
  tracker3-docs
)
pkgver=%version%
pkgrel=%release%
pkgdesc="SQLite-based RDF triplestore database with SPARQL interface"
url="https://tracker.gnome.org/"
arch=(x86_64)
license=(LGPL-2.1-or-later)
depends=(
  avahi
  bash
  gcc-libs
  glib2
  glibc
  icu
  json-glib
  libsoup3
  libstemmer
  libxml2
  python
  sqlite
)
makedepends=(
  asciidoc
  bash-completion
  dbus
  gi-docgen
  git
  gobject-introspection
  libsoup
  meson
  python-dbus
  python-gobject
  python-tappy
  systemd
  vala
)
source=(
  "git+https://gitlab.gnome.org/GNOME/tracker.git#tag=$pkgver"
  "git+https://gitlab.gnome.org/GNOME/gvdb.git"
)
b2sums=('230283b17543725b7a6f0ee3768966abec896fa2164363a7ef2b6e9f945a774ff5e8ebb264b5547a59e008c606cf22fd065ff89d2b4fb2c40f9be97b95cb08db'
        'SKIP')

prepare() {
  cd tracker

  git submodule init
  git submodule set-url subprojects/gvdb "$srcdir/gvdb"
  git -c protocol.file.allow=always submodule update
}

build() {
  local meson_options=(
    -D tests_tap_protocol=true
  )

  arch-meson tracker build "${meson_options[@]}"
  meson compile -C build
}

check() {
  dbus-run-session meson test -C build --print-errorlogs -t 3
}

package_tracker3() {
  optdepends=('libsoup: Alternative remoting backend')
  provides=(libtracker-sparql-3.0.so)

  meson install -C build --destdir "$pkgdir"

  mkdir -p docs/usr/share
  mv {"$pkgdir",docs}/usr/share/doc
}

package_tracker3-docs() {
  pkgdesc+=" (documentation)"
  depends=()
  mv docs/* "$pkgdir"
}

# vim:set sw=2 sts=-1 et:
