# Description: Realtime Policy and Watchdog Daemon
# URL: https://github.com/heftig/rtkit
# Maintainer: Tim Biermann, tbier at posteo dot de
# Depends on: dbus meson ninja

name=rtkit
version=0.13
release=3
source=(https://github.com/heftig/rtkit/releases/download/v$version/$name-$version.tar.xz
  rtkit.service org.freedesktop.RealtimeKit1.conf rtkit.rules)

build() {
  # allow rtkit group to own the service besides rtkit user and root
  mv $SRC/org.freedesktop.RealtimeKit1.conf $name-$version/org.freedesktop.RealtimeKit1.conf

  meson setup $name-$version build \
    --prefix=/usr \
    --libexecdir=/usr/lib/$name \
    --buildtype=plain \
    -D libsystemd=disabled \
    -D installed_tests=false
  meson compile -C build
  DESTDIR=$PKG meson install -C build

  install -Dm755 $SRC/rtkit.service $PKG/etc/rc.d/rtkit
  install -Dm755 $SRC/rtkit.rules $PKG/etc/polkit-1/rules.d/60-rtkit.rules

  rm -r $PKG/usr/lib/systemd
  rm -r $PKG/usr/share/dbus-1/system-services
}
