# Maintainer: Jan Alexander Steffens (heftig) <jan.steffens@gmail.com>
# Contributor: Sergej Pupykin <pupykin.s+arch@gmail.com>
# Contributor: Geoffroy Carrier <geoffroy.carrier@aur.archlinux.org>
# Contributor: Eric Belanger <belanger@astro.umontreal.ca>
# Contributor: aeolist <aeolist@hotmail.com>
# Contributor: Gabriel Rauter <rauter.gabriel@gmail.com>

pkgname=sysprof
pkgver=3.34.0
pkgrel=2
pkgdesc="Kernel based performance profiler"
url="https://wiki.gnome.org/Apps/Sysprof"
license=(GPL)
arch=(x86_64)
depends=(gtk3 polkit libdazzle)
makedepends=(yelp-tools git meson)
groups=(gnome-extra)
_commit=ee32407b28c163ba10778b279c6c13f0cd47214a  # tags/sysprof-3.34.0^0
source=("git+https://gitlab.gnome.org/GNOME/sysprof.git#commit=$_commit")
sha256sums=('SKIP')

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

prepare() {
  cd $pkgname
}

build() {
  # Ensure static library is non-LTO compatible
  CFLAGS+=" -ffat-lto-objects"

  arch-meson $pkgname build
  ninja -C build
}

check() {
  # Test needs sysprofd at system dbus
  meson test -C build --print-errorlogs || :
}

package() {
  DESTDIR="$pkgdir" meson install -C build
}
