# Maintainer: BlackAngelTVdev <dami.scoot3@gmail.com>
# The version file is the single source of truth for releases, so the package
# version follows it instead of being duplicated here.
#
# Run makepkg from a scratch directory that holds this PKGBUILD, the version file
# and the source tarball: makepkg creates src/ and pkg/ next to it, and a src/
# beside these sources would hide the real ones.
pkgname=fws-deskmanager
pkgver=$(tr -d '[:space:]' < version)
pkgrel=1
pkgdesc="Switch between installed desktop sessions without rebooting"
arch=('x86_64')
url="https://gitea.nocode-var.tech/FWS/FWS-DeskManger"
license=('GPL-3.0-or-later')
# loginctl, systemctl and pacman come from packages every Arch install already
# has; only the toolkit and the polkit helper are real additions.
depends=('gtk4' 'polkit')
optdepends=(
  'sddm: display manager for the login screen and the one-off autologin'
  'gdm: display manager for the login screen'
  'lightdm: display manager for the login screen, needs dm-tool'
)
makedepends=('cmake' 'pkgconf')
# Release packages only: the debug split package has no use for end users.
options=('!debug')
source=("$pkgname-$pkgver.tar.gz")
# The tarball is produced from the commit being packaged, so there is no
# published checksum to pin here.
sha256sums=('SKIP')

build() {
  cmake -S "$pkgname-$pkgver" -B build \
    -DCMAKE_BUILD_TYPE=Release \
    -DCMAKE_INSTALL_PREFIX=/usr
  cmake --build build -j"$(nproc)"
}

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