pkgname=seatd
pkgver=0.9.1
pkgdesc="A minimal seat management daemon, and a universal seat management library"
arch=(x86_64)
homepage="https://sr.ht/~kennylevinsen/seatd/"
license=('MIT')
provides=("libseat.so")
replaces=("libseat")
makedepends=(
    'meson'
    'ninja'
    'scdoc'
    'systemd'
)
sources=("${pkgname}-${pkgver}.tar.gz"
  "sysuser.conf"
)
urls=("https://git.sr.ht/~kennylevinsen/seatd/archive/${pkgver}.tar.gz"
  "sysuser.conf"
)
md5sums=("964a9c59cdfe39f9130508c274e8ae21"
  "508ba49cdc5af1b40f7eac8e8a65a601"
)

src_prepare() {
  tar -xf ${distdir}/${sources[0]} --strip-components=1
}

src_build() {
  local meson_args=(
    --prefix=/usr
    --buildtype=release
    -Dlibseat-builtin=disabled
    -Dexamples="disabled"
    -Dserver="disabled"
    -Dlibseat-logind="systemd"
    -Dman-pages="enabled"
  )
  meson setup build "${meson_args[@]}"
  meson compile -C build
}

src_check() {
  meson test -C build
}

src_install() {
  DESTDIR="${pkgdir}" meson install -C build
  install -Dm644 "LICENSE" -t "$pkgdir/usr/share/licenses/$pkgname/"

  install -vDm644 "${filedir}/${sources[1]}" "$pkgdir/usr/lib/sysusers.d/seatd.conf"
}

# vim:ft=sh syn=sh et sw=2:
